3 final class MacroQueryConduitAPIMethod
extends MacroConduitAPIMethod
{
5 public function getAPIMethodName() {
9 public function getMethodDescription() {
10 return pht('Retrieve image macro information.');
13 protected function defineParamTypes() {
15 'authorPHIDs' => 'optional list<phid>',
16 'phids' => 'optional list<phid>',
17 'ids' => 'optional list<id>',
18 'names' => 'optional list<string>',
19 'nameLike' => 'optional string',
23 protected function defineReturnType() {
27 protected function execute(ConduitAPIRequest
$request) {
28 $query = id(new PhabricatorMacroQuery())
29 ->setViewer($request->getUser())
32 $author_phids = $request->getValue('authorPHIDs');
33 $phids = $request->getValue('phids');
34 $ids = $request->getValue('ids');
35 $name_like = $request->getValue('nameLike');
36 $names = $request->getValue('names');
39 $query->withAuthorPHIDs($author_phids);
43 $query->withPHIDs($phids);
47 $query->withIDs($ids);
51 $query->withNameLike($name_like);
55 $query->withNames($names);
58 $macros = $query->execute();
65 foreach ($macros as $macro) {
66 $file = $macro->getFile();
67 $results[$macro->getName()] = array(
68 'uri' => $file->getBestURI(),
69 'phid' => $macro->getPHID(),
70 'authorPHID' => $file->getAuthorPHID(),
71 'dateCreated' => $file->getDateCreated(),
72 'filePHID' => $file->getPHID(),