mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
When a conduit method requires a string constant, call it "string-const" not "enum"
Summary: Ref T5058. The use of "enum" is confusing; we mean "choose one of these specific string constants". Make this more clear. Test Plan: Viewed each call from the web UI. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5058 Differential Revision: https://secure.phabricator.com/D9127
This commit is contained in:
parent
0ad0669916
commit
15561a27c3
15 changed files with 83 additions and 32 deletions
|
@ -10,11 +10,16 @@ final class ConduitAPI_audit_query_Method extends ConduitAPI_audit_Method {
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$statuses = array(
|
||||
'status-any',
|
||||
'status-open',
|
||||
);
|
||||
$status_const = $this->formatStringConstants($statuses);
|
||||
|
||||
return array(
|
||||
'auditorPHIDs' => 'optional list<phid>',
|
||||
'commitPHIDs' => 'optional list<phid>',
|
||||
'status' => 'optional enum<"status-any", "status-open"> '.
|
||||
'(default = "status-any")',
|
||||
'status' => 'optional '.$status_const.' (default = "status-any")',
|
||||
'offset' => 'optional int',
|
||||
'limit' => 'optional int (default = 100)',
|
||||
);
|
||||
|
|
|
@ -165,6 +165,14 @@ abstract class ConduitAPIMethod
|
|||
}
|
||||
}
|
||||
|
||||
protected function formatStringConstants($constants) {
|
||||
foreach ($constants as $key => $value) {
|
||||
$constants[$key] = '"'.$value.'"';
|
||||
}
|
||||
$constants = implode(', ', $constants);
|
||||
return 'string-constant<'.$constants.'>';
|
||||
}
|
||||
|
||||
|
||||
/* -( Paging Results )----------------------------------------------------- */
|
||||
|
||||
|
@ -261,4 +269,5 @@ abstract class ConduitAPIMethod
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,21 +8,37 @@ final class ConduitAPI_differential_creatediff_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
|
||||
$vcs_const = $this->formatStringConstants(
|
||||
array(
|
||||
'svn',
|
||||
'git',
|
||||
'hg',
|
||||
));
|
||||
|
||||
$status_const = $this->formatStringConstants(
|
||||
array(
|
||||
'none',
|
||||
'skip',
|
||||
'okay',
|
||||
'warn',
|
||||
'fail',
|
||||
'postponed',
|
||||
));
|
||||
|
||||
return array(
|
||||
'changes' => 'required list<dict>',
|
||||
'sourceMachine' => 'required string',
|
||||
'sourcePath' => 'required string',
|
||||
'branch' => 'required string',
|
||||
'bookmark' => 'optional string',
|
||||
'sourceControlSystem' => 'required enum<svn, git, hg>',
|
||||
'sourceControlSystem' => 'required '.$vcs_const,
|
||||
'sourceControlPath' => 'required string',
|
||||
'sourceControlBaseRevision' => 'required string',
|
||||
'creationMethod' => 'optional string',
|
||||
'arcanistProject' => 'optional string',
|
||||
'lintStatus' =>
|
||||
'required enum<none, skip, okay, warn, fail, postponed>',
|
||||
'unitStatus' =>
|
||||
'required enum<none, skip, okay, warn, fail, postponed>',
|
||||
'lintStatus' => 'required '.$status_const,
|
||||
'unitStatus' => 'required '.$status_const,
|
||||
'repositoryPHID' => 'optional phid',
|
||||
|
||||
'parentRevisionID' => 'deprecated',
|
||||
|
|
|
@ -23,10 +23,8 @@ final class ConduitAPI_differential_find_Method
|
|||
'phids',
|
||||
);
|
||||
|
||||
$types = implode(', ', $types);
|
||||
|
||||
return array(
|
||||
'query' => 'required enum<'.$types.'>',
|
||||
'query' => 'required '.$this->formatStringConstants($types),
|
||||
'guids' => 'required nonempty list<guids>',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ final class ConduitAPI_differential_getcommitmessage_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$edit_types = array('edit', 'create');
|
||||
|
||||
return array(
|
||||
'revision_id' => 'optional revision_id',
|
||||
'fields' => 'optional dict<string, wild>',
|
||||
'edit' => 'optional enum<"edit", "create">',
|
||||
'edit' => 'optional '.$this->formatStringConstants($edit_types),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ final class ConduitAPI_differential_query_Method
|
|||
|
||||
public function defineParamTypes() {
|
||||
$hash_types = ArcanistDifferentialRevisionHash::getTypes();
|
||||
$hash_types = implode(', ', $hash_types);
|
||||
$hash_const = $this->formatStringConstants($hash_types);
|
||||
|
||||
$status_types = array(
|
||||
DifferentialRevisionQuery::STATUS_ANY,
|
||||
|
@ -17,23 +17,22 @@ final class ConduitAPI_differential_query_Method
|
|||
DifferentialRevisionQuery::STATUS_ACCEPTED,
|
||||
DifferentialRevisionQuery::STATUS_CLOSED,
|
||||
);
|
||||
$status_types = implode(', ', $status_types);
|
||||
$status_const = $this->formatStringConstants($status_types);
|
||||
|
||||
$order_types = array(
|
||||
DifferentialRevisionQuery::ORDER_MODIFIED,
|
||||
DifferentialRevisionQuery::ORDER_CREATED,
|
||||
);
|
||||
$order_types = implode(', ', $order_types);
|
||||
$order_const = $this->formatStringConstants($order_types);
|
||||
|
||||
return array(
|
||||
'authors' => 'optional list<phid>',
|
||||
'ccs' => 'optional list<phid>',
|
||||
'reviewers' => 'optional list<phid>',
|
||||
'paths' => 'optional list<pair<callsign, path>>',
|
||||
'commitHashes' => 'optional list<pair<enum<'.
|
||||
$hash_types.'>, string>>',
|
||||
'status' => 'optional enum<'.$status_types.'>',
|
||||
'order' => 'optional enum<'.$order_types.'>',
|
||||
'commitHashes' => 'optional list<pair<'.$hash_const.', string>>',
|
||||
'status' => 'optional '.$status_const,
|
||||
'order' => 'optional '.$order_const,
|
||||
'limit' => 'optional uint',
|
||||
'offset' => 'optional uint',
|
||||
'ids' => 'optional list<uint>',
|
||||
|
|
|
@ -10,9 +10,11 @@ final class ConduitAPI_harbormaster_sendmessage_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$type_const = $this->formatStringConstants(array('pass', 'fail'));
|
||||
|
||||
return array(
|
||||
'buildTargetPHID' => 'phid',
|
||||
'type' => 'enum<pass, fail>',
|
||||
'buildTargetPHID' => 'required phid',
|
||||
'type' => 'required '.$type_const,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@ class ConduitAPI_maniphest_query_Method
|
|||
ManiphestTaskQuery::STATUS_SPITE,
|
||||
ManiphestTaskQuery::STATUS_DUPLICATE,
|
||||
);
|
||||
$statuses = implode(', ', $statuses);
|
||||
$status_const = $this->formatStringConstants($statuses);
|
||||
|
||||
$orders = array(
|
||||
ManiphestTaskQuery::ORDER_PRIORITY,
|
||||
ManiphestTaskQuery::ORDER_CREATED,
|
||||
ManiphestTaskQuery::ORDER_MODIFIED,
|
||||
);
|
||||
$orders = implode(', ', $orders);
|
||||
$order_const = $this->formatStringConstants($orders);
|
||||
|
||||
return array(
|
||||
'ids' => 'optional list<uint>',
|
||||
|
@ -45,8 +45,8 @@ class ConduitAPI_maniphest_query_Method
|
|||
'ccPHIDs' => 'optional list<phid>',
|
||||
'fullText' => 'optional string',
|
||||
|
||||
'status' => 'optional enum<'.$statuses.'>',
|
||||
'order' => 'optional enum<'.$orders.'>',
|
||||
'status' => 'optional '.$status_const,
|
||||
'order' => 'optional '.$order_const,
|
||||
|
||||
'limit' => 'optional int',
|
||||
'offset' => 'optional int',
|
||||
|
|
|
@ -18,10 +18,12 @@ final class ConduitAPI_user_addstatus_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$status_const = $this->formatStringConstants(array('away', 'sporadic'));
|
||||
|
||||
return array(
|
||||
'fromEpoch' => 'required int',
|
||||
'toEpoch' => 'required int',
|
||||
'status' => 'required enum<away, sporadic>',
|
||||
'status' => 'required '.$status_const,
|
||||
'description' => 'optional string',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@ final class ConduitAPI_project_query_Method extends ConduitAPI_project_Method {
|
|||
PhabricatorProjectQuery::STATUS_ARCHIVED,
|
||||
);
|
||||
|
||||
$status_const = $this->formatStringConstants($statuses);
|
||||
|
||||
return array(
|
||||
'ids' => 'optional list<int>',
|
||||
'phids' => 'optional list<phid>',
|
||||
'status' => 'optional enum<'.implode(', ', $statuses).'>',
|
||||
'status' => 'optional '.$status_const,
|
||||
|
||||
'members' => 'optional list<phid>',
|
||||
|
||||
|
|
|
@ -14,9 +14,11 @@ final class ConduitAPI_releephwork_getcommitmessage_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$action_const = $this->formatStringConstants(array('pick', 'revert'));
|
||||
|
||||
return array(
|
||||
'requestPHID' => 'required string',
|
||||
'action' => 'required enum<"pick", "revert">',
|
||||
'action' => 'required '.$action_const,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,15 @@ final class ConduitAPI_releephwork_record_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$action_const = $this->formatStringConstants(
|
||||
array(
|
||||
'pick',
|
||||
'revert',
|
||||
));
|
||||
|
||||
return array(
|
||||
'requestPHID' => 'required string',
|
||||
'action' => 'required enum<"pick", "revert">',
|
||||
'action' => 'required '.$action_const,
|
||||
'commitIdentifier' => 'required string',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,15 @@ final class ConduitAPI_releephwork_recordpickstatus_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$action_const = $this->formatStringConstants(
|
||||
array(
|
||||
'pick',
|
||||
'revert',
|
||||
));
|
||||
|
||||
return array(
|
||||
'requestPHID' => 'required string',
|
||||
'action' => 'required enum<"pick", "revert">',
|
||||
'action' => 'required '.$action_const,
|
||||
'ok' => 'required bool',
|
||||
'dryRun' => 'optional bool',
|
||||
'details' => 'optional dict<string, wild>',
|
||||
|
|
|
@ -23,10 +23,10 @@ final class ConduitAPI_remarkup_process_Method extends ConduitAPIMethod {
|
|||
|
||||
public function defineParamTypes() {
|
||||
$available_contexts = array_keys($this->getEngineContexts());
|
||||
$available_contexts = implode(', ', $available_contexts);
|
||||
$available_const = $this->formatStringConstants($available_contexts);
|
||||
|
||||
return array(
|
||||
'context' => 'required enum<'.$available_contexts.'>',
|
||||
'context' => 'required '.$available_const,
|
||||
'contents' => 'required list<string>',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,11 @@ final class ConduitAPI_repository_create_Method
|
|||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$vcs_const = $this->formatStringConstants(array('git', 'hg', 'svn'));
|
||||
|
||||
return array(
|
||||
'name' => 'required string',
|
||||
'vcs' => 'required enum<git, hg, svn>',
|
||||
'vcs' => 'required '.$vcs_const,
|
||||
'callsign' => 'required string',
|
||||
'description' => 'optional string',
|
||||
'encoding' => 'optional string',
|
||||
|
|
Loading…
Reference in a new issue