1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Merge pull request #20 from CodeBlock/master

paste.info conduit method.
This commit is contained in:
Evan Priestley 2011-06-13 23:02:53 -07:00
commit 037efb2ae7
3 changed files with 78 additions and 0 deletions

View file

@ -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',

View file

@ -0,0 +1,60 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ConduitAPI_paste_info_Method extends ConduitAPIMethod {
public function getMethodDescription() {
return "Retrieve an array of information about a paste.";
}
public function defineParamTypes() {
return array(
'paste_id' => '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;
}
}

View file

@ -0,0 +1,16 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/conduit/method/base');
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
phutil_require_module('phabricator', 'applications/paste/storage/paste');
phutil_require_module('phutil', 'utils');
phutil_require_source('ConduitAPI_paste_info_Method.php');