Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548562
MacroQueryConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MacroQueryConduitAPIMethod.php
View Options
<?php
final
class
MacroQueryConduitAPIMethod
extends
MacroConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'macro.query'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Retrieve image macro information.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'authorPHIDs'
=>
'optional list<phid>'
,
'phids'
=>
'optional list<phid>'
,
'ids'
=>
'optional list<id>'
,
'names'
=>
'optional list<string>'
,
'nameLike'
=>
'optional string'
,
);
}
protected
function
defineReturnType
()
{
return
'list<dict>'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$query
=
id
(
new
PhabricatorMacroQuery
())
->
setViewer
(
$request
->
getUser
())
->
needFiles
(
true
);
$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
(),
'filePHID'
=>
$file
->
getPHID
(),
);
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:51 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
119743
Default Alt Text
MacroQueryConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment