3 final class DifferentialGetDiffConduitAPIMethod
4 extends DifferentialConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'differential.getdiff';
10 public function shouldAllowPublic() {
14 public function getMethodStatus() {
15 return self
::METHOD_STATUS_DEPRECATED
;
18 public function getMethodStatusDescription() {
20 'This method has been deprecated in favor of %s.',
21 'differential.querydiffs');
25 public function getMethodDescription() {
27 'Load the content of a diff from Differential by revision ID '.
31 protected function defineParamTypes() {
33 'revision_id' => 'optional id',
34 'diff_id' => 'optional id',
38 protected function defineReturnType() {
39 return 'nonempty dict';
42 protected function defineErrorTypes() {
44 'ERR_BAD_DIFF' => pht('No such diff exists.'),
48 protected function execute(ConduitAPIRequest
$request) {
49 $diff_id = $request->getValue('diff_id');
51 // If we have a revision ID, we need the most recent diff. Figure that out
52 // without loading all the attached data.
53 $revision_id = $request->getValue('revision_id');
55 $diffs = id(new DifferentialDiffQuery())
56 ->setViewer($request->getUser())
57 ->withRevisionIDs(array($revision_id))
60 $diff_id = head($diffs)->getID();
62 throw new ConduitException('ERR_BAD_DIFF');
68 $diff = id(new DifferentialDiffQuery())
69 ->setViewer($request->getUser())
70 ->withIDs(array($diff_id))
71 ->needChangesets(true)
76 throw new ConduitException('ERR_BAD_DIFF');
79 return $diff->getDiffDict();