mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
36e2d02d6e
Summary: `pht`ize a whole bunch of strings in rP. Test Plan: Intense eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12797
46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
<?php
|
|
|
|
final class PhrictionInfoConduitAPIMethod extends PhrictionConduitAPIMethod {
|
|
|
|
public function getAPIMethodName() {
|
|
return 'phriction.info';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return pht('Retrieve information about a Phriction document.');
|
|
}
|
|
|
|
protected function defineParamTypes() {
|
|
return array(
|
|
'slug' => 'required string',
|
|
);
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'nonempty dict';
|
|
}
|
|
|
|
protected function defineErrorTypes() {
|
|
return array(
|
|
'ERR-BAD-DOCUMENT' => pht('No such document exists.'),
|
|
);
|
|
}
|
|
|
|
protected function execute(ConduitAPIRequest $request) {
|
|
$slug = $request->getValue('slug');
|
|
|
|
$document = id(new PhrictionDocumentQuery())
|
|
->setViewer($request->getUser())
|
|
->withSlugs(array(PhabricatorSlug::normalize($slug)))
|
|
->needContent(true)
|
|
->executeOne();
|
|
if (!$document) {
|
|
throw new ConduitException('ERR-BAD-DOCUMENT');
|
|
}
|
|
|
|
return $this->buildDocumentInfoDictionary(
|
|
$document,
|
|
$document->getContent());
|
|
}
|
|
|
|
}
|