Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / maniphest / conduit / ManiphestQueryConduitAPIMethod.php
blob7ddf3b03eb8973d795a9199ab7ca2cccb2200a70
1 <?php
3 final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'maniphest.query';
9 public function getMethodDescription() {
10 return pht('Execute complex searches for Maniphest tasks.');
13 public function getMethodStatus() {
14 return self::METHOD_STATUS_FROZEN;
17 public function getMethodStatusDescription() {
18 return pht(
19 'This method is frozen and will eventually be deprecated. New code '.
20 'should use "maniphest.search" instead.');
23 protected function defineParamTypes() {
24 $statuses = array(
25 ManiphestTaskQuery::STATUS_ANY,
26 ManiphestTaskQuery::STATUS_OPEN,
27 ManiphestTaskQuery::STATUS_CLOSED,
28 ManiphestTaskQuery::STATUS_RESOLVED,
29 ManiphestTaskQuery::STATUS_WONTFIX,
30 ManiphestTaskQuery::STATUS_INVALID,
31 ManiphestTaskQuery::STATUS_SPITE,
32 ManiphestTaskQuery::STATUS_DUPLICATE,
34 $status_const = $this->formatStringConstants($statuses);
36 $orders = array(
37 ManiphestTaskQuery::ORDER_PRIORITY,
38 ManiphestTaskQuery::ORDER_CREATED,
39 ManiphestTaskQuery::ORDER_MODIFIED,
41 $order_const = $this->formatStringConstants($orders);
43 return array(
44 'ids' => 'optional list<uint>',
45 'phids' => 'optional list<phid>',
46 'ownerPHIDs' => 'optional list<phid>',
47 'authorPHIDs' => 'optional list<phid>',
48 'projectPHIDs' => 'optional list<phid>',
49 'ccPHIDs' => 'optional list<phid>',
50 'fullText' => 'optional string',
52 'status' => 'optional '.$status_const,
53 'order' => 'optional '.$order_const,
55 'limit' => 'optional int',
56 'offset' => 'optional int',
60 protected function defineReturnType() {
61 return 'list';
64 protected function execute(ConduitAPIRequest $request) {
65 $query = id(new ManiphestTaskQuery())
66 ->setViewer($request->getUser())
67 ->needProjectPHIDs(true)
68 ->needSubscriberPHIDs(true);
70 $task_ids = $request->getValue('ids');
71 if ($task_ids) {
72 $query->withIDs($task_ids);
75 $task_phids = $request->getValue('phids');
76 if ($task_phids) {
77 $query->withPHIDs($task_phids);
80 $owners = $request->getValue('ownerPHIDs');
81 if ($owners) {
82 $query->withOwners($owners);
85 $authors = $request->getValue('authorPHIDs');
86 if ($authors) {
87 $query->withAuthors($authors);
90 $projects = $request->getValue('projectPHIDs');
91 if ($projects) {
92 $query->withEdgeLogicPHIDs(
93 PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
94 PhabricatorQueryConstraint::OPERATOR_AND,
95 $projects);
98 $ccs = $request->getValue('ccPHIDs');
99 if ($ccs) {
100 $query->withSubscribers($ccs);
103 $full_text = $request->getValue('fullText');
104 if ($full_text) {
105 throw new Exception(
106 pht(
107 'Parameter "fullText" is no longer supported. Use method '.
108 '"maniphest.search" with the "query" constraint instead.'));
111 $status = $request->getValue('status');
112 if ($status) {
113 $query->withStatus($status);
116 $order = $request->getValue('order');
117 if ($order) {
118 $query->setOrder($order);
121 $limit = $request->getValue('limit');
122 if ($limit) {
123 $query->setLimit($limit);
126 $offset = $request->getValue('offset');
127 if ($offset) {
128 $query->setOffset($offset);
131 $results = $query->execute();
132 return $this->buildTaskInfoDictionaries($results);