Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96943338
PasteQueryConduitAPIMethod.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, Jan 1, 00:23
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 3, 00:23 (2 d)
Engine
blob
Format
Raw Data
Handle
23296215
Attached To
rPH Phabricator
PasteQueryConduitAPIMethod.php
View Options
<?php
final
class
PasteQueryConduitAPIMethod
extends
PasteConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'paste.query'
;
}
public
function
getMethodDescription
()
{
return
'Query Pastes.'
;
}
public
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional list<int>'
,
'phids'
=>
'optional list<phid>'
,
'authorPHIDs'
=>
'optional list<phid>'
,
'after'
=>
'optional int'
,
'limit'
=>
'optional int, default = 100'
,
);
}
public
function
defineReturnType
()
{
return
'list<dict>'
;
}
public
function
defineErrorTypes
()
{
return
array
();
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$query
=
id
(
new
PhabricatorPasteQuery
())
->
setViewer
(
$request
->
getUser
())
->
needRawContent
(
true
);
if
(
$request
->
getValue
(
'ids'
))
{
$query
->
withIDs
(
$request
->
getValue
(
'ids'
));
}
if
(
$request
->
getValue
(
'phids'
))
{
$query
->
withPHIDs
(
$request
->
getValue
(
'phids'
));
}
if
(
$request
->
getValue
(
'authorPHIDs'
))
{
$query
->
withAuthorPHIDs
(
$request
->
getValue
(
'authorPHIDs'
));
}
if
(
$request
->
getValue
(
'after'
))
{
$query
->
setAfterID
(
$request
->
getValue
(
'after'
));
}
$limit
=
$request
->
getValue
(
'limit'
,
100
);
if
(
$limit
)
{
$query
->
setLimit
(
$limit
);
}
$pastes
=
$query
->
execute
();
$results
=
array
();
foreach
(
$pastes
as
$paste
)
{
$results
[
$paste
->
getPHID
()]
=
$this
->
buildPasteInfoDictionary
(
$paste
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment