Path: blob/master/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php
12256 views
<?php12final class ConpherenceCreateThreadConduitAPIMethod3extends ConpherenceConduitAPIMethod {45public function getAPIMethodName() {6return 'conpherence.createthread';7}89public function getMethodDescription() {10return pht('Create a new conpherence thread.');11}1213public function getMethodStatus() {14return self::METHOD_STATUS_FROZEN;15}1617public function getMethodStatusDescription() {18return pht(19'This method is frozen and will eventually be deprecated. New code '.20'should use "conpherence.edit" instead.');21}2223protected function defineParamTypes() {24return array(25'title' => 'required string',26'topic' => 'optional string',27'message' => 'optional string',28'participantPHIDs' => 'required list<phids>',29);30}3132protected function defineReturnType() {33return 'nonempty dict';34}3536protected function defineErrorTypes() {37return array(38'ERR_EMPTY_PARTICIPANT_PHIDS' => pht(39'You must specify participant phids.'),40'ERR_EMPTY_TITLE' => pht(41'You must specify a title.'),42);43}4445protected function execute(ConduitAPIRequest $request) {46$participant_phids = $request->getValue('participantPHIDs', array());47$message = $request->getValue('message');48$title = $request->getValue('title');49$topic = $request->getValue('topic');5051list($errors, $conpherence) = ConpherenceEditor::createThread(52$request->getUser(),53$participant_phids,54$title,55$message,56$request->newContentSource(),57$topic);5859if ($errors) {60foreach ($errors as $error_code) {61switch ($error_code) {62case ConpherenceEditor::ERROR_EMPTY_PARTICIPANTS:63throw new ConduitException('ERR_EMPTY_PARTICIPANT_PHIDS');64break;65}66}67}6869return array(70'conpherenceID' => $conpherence->getID(),71'conpherencePHID' => $conpherence->getPHID(),72'conpherenceURI' => $this->getConpherenceURI($conpherence),73);74}7576}777879