1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 03:02:43 +01:00
phorge-phorge/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php
Joshua Spence fff0481184 Add method description to conduit.query
Summary: As suggested in T6950, add the method description to the response from `conduit.query`.

Test Plan: Called `echo '{}' | arc call-conduit conduit.query` and verified that the response contained the method description.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11467
2015-01-23 07:16:26 +11:00

43 lines
983 B
PHP

<?php
final class ConduitQueryConduitAPIMethod extends ConduitAPIMethod {
public function getAPIMethodName() {
return 'conduit.query';
}
public function getMethodDescription() {
return 'Returns the parameters of the Conduit methods.';
}
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')
->loadObjects();
$names_to_params = array();
foreach ($classes as $class) {
$names_to_params[$class->getAPIMethodName()] = array(
'description' => $class->getMethodDescription(),
'params' => $class->defineParamTypes(),
'return' => $class->defineReturnType(),
);
}
return $names_to_params;
}
}