3 final class HarbormasterQueryBuildsConduitAPIMethod
4 extends HarbormasterConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'harbormaster.querybuilds';
10 public function getMethodDescription() {
11 return pht('Query Harbormaster builds.');
14 public function getMethodStatus() {
15 return self
::METHOD_STATUS_DEPRECATED
;
18 public function getMethodStatusDescription() {
19 return pht('Use %s instead.', 'harbormaster.build.search');
22 protected function defineParamTypes() {
24 'ids' => 'optional list<id>',
25 'phids' => 'optional list<phid>',
26 'buildStatuses' => 'optional list<string>',
27 'buildablePHIDs' => 'optional list<phid>',
28 'buildPlanPHIDs' => 'optional list<phid>',
29 ) + self
::getPagerParamTypes();
32 protected function defineReturnType() {
36 protected function execute(ConduitAPIRequest
$request) {
37 $viewer = $request->getUser();
38 $call = new ConduitCall(
39 'harbormaster.build.search',
41 'constraints' => array_filter(array(
42 'ids' => $request->getValue('ids'),
43 'phids' => $request->getValue('phids'),
44 'statuses' => $request->getValue('buildStatuses'),
45 'buildables' => $request->getValue('buildablePHIDs'),
46 'plans' => $request->getValue('buildPlanPHIDs'),
48 'attachments' => array(
49 'querybuilds' => true,
51 'limit' => $request->getValue('limit'),
52 'before' => $request->getValue('before'),
53 'after' => $request->getValue('after'),
56 $subsumption = $call->setUser($viewer)
60 foreach ($subsumption['data'] as $build_data) {
63 array('attachments', 'querybuilds'),
65 $fields = idx($build_data, 'fields', array());
66 unset($build_data['fields']);
67 unset($build_data['attachments']);
69 // To retain backward compatibility, remove newer keys from the
71 $fields['buildStatus'] = array_select_keys(
72 $fields['buildStatus'],
78 $data[] = array_mergev(array($build_data, $querybuilds, $fields));
81 $subsumption['data'] = $data;