3 final class ReleephQueryBranchesConduitAPIMethod
4 extends ReleephConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'releeph.querybranches';
10 public function getMethodDescription() {
11 return pht('Query information about Releeph branches.');
14 protected function defineParamTypes() {
16 'ids' => 'optional list<id>',
17 'phids' => 'optional list<phid>',
18 'productPHIDs' => 'optional list<phid>',
19 ) +
$this->getPagerParamTypes();
22 protected function defineReturnType() {
23 return 'query-results';
26 protected function execute(ConduitAPIRequest
$request) {
27 $viewer = $request->getUser();
29 $query = id(new ReleephBranchQuery())
32 $ids = $request->getValue('ids');
34 $query->withIDs($ids);
37 $phids = $request->getValue('phids');
38 if ($phids !== null) {
39 $query->withPHIDs($phids);
42 $product_phids = $request->getValue('productPHIDs');
43 if ($product_phids !== null) {
44 $query->withProductPHIDs($product_phids);
47 $pager = $this->newPager($request);
48 $branches = $query->executeWithCursorPager($pager);
51 foreach ($branches as $branch) {
52 $id = $branch->getID();
54 $uri = '/releeph/branch/'.$id.'/';
55 $uri = PhabricatorEnv
::getProductionURI($uri);
59 'phid' => $branch->getPHID(),
61 'name' => $branch->getName(),
62 'productPHID' => $branch->getProduct()->getPHID(),
66 return $this->addPagerResults(