Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92653506
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
Fri, Nov 22, 10:21
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 10:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22478958
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
,
$document
->
getContent
());
}
}
Event Timeline
Log In to Comment