@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.buildable.search API Method

Summary:
This revision adds a Conduit search method for buildables. It exposes:
* `objectPHID`
* `containerPHID`
* `buildableStatus`
* `isManual`

Test Plan:
Use the API Console to run searches. Example:
```
{
"data": [
{
"id": 2,
"type": "HMBB",
"phid": "PHID-HMBB-m4k5lodx6naq22576a7d",
"fields": {
"objectPHID": "PHID-DIFF-vzvgqqcyscpd7ta4osy2",
"containerPHID": "PHID-DREV-vsivs5276c7vtgpmssn2",
"buildableStatus": {
"value": "passed"
},
"isManual": true,
"dateCreated": 1542407155,
"dateModified": 1542407156,
"policy": {
"view": "users",
"edit": "users"
}
},
"attachments": {}
},
{
"id": 1,
"type": "HMBB",
"phid": "PHID-HMBB-opxfl4auoz3ey5klplrx",
"fields": {
"objectPHID": "PHID-DIFF-vzvgqqcyscpd7ta4osy2",
"containerPHID": null,
"buildableStatus": {
"value": "passed"
},
"isManual": false,
"dateCreated": 1542406968,
"dateModified": 1542406968,
"policy": {
"view": "users",
"edit": "users"
}
},
"attachments": {}
}
],
"maps": {},
"query": {
"queryKey": null
},
"cursor": {
"limit": 100,
"after": null,
"before": null,
"order": null
}
}
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, O14 ATC Monitoring

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

authored by

John Linahan and committed by
epriestley
433a7321 03f249ba

+62
+3
src/__phutil_library_map__.php
··· 1367 1367 'HarbormasterBuildableListController' => 'applications/harbormaster/controller/HarbormasterBuildableListController.php', 1368 1368 'HarbormasterBuildablePHIDType' => 'applications/harbormaster/phid/HarbormasterBuildablePHIDType.php', 1369 1369 'HarbormasterBuildableQuery' => 'applications/harbormaster/query/HarbormasterBuildableQuery.php', 1370 + 'HarbormasterBuildableSearchAPIMethod' => 'applications/harbormaster/conduit/HarbormasterBuildableSearchAPIMethod.php', 1370 1371 'HarbormasterBuildableSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildableSearchEngine.php', 1371 1372 'HarbormasterBuildableStatus' => 'applications/harbormaster/constants/HarbormasterBuildableStatus.php', 1372 1373 'HarbormasterBuildableTransaction' => 'applications/harbormaster/storage/HarbormasterBuildableTransaction.php', ··· 6845 6846 'PhabricatorApplicationTransactionInterface', 6846 6847 'PhabricatorPolicyInterface', 6847 6848 'HarbormasterBuildableInterface', 6849 + 'PhabricatorConduitResultInterface', 6848 6850 'PhabricatorDestructibleInterface', 6849 6851 ), 6850 6852 'HarbormasterBuildableActionController' => 'HarbormasterController', ··· 6852 6854 'HarbormasterBuildableListController' => 'HarbormasterController', 6853 6855 'HarbormasterBuildablePHIDType' => 'PhabricatorPHIDType', 6854 6856 'HarbormasterBuildableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 6857 + 'HarbormasterBuildableSearchAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 6855 6858 'HarbormasterBuildableSearchEngine' => 'PhabricatorApplicationSearchEngine', 6856 6859 'HarbormasterBuildableStatus' => 'Phobject', 6857 6860 'HarbormasterBuildableTransaction' => 'PhabricatorApplicationTransaction',
+18
src/applications/harbormaster/conduit/HarbormasterBuildableSearchAPIMethod.php
··· 1 + <?php 2 + 3 + final class HarbormasterBuildableSearchAPIMethod 4 + extends PhabricatorSearchEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'harbormaster.buildable.search'; 8 + } 9 + 10 + public function newSearchEngine() { 11 + return new HarbormasterBuildableSearchEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht('Find out information about buildables.'); 16 + } 17 + 18 + }
+41
src/applications/harbormaster/storage/HarbormasterBuildable.php
··· 6 6 PhabricatorApplicationTransactionInterface, 7 7 PhabricatorPolicyInterface, 8 8 HarbormasterBuildableInterface, 9 + PhabricatorConduitResultInterface, 9 10 PhabricatorDestructibleInterface { 10 11 11 12 protected $buildablePHID; ··· 352 353 353 354 public function newBuildableEngine() { 354 355 return $this->getBuildableObject()->newBuildableEngine(); 356 + } 357 + 358 + 359 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 360 + 361 + 362 + public function getFieldSpecificationsForConduit() { 363 + return array( 364 + id(new PhabricatorConduitSearchFieldSpecification()) 365 + ->setKey('objectPHID') 366 + ->setType('phid') 367 + ->setDescription(pht('PHID of the object that is built.')), 368 + id(new PhabricatorConduitSearchFieldSpecification()) 369 + ->setKey('containerPHID') 370 + ->setType('phid') 371 + ->setDescription(pht('PHID of the object containing this buildable.')), 372 + id(new PhabricatorConduitSearchFieldSpecification()) 373 + ->setKey('buildableStatus') 374 + ->setType('map<string, wild>') 375 + ->setDescription(pht('The current status of this buildable.')), 376 + id(new PhabricatorConduitSearchFieldSpecification()) 377 + ->setKey('isManual') 378 + ->setType('bool') 379 + ->setDescription(pht('True if this is a manual buildable.')), 380 + ); 381 + } 382 + 383 + public function getFieldValuesForConduit() { 384 + return array( 385 + 'objectPHID' => $this->getBuildablePHID(), 386 + 'containerPHID' => $this->getContainerPHID(), 387 + 'buildableStatus' => array( 388 + 'value' => $this->getBuildableStatus(), 389 + ), 390 + 'isManual' => (bool)$this->getIsManualBuildable(), 391 + ); 392 + } 393 + 394 + public function getConduitSearchAttachments() { 395 + return array(); 355 396 } 356 397 357 398