Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69795208
SlowvoteInfoConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 3, 13:22
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jul 5, 13:22 (2 d)
Engine
blob
Format
Raw Data
Handle
18755259
Attached To
rPH Phabricator
SlowvoteInfoConduitAPIMethod.php
View Options
<?php
final
class
SlowvoteInfoConduitAPIMethod
extends
SlowvoteConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'slowvote.info'
;
}
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
;
}
}
Event Timeline
Log In to Comment