1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 03:42:41 +01:00
phorge-phorge/src/applications/differential/conduit/DifferentialQueryDiffsConduitAPIMethod.php

48 lines
1.1 KiB
PHP
Raw Normal View History

<?php
final class DifferentialQueryDiffsConduitAPIMethod
extends DifferentialConduitAPIMethod {
public function getAPIMethodName() {
return 'differential.querydiffs';
}
public function getMethodDescription() {
return pht('Query differential diffs which match certain criteria.');
}
public function defineParamTypes() {
return array(
'ids' => 'optional list<uint>',
'revisionIDs' => 'optional list<uint>',
);
}
public function defineErrorTypes() {
return array();
}
public function defineReturnType() {
return 'list<dict>';
}
protected function execute(ConduitAPIRequest $request) {
$ids = $request->getValue('ids', array());
$revision_ids = $request->getValue('revisionIDs', array());
$diffs = array();
if ($ids || $revision_ids) {
$diffs = id(new DifferentialDiffQuery())
->setViewer($request->getUser())
->withIDs($ids)
->withRevisionIDs($revision_ids)
->needChangesets(true)
->needArcanistProjects(true)
->execute();
}
return mpull($diffs, 'getDiffDict', 'getID');
}
}