Path: blob/master/src/applications/flag/conduit/FlagQueryConduitAPIMethod.php
12256 views
<?php12final class FlagQueryConduitAPIMethod extends FlagConduitAPIMethod {34public function getAPIMethodName() {5return 'flag.query';6}78public function getMethodDescription() {9return pht('Query flag markers.');10}1112protected function defineParamTypes() {13return array(14'ownerPHIDs' => 'optional list<phid>',15'types' => 'optional list<type>',16'objectPHIDs' => 'optional list<phid>',1718'offset' => 'optional int',19'limit' => 'optional int (default = 100)',20);21}2223protected function defineReturnType() {24return 'list<dict>';25}2627protected function execute(ConduitAPIRequest $request) {28$query = new PhabricatorFlagQuery();29$query->setViewer($request->getUser());3031$owner_phids = $request->getValue('ownerPHIDs', array());32if ($owner_phids) {33$query->withOwnerPHIDs($owner_phids);34}3536$object_phids = $request->getValue('objectPHIDs', array());37if ($object_phids) {38$query->withObjectPHIDs($object_phids);39}4041$types = $request->getValue('types', array());42if ($types) {43$query->withTypes($types);44}4546$query->needHandles(true);4748$query->setOffset($request->getValue('offset', 0));49$query->setLimit($request->getValue('limit', 100));5051$flags = $query->execute();5253$results = array();54foreach ($flags as $flag) {55$results[] = $this->buildFlagInfoDictionary($flag);56}5758return $results;59}6061}626364