diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3b99b07090..62d503e56c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/aphront/console/plugin/services/__init__.php b/src/aphront/console/plugin/services/__init__.php index a89b976384..39fa0dd07a 100644 --- a/src/aphront/console/plugin/services/__init__.php +++ b/src/aphront/console/plugin/services/__init__.php @@ -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'); diff --git a/src/applications/conduit/method/slowvote/info/ConduitAPI_slowvote_info_Method.php b/src/applications/conduit/method/slowvote/info/ConduitAPI_slowvote_info_Method.php new file mode 100644 index 0000000000..765e925b49 --- /dev/null +++ b/src/applications/conduit/method/slowvote/info/ConduitAPI_slowvote_info_Method.php @@ -0,0 +1,62 @@ + '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; + } + +} diff --git a/src/applications/conduit/method/slowvote/info/__init__.php b/src/applications/conduit/method/slowvote/info/__init__.php new file mode 100644 index 0000000000..fdbfcdc0ee --- /dev/null +++ b/src/applications/conduit/method/slowvote/info/__init__.php @@ -0,0 +1,17 @@ +