3 final class ManiphestUpdateConduitAPIMethod
extends ManiphestConduitAPIMethod
{
5 public function getAPIMethodName() {
6 return 'maniphest.update';
9 public function getMethodDescription() {
10 return pht('Update an existing Maniphest task.');
13 public function getMethodStatus() {
14 return self
::METHOD_STATUS_FROZEN
;
17 public function getMethodStatusDescription() {
19 'This method is frozen and will eventually be deprecated. New code '.
20 'should use "maniphest.edit" instead.');
23 protected function defineErrorTypes() {
25 'ERR-BAD-TASK' => pht('No such Maniphest task exists.'),
26 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
27 'ERR-NO-EFFECT' => pht('Update has no effect.'),
31 protected function defineParamTypes() {
32 return $this->getTaskFields($is_new = false);
35 protected function defineReturnType() {
36 return 'nonempty dict';
39 protected function execute(ConduitAPIRequest
$request) {
40 $id = $request->getValue('id');
41 $phid = $request->getValue('phid');
43 if (($id && $phid) ||
(!$id && !$phid)) {
46 "Specify exactly one of '%s' and '%s'.",
51 $query = id(new ManiphestTaskQuery())
52 ->setViewer($request->getUser())
53 ->needSubscriberPHIDs(true)
54 ->needProjectPHIDs(true);
56 $query->withIDs(array($id));
58 $query->withPHIDs(array($phid));
60 $task = $query->executeOne();
62 $params = $request->getAllParameters();
64 unset($params['phid']);
66 if (call_user_func_array('coalesce', $params) === null) {
67 throw new ConduitException('ERR-NO-EFFECT');
71 throw new ConduitException('ERR-BAD-TASK');
74 $task = $this->applyRequest($task, $request, $is_new = false);
76 return $this->buildTaskInfoDictionary($task);