3 final class ConpherenceCreateThreadConduitAPIMethod
4 extends ConpherenceConduitAPIMethod
{
6 public function getAPIMethodName() {
7 return 'conpherence.createthread';
10 public function getMethodDescription() {
11 return pht('Create a new conpherence thread.');
14 public function getMethodStatus() {
15 return self
::METHOD_STATUS_FROZEN
;
18 public function getMethodStatusDescription() {
20 'This method is frozen and will eventually be deprecated. New code '.
21 'should use "conpherence.edit" instead.');
24 protected function defineParamTypes() {
26 'title' => 'required string',
27 'topic' => 'optional string',
28 'message' => 'optional string',
29 'participantPHIDs' => 'required list<phids>',
33 protected function defineReturnType() {
34 return 'nonempty dict';
37 protected function defineErrorTypes() {
39 'ERR_EMPTY_PARTICIPANT_PHIDS' => pht(
40 'You must specify participant phids.'),
41 'ERR_EMPTY_TITLE' => pht(
42 'You must specify a title.'),
46 protected function execute(ConduitAPIRequest
$request) {
47 $participant_phids = $request->getValue('participantPHIDs', array());
48 $message = $request->getValue('message');
49 $title = $request->getValue('title');
50 $topic = $request->getValue('topic');
52 list($errors, $conpherence) = ConpherenceEditor
::createThread(
57 $request->newContentSource(),
61 foreach ($errors as $error_code) {
62 switch ($error_code) {
63 case ConpherenceEditor
::ERROR_EMPTY_PARTICIPANTS
:
64 throw new ConduitException('ERR_EMPTY_PARTICIPANT_PHIDS');
71 'conpherenceID' => $conpherence->getID(),
72 'conpherencePHID' => $conpherence->getPHID(),
73 'conpherenceURI' => $this->getConpherenceURI($conpherence),