Differential D12894 Diff 31029 src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php
Show All 11 Lines | final class DifferentialGetDiffConduitAPIMethod | ||||
} | } | ||||
public function getMethodStatus() { | public function getMethodStatus() { | ||||
return self::METHOD_STATUS_DEPRECATED; | return self::METHOD_STATUS_DEPRECATED; | ||||
} | } | ||||
public function getMethodStatusDescription() { | public function getMethodStatusDescription() { | ||||
return pht( | return pht( | ||||
'This method has been deprecated in favor of differential.querydiffs.'); | 'This method has been deprecated in favor of %s.', | ||||
'differential.querydiffs'); | |||||
} | } | ||||
public function getMethodDescription() { | public function getMethodDescription() { | ||||
return pht('Load the content of a diff from Differential by revision id '. | return pht( | ||||
'Load the content of a diff from Differential by revision id '. | |||||
'or diff id.'); | 'or diff id.'); | ||||
} | } | ||||
protected function defineParamTypes() { | protected function defineParamTypes() { | ||||
return array( | return array( | ||||
'revision_id' => 'optional id', | 'revision_id' => 'optional id', | ||||
'diff_id' => 'optional id', | 'diff_id' => 'optional id', | ||||
); | ); | ||||
} | } | ||||
Show All 27 Lines | protected function execute(ConduitAPIRequest $request) { | ||||
} | } | ||||
$diff = null; | $diff = null; | ||||
if ($diff_id) { | if ($diff_id) { | ||||
$diff = id(new DifferentialDiffQuery()) | $diff = id(new DifferentialDiffQuery()) | ||||
->setViewer($request->getUser()) | ->setViewer($request->getUser()) | ||||
->withIDs(array($diff_id)) | ->withIDs(array($diff_id)) | ||||
->needChangesets(true) | ->needChangesets(true) | ||||
->needArcanistProjects(true) | |||||
->executeOne(); | ->executeOne(); | ||||
} | } | ||||
if (!$diff) { | if (!$diff) { | ||||
throw new ConduitException('ERR_BAD_DIFF'); | throw new ConduitException('ERR_BAD_DIFF'); | ||||
} | } | ||||
return $diff->getDiffDict(); | return $diff->getDiffDict(); | ||||
} | } | ||||
} | } |