1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Mark "v3" API methods as stable; mark obsoleted methods as "Frozen"

Summary:
Ref T12074. The "v3" API methods (`*.search`, `*.edit`) are currently marked as "unstable", but they're pretty stable and essentially all new code should be using them.

Although these methods are seeing some changes, almost all changes are additive (support for new constraints or attachemnts) and do not break backward compatibility. We have no major, compatibility-breaking changes planned.

I don't want to mark the older methods "deprecated" yet since `arc` still uses a lot of them and there are some capabilities not yet available on the v3 methods, but introduce a new "frozen" status with pointers to the new methods.

Overall, this should gently push users toward the newer methods.

Test Plan: {F2325323}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12074

Differential Revision: https://secure.phabricator.com/D17158
This commit is contained in:
epriestley 2017-01-08 12:54:39 -08:00
parent 63bfa5ccb5
commit aa6e788f36
21 changed files with 161 additions and 28 deletions

View file

@ -128,6 +128,13 @@ final class PhabricatorConduitConsoleController
$stability_label = pht('Deprecated Method');
$stability_info = nonempty($reason, pht('This method is deprecated.'));
break;
case ConduitAPIMethod::METHOD_STATUS_FROZEN:
$stability_icon = 'fa-archive grey';
$stability_label = pht('Frozen Method');
$stability_info = nonempty(
$reason,
pht('This method is frozen and will eventually be deprecated.'));
break;
default:
$stability_label = null;
break;

View file

@ -11,9 +11,10 @@ abstract class ConduitAPIMethod
private $viewer;
const METHOD_STATUS_STABLE = 'stable';
const METHOD_STATUS_UNSTABLE = 'unstable';
const METHOD_STATUS_DEPRECATED = 'deprecated';
const METHOD_STATUS_STABLE = 'stable';
const METHOD_STATUS_UNSTABLE = 'unstable';
const METHOD_STATUS_DEPRECATED = 'deprecated';
const METHOD_STATUS_FROZEN = 'frozen';
const SCOPE_NEVER = 'scope.never';
const SCOPE_ALWAYS = 'scope.always';

View file

@ -66,7 +66,8 @@ final class PhabricatorConduitMethodQuery
}
$status = array(
ConduitAPIMethod::METHOD_STATUS_STABLE => $this->isStable,
ConduitAPIMethod::METHOD_STATUS_STABLE => $this->isStable,
ConduitAPIMethod::METHOD_STATUS_FROZEN => $this->isStable,
ConduitAPIMethod::METHOD_STATUS_DEPRECATED => $this->isDeprecated,
ConduitAPIMethod::METHOD_STATUS_UNSTABLE => $this->isUnstable,
);

View file

@ -166,6 +166,10 @@ final class PhabricatorConduitSearchEngine
$item->addIcon('fa-warning', pht('Deprecated'));
$item->setStatusIcon('fa-warning red');
break;
case ConduitAPIMethod::METHOD_STATUS_FROZEN:
$item->addIcon('fa-archive', pht('Frozen'));
$item->setStatusIcon('fa-archive grey');
break;
}
$list->addItem($item);

View file

@ -11,6 +11,16 @@ final class DifferentialCloseConduitAPIMethod
return pht('Close a Differential revision.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() {
return array(
'revisionID' => 'required int',

View file

@ -11,6 +11,16 @@ final class DifferentialCreateCommentConduitAPIMethod
return pht('Add a comment to a Differential revision.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() {
return array(
'revision_id' => 'required revisionid',

View file

@ -11,6 +11,16 @@ final class DifferentialCreateRevisionConduitAPIMethod
return pht('Create a new Differential revision.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() {
return array(
// TODO: Arcanist passes this; prevent fatals after D4191 until Conduit

View file

@ -11,6 +11,16 @@ final class DifferentialQueryConduitAPIMethod
return pht('Query Differential revisions which match certain criteria.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.search" instead.');
}
protected function defineParamTypes() {
$hash_types = ArcanistDifferentialRevisionHash::getTypes();
$hash_const = $this->formatStringConstants($hash_types);

View file

@ -11,6 +11,16 @@ final class DifferentialUpdateRevisionConduitAPIMethod
return pht('Update a Differential revision.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() {
return array(
'id' => 'required revisionid',

View file

@ -11,6 +11,16 @@ final class ManiphestCreateTaskConduitAPIMethod
return pht('Create a new Maniphest task.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.edit" instead.');
}
protected function defineParamTypes() {
return $this->getTaskFields($is_new = true);
}

View file

@ -10,6 +10,16 @@ final class ManiphestInfoConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Retrieve information about a Maniphest task, given its ID.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.search" instead.');
}
protected function defineParamTypes() {
return array(
'task_id' => 'required id',

View file

@ -10,6 +10,16 @@ final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Execute complex searches for Maniphest tasks.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.search" instead.');
}
protected function defineParamTypes() {
$statuses = array(
ManiphestTaskQuery::STATUS_ANY,

View file

@ -10,6 +10,16 @@ final class ManiphestUpdateConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Update an existing Maniphest task.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.edit" instead.');
}
protected function defineErrorTypes() {
return array(
'ERR-BAD-TASK' => pht('No such Maniphest task exists.'),

View file

@ -10,6 +10,16 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
return pht('Create a new paste.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "paste.edit" instead.');
}
protected function defineParamTypes() {
return array(
'content' => 'required string',

View file

@ -10,6 +10,16 @@ final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod {
return pht('Query Pastes.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "paste.search" instead.');
}
protected function defineParamTypes() {
return array(
'ids' => 'optional list<int>',

View file

@ -10,6 +10,16 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod {
return pht('Query users.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "user.search" instead.');
}
protected function defineParamTypes() {
return array(
'usernames' => 'optional list<string>',

View file

@ -10,6 +10,16 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
return pht('Create a project.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "project.edit" instead.');
}
protected function defineParamTypes() {
return array(
'name' => 'required string',

View file

@ -10,6 +10,16 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
return pht('Execute searches for Projects.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "project.search" instead.');
}
protected function defineParamTypes() {
$statuses = array(

View file

@ -8,11 +8,13 @@ final class RepositoryQueryConduitAPIMethod
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht('Repository methods are new and subject to change.');
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "diffusion.repository.query" instead.');
}
public function getMethodDescription() {

View file

@ -32,17 +32,6 @@ abstract class PhabricatorSearchEngineAPIMethod
return PhabricatorApplication::getByClass($class);
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodStatusDescription() {
return pht(
'ApplicationSearch methods are fairly stable, but were introduced '.
'relatively recently and may continue to evolve as more applications '.
'adopt them.');
}
final protected function defineParamTypes() {
return array(
'queryKey' => 'optional string',

View file

@ -11,17 +11,6 @@ abstract class PhabricatorEditEngineAPIMethod
return PhabricatorApplication::getByClass($class);
}
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodStatusDescription() {
return pht(
'ApplicationEditor methods are fairly stable, but were introduced '.
'relatively recently and may continue to evolve as more applications '.
'adopt them.');
}
final protected function defineParamTypes() {
return array(
'transactions' => 'list<map<string, wild>>',