Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96138302
MacroQueryConduitAPIMethod.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
Mon, Dec 23, 01:13
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 01:13 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23130665
Attached To
rPH Phabricator
MacroQueryConduitAPIMethod.php
View Options
<?php
final
class
MacroQueryConduitAPIMethod
extends
MacroConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'macro.query'
;
}
public
function
getMethodDescription
()
{
return
'Retrieve image macro information.'
;
}
public
function
defineParamTypes
()
{
return
array
(
'authorPHIDs'
=>
'optional list<phid>'
,
'phids'
=>
'optional list<phid>'
,
'ids'
=>
'optional list<id>'
,
'names'
=>
'optional list<string>'
,
'nameLike'
=>
'optional string'
,
);
}
public
function
defineReturnType
()
{
return
'list<dict>'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$query
=
new
PhabricatorMacroQuery
();
$query
->
setViewer
(
$request
->
getUser
());
$author_phids
=
$request
->
getValue
(
'authorPHIDs'
);
$phids
=
$request
->
getValue
(
'phids'
);
$ids
=
$request
->
getValue
(
'ids'
);
$name_like
=
$request
->
getValue
(
'nameLike'
);
$names
=
$request
->
getValue
(
'names'
);
if
(
$author_phids
)
{
$query
->
withAuthorPHIDs
(
$author_phids
);
}
if
(
$phids
)
{
$query
->
withPHIDs
(
$phids
);
}
if
(
$ids
)
{
$query
->
withIDs
(
$ids
);
}
if
(
$name_like
)
{
$query
->
withNameLike
(
$name_like
);
}
if
(
$names
)
{
$query
->
withNames
(
$names
);
}
$macros
=
$query
->
execute
();
if
(!
$macros
)
{
return
array
();
}
$results
=
array
();
foreach
(
$macros
as
$macro
)
{
$file
=
$macro
->
getFile
();
$results
[
$macro
->
getName
()]
=
array
(
'uri'
=>
$file
->
getBestURI
(),
'phid'
=>
$macro
->
getPHID
(),
'authorPHID'
=>
$file
->
getAuthorPHID
(),
'dateCreated'
=>
$file
->
getDateCreated
(),
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment