Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / tokens / conduit / TokenGivenConduitAPIMethod.php
blobdfa887fc76b2e1aec1a063362c663e9bf669cb6b
1 <?php
3 final class TokenGivenConduitAPIMethod extends TokenConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'token.given';
9 public function getMethodDescription() {
10 return pht('Query tokens given to objects.');
13 protected function defineParamTypes() {
14 return array(
15 'authorPHIDs' => 'list<phid>',
16 'objectPHIDs' => 'list<phid>',
17 'tokenPHIDs' => 'list<phid>',
21 protected function defineReturnType() {
22 return 'list<dict>';
25 protected function execute(ConduitAPIRequest $request) {
26 $query = id(new PhabricatorTokenGivenQuery())
27 ->setViewer($request->getUser());
29 $author_phids = $request->getValue('authorPHIDs');
30 if ($author_phids) {
31 $query->withAuthorPHIDs($author_phids);
34 $object_phids = $request->getValue('objectPHIDs');
35 if ($object_phids) {
36 $query->withObjectPHIDs($object_phids);
39 $token_phids = $request->getValue('tokenPHIDs');
40 if ($token_phids) {
41 $query->withTokenPHIDs($token_phids);
44 $given = $query->execute();
46 return $this->buildTokenGivenDicts($given);