1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Give Conduit params/return/errors protected visibility

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
This commit is contained in:
epriestley 2015-04-12 15:59:07 -07:00
parent 6e4f508beb
commit 156b156e77
140 changed files with 341 additions and 617 deletions

View file

@ -11,7 +11,7 @@ final class AlmanacQueryDevicesConduitAPIMethod
return pht('Query Almanac devices.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<id>',
'phids' => 'optional list<phid>',
@ -19,14 +19,10 @@ final class AlmanacQueryDevicesConduitAPIMethod
) + self::getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -11,7 +11,7 @@ final class AlmanacQueryServicesConduitAPIMethod
return pht('Query Almanac services.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<id>',
'phids' => 'optional list<phid>',
@ -21,14 +21,10 @@ final class AlmanacQueryServicesConduitAPIMethod
) + self::getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -11,17 +11,17 @@ final class ArcanistProjectInfoConduitAPIMethod
return 'Get information about Arcanist projects.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'name' => 'required string',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-ARCANIST-PROJECT' => 'No such project exists.',
);

View file

@ -10,7 +10,7 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod {
return 'Query audit requests.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$statuses = array(
DiffusionCommitQuery::AUDIT_STATUS_ANY,
DiffusionCommitQuery::AUDIT_STATUS_OPEN,
@ -30,15 +30,10 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$query = id(new DiffusionCommitQuery())

View file

@ -11,7 +11,7 @@ final class PhabricatorAuthQueryPublicKeysConduitAPIMethod
return pht('Query public keys.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<id>',
'objectPHIDs' => 'optional list<phid>',
@ -19,14 +19,10 @@ final class PhabricatorAuthQueryPublicKeysConduitAPIMethod
) + self::getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'result-set';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -14,21 +14,17 @@ final class ChatLogQueryConduitAPIMethod extends ChatLogConduitAPIMethod {
return 'Retrieve chatter.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'channels' => 'optional list<string>',
'limit' => 'optional int (default = 100)',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$query = new PhabricatorChatLogQuery();

View file

@ -14,20 +14,16 @@ final class ChatLogRecordConduitAPIMethod extends ChatLogConduitAPIMethod {
return 'Record chatter.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'logs' => 'required list<dict>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<id>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$logs = $request->getValue('logs');
if (!is_array($logs)) {

View file

@ -15,10 +15,10 @@ final class ConduitCall {
private $user;
public function __construct($method, array $params) {
$this->method = $method;
$this->handler = $this->buildMethodHandler($method);
$this->method = $method;
$this->handler = $this->buildMethodHandler($method);
$param_types = $this->handler->defineParamTypes();
$param_types = $this->handler->getParamTypes();
foreach ($param_types as $key => $spec) {
if (ConduitAPIMethod::getParameterMetadataKey($key) !== null) {

View file

@ -48,7 +48,7 @@ final class PhabricatorConduitConsoleController
break;
}
$error_types = $method->defineErrorTypes();
$error_types = $method->getErrorTypes();
$error_types['ERR-CONDUIT-CORE'] = pht('See error message for details.');
$error_description = array();
foreach ($error_types as $error => $meaning) {
@ -70,7 +70,7 @@ final class PhabricatorConduitConsoleController
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Returns')
->setValue($method->defineReturnType()))
->setValue($method->getReturnType()))
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel('Errors')
@ -80,7 +80,7 @@ final class PhabricatorConduitConsoleController
'<strong>JSON</strong>. For instance, to enter a list, type: '.
'<tt>["apple", "banana", "cherry"]</tt>'));
$params = $method->defineParamTypes();
$params = $method->getParamTypes();
foreach ($params as $param => $desc) {
$form->appendChild(
id(new AphrontFormTextControl())

View file

@ -13,13 +13,30 @@ abstract class ConduitAPIMethod
const METHOD_STATUS_DEPRECATED = 'deprecated';
abstract public function getMethodDescription();
abstract public function defineParamTypes();
abstract public function defineReturnType();
abstract public function defineErrorTypes();
abstract protected function defineParamTypes();
abstract protected function defineReturnType();
protected function defineErrorTypes() {
return array();
}
abstract protected function execute(ConduitAPIRequest $request);
public function __construct() {}
public function getParamTypes() {
return $this->defineParamTypes();
}
public function getReturnType() {
return $this->defineReturnType();
}
public function getErrorTypes() {
return $this->defineErrorTypes();
}
/**
* This is mostly for compatibility with
* @{class:PhabricatorCursorPagedPolicyAwareQuery}.
@ -53,7 +70,7 @@ abstract class ConduitAPIMethod
}
public function getErrorDescription($error_code) {
return idx($this->defineErrorTypes(), $error_code, 'Unknown Error');
return idx($this->getErrorTypes(), $error_code, 'Unknown Error');
}
public function getRequiredScope() {

View file

@ -18,7 +18,7 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod {
return 'Connect a session-based client.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'client' => 'required string',
'clientVersion' => 'required int',
@ -30,11 +30,11 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<string, any>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-VERSION' =>
'Client/server version mismatch. Upgrade your server or downgrade '.

View file

@ -16,18 +16,14 @@ final class ConduitGetCapabilitiesConduitAPIMethod extends ConduitAPIMethod {
'available on this server.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<string, any>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$authentication = array(
'token',

View file

@ -19,18 +19,18 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod {
return 'Retrieve certificate information for a user.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'token' => 'required string',
'host' => 'required string',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<string, any>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-TOKEN' => 'Token does not exist or has expired.',
'ERR-RATE-LIMIT' =>

View file

@ -14,18 +14,14 @@ final class ConduitPingConduitAPIMethod extends ConduitAPIMethod {
return 'Basic ping for monitoring or a health-check.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'string';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
return php_uname('n');
}

View file

@ -10,18 +10,14 @@ final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
return 'Returns the parameters of the Conduit methods.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<dict>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$classes = id(new PhutilSymbolLoader())
->setAncestorClass('ConduitAPIMethod')
@ -32,8 +28,8 @@ final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
foreach ($classes as $class) {
$names_to_params[$class->getAPIMethodName()] = array(
'description' => $class->getMethodDescription(),
'params' => $class->defineParamTypes(),
'return' => $class->defineReturnType(),
'params' => $class->getParamTypes(),
'return' => $class->getReturnType(),
);
}

View file

@ -11,7 +11,7 @@ final class ConpherenceCreateThreadConduitAPIMethod
return pht('Create a new conpherence thread.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'title' => 'optional string',
'message' => 'required string',
@ -19,11 +19,11 @@ final class ConpherenceCreateThreadConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_EMPTY_PARTICIPANT_PHIDS' => pht(
'You must specify participant phids.'),

View file

@ -15,7 +15,7 @@ final class ConpherenceQueryThreadConduitAPIMethod
'updated conpherences for the logged in user.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional array<int>',
'phids' => 'optional array<phids>',
@ -24,14 +24,10 @@ final class ConpherenceQueryThreadConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$user = $request->getUser();
$ids = $request->getValue('ids', array());

View file

@ -15,7 +15,7 @@ final class ConpherenceQueryTransactionConduitAPIMethod
'transactions within the conpherence for the logged in user.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'threadID' => 'optional int',
'threadPHID' => 'optional phid',
@ -24,11 +24,11 @@ final class ConpherenceQueryTransactionConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_USAGE_NO_THREAD_ID' => pht(
'You must specify a thread id or thread phid to query transactions '.

View file

@ -11,7 +11,7 @@ final class ConpherenceUpdateThreadConduitAPIMethod
return pht('Update an existing conpherence thread.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'id' => 'optional int',
'phid' => 'optional phid',
@ -22,11 +22,11 @@ final class ConpherenceUpdateThreadConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'bool';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_USAGE_NO_THREAD_ID' => pht(
'You must specify a thread id or thread phid to query transactions '.

View file

@ -11,17 +11,17 @@ final class DifferentialCloseConduitAPIMethod
return pht('Close a Differential revision.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revisionID' => 'required int',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'Revision was not found.',
);

View file

@ -11,7 +11,7 @@ final class DifferentialCreateCommentConduitAPIMethod
return pht('Add a comment to a Differential revision.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revision_id' => 'required revisionid',
'message' => 'optional string',
@ -21,11 +21,11 @@ final class DifferentialCreateCommentConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_REVISION' => 'Bad revision ID.',
);

View file

@ -11,7 +11,7 @@ final class DifferentialCreateDiffConduitAPIMethod
return 'Create a new Differential diff.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$vcs_const = $this->formatStringConstants(
array(
@ -51,15 +51,10 @@ final class DifferentialCreateDiffConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$change_data = $request->getValue('changes');

View file

@ -11,7 +11,7 @@ final class DifferentialCreateInlineConduitAPIMethod
return 'Add an inline comment to a Differential revision.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revisionID' => 'optional revisionid',
'diffID' => 'optional diffid',
@ -23,11 +23,11 @@ final class DifferentialCreateInlineConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-REVISION' => 'Bad revision ID.',
'ERR-BAD-DIFF' => 'Bad diff ID, or diff does not belong to revision.',

View file

@ -11,7 +11,7 @@ final class DifferentialCreateRawDiffConduitAPIMethod
return pht('Create a new Differential diff from a raw diff source.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'diff' => 'required string',
'repositoryPHID' => 'optional string',
@ -19,15 +19,10 @@ final class DifferentialCreateRawDiffConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$raw_diff = $request->getValue('diff');

View file

@ -11,7 +11,7 @@ final class DifferentialCreateRevisionConduitAPIMethod
return pht('Create a new Differential revision.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
// TODO: Arcanist passes this; prevent fatals after D4191 until Conduit
// version 7 or newer.
@ -21,11 +21,11 @@ final class DifferentialCreateRevisionConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_DIFF' => 'Bad diff ID.',
);

View file

@ -19,7 +19,7 @@ final class DifferentialFindConduitAPIMethod
return 'Query Differential revisions which match certain criteria.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$types = array(
'open',
'committable',
@ -33,15 +33,10 @@ final class DifferentialFindConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$type = $request->getValue('query');
$guids = $request->getValue('guids');

View file

@ -12,18 +12,18 @@ final class DifferentialFinishPostponedLintersConduitAPIMethod
'linters as finished.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'diffID' => 'required diffID',
'linters' => 'required dict',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-DIFF' => 'Bad diff ID.',
'ERR-BAD-LINTER' => 'No postponed linter by the given name',

View file

@ -20,20 +20,16 @@ final class DifferentialGetAllDiffsConduitAPIMethod
return 'Load all diffs for given revisions from Differential.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revision_ids' => 'required list<int>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$results = array();
$revision_ids = $request->getValue('revision_ids');

View file

@ -11,7 +11,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod
return 'Retrieve Differential commit messages or message templates.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$edit_types = array('edit', 'create');
return array(
@ -21,11 +21,11 @@ final class DifferentialGetCommitMessageConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty string';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'Revision was not found.',
);

View file

@ -12,17 +12,17 @@ final class DifferentialGetCommitPathsConduitAPIMethod
'Differential revision.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revision_id' => 'required int',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<string>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'No such revision exists.',
);

View file

@ -26,18 +26,18 @@ final class DifferentialGetDiffConduitAPIMethod
'or diff id.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revision_id' => 'optional id',
'diff_id' => 'optional id',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_DIFF' => 'No such diff exists.',
);

View file

@ -11,17 +11,17 @@ final class DifferentialGetRawDiffConduitAPIMethod
return pht('Retrieve a raw diff');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'diffID' => 'required diffID',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty string';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => pht('Diff not found.'),
);

View file

@ -19,22 +19,17 @@ final class DifferentialGetRevisionCommentsConduitAPIMethod
return 'Retrieve Differential Revision Comments.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'required list<int>',
'inlines' => 'optional bool (deprecated)',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$results = array();

View file

@ -19,17 +19,17 @@ final class DifferentialGetRevisionConduitAPIMethod
return 'Load the content of a revision from Differential.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'revision_id' => 'required id',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_REVISION' => 'No such revision exists.',
);

View file

@ -13,21 +13,17 @@ final class DifferentialParseCommitMessageConduitAPIMethod
return pht('Parse commit messages for Differential fields.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'corpus' => 'required string',
'partial' => 'optional bool',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$corpus = $request->getValue('corpus');

View file

@ -11,7 +11,7 @@ final class DifferentialQueryConduitAPIMethod
return 'Query Differential revisions which match certain criteria.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$hash_types = ArcanistDifferentialRevisionHash::getTypes();
$hash_const = $this->formatStringConstants($hash_types);
@ -48,11 +48,11 @@ final class DifferentialQueryConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
);

View file

@ -11,18 +11,14 @@ final class DifferentialQueryDiffsConduitAPIMethod
return pht('Query differential diffs which match certain criteria.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<uint>',
'revisionIDs' => 'optional list<uint>',
);
}
public function defineErrorTypes() {
return array();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}

View file

@ -11,7 +11,7 @@ final class DifferentialSetDiffPropertyConduitAPIMethod
return 'Attach properties to Differential diffs.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'diff_id' => 'required diff_id',
'name' => 'required string',
@ -19,11 +19,11 @@ final class DifferentialSetDiffPropertyConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'Diff was not found.',
);

View file

@ -11,7 +11,7 @@ final class DifferentialUpdateRevisionConduitAPIMethod
return pht('Update a Differential revision.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'id' => 'required revisionid',
'diffid' => 'required diffid',
@ -20,11 +20,11 @@ final class DifferentialUpdateRevisionConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_DIFF' => 'Bad diff ID.',
'ERR_BAD_REVISION' => 'Bad revision ID.',

View file

@ -11,7 +11,7 @@ final class DifferentialUpdateUnitResultsConduitAPIMethod
return 'Update arc unit results for a postponed test.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'diff_id' => 'required diff_id',
'file' => 'required string',
@ -23,11 +23,11 @@ final class DifferentialUpdateUnitResultsConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_DIFF' => 'Bad diff ID.',
'ERR_NO_RESULTS' => 'Could not find the postponed test',

View file

@ -11,7 +11,7 @@ final class DiffusionBranchQueryConduitAPIMethod
return pht('Determine what branches exist for a repository.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}

View file

@ -13,7 +13,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
'(optional) commit.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -12,7 +12,7 @@ final class DiffusionCommitParentsQueryConduitAPIMethod
"Get the commit identifiers for a commit's parent or parents.");
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<string>';
}

View file

@ -17,7 +17,7 @@ final class DiffusionCreateCommentConduitAPIMethod
'be triggered. Defaults to "comment".';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'phid' => 'required string',
'action' => 'optional string',
@ -26,11 +26,11 @@ final class DiffusionCreateCommentConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'bool';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_COMMIT' => 'No commit found with that PHID',
'ERR_BAD_ACTION' => 'Invalid action type',

View file

@ -15,7 +15,7 @@ final class DiffusionDiffQueryConduitAPIMethod
'(optional) commit.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,7 +11,7 @@ final class DiffusionExistsQueryConduitAPIMethod
return 'Determine if code exists in a version control system.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'bool';
}

View file

@ -11,7 +11,7 @@ final class DiffusionFileContentQueryConduitAPIMethod
return 'Retrieve file content from a repository.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,7 +11,7 @@ final class DiffusionFindSymbolsConduitAPIMethod
return 'Retrieve Diffusion symbol information.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'name' => 'optional string',
'namePrefix' => 'optional string',
@ -21,15 +21,10 @@ final class DiffusionFindSymbolsConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$name = $request->getValue('name');
$name_prefix = $request->getValue('namePrefix');

View file

@ -19,20 +19,16 @@ final class DiffusionGetCommitsConduitAPIMethod
return pht('Obsoleted by diffusion.querycommits.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'commits' => 'required list<string>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$results = array();

View file

@ -15,7 +15,7 @@ final class DiffusionGetLintMessagesConduitAPIMethod
return 'Get lint messages for existing code.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'arcanistProject' => 'required string',
'branch' => 'optional string',
@ -24,14 +24,10 @@ final class DiffusionGetLintMessagesConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere(
'name = %s',

View file

@ -13,7 +13,7 @@ final class DiffusionGetRecentCommitsByPathConduitAPIMethod
return 'Get commit identifiers for recent commits affecting a given path.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'callsign' => 'required string',
'path' => 'required string',
@ -22,15 +22,10 @@ final class DiffusionGetRecentCommitsByPathConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<string>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$drequest = DiffusionRequest::newFromDictionary(
array(

View file

@ -14,7 +14,7 @@ final class DiffusionHistoryQueryConduitAPIMethod
'commit and path.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,7 +11,7 @@ final class DiffusionLastModifiedQueryConduitAPIMethod
return pht('Get the commits at which paths were last modified.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'map<string, string>';
}

View file

@ -18,21 +18,17 @@ final class DiffusionLookSoonConduitAPIMethod
'commits to that repository.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'callsigns' => 'required list<string>',
'urgency' => 'optional string',
);
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
// NOTE: The "urgency" parameter does nothing, it is just a hilarious joke
// which exemplifies the boundless clever wit of this project.

View file

@ -12,7 +12,7 @@ final class DiffusionMergedCommitsQueryConduitAPIMethod
'Merged commit information for a specific commit in a repository.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,11 +11,11 @@ final class DiffusionQueryCommitsConduitAPIMethod
return pht('Retrieve information about commits.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'map<string, dict>';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<int>',
'phids' => 'optional list<phid>',
@ -26,10 +26,6 @@ final class DiffusionQueryCommitsConduitAPIMethod
) + $this->getPagerParamTypes();
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$need_messages = $request->getValue('needMessages');
$bypass_cache = $request->getValue('bypassCache');

View file

@ -34,7 +34,7 @@ abstract class DiffusionQueryConduitAPIMethod
return $this->getDiffusionRequest()->getRepository();
}
final public function defineErrorTypes() {
final protected function defineErrorTypes() {
return $this->defineCustomErrorTypes() +
array(
'ERR-UNKNOWN-REPOSITORY' =>
@ -53,7 +53,7 @@ abstract class DiffusionQueryConduitAPIMethod
return array();
}
final public function defineParamTypes() {
final protected function defineParamTypes() {
return $this->defineCustomParamTypes() +
array(
'callsign' => 'required string',

View file

@ -11,7 +11,7 @@ final class DiffusionQueryPathsConduitAPIMethod
return pht('Filename search on a repository.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<string>';
}

View file

@ -13,7 +13,7 @@ final class DiffusionRawDiffQueryConduitAPIMethod
'(optional) path.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'string';
}

View file

@ -12,7 +12,7 @@ final class DiffusionRefsQueryConduitAPIMethod
'Query a git repository for ref information at a specific commit.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,7 +11,7 @@ final class DiffusionResolveRefsConduitAPIMethod
return pht('Resolve references into stable, canonical identifiers.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<string, list<dict<string, wild>>>';
}

View file

@ -11,7 +11,7 @@ final class DiffusionSearchQueryConduitAPIMethod
return 'Search (grep) a repository at a specific path and commit.';
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -11,7 +11,7 @@ final class DiffusionTagsQueryConduitAPIMethod
return pht('Retrieve information about tags in a repository.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'array';
}

View file

@ -15,11 +15,11 @@ final class DiffusionUpdateCoverageConduitAPIMethod
return pht('Publish coverage information for a repository.');
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'repositoryPHID' => 'required phid',
'branch' => 'required string',
@ -28,10 +28,6 @@ final class DiffusionUpdateCoverageConduitAPIMethod
);
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -63,7 +63,7 @@ abstract class DiffusionQuery extends PhabricatorQuery {
// If the method we're calling doesn't actually take some of the implicit
// parameters we derive from the DiffusionRequest, omit them.
$method_object = ConduitAPIMethod::getConduitMethod($method);
$method_params = $method_object->defineParamTypes();
$method_params = $method_object->getParamTypes();
foreach ($core_params as $key => $value) {
if (empty($method_params[$key])) {
unset($core_params[$key]);

View file

@ -14,7 +14,7 @@ final class FeedPublishConduitAPIMethod extends FeedConduitAPIMethod {
return 'Publish a story to the feed.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'type' => 'required string',
'data' => 'required dict',
@ -22,12 +22,7 @@ final class FeedPublishConduitAPIMethod extends FeedConduitAPIMethod {
);
}
public function defineErrorTypes() {
return array(
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty phid';
}

View file

@ -18,7 +18,7 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod {
return 100;
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'filterPHIDs' => 'optional list <phid>',
'limit' => 'optional int (default '.$this->getDefaultLimit().')',
@ -37,7 +37,7 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod {
);
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
$view_types = array_keys($this->getSupportedViewTypes());
$view_types = implode(', ', $view_types);
@ -48,7 +48,7 @@ final class FeedQueryConduitAPIMethod extends FeedConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}

View file

@ -11,7 +11,7 @@ final class FileAllocateConduitAPIMethod
return pht('Prepare to upload a file.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'name' => 'string',
'contentLength' => 'int',
@ -20,14 +20,10 @@ final class FileAllocateConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'map<string, wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -10,17 +10,17 @@ final class FileDownloadConduitAPIMethod extends FileConduitAPIMethod {
return 'Download a file from the server.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'phid' => 'required phid',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty base64-bytes';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-PHID' => 'No such file exists.',
);

View file

@ -10,18 +10,18 @@ final class FileInfoConduitAPIMethod extends FileConduitAPIMethod {
return 'Get information about a file.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'phid' => 'optional phid',
'id' => 'optional id',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-NOT-FOUND' => 'No such file exists.',
);

View file

@ -11,20 +11,16 @@ final class FileQueryChunksConduitAPIMethod
return pht('Get information about file chunks.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'filePHID' => 'phid',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -11,7 +11,7 @@ final class FileUploadChunkConduitAPIMethod
return pht('Upload a chunk of file data to the server.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'filePHID' => 'phid',
'byteStart' => 'int',
@ -20,14 +20,10 @@ final class FileUploadChunkConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -10,7 +10,7 @@ final class FileUploadConduitAPIMethod extends FileConduitAPIMethod {
return 'Upload a file to the server.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'data_base64' => 'required nonempty base64-bytes',
'name' => 'optional string',
@ -19,15 +19,10 @@ final class FileUploadConduitAPIMethod extends FileConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty guid';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -11,22 +11,17 @@ final class FileUploadHashConduitAPIMethod extends FileConduitAPIMethod {
return 'Upload a file to the server using content hash.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'hash' => 'required nonempty string',
'name' => 'required nonempty string',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'phid or null';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$hash = $request->getValue('hash');
$name = $request->getValue('name');

View file

@ -10,18 +10,18 @@ final class FlagDeleteConduitAPIMethod extends FlagConduitAPIMethod {
return 'Clear a flag.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'id' => 'optional id',
'objectPHID' => 'optional phid',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict | null';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'Bad flag ID.',
'ERR_WRONG_USER' => 'You are not the creator of this flag.',

View file

@ -10,7 +10,7 @@ final class FlagEditConduitAPIMethod extends FlagConduitAPIMethod {
return 'Create or modify a flag.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'objectPHID' => 'required phid',
'color' => 'optional int',
@ -18,15 +18,10 @@ final class FlagEditConduitAPIMethod extends FlagConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$user = $request->getUser()->getPHID();
$phid = $request->getValue('objectPHID');

View file

@ -10,7 +10,7 @@ final class FlagQueryConduitAPIMethod extends FlagConduitAPIMethod {
return 'Query flag markers.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ownerPHIDs' => 'optional list<phid>',
'types' => 'optional list<type>',
@ -21,15 +21,10 @@ final class FlagQueryConduitAPIMethod extends FlagConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$query = new PhabricatorFlagQuery();
$query->setViewer($request->getUser());

View file

@ -11,7 +11,7 @@ final class HarbormasterQueryBuildablesConduitAPIMethod
return pht('Query Harbormaster buildables.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<id>',
'phids' => 'optional list<phid>',
@ -21,14 +21,10 @@ final class HarbormasterQueryBuildablesConduitAPIMethod
) + self::getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'wild';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -11,7 +11,7 @@ final class HarbormasterQueryBuildsConduitAPIMethod
return pht('Query Harbormaster builds.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<id>',
'phids' => 'optional list<phid>',
@ -21,14 +21,10 @@ final class HarbormasterQueryBuildsConduitAPIMethod
) + self::getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'wild';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -13,7 +13,7 @@ final class HarbormasterSendMessageConduitAPIMethod
'external system.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
$type_const = $this->formatStringConstants(array('pass', 'fail'));
return array(
@ -22,14 +22,10 @@ final class HarbormasterSendMessageConduitAPIMethod
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();

View file

@ -14,7 +14,7 @@ final class MacroCreateMemeConduitAPIMethod extends MacroConduitAPIMethod {
return pht('Generate a meme.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'macroName' => 'string',
'upperText' => 'optional string',
@ -22,11 +22,11 @@ final class MacroCreateMemeConduitAPIMethod extends MacroConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'string';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-NOT-FOUND' => 'Macro was not found.',
);

View file

@ -10,7 +10,7 @@ final class MacroQueryConduitAPIMethod extends MacroConduitAPIMethod {
return 'Retrieve image macro information.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'authorPHIDs' => 'optional list<phid>',
'phids' => 'optional list<phid>',
@ -20,15 +20,10 @@ final class MacroQueryConduitAPIMethod extends MacroConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$query = id(new PhabricatorMacroQuery())
->setViewer($request->getUser())

View file

@ -7,7 +7,7 @@ abstract class ManiphestConduitAPIMethod extends ConduitAPIMethod {
'PhabricatorManiphestApplication');
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
);

View file

@ -11,15 +11,15 @@ final class ManiphestCreateTaskConduitAPIMethod
return 'Create a new Maniphest task.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return $this->getTaskFields($is_new = true);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
);

View file

@ -11,21 +11,16 @@ final class ManiphestGetTaskTransactionsConduitAPIMethod
return 'Retrieve Maniphest Task Transactions.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'required list<int>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$results = array();
$task_ids = $request->getValue('ids');

View file

@ -10,17 +10,17 @@ final class ManiphestInfoConduitAPIMethod extends ManiphestConduitAPIMethod {
return 'Retrieve information about a Maniphest task, given its id.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'task_id' => 'required id',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_TASK' => 'No such maniphest task exists',
);

View file

@ -10,7 +10,7 @@ final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
return 'Execute complex searches for Maniphest tasks.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
$statuses = array(
ManiphestTaskQuery::STATUS_ANY,
ManiphestTaskQuery::STATUS_OPEN,
@ -47,14 +47,10 @@ final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$query = id(new ManiphestTaskQuery())
->setViewer($request->getUser())

View file

@ -11,18 +11,14 @@ final class ManiphestQueryStatusesConduitAPIMethod
return 'Retrieve information about possible Maniphest Task status values.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict<string, wild>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$results = array(
'defaultStatus' => ManiphestTaskStatus::getDefaultStatus(),

View file

@ -10,7 +10,7 @@ final class ManiphestUpdateConduitAPIMethod extends ManiphestConduitAPIMethod {
return 'Update an existing Maniphest task.';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-TASK' => 'No such maniphest task exists.',
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
@ -18,11 +18,11 @@ final class ManiphestUpdateConduitAPIMethod extends ManiphestConduitAPIMethod {
);
}
public function defineParamTypes() {
protected function defineParamTypes() {
return $this->getTaskFields($is_new = false);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}

View file

@ -10,7 +10,7 @@ final class NuanceCreateItemConduitAPIMethod extends NuanceConduitAPIMethod {
return pht('Create a new item.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'requestorPHID' => 'required string',
'sourcePHID' => 'required string',
@ -18,11 +18,11 @@ final class NuanceCreateItemConduitAPIMethod extends NuanceConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-NO-REQUESTOR-PHID' => pht('Items must have a requestor.'),
'ERR-NO-SOURCE-PHID' => pht('Items must have a source.'),

View file

@ -13,7 +13,7 @@ final class OwnersQueryConduitAPIMethod extends OwnersConduitAPIMethod {
'of.) You should only provide at most one search query.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'userOwner' => 'optional string',
'projectOwner' => 'optional string',
@ -23,11 +23,11 @@ final class OwnersQueryConduitAPIMethod extends OwnersConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'dict<phid -> dict of package info>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-INVALID-USAGE' =>
'Provide one of a single owner phid (user/project), a single '.

View file

@ -11,7 +11,7 @@ final class PassphraseQueryConduitAPIMethod
return pht('Query credentials.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<int>',
'phids' => 'optional list<phid>',
@ -20,14 +20,10 @@ final class PassphraseQueryConduitAPIMethod
) + $this->getPagerParamTypes();
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$query = id(new PassphraseCredentialQuery())
->setViewer($request->getUser());

View file

@ -10,7 +10,7 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
return 'Create a new paste.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'content' => 'required string',
'title' => 'optional string',
@ -18,11 +18,11 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-NO-PASTE' => 'Paste may not be empty.',
);

View file

@ -18,17 +18,17 @@ final class PasteInfoConduitAPIMethod extends PasteConduitAPIMethod {
return 'Retrieve an array of information about a paste.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'paste_id' => 'required id',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR_BAD_PASTE' => 'No such paste exists',
);

View file

@ -10,7 +10,7 @@ final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod {
return 'Query Pastes.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'ids' => 'optional list<int>',
'phids' => 'optional list<phid>',
@ -20,14 +20,10 @@ final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) {
$query = id(new PhabricatorPasteQuery())
->setViewer($request->getUser())

View file

@ -20,7 +20,7 @@ final class UserAddStatusConduitAPIMethod extends UserConduitAPIMethod {
'Calendar application.');
}
public function defineParamTypes() {
protected function defineParamTypes() {
$status_const = $this->formatStringConstants(array('away', 'sporadic'));
return array(
@ -31,11 +31,11 @@ final class UserAddStatusConduitAPIMethod extends UserConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-BAD-EPOCH' => "'toEpoch' must be bigger than 'fromEpoch'.",
'ERR-OVERLAP' =>

View file

@ -10,17 +10,17 @@ final class UserDisableConduitAPIMethod extends UserConduitAPIMethod {
return 'Permanently disable specified users (admin only).';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'phids' => 'required list<phid>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-PERMISSIONS' => 'Only admins can call this method.',
'ERR-BAD-PHID' => 'Non existent user PHID.',

View file

@ -10,17 +10,17 @@ final class UserEnableConduitAPIMethod extends UserConduitAPIMethod {
return 'Re-enable specified users (admin only).';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'phids' => 'required list<phid>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-PERMISSIONS' => 'Only admins can call this method.',
'ERR-BAD-PHID' => 'Non existent user PHID.',

View file

@ -18,21 +18,16 @@ final class UserFindConduitAPIMethod extends UserConduitAPIMethod {
return pht('Lookup PHIDs by username. Obsoleted by "user.query".');
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'aliases' => 'required list<string>',
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'nonempty dict<string, phid>';
}
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) {
$users = id(new PhabricatorPeopleQuery())
->setViewer($request->getUser())

View file

@ -10,7 +10,7 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod {
return 'Query users.';
}
public function defineParamTypes() {
protected function defineParamTypes() {
return array(
'usernames' => 'optional list<string>',
'emails' => 'optional list<string>',
@ -22,11 +22,11 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod {
);
}
public function defineReturnType() {
protected function defineReturnType() {
return 'list<dict>';
}
public function defineErrorTypes() {
protected function defineErrorTypes() {
return array(
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
);

Some files were not shown because too many files have changed in this diff Show more