mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Conduit method for slowvote.poll.info.
Summary: Provides a slowvote.poll.info method. Test Plan: Web console - seemed to work fine. Reviewers: epriestley, phuzion CC: Differential Revision: 659
This commit is contained in:
parent
0c49b39658
commit
314d84eae6
4 changed files with 82 additions and 0 deletions
|
@ -109,6 +109,7 @@ phutil_register_library_map(array(
|
|||
'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_slowvote_info_Method' => 'applications/conduit/method/slowvote/info',
|
||||
'ConduitAPI_user_find_Method' => 'applications/conduit/method/user/find',
|
||||
'ConduitAPI_user_whoami_Method' => 'applications/conduit/method/user/whoami',
|
||||
'ConduitException' => 'applications/conduit/protocol/exception',
|
||||
|
@ -707,6 +708,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_maniphest_info_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_paste_info_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_slowvote_info_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_user_find_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_user_whoami_Method' => 'ConduitAPIMethod',
|
||||
'DarkConsoleConfigPlugin' => 'DarkConsolePlugin',
|
||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'view/control/table');
|
|||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'serviceprofiler');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DarkConsoleServicesPlugin.php');
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<?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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_slowvote_info_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Retrieve an array of information about a poll.";
|
||||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
return array(
|
||||
'poll_id' => 'required id',
|
||||
);
|
||||
}
|
||||
|
||||
public function defineReturnType() {
|
||||
return 'nonempty dict';
|
||||
}
|
||||
|
||||
public function defineErrorTypes() {
|
||||
return array(
|
||||
'ERR_BAD_POLL' => 'No such poll exists',
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
$poll_id = $request->getValue('poll_id');
|
||||
$poll = id(new PhabricatorSlowvotePoll())->load($poll_id);
|
||||
if (!$poll) {
|
||||
throw new ConduitException('ERR_BAD_POLL');
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'id' => $poll->getID(),
|
||||
'phid' => $poll->getPHID(),
|
||||
'authorPHID' => $poll->getAuthorPHID(),
|
||||
'question' => $poll->getQuestion(),
|
||||
'uri' => PhabricatorEnv::getProductionURI('/V'.$poll->getID()),
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
17
src/applications/conduit/method/slowvote/info/__init__.php
Normal file
17
src/applications/conduit/method/slowvote/info/__init__.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?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/slowvote/storage/poll');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ConduitAPI_slowvote_info_Method.php');
|
Loading…
Reference in a new issue