Path: blob/master/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php
12241 views
<?php12final class ChatLogQueryConduitAPIMethod extends ChatLogConduitAPIMethod {34public function getAPIMethodName() {5return 'chatlog.query';6}78public function getMethodStatus() {9return self::METHOD_STATUS_UNSTABLE;10}1112public function getMethodDescription() {13return pht('Retrieve chatter.');14}1516protected function defineParamTypes() {17return array(18'channels' => 'optional list<string>',19'limit' => 'optional int (default = 100)',20);21}2223protected function defineReturnType() {24return 'nonempty list<dict>';25}2627protected function execute(ConduitAPIRequest $request) {28$query = new PhabricatorChatLogQuery();2930$channel_ids = $request->getValue('channelIDs');31if ($channel_ids) {32$query->withChannelIDs($channel_ids);33}3435$limit = $request->getValue('limit');36if (!$limit) {37$limit = 100;38}39$query->setLimit($limit);4041$logs = $query->execute();4243$results = array();44foreach ($logs as $log) {45$results[] = array(46'channelID' => $log->getChannelID(),47'epoch' => $log->getEpoch(),48'author' => $log->getAuthor(),49'type' => $log->getType(),50'message' => $log->getMessage(),51'loggedByPHID' => $log->getLoggedByPHID(),52);53}5455return $results;56}5758}596061