Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
<?php | <?php | ||||
final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod { | final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod { | ||||
public function getAPIMethodName() { | public function getAPIMethodName() { | ||||
return 'paste.create'; | return 'paste.create'; | ||||
} | } | ||||
public function getMethodDescription() { | public function getMethodDescription() { | ||||
return 'Create a new paste.'; | return 'Create a new paste.'; | ||||
} | } | ||||
public function defineParamTypes() { | protected function defineParamTypes() { | ||||
return array( | return array( | ||||
'content' => 'required string', | 'content' => 'required string', | ||||
'title' => 'optional string', | 'title' => 'optional string', | ||||
'language' => 'optional string', | 'language' => 'optional string', | ||||
); | ); | ||||
} | } | ||||
public function defineReturnType() { | protected function defineReturnType() { | ||||
return 'nonempty dict'; | return 'nonempty dict'; | ||||
} | } | ||||
public function defineErrorTypes() { | protected function defineErrorTypes() { | ||||
return array( | return array( | ||||
'ERR-NO-PASTE' => 'Paste may not be empty.', | 'ERR-NO-PASTE' => 'Paste may not be empty.', | ||||
); | ); | ||||
} | } | ||||
protected function execute(ConduitAPIRequest $request) { | protected function execute(ConduitAPIRequest $request) { | ||||
$content = $request->getValue('content'); | $content = $request->getValue('content'); | ||||
$title = $request->getValue('title'); | $title = $request->getValue('title'); | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |