From a8c4da13c0be09838da4d1ab1e149c3fd12e5f35 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 Apr 2018 11:08:42 -0700 Subject: [PATCH] Add "almanac.network.edit" and "almanac.network.search" API methods Summary: Depends on D19334. Ref T13120. Ref T12414. These are pretty straightforward, but no one really has a use case for them anyway today so they're primarily just for completeness. Test Plan: - Queried networks with `almanac.network.search`. - Created and edited networks with `almanac.network.edit`. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13120, T12414 Differential Revision: https://secure.phabricator.com/D19335 --- src/__phutil_library_map__.php | 5 ++++ .../AlmanacNetworkEditConduitAPIMethod.php | 19 ++++++++++++++ .../AlmanacNetworkSearchConduitAPIMethod.php | 18 +++++++++++++ .../almanac/storage/AlmanacNetwork.php | 26 ++++++++++++++++++- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/applications/almanac/conduit/AlmanacNetworkEditConduitAPIMethod.php create mode 100644 src/applications/almanac/conduit/AlmanacNetworkSearchConduitAPIMethod.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 118196a5d7..df0110d332 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -104,6 +104,7 @@ phutil_register_library_map(array( 'AlmanacNamespaceViewController' => 'applications/almanac/controller/AlmanacNamespaceViewController.php', 'AlmanacNetwork' => 'applications/almanac/storage/AlmanacNetwork.php', 'AlmanacNetworkController' => 'applications/almanac/controller/AlmanacNetworkController.php', + 'AlmanacNetworkEditConduitAPIMethod' => 'applications/almanac/conduit/AlmanacNetworkEditConduitAPIMethod.php', 'AlmanacNetworkEditController' => 'applications/almanac/controller/AlmanacNetworkEditController.php', 'AlmanacNetworkEditEngine' => 'applications/almanac/editor/AlmanacNetworkEditEngine.php', 'AlmanacNetworkEditor' => 'applications/almanac/editor/AlmanacNetworkEditor.php', @@ -112,6 +113,7 @@ phutil_register_library_map(array( 'AlmanacNetworkNameTransaction' => 'applications/almanac/xaction/AlmanacNetworkNameTransaction.php', 'AlmanacNetworkPHIDType' => 'applications/almanac/phid/AlmanacNetworkPHIDType.php', 'AlmanacNetworkQuery' => 'applications/almanac/query/AlmanacNetworkQuery.php', + 'AlmanacNetworkSearchConduitAPIMethod' => 'applications/almanac/conduit/AlmanacNetworkSearchConduitAPIMethod.php', 'AlmanacNetworkSearchEngine' => 'applications/almanac/query/AlmanacNetworkSearchEngine.php', 'AlmanacNetworkTransaction' => 'applications/almanac/storage/AlmanacNetworkTransaction.php', 'AlmanacNetworkTransactionQuery' => 'applications/almanac/query/AlmanacNetworkTransactionQuery.php', @@ -5321,8 +5323,10 @@ phutil_register_library_map(array( 'PhabricatorPolicyInterface', 'PhabricatorDestructibleInterface', 'PhabricatorNgramsInterface', + 'PhabricatorConduitResultInterface', ), 'AlmanacNetworkController' => 'AlmanacController', + 'AlmanacNetworkEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'AlmanacNetworkEditController' => 'AlmanacNetworkController', 'AlmanacNetworkEditEngine' => 'PhabricatorEditEngine', 'AlmanacNetworkEditor' => 'AlmanacEditor', @@ -5331,6 +5335,7 @@ phutil_register_library_map(array( 'AlmanacNetworkNameTransaction' => 'AlmanacNetworkTransactionType', 'AlmanacNetworkPHIDType' => 'PhabricatorPHIDType', 'AlmanacNetworkQuery' => 'AlmanacQuery', + 'AlmanacNetworkSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'AlmanacNetworkSearchEngine' => 'PhabricatorApplicationSearchEngine', 'AlmanacNetworkTransaction' => 'AlmanacModularTransaction', 'AlmanacNetworkTransactionQuery' => 'PhabricatorApplicationTransactionQuery', diff --git a/src/applications/almanac/conduit/AlmanacNetworkEditConduitAPIMethod.php b/src/applications/almanac/conduit/AlmanacNetworkEditConduitAPIMethod.php new file mode 100644 index 0000000000..b2acdf2572 --- /dev/null +++ b/src/applications/almanac/conduit/AlmanacNetworkEditConduitAPIMethod.php @@ -0,0 +1,19 @@ +setKey('name') + ->setType('string') + ->setDescription(pht('The name of the network.')), + ); + } + + public function getFieldValuesForConduit() { + return array( + 'name' => $this->getName(), + ); + } + + public function getConduitSearchAttachments() { + return array(); + } + }