Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/paste/conduit/PasteInfoConduitAPIMethod.php
12241 views
1
<?php
2
3
final class PasteInfoConduitAPIMethod extends PasteConduitAPIMethod {
4
5
public function getAPIMethodName() {
6
return 'paste.info';
7
}
8
9
public function getMethodStatus() {
10
return self::METHOD_STATUS_DEPRECATED;
11
}
12
13
public function getMethodStatusDescription() {
14
return pht("Replaced by '%s'.", 'paste.query');
15
}
16
17
public function getMethodDescription() {
18
return pht('Retrieve an array of information about a paste.');
19
}
20
21
protected function defineParamTypes() {
22
return array(
23
'paste_id' => 'required id',
24
);
25
}
26
27
protected function defineReturnType() {
28
return 'nonempty dict';
29
}
30
31
protected function defineErrorTypes() {
32
return array(
33
'ERR_BAD_PASTE' => pht('No such paste exists.'),
34
);
35
}
36
37
protected function execute(ConduitAPIRequest $request) {
38
$paste_id = $request->getValue('paste_id');
39
$paste = id(new PhabricatorPasteQuery())
40
->setViewer($request->getUser())
41
->withIDs(array($paste_id))
42
->needRawContent(true)
43
->executeOne();
44
if (!$paste) {
45
throw new ConduitException('ERR_BAD_PASTE');
46
}
47
return $this->buildPasteInfoDictionary($paste);
48
}
49
50
}
51
52