diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ca916ce23d..a9898fe78c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -104,6 +104,7 @@ phutil_register_library_map(array( 'ConduitAPI_diffusion_getrecentcommitsbypath_Method' => 'applications/conduit/method/diffusion/getrecentcommitsbypath', 'ConduitAPI_file_download_Method' => 'applications/conduit/method/file/download', 'ConduitAPI_file_upload_Method' => 'applications/conduit/method/file/upload', + 'ConduitAPI_paste_info_Method' => 'applications/conduit/method/paste/info', 'ConduitAPI_path_getowners_Method' => 'applications/conduit/method/path/getowners', 'ConduitAPI_user_find_Method' => 'applications/conduit/method/user/find', 'ConduitAPI_user_whoami_Method' => 'applications/conduit/method/user/whoami', @@ -636,6 +637,7 @@ phutil_register_library_map(array( 'ConduitAPI_diffusion_getrecentcommitsbypath_Method' => 'ConduitAPIMethod', 'ConduitAPI_file_download_Method' => 'ConduitAPIMethod', 'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod', + 'ConduitAPI_paste_info_Method' => 'ConduitAPIMethod', 'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod', 'ConduitAPI_user_find_Method' => 'ConduitAPIMethod', 'ConduitAPI_user_whoami_Method' => 'ConduitAPIMethod', diff --git a/src/applications/conduit/method/paste/info/ConduitAPI_paste_info_Method.php b/src/applications/conduit/method/paste/info/ConduitAPI_paste_info_Method.php new file mode 100644 index 0000000000..51da551c36 --- /dev/null +++ b/src/applications/conduit/method/paste/info/ConduitAPI_paste_info_Method.php @@ -0,0 +1,60 @@ + 'required id', + ); + } + + public function defineReturnType() { + return 'nonempty dict'; + } + + public function defineErrorTypes() { + return array( + 'ERR_BAD_PASTE' => 'No such paste exists' + ); + } + + protected function execute(ConduitAPIRequest $request) { + $paste_id = $request->getValue('paste_id'); + $paste = id(new PhabricatorPaste())->load($paste_id); + if (!$paste) { + throw new ConduitException('ERR_BAD_PASTE'); + } + + $result = array( + 'id' => $paste->getID(), + 'phid' => $paste->getPHID(), + 'authorPHID' => $paste->getAuthorPHID(), + 'filePHID' => $paste->getFilePHID(), + 'title' => $paste->getTitle(), + 'dateCreated' => $paste->getDateCreated(), + ); + + return $result; + } + +} diff --git a/src/applications/conduit/method/paste/info/__init__.php b/src/applications/conduit/method/paste/info/__init__.php new file mode 100644 index 0000000000..1a92ec47f0 --- /dev/null +++ b/src/applications/conduit/method/paste/info/__init__.php @@ -0,0 +1,16 @@ +