@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add harbormaster.buildplan.search api method

Summary: This revision adds a conduit search method for build plans. Other api methods (eg: `harbormaster.build.search`) support build plan phid's as a constraint, but they weren't exposed anywhere, so this provides a way to fetch them.

Test Plan:
Used the api console to run some searches. Output:
```
{
"data": [
{
"id": 1,
"type": "HMCP",
"phid": "PHID-HMCP-q2c25wvegzdkxs7gzor6",
"fields": {
"name": "my build plan",
"planStatus": "active",
"dateCreated": 1538085249,
"dateModified": 1538085249,
"policy": {
"view": "users",
"edit": "admin"
}
},
{
"id": 1,
"type": "HMCP",
"phid": "PHID-HMCP-q2c25wvegzdkxs7gzor6",
"fields": {
"name": "my build plan",
"status": {
"value": "active"
},
"dateCreated": 1538085249,
"dateModified": 1538085249,
"policy": {
"view": "users",
"edit": "admin"
}
},
"attachments": {}
},
...
],
"maps": {},
"query": {
"queryKey": null
},
"cursor": {
"limit": 100,
"after": null,
"before": null,
"order": null
}
}
```

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, yelirekim

Differential Revision: https://secure.phabricator.com/D19769

+52
+3
src/__phutil_library_map__.php
··· 1326 1326 'HarbormasterBuildPlanNameNgrams' => 'applications/harbormaster/storage/configuration/HarbormasterBuildPlanNameNgrams.php', 1327 1327 'HarbormasterBuildPlanPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildPlanPHIDType.php', 1328 1328 'HarbormasterBuildPlanQuery' => 'applications/harbormaster/query/HarbormasterBuildPlanQuery.php', 1329 + 'HarbormasterBuildPlanSearchAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildPlanSearchAPIMethod.php', 1329 1330 'HarbormasterBuildPlanSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php', 1330 1331 'HarbormasterBuildPlanTransaction' => 'applications/harbormaster/storage/configuration/HarbormasterBuildPlanTransaction.php', 1331 1332 'HarbormasterBuildPlanTransactionQuery' => 'applications/harbormaster/query/HarbormasterBuildPlanTransactionQuery.php', ··· 6775 6776 'PhabricatorPolicyInterface', 6776 6777 'PhabricatorSubscribableInterface', 6777 6778 'PhabricatorNgramsInterface', 6779 + 'PhabricatorConduitResultInterface', 6778 6780 'PhabricatorProjectInterface', 6779 6781 ), 6780 6782 'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource', ··· 6785 6787 'HarbormasterBuildPlanNameNgrams' => 'PhabricatorSearchNgrams', 6786 6788 'HarbormasterBuildPlanPHIDType' => 'PhabricatorPHIDType', 6787 6789 'HarbormasterBuildPlanQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 6790 + 'HarbormasterBuildPlanSearchAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 6788 6791 'HarbormasterBuildPlanSearchEngine' => 'PhabricatorApplicationSearchEngine', 6789 6792 'HarbormasterBuildPlanTransaction' => 'PhabricatorApplicationTransaction', 6790 6793 'HarbormasterBuildPlanTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+18
src/applications/harbormaster/conduit/HarbormasterBuildPlanSearchAPIMethod.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildPlanSearchAPIMethod 4 + extends PhabricatorSearchEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'harbormaster.buildplan.search'; 8 + } 9 + 10 + public function newSearchEngine() { 11 + return new HarbormasterBuildPlanSearchEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht('Retrieve information about Harbormaster build plans.'); 16 + } 17 + 18 + }
+31
src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
··· 9 9 PhabricatorPolicyInterface, 10 10 PhabricatorSubscribableInterface, 11 11 PhabricatorNgramsInterface, 12 + PhabricatorConduitResultInterface, 12 13 PhabricatorProjectInterface { 13 14 14 15 protected $name; ··· 205 206 id(new HarbormasterBuildPlanNameNgrams()) 206 207 ->setValue($this->getName()), 207 208 ); 209 + } 210 + 211 + 212 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 213 + 214 + 215 + public function getFieldSpecificationsForConduit() { 216 + return array( 217 + id(new PhabricatorConduitSearchFieldSpecification()) 218 + ->setKey('name') 219 + ->setType('string') 220 + ->setDescription(pht('The name of this build plan.')), 221 + id(new PhabricatorConduitSearchFieldSpecification()) 222 + ->setKey('status') 223 + ->setType('map<string, wild>') 224 + ->setDescription(pht('The current status of this build plan.')), 225 + ); 226 + } 227 + 228 + public function getFieldValuesForConduit() { 229 + return array( 230 + 'name' => $this->getName(), 231 + 'status' => array( 232 + 'value' => $this->getPlanStatus(), 233 + ), 234 + ); 235 + } 236 + 237 + public function getConduitSearchAttachments() { 238 + return array(); 208 239 } 209 240 210 241 }