mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-20 18:58:56 +01:00
Preliminary Conduit info method for Maniphest tasks.
Summary: Provide a simple maniphest.info method for fetching info about a Maniphest task, given its ID. Test Plan: Tested via the web console, and it appeared to work fine. This is preliminary though, but I plan to use it for adding 'Txxx' to phabot. Reviewers: epriestley CC: Differential Revision: 540
This commit is contained in:
parent
709d7ed5d7
commit
14d35b8171
3 changed files with 89 additions and 0 deletions
|
@ -105,6 +105,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_maniphest_info_Method' => 'applications/conduit/method/maniphest/info',
|
||||
'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',
|
||||
|
@ -651,6 +652,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_diffusion_getrecentcommitsbypath_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_file_download_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_maniphest_info_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_paste_info_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_user_find_Method' => 'ConduitAPIMethod',
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?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_maniphest_info_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Retrieve information about a Maniphest task, given its id.";
|
||||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
return array(
|
||||
'task_id' => 'required id',
|
||||
);
|
||||
}
|
||||
|
||||
public function defineReturnType() {
|
||||
return 'nonempty dict';
|
||||
}
|
||||
|
||||
public function defineErrorTypes() {
|
||||
return array(
|
||||
'ERR_BAD_TASK' => 'No such maniphest task exists',
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
$task_id = $request->getValue('task_id');
|
||||
|
||||
$task = id(new ManiphestTask())->load($task_id);
|
||||
if (!$task) {
|
||||
throw new ConduitException('ERR_BAD_TASK');
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'id' => $task->getID(),
|
||||
'phid' => $task->getPHID(),
|
||||
'authorPHID' => $task->getAuthorPHID(),
|
||||
'ownerPHID' => $task->getAuthorPHID(),
|
||||
'ccPHIDs' => $task->getCCPHIDs(),
|
||||
'status' => $task->getStatus(),
|
||||
'priority' => ManiphestTaskPriority::getTaskPriorityName(
|
||||
$task->getPriority()),
|
||||
'title' => $task->getTitle(),
|
||||
'description' => $task->getDescription(),
|
||||
'projectPHIDs' => $task->getProjectPHIDs(),
|
||||
'uri' => PhabricatorEnv::getProductionURI('/T'.$task->getID()),
|
||||
|
||||
// Not sure what this is yet.
|
||||
// 'attached' => array($task->getAttached()),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
18
src/applications/conduit/method/maniphest/info/__init__.php
Normal file
18
src/applications/conduit/method/maniphest/info/__init__.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?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/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ConduitAPI_maniphest_info_Method.php');
|
Loading…
Add table
Reference in a new issue