Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96679585
ConduitAPI_conpherence_querythread_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, Dec 29, 18:43
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Dec 31, 18:43 (2 d)
Engine
blob
Format
Raw Data
Handle
23225135
Attached To
rPH Phabricator
ConduitAPI_conpherence_querythread_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_conpherence_querythread_Method
extends
ConduitAPI_conpherence_Method
{
public
function
getMethodDescription
()
{
return
pht
(
'Query for conpherence threads for the logged in user. '
.
'You can query by ids or phids for specific conpherence threads. '
.
'Otherwise, specify limit and offset to query the most recently '
.
'updated conpherences for the logged in user.'
);
}
public
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional array<int>'
,
'phids'
=>
'optional array<phids>'
,
'limit'
=>
'optional int'
,
'offset'
=>
'optional int'
);
}
public
function
defineReturnType
()
{
return
'nonempty dict'
;
}
public
function
defineErrorTypes
()
{
return
array
();
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$user
=
$request
->
getUser
();
$ids
=
$request
->
getValue
(
'ids'
,
array
());
$phids
=
$request
->
getValue
(
'phids'
,
array
());
$limit
=
$request
->
getValue
(
'limit'
);
$offset
=
$request
->
getValue
(
'offset'
);
$query
=
id
(
new
ConpherenceThreadQuery
())
->
setViewer
(
$user
)
->
needParticipantCache
(
true
)
->
needFilePHIDs
(
true
);
if
(
$ids
)
{
$conpherences
=
$query
->
withIDs
(
$ids
)
->
setLimit
(
$limit
)
->
setOffset
(
$offset
)
->
execute
();
}
else
if
(
$phids
)
{
$conpherences
=
$query
->
withPHIDs
(
$phids
)
->
setLimit
(
$limit
)
->
setOffset
(
$offset
)
->
execute
();
}
else
{
$participation
=
id
(
new
ConpherenceParticipantQuery
())
->
withParticipantPHIDs
(
array
(
$user
->
getPHID
()))
->
setLimit
(
$limit
)
->
setOffset
(
$offset
)
->
execute
();
$conpherence_phids
=
array_keys
(
$participation
);
$query
->
withPHIDs
(
$conpherence_phids
);
$conpherences
=
$query
->
execute
();
$conpherences
=
array_select_keys
(
$conpherences
,
$conpherence_phids
);
}
$data
=
array
();
foreach
(
$conpherences
as
$conpherence
)
{
$id
=
$conpherence
->
getID
();
$data
[
$id
]
=
array
(
'conpherenceID'
=>
$id
,
'conpherencePHID'
=>
$conpherence
->
getPHID
(),
'conpherenceTitle'
=>
$conpherence
->
getTitle
(),
'messageCount'
=>
$conpherence
->
getMessageCount
(),
'recentParticipantPHIDs'
=>
$conpherence
->
getRecentParticipantPHIDs
(),
'filePHIDs'
=>
$conpherence
->
getFilePHIDs
(),
'conpherenceURI'
=>
$this
->
getConpherenceURI
(
$conpherence
));
}
return
$data
;
}
}
Event Timeline
Log In to Comment