Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97261311
AlmanacQueryDevicesConduitAPIMethod.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, Jan 3, 21:11
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 21:11 (2 d)
Engine
blob
Format
Raw Data
Handle
23367972
Attached To
rPH Phabricator
AlmanacQueryDevicesConduitAPIMethod.php
View Options
<?php
final
class
AlmanacQueryDevicesConduitAPIMethod
extends
AlmanacConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'almanac.querydevices'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Query Almanac devices.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional list<id>'
,
'phids'
=>
'optional list<phid>'
,
'names'
=>
'optional list<phid>'
,
)
+
self
::
getPagerParamTypes
();
}
protected
function
defineReturnType
()
{
return
'list<wild>'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$query
=
id
(
new
AlmanacDeviceQuery
())
->
setViewer
(
$viewer
);
$ids
=
$request
->
getValue
(
'ids'
);
if
(
$ids
!==
null
)
{
$query
->
withIDs
(
$ids
);
}
$phids
=
$request
->
getValue
(
'phids'
);
if
(
$phids
!==
null
)
{
$query
->
withPHIDs
(
$phids
);
}
$names
=
$request
->
getValue
(
'names'
);
if
(
$names
!==
null
)
{
$query
->
withNames
(
$names
);
}
$pager
=
$this
->
newPager
(
$request
);
$devices
=
$query
->
executeWithCursorPager
(
$pager
);
$data
=
array
();
foreach
(
$devices
as
$device
)
{
$data
[]
=
$this
->
getDeviceDictionary
(
$device
);
}
$results
=
array
(
'data'
=>
$data
,
);
return
$this
->
addPagerResults
(
$results
,
$pager
);
}
}
Event Timeline
Log In to Comment