[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/chatlog/conduit/ -> ChatLogQueryConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class ChatLogQueryConduitAPIMethod extends ChatLogConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'chatlog.query';
   7    }
   8  
   9    public function getMethodStatus() {
  10      return self::METHOD_STATUS_UNSTABLE;
  11    }
  12  
  13    public function getMethodDescription() {
  14      return 'Retrieve chatter.';
  15    }
  16  
  17    public function defineParamTypes() {
  18      return array(
  19        'channels' => 'optional list<string>',
  20        'limit'    => 'optional int (default = 100)',
  21      );
  22    }
  23  
  24    public function defineReturnType() {
  25      return 'nonempty list<dict>';
  26    }
  27  
  28    public function defineErrorTypes() {
  29      return array();
  30    }
  31  
  32    protected function execute(ConduitAPIRequest $request) {
  33      $query = new PhabricatorChatLogQuery();
  34  
  35      $channel_ids = $request->getValue('channelIDs');
  36      if ($channel_ids) {
  37        $query->withChannelIDs($channel_ids);
  38      }
  39  
  40      $limit = $request->getValue('limit');
  41      if (!$limit) {
  42        $limit = 100;
  43      }
  44      $query->setLimit($limit);
  45  
  46      $logs = $query->execute();
  47  
  48      $results = array();
  49      foreach ($logs as $log) {
  50        $results[] = array(
  51          'channelID'       => $log->getChannelID(),
  52          'epoch'           => $log->getEpoch(),
  53          'author'          => $log->getAuthor(),
  54          'type'            => $log->getType(),
  55          'message'         => $log->getMessage(),
  56          'loggedByPHID'    => $log->getLoggedByPHID(),
  57        );
  58      }
  59  
  60      return $results;
  61    }
  62  
  63  }


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