3 final class ConpherenceQueryThreadConduitAPIMethod
4 extends ConpherenceConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'conpherence.querythread';
10 public function getMethodDescription() {
12 'Query for Conpherence threads for the logged in user. You can query '.
13 'by IDs or PHIDs for specific Conpherence threads. Otherwise, specify '.
14 'limit and offset to query the most recently updated Conpherences for '.
15 'the logged in user.');
18 protected function defineParamTypes() {
20 'ids' => 'optional array<int>',
21 'phids' => 'optional array<phids>',
22 'limit' => 'optional int',
23 'offset' => 'optional int',
27 protected function defineReturnType() {
28 return 'nonempty dict';
31 protected function execute(ConduitAPIRequest
$request) {
32 $user = $request->getUser();
33 $ids = $request->getValue('ids', array());
34 $phids = $request->getValue('phids', array());
35 $limit = $request->getValue('limit');
36 $offset = $request->getValue('offset');
38 $query = id(new ConpherenceThreadQuery())
42 $conpherences = $query
48 $conpherences = $query
54 $participation = id(new ConpherenceParticipantQuery())
55 ->withParticipantPHIDs(array($user->getPHID()))
59 $conpherence_phids = mpull($participation, 'getConpherencePHID');
60 $query->withPHIDs($conpherence_phids);
61 $conpherences = $query->execute();
62 $conpherences = array_select_keys($conpherences, $conpherence_phids);
66 foreach ($conpherences as $conpherence) {
67 $id = $conpherence->getID();
69 'conpherenceID' => $id,
70 'conpherencePHID' => $conpherence->getPHID(),
71 'conpherenceTitle' => $conpherence->getTitle(),
72 'messageCount' => $conpherence->getMessageCount(),
73 'conpherenceURI' => $this->getConpherenceURI($conpherence),