Path: blob/master/src/applications/differential/conduit/DifferentialGetRawDiffConduitAPIMethod.php
12256 views
<?php12final class DifferentialGetRawDiffConduitAPIMethod3extends DifferentialConduitAPIMethod {45public function getAPIMethodName() {6return 'differential.getrawdiff';7}89public function getMethodDescription() {10return pht('Retrieve a raw diff');11}1213protected function defineParamTypes() {14return array(15'diffID' => 'required diffID',16);17}1819protected function defineReturnType() {20return 'nonempty string';21}2223protected function defineErrorTypes() {24return array(25'ERR_NOT_FOUND' => pht('Diff not found.'),26);27}2829protected function execute(ConduitAPIRequest $request) {30$diff_id = $request->getValue('diffID');3132$viewer = $request->getUser();3334$diff = id(new DifferentialDiffQuery())35->withIDs(array($diff_id))36->setViewer($viewer)37->needChangesets(true)38->executeOne();3940if (!$diff) {41throw new ConduitException('ERR_NOT_FOUND');42}4344$renderer = id(new DifferentialRawDiffRenderer())45->setChangesets($diff->getChangesets())46->setViewer($viewer)47->setFormat('git');4849return $renderer->buildPatch();50}5152}535455