mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
156b156e77
Summary: Ref T7803. Ref T5873. I want to drive Conduit through more shared infrastructure, but can't currently add parameters automatically. Put a `getX()` around the `defineX()` methods so the parent can provide default behaviors. Also like 60% of methods don't define any special error types; don't require them to implement this method. I want to move away from this in general. Test Plan: - Ran `arc unit --everything`. - Called `conduit.query`. - Browsed Conduit UI. Reviewers: btrahan Reviewed By: btrahan Subscribers: hach-que, epriestley Maniphest Tasks: T5873, T7803 Differential Revision: https://secure.phabricator.com/D12380
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class DiffusionRawDiffQueryConduitAPIMethod
|
|
extends DiffusionQueryConduitAPIMethod {
|
|
|
|
public function getAPIMethodName() {
|
|
return 'diffusion.rawdiffquery';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return
|
|
'Get raw diff information from a repository for a specific commit at an '.
|
|
'(optional) path.';
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'string';
|
|
}
|
|
|
|
protected function defineCustomParamTypes() {
|
|
return array(
|
|
'commit' => 'required string',
|
|
'path' => 'optional string',
|
|
'timeout' => 'optional int',
|
|
'byteLimit' => 'optional int',
|
|
'linesOfContext' => 'optional int',
|
|
'againstCommit' => 'optional string',
|
|
);
|
|
}
|
|
|
|
protected function getResult(ConduitAPIRequest $request) {
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$raw_query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest);
|
|
|
|
$timeout = $request->getValue('timeout');
|
|
if ($timeout !== null) {
|
|
$raw_query->setTimeout($timeout);
|
|
}
|
|
|
|
$lines_of_context = $request->getValue('linesOfContext');
|
|
if ($lines_of_context !== null) {
|
|
$raw_query->setLinesOfContext($lines_of_context);
|
|
}
|
|
|
|
$against_commit = $request->getValue('againstCommit');
|
|
if ($against_commit !== null) {
|
|
$raw_query->setAgainstCommit($against_commit);
|
|
}
|
|
|
|
$byte_limit = $request->getValue('byteLimit');
|
|
if ($byte_limit !== null) {
|
|
$raw_query->setByteLimit($byte_limit);
|
|
}
|
|
|
|
return $raw_query->loadRawDiff();
|
|
}
|
|
|
|
}
|