[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class RepositoryQueryConduitAPIMethod 4 extends RepositoryConduitAPIMethod { 5 6 public function getAPIMethodName() { 7 return 'repository.query'; 8 } 9 10 public function getMethodStatus() { 11 return self::METHOD_STATUS_UNSTABLE; 12 } 13 14 public function getMethodStatusDescription() { 15 return pht('Repository methods are new and subject to change.'); 16 } 17 18 public function getMethodDescription() { 19 return pht('Query repositories.'); 20 } 21 22 public function defineParamTypes() { 23 return array( 24 'ids' => 'optional list<int>', 25 'phids' => 'optional list<phid>', 26 'callsigns' => 'optional list<string>', 27 'vcsTypes' => 'optional list<string>', 28 'remoteURIs' => 'optional list<string>', 29 'uuids' => 'optional list<string>', 30 ); 31 } 32 33 public function defineReturnType() { 34 return 'list<dict>'; 35 } 36 37 public function defineErrorTypes() { 38 return array( 39 ); 40 } 41 42 protected function execute(ConduitAPIRequest $request) { 43 $query = id(new PhabricatorRepositoryQuery()) 44 ->setViewer($request->getUser()); 45 46 $ids = $request->getValue('ids', array()); 47 if ($ids) { 48 $query->withIDs($ids); 49 } 50 51 $phids = $request->getValue('phids', array()); 52 if ($phids) { 53 $query->withPHIDs($phids); 54 } 55 56 $callsigns = $request->getValue('callsigns', array()); 57 if ($callsigns) { 58 $query->withCallsigns($callsigns); 59 } 60 61 $vcs_types = $request->getValue('vcsTypes', array()); 62 if ($vcs_types) { 63 $query->withTypes($vcs_types); 64 } 65 66 $remote_uris = $request->getValue('remoteURIs', array()); 67 if ($remote_uris) { 68 $query->withRemoteURIs($remote_uris); 69 } 70 71 $uuids = $request->getValue('uuids', array()); 72 if ($uuids) { 73 $query->withUUIDs($uuids); 74 } 75 76 $repositories = $query->execute(); 77 78 $results = array(); 79 foreach ($repositories as $repository) { 80 $results[] = $repository->toDictionary(); 81 } 82 83 return $results; 84 } 85 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |