3 final class TokenGiveConduitAPIMethod
extends TokenConduitAPIMethod
{
5 public function getAPIMethodName() {
9 public function getMethodDescription() {
10 return pht('Give or change a token.');
13 protected function defineParamTypes() {
15 'tokenPHID' => 'phid|null',
16 'objectPHID' => 'phid',
20 protected function defineReturnType() {
24 protected function execute(ConduitAPIRequest
$request) {
25 $content_source = $request->newContentSource();
27 $editor = id(new PhabricatorTokenGivenEditor())
28 ->setActor($request->getUser())
29 ->setContentSource($content_source);
31 if ($request->getValue('tokenPHID')) {
33 $request->getValue('objectPHID'),
34 $request->getValue('tokenPHID'));
36 $editor->deleteToken($request->getValue('objectPHID'));