3 final class PHIDLookupConduitAPIMethod
extends PHIDConduitAPIMethod
{
5 public function getAPIMethodName() {
9 public function getMethodDescription() {
10 return pht('Look up objects by name.');
13 protected function defineParamTypes() {
15 'names' => 'required list<string>',
19 protected function defineReturnType() {
20 return 'nonempty dict<string, wild>';
23 protected function execute(ConduitAPIRequest
$request) {
24 $names = $request->getValue('names');
26 $query = id(new PhabricatorObjectQuery())
27 ->setViewer($request->getUser())
30 $name_map = $query->getNamedResults();
32 $handles = id(new PhabricatorHandleQuery())
33 ->setViewer($request->getUser())
34 ->withPHIDs(mpull($name_map, 'getPHID'))
38 foreach ($name_map as $name => $object) {
39 $phid = $object->getPHID();
40 $handle = $handles[$phid];
41 $result[$name] = $this->buildHandleInformationDictionary($handle);