Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97602965
PhrictionInfoConduitAPIMethod.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
Sun, Jan 5, 15:34
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 15:34 (2 d)
Engine
blob
Format
Raw Data
Handle
23362004
Attached To
rPH Phabricator
PhrictionInfoConduitAPIMethod.php
View Options
<?php
final
class
PhrictionInfoConduitAPIMethod
extends
PhrictionConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'phriction.info'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Retrieve information about a Phriction document.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'slug'
=>
'required string'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty dict'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-BAD-DOCUMENT'
=>
pht
(
'No such document exists.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$slug
=
$request
->
getValue
(
'slug'
);
$document
=
id
(
new
PhrictionDocumentQuery
())
->
setViewer
(
$request
->
getUser
())
->
withSlugs
(
array
(
PhabricatorSlug
::
normalize
(
$slug
)))
->
needContent
(
true
)
->
executeOne
();
if
(!
$document
)
{
throw
new
ConduitException
(
'ERR-BAD-DOCUMENT'
);
}
return
$this
->
buildDocumentInfoDictionary
(
$document
);
}
}
Event Timeline
Log In to Comment