Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php
12256 views
1
<?php
2
3
final class ManiphestInfoConduitAPIMethod extends ManiphestConduitAPIMethod {
4
5
public function getAPIMethodName() {
6
return 'maniphest.info';
7
}
8
9
public function getMethodDescription() {
10
return pht('Retrieve information about a Maniphest task, given its ID.');
11
}
12
13
public function getMethodStatus() {
14
return self::METHOD_STATUS_FROZEN;
15
}
16
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.');
21
}
22
23
protected function defineParamTypes() {
24
return array(
25
'task_id' => 'required id',
26
);
27
}
28
29
protected function defineReturnType() {
30
return 'nonempty dict';
31
}
32
33
protected function defineErrorTypes() {
34
return array(
35
'ERR_BAD_TASK' => pht('No such Maniphest task exists.'),
36
);
37
}
38
39
protected function execute(ConduitAPIRequest $request) {
40
$task_id = $request->getValue('task_id');
41
42
$task = id(new ManiphestTaskQuery())
43
->setViewer($request->getUser())
44
->withIDs(array($task_id))
45
->needSubscriberPHIDs(true)
46
->needProjectPHIDs(true)
47
->executeOne();
48
if (!$task) {
49
throw new ConduitException('ERR_BAD_TASK');
50
}
51
52
return $this->buildTaskInfoDictionary($task);
53
}
54
55
}
56
57