3 final class HarbormasterQueryBuildablesConduitAPIMethod
4 extends HarbormasterConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'harbormaster.querybuildables';
10 public function getMethodDescription() {
11 return pht('Query Harbormaster buildables.');
14 protected function defineParamTypes() {
16 'ids' => 'optional list<id>',
17 'phids' => 'optional list<phid>',
18 'buildablePHIDs' => 'optional list<phid>',
19 'containerPHIDs' => 'optional list<phid>',
20 'manualBuildables' => 'optional bool',
21 ) + self
::getPagerParamTypes();
24 protected function defineReturnType() {
28 protected function execute(ConduitAPIRequest
$request) {
29 $viewer = $request->getUser();
31 $query = id(new HarbormasterBuildableQuery())
34 $ids = $request->getValue('ids');
36 $query->withIDs($ids);
39 $phids = $request->getValue('phids');
40 if ($phids !== null) {
41 $query->withPHIDs($phids);
44 $buildable_phids = $request->getValue('buildablePHIDs');
45 if ($buildable_phids !== null) {
46 $query->withBuildablePHIDs($buildable_phids);
49 $container_phids = $request->getValue('containerPHIDs');
50 if ($container_phids !== null) {
51 $query->withContainerPHIDs($container_phids);
54 $manual = $request->getValue('manualBuildables');
55 if ($manual !== null) {
56 $query->withManualBuildables($manual);
59 $pager = $this->newPager($request);
61 $buildables = $query->executeWithCursorPager($pager);
64 foreach ($buildables as $buildable) {
65 $monogram = $buildable->getMonogram();
67 $status = $buildable->getBuildableStatus();
68 $status_name = $buildable->getStatusDisplayName();
71 'id' => $buildable->getID(),
72 'phid' => $buildable->getPHID(),
73 'monogram' => $monogram,
74 'uri' => PhabricatorEnv
::getProductionURI('/'.$monogram),
75 'buildableStatus' => $status,
76 'buildableStatusName' => $status_name,
77 'buildablePHID' => $buildable->getBuildablePHID(),
78 'containerPHID' => $buildable->getContainerPHID(),
79 'isManualBuildable' => (bool)$buildable->getIsManualBuildable(),
87 $results = $this->addPagerResults($results, $pager);