Page MenuHomePhabricator

DifferentialGetDiffPropertiesConduitAPIMethod.php

Authored By
mwek
Dec 13 2016, 9:26 PM
Size
1 KB
Referenced Files
None
Subscribers
None

DifferentialGetDiffPropertiesConduitAPIMethod.php

<?php
final class DifferentialGetDiffPropertiesConduitAPIMethod
extends DifferentialConduitAPIMethod {
public function getAPIMethodName() {
return 'differential.getdiffproperties';
}
public function getMethodDescription() {
return pht('Read properties from Differential diffs.');
}
protected function defineParamTypes() {
return array(
'diff_id' => 'required diff_id',
'names' => 'optional list<string>',
);
}
protected function defineReturnType() {
return 'dict';
}
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => pht('Properties not found.'),
);
}
protected function execute(ConduitAPIRequest $request) {
$diff_id = $request->getValue('diff_id');
$names = $request->getValue('names', array());
$properties = array();
if ($names) {
$properties = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d AND name IN (%Ls)',
$diff_id,
$names);
} else {
$properties = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d',
$diff_id);
}
if (!$properties) {
throw new ConduitException('ERR_NOT_FOUND');
}
return mpull($properties, 'getData', 'getName');
}
}

File Metadata

Mime Type
text/x-php
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
371129
Default Alt Text
DifferentialGetDiffPropertiesConduitAPIMethod.php (1 KB)

Event Timeline