3 final class ReleephGetBranchesConduitAPIMethod
extends ReleephConduitAPIMethod
{
5 public function getAPIMethodName() {
6 return 'releeph.getbranches';
9 public function getMethodDescription() {
10 return pht('Return information about all active Releeph branches.');
13 protected function defineParamTypes() {
18 protected function defineReturnType() {
19 return 'nonempty list<dict<string, wild>>';
22 protected function execute(ConduitAPIRequest
$request) {
25 $projects = id(new ReleephProductQuery())
26 ->setViewer($request->getUser())
30 foreach ($projects as $project) {
31 $repository = $project->getRepository();
33 $branches = id(new ReleephBranch())->loadAllWhere(
34 'releephProjectID = %d AND isActive = 1',
37 foreach ($branches as $branch) {
38 $full_branch_name = $branch->getName();
40 $cut_point_commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
42 $branch->getCutPointCommitPHID());
45 'project' => $project->getName(),
46 'repository' => $repository->getCallsign(),
47 'branch' => $branch->getBasename(),
48 'fullBranchName' => $full_branch_name,
49 'symbolicName' => $branch->getSymbolicName(),
50 'cutPoint' => $cut_point_commit->getCommitIdentifier(),