2013-01-19 16:37:06 -08:00
|
|
|
<?php
|
|
|
|
|
Rename Conduit classes
Summary: Ref T5655. Rename Conduit classes and provide a `getAPIMethodName` method to declare the API method.
Test Plan:
```
> echo '{}' | arc --conduit-uri='http://phabricator.joshuaspence.com' call-conduit user.whoami
Waiting for JSON parameters on stdin...
{"error":null,"errorMessage":null,"response":{"phid":"PHID-USER-lioqffnwn6y475mu5ndb","userName":"josh","realName":"Joshua Spence","image":"http:\/\/phabricator.joshuaspence.com\/res\/1404425321T\/phabricator\/3eb28cd9\/rsrc\/image\/avatar.png","uri":"http:\/\/phabricator.joshuaspence.com\/p\/josh\/","roles":["admin","verified","approved","activated"]}}
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin, hach-que
Maniphest Tasks: T5655
Differential Revision: https://secure.phabricator.com/D9991
2014-07-25 10:54:15 +10:00
|
|
|
final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
|
|
|
|
|
|
|
|
public function getAPIMethodName() {
|
|
|
|
return 'conduit.query';
|
|
|
|
}
|
2013-01-19 16:37:06 -08:00
|
|
|
|
|
|
|
public function getMethodDescription() {
|
2014-06-09 11:36:49 -07:00
|
|
|
return 'Returns the parameters of the Conduit methods.';
|
2013-01-19 16:37:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function defineParamTypes() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function defineReturnType() {
|
|
|
|
return 'dict<dict>';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function defineErrorTypes() {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(ConduitAPIRequest $request) {
|
|
|
|
$classes = id(new PhutilSymbolLoader())
|
|
|
|
->setAncestorClass('ConduitAPIMethod')
|
|
|
|
->setType('class')
|
2014-07-25 15:52:15 +10:00
|
|
|
->loadObjects();
|
2013-01-19 16:37:06 -08:00
|
|
|
|
|
|
|
$names_to_params = array();
|
|
|
|
foreach ($classes as $class) {
|
2014-07-25 15:52:15 +10:00
|
|
|
$names_to_params[$class->getAPIMethodName()] = array(
|
2015-01-23 07:16:25 +11:00
|
|
|
'description' => $class->getMethodDescription(),
|
2014-07-25 15:52:15 +10:00
|
|
|
'params' => $class->defineParamTypes(),
|
2015-01-23 07:16:15 +11:00
|
|
|
'return' => $class->defineReturnType(),
|
2014-07-25 15:52:15 +10:00
|
|
|
);
|
2013-01-19 16:37:06 -08:00
|
|
|
}
|
2014-07-25 15:52:15 +10:00
|
|
|
|
2013-01-19 16:37:06 -08:00
|
|
|
return $names_to_params;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|