Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / macro / conduit / MacroCreateMemeConduitAPIMethod.php
blob3c939f97d59fc73bf8911dc6a6bdcf12b9c532b2
1 <?php
3 final class MacroCreateMemeConduitAPIMethod extends MacroConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'macro.creatememe';
9 public function getMethodStatus() {
10 return self::METHOD_STATUS_UNSTABLE;
13 public function getMethodDescription() {
14 return pht('Generate a meme.');
17 protected function defineParamTypes() {
18 return array(
19 'macroName' => 'string',
20 'upperText' => 'optional string',
21 'lowerText' => 'optional string',
25 protected function defineReturnType() {
26 return 'string';
29 protected function defineErrorTypes() {
30 return array(
31 'ERR-NOT-FOUND' => pht('Macro was not found.'),
35 protected function execute(ConduitAPIRequest $request) {
36 $user = $request->getUser();
38 $file = id(new PhabricatorMemeEngine())
39 ->setViewer($user)
40 ->setTemplate($request->getValue('macroName'))
41 ->setAboveText($request->getValue('upperText'))
42 ->setBelowText($request->getValue('lowerText'))
43 ->newAsset();
45 return array(
46 'uri' => $file->getViewURI(),