Differential D12380 Diff 29771 src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php
<?php | <?php | ||||
final class HarbormasterSendMessageConduitAPIMethod | final class HarbormasterSendMessageConduitAPIMethod | ||||
extends HarbormasterConduitAPIMethod { | extends HarbormasterConduitAPIMethod { | ||||
public function getAPIMethodName() { | public function getAPIMethodName() { | ||||
return 'harbormaster.sendmessage'; | return 'harbormaster.sendmessage'; | ||||
} | } | ||||
public function getMethodDescription() { | public function getMethodDescription() { | ||||
return pht( | return pht( | ||||
'Send a message to a build target, notifying it of results in an '. | 'Send a message to a build target, notifying it of results in an '. | ||||
'external system.'); | 'external system.'); | ||||
} | } | ||||
public function defineParamTypes() { | protected function defineParamTypes() { | ||||
$type_const = $this->formatStringConstants(array('pass', 'fail')); | $type_const = $this->formatStringConstants(array('pass', 'fail')); | ||||
return array( | return array( | ||||
'buildTargetPHID' => 'required phid', | 'buildTargetPHID' => 'required phid', | ||||
'type' => 'required '.$type_const, | 'type' => 'required '.$type_const, | ||||
); | ); | ||||
} | } | ||||
public function defineReturnType() { | protected function defineReturnType() { | ||||
return 'void'; | return 'void'; | ||||
} | } | ||||
public function defineErrorTypes() { | |||||
return array(); | |||||
} | |||||
protected function execute(ConduitAPIRequest $request) { | protected function execute(ConduitAPIRequest $request) { | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$build_target_phid = $request->getValue('buildTargetPHID'); | $build_target_phid = $request->getValue('buildTargetPHID'); | ||||
$message_type = $request->getValue('type'); | $message_type = $request->getValue('type'); | ||||
$build_target = id(new HarbormasterBuildTargetQuery()) | $build_target = id(new HarbormasterBuildTargetQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
Show All 23 Lines |