Differential D12380 Diff 29771 src/applications/conduit/controller/PhabricatorConduitConsoleController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/controller/PhabricatorConduitConsoleController.php
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | switch ($status) { | ||||
$reason, | $reason, | ||||
pht( | pht( | ||||
'This method is new and unstable. Its interface is subject '. | 'This method is new and unstable. Its interface is subject '. | ||||
'to change.')); | 'to change.')); | ||||
$errors[] = pht('Unstable Method: %s', $reason); | $errors[] = pht('Unstable Method: %s', $reason); | ||||
break; | break; | ||||
} | } | ||||
$error_types = $method->defineErrorTypes(); | $error_types = $method->getErrorTypes(); | ||||
$error_types['ERR-CONDUIT-CORE'] = pht('See error message for details.'); | $error_types['ERR-CONDUIT-CORE'] = pht('See error message for details.'); | ||||
$error_description = array(); | $error_description = array(); | ||||
foreach ($error_types as $error => $meaning) { | foreach ($error_types as $error => $meaning) { | ||||
$error_description[] = hsprintf( | $error_description[] = hsprintf( | ||||
'<li><strong>%s:</strong> %s</li>', | '<li><strong>%s:</strong> %s</li>', | ||||
$error, | $error, | ||||
$meaning); | $meaning); | ||||
} | } | ||||
$error_description = phutil_tag('ul', array(), $error_description); | $error_description = phutil_tag('ul', array(), $error_description); | ||||
$form = new AphrontFormView(); | $form = new AphrontFormView(); | ||||
$form | $form | ||||
->setUser($request->getUser()) | ->setUser($request->getUser()) | ||||
->setAction('/api/'.$this->method) | ->setAction('/api/'.$this->method) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormStaticControl()) | id(new AphrontFormStaticControl()) | ||||
->setLabel('Description') | ->setLabel('Description') | ||||
->setValue($method->getMethodDescription())) | ->setValue($method->getMethodDescription())) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormStaticControl()) | id(new AphrontFormStaticControl()) | ||||
->setLabel('Returns') | ->setLabel('Returns') | ||||
->setValue($method->defineReturnType())) | ->setValue($method->getReturnType())) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormMarkupControl()) | id(new AphrontFormMarkupControl()) | ||||
->setLabel('Errors') | ->setLabel('Errors') | ||||
->setValue($error_description)) | ->setValue($error_description)) | ||||
->appendChild(hsprintf( | ->appendChild(hsprintf( | ||||
'<p class="aphront-form-instructions">Enter parameters using '. | '<p class="aphront-form-instructions">Enter parameters using '. | ||||
'<strong>JSON</strong>. For instance, to enter a list, type: '. | '<strong>JSON</strong>. For instance, to enter a list, type: '. | ||||
'<tt>["apple", "banana", "cherry"]</tt>')); | '<tt>["apple", "banana", "cherry"]</tt>')); | ||||
$params = $method->defineParamTypes(); | $params = $method->getParamTypes(); | ||||
foreach ($params as $param => $desc) { | foreach ($params as $param => $desc) { | ||||
$form->appendChild( | $form->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
->setLabel($param) | ->setLabel($param) | ||||
->setName("params[{$param}]") | ->setName("params[{$param}]") | ||||
->setCaption($desc)); | ->setCaption($desc)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |