mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 06:50:55 +01:00
Formally deprecate owners.query Conduit API method
Summary: This is completely obsoleted by `owners.search`. See D15472. Test Plan: Viewed API method in UI console. Reviewers: avivey, chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D15769
This commit is contained in:
parent
11f8fffe5b
commit
7f15e8fbe8
4 changed files with 53 additions and 24 deletions
|
@ -23,25 +23,8 @@ final class PhabricatorConduitConsoleController
|
||||||
|
|
||||||
$call_uri = '/api/'.$method->getAPIMethodName();
|
$call_uri = '/api/'.$method->getAPIMethodName();
|
||||||
|
|
||||||
$status = $method->getMethodStatus();
|
|
||||||
$reason = $method->getMethodStatusDescription();
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
switch ($status) {
|
|
||||||
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
|
|
||||||
$reason = nonempty($reason, pht('This method is deprecated.'));
|
|
||||||
$errors[] = pht('Deprecated Method: %s', $reason);
|
|
||||||
break;
|
|
||||||
case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
|
|
||||||
$reason = nonempty(
|
|
||||||
$reason,
|
|
||||||
pht(
|
|
||||||
'This method is new and unstable. Its interface is subject '.
|
|
||||||
'to change.'));
|
|
||||||
$errors[] = pht('Unstable Method: %s', $reason);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setAction($call_uri)
|
->setAction($call_uri)
|
||||||
->setUser($request->getUser())
|
->setUser($request->getUser())
|
||||||
|
@ -127,6 +110,41 @@ final class PhabricatorConduitConsoleController
|
||||||
|
|
||||||
$view = id(new PHUIPropertyListView());
|
$view = id(new PHUIPropertyListView());
|
||||||
|
|
||||||
|
$status = $method->getMethodStatus();
|
||||||
|
$reason = $method->getMethodStatusDescription();
|
||||||
|
|
||||||
|
switch ($status) {
|
||||||
|
case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
|
||||||
|
$stability_icon = 'fa-exclamation-triangle yellow';
|
||||||
|
$stability_label = pht('Unstable Method');
|
||||||
|
$stability_info = nonempty(
|
||||||
|
$reason,
|
||||||
|
pht(
|
||||||
|
'This method is new and unstable. Its interface is subject '.
|
||||||
|
'to change.'));
|
||||||
|
break;
|
||||||
|
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
|
||||||
|
$stability_icon = 'fa-exclamation-triangle red';
|
||||||
|
$stability_label = pht('Deprecated Method');
|
||||||
|
$stability_info = nonempty($reason, pht('This method is deprecated.'));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$stability_label = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stability_label) {
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Stability'),
|
||||||
|
array(
|
||||||
|
id(new PHUIIconView())->setIcon($stability_icon),
|
||||||
|
' ',
|
||||||
|
phutil_tag('strong', array(), $stability_label.':'),
|
||||||
|
' ',
|
||||||
|
$stability_info,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$view->addProperty(
|
$view->addProperty(
|
||||||
pht('Returns'),
|
pht('Returns'),
|
||||||
$method->getReturnType());
|
$method->getReturnType());
|
||||||
|
|
|
@ -6,12 +6,17 @@ final class OwnersQueryConduitAPIMethod extends OwnersConduitAPIMethod {
|
||||||
return 'owners.query';
|
return 'owners.query';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMethodStatus() {
|
||||||
|
return self::METHOD_STATUS_DEPRECATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMethodStatusDescription() {
|
||||||
|
return pht('Obsolete; use "owners.search" instead.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getMethodDescription() {
|
public function getMethodDescription() {
|
||||||
return pht(
|
return pht('Query for Owners packages. Obsoleted by "owners.search".');
|
||||||
'Query for packages by one of the following: repository/path, '.
|
|
||||||
'packages with a given user or project owner, or packages affiliated '.
|
|
||||||
'with a user (owned by either the user or a project they are a member '.
|
|
||||||
'of.) You should only provide at most one search query.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function defineParamTypes() {
|
protected function defineParamTypes() {
|
||||||
|
|
|
@ -37,7 +37,10 @@ abstract class PhabricatorSearchEngineAPIMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMethodStatusDescription() {
|
public function getMethodStatusDescription() {
|
||||||
return pht('ApplicationSearch methods are highly unstable.');
|
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() {
|
final protected function defineParamTypes() {
|
||||||
|
|
|
@ -16,7 +16,10 @@ abstract class PhabricatorEditEngineAPIMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMethodStatusDescription() {
|
public function getMethodStatusDescription() {
|
||||||
return pht('ApplicationEditor methods are highly unstable.');
|
return pht(
|
||||||
|
'ApplicationEditor methods are fairly stable, but were introduced '.
|
||||||
|
'relativelyr cently and may continue to evolve as more applications '.
|
||||||
|
'adopt them.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function defineParamTypes() {
|
final protected function defineParamTypes() {
|
||||||
|
|
Loading…
Reference in a new issue