1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-17 09:18:44 +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.'); return pht('Query Almanac devices.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'ids' => 'optional list<id>', 'ids' => 'optional list<id>',
'phids' => 'optional list<phid>', 'phids' => 'optional list<phid>',
@ -19,14 +19,10 @@ final class AlmanacQueryDevicesConduitAPIMethod
) + self::getPagerParamTypes(); ) + self::getPagerParamTypes();
} }
public function defineReturnType() { protected function defineReturnType() {
return 'list<wild>'; return 'list<wild>';
} }
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser(); $viewer = $request->getUser();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ final class ConduitCall {
$this->method = $method; $this->method = $method;
$this->handler = $this->buildMethodHandler($method); $this->handler = $this->buildMethodHandler($method);
$param_types = $this->handler->defineParamTypes(); $param_types = $this->handler->getParamTypes();
foreach ($param_types as $key => $spec) { foreach ($param_types as $key => $spec) {
if (ConduitAPIMethod::getParameterMetadataKey($key) !== null) { if (ConduitAPIMethod::getParameterMetadataKey($key) !== null) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,7 +15,7 @@ final class ConpherenceQueryTransactionConduitAPIMethod
'transactions within the conpherence for the logged in user.'); 'transactions within the conpherence for the logged in user.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'threadID' => 'optional int', 'threadID' => 'optional int',
'threadPHID' => 'optional phid', 'threadPHID' => 'optional phid',
@ -24,11 +24,11 @@ final class ConpherenceQueryTransactionConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_USAGE_NO_THREAD_ID' => pht( 'ERR_USAGE_NO_THREAD_ID' => pht(
'You must specify a thread id or thread phid to query transactions '. '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.'); return pht('Update an existing conpherence thread.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'id' => 'optional int', 'id' => 'optional int',
'phid' => 'optional phid', 'phid' => 'optional phid',
@ -22,11 +22,11 @@ final class ConpherenceUpdateThreadConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'bool'; return 'bool';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_USAGE_NO_THREAD_ID' => pht( 'ERR_USAGE_NO_THREAD_ID' => pht(
'You must specify a thread id or thread phid to query transactions '. '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.'); return pht('Close a Differential revision.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revisionID' => 'required int', 'revisionID' => 'required int',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_NOT_FOUND' => 'Revision was not found.', '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.'); return pht('Add a comment to a Differential revision.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revision_id' => 'required revisionid', 'revision_id' => 'required revisionid',
'message' => 'optional string', 'message' => 'optional string',
@ -21,11 +21,11 @@ final class DifferentialCreateCommentConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_BAD_REVISION' => 'Bad revision ID.', 'ERR_BAD_REVISION' => 'Bad revision ID.',
); );

View file

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

View file

@ -11,7 +11,7 @@ final class DifferentialCreateInlineConduitAPIMethod
return 'Add an inline comment to a Differential revision.'; return 'Add an inline comment to a Differential revision.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revisionID' => 'optional revisionid', 'revisionID' => 'optional revisionid',
'diffID' => 'optional diffid', 'diffID' => 'optional diffid',
@ -23,11 +23,11 @@ final class DifferentialCreateInlineConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-BAD-REVISION' => 'Bad revision ID.', 'ERR-BAD-REVISION' => 'Bad revision ID.',
'ERR-BAD-DIFF' => 'Bad diff ID, or diff does not belong to revision.', '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.'); return pht('Create a new Differential diff from a raw diff source.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'diff' => 'required string', 'diff' => 'required string',
'repositoryPHID' => 'optional string', 'repositoryPHID' => 'optional string',
@ -19,15 +19,10 @@ final class DifferentialCreateRawDiffConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser(); $viewer = $request->getUser();
$raw_diff = $request->getValue('diff'); $raw_diff = $request->getValue('diff');

View file

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

View file

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

View file

@ -12,18 +12,18 @@ final class DifferentialFinishPostponedLintersConduitAPIMethod
'linters as finished.'; 'linters as finished.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'diffID' => 'required diffID', 'diffID' => 'required diffID',
'linters' => 'required dict', 'linters' => 'required dict',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-BAD-DIFF' => 'Bad diff ID.', 'ERR-BAD-DIFF' => 'Bad diff ID.',
'ERR-BAD-LINTER' => 'No postponed linter by the given name', '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.'; return 'Load all diffs for given revisions from Differential.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revision_ids' => 'required list<int>', 'revision_ids' => 'required list<int>',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'dict'; return 'dict';
} }
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$results = array(); $results = array();
$revision_ids = $request->getValue('revision_ids'); $revision_ids = $request->getValue('revision_ids');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,7 +11,7 @@ final class DifferentialUpdateRevisionConduitAPIMethod
return pht('Update a Differential revision.'); return pht('Update a Differential revision.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'id' => 'required revisionid', 'id' => 'required revisionid',
'diffid' => 'required diffid', 'diffid' => 'required diffid',
@ -20,11 +20,11 @@ final class DifferentialUpdateRevisionConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_BAD_DIFF' => 'Bad diff ID.', 'ERR_BAD_DIFF' => 'Bad diff ID.',
'ERR_BAD_REVISION' => 'Bad revision 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.'; return 'Update arc unit results for a postponed test.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'diff_id' => 'required diff_id', 'diff_id' => 'required diff_id',
'file' => 'required string', 'file' => 'required string',
@ -23,11 +23,11 @@ final class DifferentialUpdateUnitResultsConduitAPIMethod
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_BAD_DIFF' => 'Bad diff ID.', 'ERR_BAD_DIFF' => 'Bad diff ID.',
'ERR_NO_RESULTS' => 'Could not find the postponed test', '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.'); return pht('Determine what branches exist for a repository.');
} }
public function defineReturnType() { protected function defineReturnType() {
return 'list<dict>'; return 'list<dict>';
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,7 +11,7 @@ final class DiffusionResolveRefsConduitAPIMethod
return pht('Resolve references into stable, canonical identifiers.'); return pht('Resolve references into stable, canonical identifiers.');
} }
public function defineReturnType() { protected function defineReturnType() {
return 'dict<string, list<dict<string, wild>>>'; 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.'; return 'Search (grep) a repository at a specific path and commit.';
} }
public function defineReturnType() { protected function defineReturnType() {
return 'array'; return 'array';
} }

View file

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

View file

@ -15,11 +15,11 @@ final class DiffusionUpdateCoverageConduitAPIMethod
return pht('Publish coverage information for a repository.'); return pht('Publish coverage information for a repository.');
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'repositoryPHID' => 'required phid', 'repositoryPHID' => 'required phid',
'branch' => 'required string', 'branch' => 'required string',
@ -28,10 +28,6 @@ final class DiffusionUpdateCoverageConduitAPIMethod
); );
} }
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser(); $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 // If the method we're calling doesn't actually take some of the implicit
// parameters we derive from the DiffusionRequest, omit them. // parameters we derive from the DiffusionRequest, omit them.
$method_object = ConduitAPIMethod::getConduitMethod($method); $method_object = ConduitAPIMethod::getConduitMethod($method);
$method_params = $method_object->defineParamTypes(); $method_params = $method_object->getParamTypes();
foreach ($core_params as $key => $value) { foreach ($core_params as $key => $value) {
if (empty($method_params[$key])) { if (empty($method_params[$key])) {
unset($core_params[$key]); unset($core_params[$key]);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,18 +10,18 @@ final class FlagDeleteConduitAPIMethod extends FlagConduitAPIMethod {
return 'Clear a flag.'; return 'Clear a flag.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'id' => 'optional id', 'id' => 'optional id',
'objectPHID' => 'optional phid', 'objectPHID' => 'optional phid',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'dict | null'; return 'dict | null';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_NOT_FOUND' => 'Bad flag ID.', 'ERR_NOT_FOUND' => 'Bad flag ID.',
'ERR_WRONG_USER' => 'You are not the creator of this flag.', '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.'; return 'Create or modify a flag.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'objectPHID' => 'required phid', 'objectPHID' => 'required phid',
'color' => 'optional int', 'color' => 'optional int',
@ -18,15 +18,10 @@ final class FlagEditConduitAPIMethod extends FlagConduitAPIMethod {
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'dict'; return 'dict';
} }
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$user = $request->getUser()->getPHID(); $user = $request->getUser()->getPHID();
$phid = $request->getValue('objectPHID'); $phid = $request->getValue('objectPHID');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,21 +11,16 @@ final class ManiphestGetTaskTransactionsConduitAPIMethod
return 'Retrieve Maniphest Task Transactions.'; return 'Retrieve Maniphest Task Transactions.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'ids' => 'required list<int>', 'ids' => 'required list<int>',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>'; return 'nonempty list<dict<string, wild>>';
} }
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$results = array(); $results = array();
$task_ids = $request->getValue('ids'); $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.'; return 'Retrieve information about a Maniphest task, given its id.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'task_id' => 'required id', 'task_id' => 'required id',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_BAD_TASK' => 'No such maniphest task exists', '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.'; return 'Execute complex searches for Maniphest tasks.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
$statuses = array( $statuses = array(
ManiphestTaskQuery::STATUS_ANY, ManiphestTaskQuery::STATUS_ANY,
ManiphestTaskQuery::STATUS_OPEN, ManiphestTaskQuery::STATUS_OPEN,
@ -47,14 +47,10 @@ final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'list'; return 'list';
} }
public function defineErrorTypes() {
return array();
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$query = id(new ManiphestTaskQuery()) $query = id(new ManiphestTaskQuery())
->setViewer($request->getUser()) ->setViewer($request->getUser())

View file

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

View file

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

View file

@ -10,7 +10,7 @@ final class NuanceCreateItemConduitAPIMethod extends NuanceConduitAPIMethod {
return pht('Create a new item.'); return pht('Create a new item.');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'requestorPHID' => 'required string', 'requestorPHID' => 'required string',
'sourcePHID' => 'required string', 'sourcePHID' => 'required string',
@ -18,11 +18,11 @@ final class NuanceCreateItemConduitAPIMethod extends NuanceConduitAPIMethod {
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-NO-REQUESTOR-PHID' => pht('Items must have a requestor.'), 'ERR-NO-REQUESTOR-PHID' => pht('Items must have a requestor.'),
'ERR-NO-SOURCE-PHID' => pht('Items must have a source.'), '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.'; 'of.) You should only provide at most one search query.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'userOwner' => 'optional string', 'userOwner' => 'optional string',
'projectOwner' => '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>'; return 'dict<phid -> dict of package info>';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-INVALID-USAGE' => 'ERR-INVALID-USAGE' =>
'Provide one of a single owner phid (user/project), a single '. 'Provide one of a single owner phid (user/project), a single '.

View file

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

View file

@ -10,7 +10,7 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
return 'Create a new paste.'; return 'Create a new paste.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'content' => 'required string', 'content' => 'required string',
'title' => 'optional string', 'title' => 'optional string',
@ -18,11 +18,11 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-NO-PASTE' => 'Paste may not be empty.', '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.'; return 'Retrieve an array of information about a paste.';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'paste_id' => 'required id', 'paste_id' => 'required id',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict'; return 'nonempty dict';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR_BAD_PASTE' => 'No such paste exists', 'ERR_BAD_PASTE' => 'No such paste exists',
); );

View file

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

View file

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

View file

@ -10,17 +10,17 @@ final class UserDisableConduitAPIMethod extends UserConduitAPIMethod {
return 'Permanently disable specified users (admin only).'; return 'Permanently disable specified users (admin only).';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'phids' => 'required list<phid>', 'phids' => 'required list<phid>',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-PERMISSIONS' => 'Only admins can call this method.', 'ERR-PERMISSIONS' => 'Only admins can call this method.',
'ERR-BAD-PHID' => 'Non existent user PHID.', '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).'; return 'Re-enable specified users (admin only).';
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'phids' => 'required list<phid>', 'phids' => 'required list<phid>',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'void'; return 'void';
} }
public function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-PERMISSIONS' => 'Only admins can call this method.', 'ERR-PERMISSIONS' => 'Only admins can call this method.',
'ERR-BAD-PHID' => 'Non existent user PHID.', '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".'); return pht('Lookup PHIDs by username. Obsoleted by "user.query".');
} }
public function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'aliases' => 'required list<string>', 'aliases' => 'required list<string>',
); );
} }
public function defineReturnType() { protected function defineReturnType() {
return 'nonempty dict<string, phid>'; return 'nonempty dict<string, phid>';
} }
public function defineErrorTypes() {
return array(
);
}
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$users = id(new PhabricatorPeopleQuery()) $users = id(new PhabricatorPeopleQuery())
->setViewer($request->getUser()) ->setViewer($request->getUser())

View file

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

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