[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/flag/conduit/ -> FlagQueryConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class FlagQueryConduitAPIMethod extends FlagConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'flag.query';
   7    }
   8  
   9    public function getMethodDescription() {
  10      return 'Query flag markers.';
  11    }
  12  
  13    public function defineParamTypes() {
  14      return array(
  15        'ownerPHIDs'    => 'optional list<phid>',
  16        'types'         => 'optional list<type>',
  17        'objectPHIDs'   => 'optional list<phid>',
  18  
  19        'offset'        => 'optional int',
  20        'limit'         => 'optional int (default = 100)',
  21      );
  22    }
  23  
  24    public function defineReturnType() {
  25      return 'list<dict>';
  26    }
  27  
  28    public function defineErrorTypes() {
  29      return array(
  30      );
  31    }
  32  
  33    protected function execute(ConduitAPIRequest $request) {
  34      $query = new PhabricatorFlagQuery();
  35      $query->setViewer($request->getUser());
  36  
  37      $owner_phids = $request->getValue('ownerPHIDs', array());
  38      if ($owner_phids) {
  39        $query->withOwnerPHIDs($owner_phids);
  40      }
  41  
  42      $object_phids = $request->getValue('objectPHIDs', array());
  43      if ($object_phids) {
  44        $query->withObjectPHIDs($object_phids);
  45      }
  46  
  47      $types = $request->getValue('types', array());
  48      if ($types) {
  49        $query->withTypes($types);
  50      }
  51  
  52      $query->needHandles(true);
  53  
  54      $query->setOffset($request->getValue('offset', 0));
  55      $query->setLimit($request->getValue('limit', 100));
  56  
  57      $flags = $query->execute();
  58  
  59      $results = array();
  60      foreach ($flags as $flag) {
  61        $results[] = $this->buildFlagInfoDictionary($flag);
  62      }
  63  
  64      return $results;
  65    }
  66  
  67  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1