Path: blob/master/src/applications/paste/conduit/PasteQueryConduitAPIMethod.php
12241 views
<?php12final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod {34public function getAPIMethodName() {5return 'paste.query';6}78public function getMethodDescription() {9return pht('Query Pastes.');10}1112public function getMethodStatus() {13return self::METHOD_STATUS_FROZEN;14}1516public function getMethodStatusDescription() {17return pht(18'This method is frozen and will eventually be deprecated. New code '.19'should use "paste.search" instead.');20}2122protected function defineParamTypes() {23return array(24'ids' => 'optional list<int>',25'phids' => 'optional list<phid>',26'authorPHIDs' => 'optional list<phid>',27'after' => 'optional int',28'limit' => 'optional int, default = 100',29);30}3132protected function defineReturnType() {33return 'list<dict>';34}3536protected function execute(ConduitAPIRequest $request) {37$query = id(new PhabricatorPasteQuery())38->setViewer($request->getUser())39->needRawContent(true);4041if ($request->getValue('ids')) {42$query->withIDs($request->getValue('ids'));43}4445if ($request->getValue('phids')) {46$query->withPHIDs($request->getValue('phids'));47}4849if ($request->getValue('authorPHIDs')) {50$query->withAuthorPHIDs($request->getValue('authorPHIDs'));51}5253if ($request->getValue('after')) {54$query->setAfterID($request->getValue('after'));55}5657$limit = $request->getValue('limit', 100);58if ($limit) {59$query->setLimit($limit);60}6162$pastes = $query->execute();6364$results = array();65foreach ($pastes as $paste) {66$results[$paste->getPHID()] = $this->buildPasteInfoDictionary($paste);67}6869return $results;70}7172}737475