Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100721590
ConduitAPI_user_query_Method.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
Sun, Feb 2, 04:52
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 04:52 (1 d, 20 h)
Engine
blob
Format
Raw Data
Handle
24018512
Attached To
rPH Phabricator
ConduitAPI_user_query_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_user_query_Method
extends
ConduitAPI_user_Method
{
public
function
getMethodDescription
()
{
return
"Query users."
;
}
public
function
defineParamTypes
()
{
return
array
(
'usernames'
=>
'optional list<string>'
,
'emails'
=>
'optional list<string>'
,
'realnames'
=>
'optional list<string>'
,
'phids'
=>
'optional list<phid>'
,
'ids'
=>
'optional list<uint>'
,
'offset'
=>
'optional int'
,
'limit'
=>
'optional int (default = 100)'
,
);
}
public
function
defineReturnType
()
{
return
'list<dict>'
;
}
public
function
defineErrorTypes
()
{
return
array
(
'ERR-INVALID-PARAMETER'
=>
'Missing or malformed parameter.'
,
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$usernames
=
$request
->
getValue
(
'usernames'
,
array
());
$emails
=
$request
->
getValue
(
'emails'
,
array
());
$realnames
=
$request
->
getValue
(
'realnames'
,
array
());
$phids
=
$request
->
getValue
(
'phids'
,
array
());
$ids
=
$request
->
getValue
(
'ids'
,
array
());
$offset
=
$request
->
getValue
(
'offset'
,
0
);
$limit
=
$request
->
getValue
(
'limit'
,
100
);
$query
=
new
PhabricatorPeopleQuery
();
$query
->
setViewer
(
$request
->
getUser
());
if
(
$usernames
)
{
$query
->
withUsernames
(
$usernames
);
}
if
(
$emails
)
{
$query
->
withEmails
(
$emails
);
}
if
(
$realnames
)
{
$query
->
withRealnames
(
$realnames
);
}
if
(
$phids
)
{
$query
->
withPHIDs
(
$phids
);
}
if
(
$ids
)
{
$query
->
withIDs
(
$ids
);
}
if
(
$limit
)
{
$query
->
setLimit
(
$limit
);
}
if
(
$offset
)
{
$query
->
setOffset
(
$offset
);
}
$users
=
$query
->
execute
();
$statuses
=
id
(
new
PhabricatorCalendarEvent
())->
loadCurrentStatuses
(
mpull
(
$users
,
'getPHID'
));
$results
=
array
();
foreach
(
$users
as
$user
)
{
$results
[]
=
$this
->
buildUserInformationDictionary
(
$user
,
idx
(
$statuses
,
$user
->
getPHID
()));
}
return
$results
;
}
}
Event Timeline
Log In to Comment