1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Add "maniphest.search" Conduit API endpoint

Summary: Ref T9964. This is a basic implementation of the new "maniphest.search" endpoint.

Test Plan: Clicked the button in the web UI, got meaningful results back.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

Differential Revision: https://secure.phabricator.com/D14760
This commit is contained in:
epriestley 2015-12-13 02:31:09 -08:00
parent 9499987cfe
commit f3b57990bf
3 changed files with 67 additions and 1 deletions

View file

@ -1288,6 +1288,7 @@ phutil_register_library_map(array(
'ManiphestReplyHandler' => 'applications/maniphest/mail/ManiphestReplyHandler.php',
'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php',
'ManiphestSchemaSpec' => 'applications/maniphest/storage/ManiphestSchemaSpec.php',
'ManiphestSearchConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestSearchConduitAPIMethod.php',
'ManiphestSearchIndexer' => 'applications/maniphest/search/ManiphestSearchIndexer.php',
'ManiphestStatusConfigOptionType' => 'applications/maniphest/config/ManiphestStatusConfigOptionType.php',
'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php',
@ -5282,6 +5283,7 @@ phutil_register_library_map(array(
'ManiphestReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'ManiphestReportController' => 'ManiphestController',
'ManiphestSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'ManiphestSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'ManiphestSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'ManiphestStatusConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'ManiphestStatusEmailCommand' => 'ManiphestEmailCommand',
@ -5300,6 +5302,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationTransactionInterface',
'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
'PhabricatorConduitResultInterface',
),
'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',

View file

@ -0,0 +1,18 @@
<?php
final class ManiphestSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'maniphest.search';
}
public function newSearchEngine() {
return new ManiphestTaskSearchEngine();
}
public function getMethodSummary() {
return pht('Read information about tasks.');
}
}

View file

@ -13,7 +13,8 @@ final class ManiphestTask extends ManiphestDAO
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface,
PhabricatorProjectInterface,
PhabricatorSpacesInterface {
PhabricatorSpacesInterface,
PhabricatorConduitResultInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@ -392,4 +393,48 @@ final class ManiphestTask extends ManiphestDAO
return $this->spacePHID;
}
/* -( PhabricatorConduitResultInterface )---------------------------------- */
public function getFieldSpecificationsForConduit() {
return array(
'title' => array(
'type' => 'string',
'description' => pht('The name of the object.'),
),
'authorPHID' => array(
'type' => 'phid',
'description' => pht('Original task author.'),
),
'ownerPHID' => array(
'type' => 'phid?',
'description' => pht('Current task owner.'),
),
'status' => array(
'type' => 'string',
'description' => pht('Current task status.'),
),
'priority' => array(
'type' => 'int',
'description' => pht('Task priority.'),
),
'subpriority' => array(
'type' => 'double',
'description' => pht('Order within priority level.'),
),
);
}
public function getFieldValuesForConduit() {
return array(
'name' => $this->getTitle(),
'authorPHID' => $this->getAuthorPHID(),
'ownerPHID' => $this->getOwnerPHID(),
'status' => $this->getStatus(),
'priority' => (int)$this->getPriority(),
'subpriority' => (double)$this->getSubpriority(),
);
}
}