3 final class FeedPublishConduitAPIMethod
extends FeedConduitAPIMethod
{
5 public function getAPIMethodName() {
9 public function getMethodStatus() {
10 return self
::METHOD_STATUS_UNSTABLE
;
13 public function getMethodDescription() {
14 return pht('Publish a story to the feed.');
17 protected function defineParamTypes() {
19 'type' => 'required string',
20 'data' => 'required dict',
21 'time' => 'optional int',
25 protected function defineReturnType() {
26 return 'nonempty phid';
29 protected function execute(ConduitAPIRequest
$request) {
30 $type = $request->getValue('type');
31 $data = $request->getValue('data');
32 $time = $request->getValue('time');
34 $author_phid = $request->getUser()->getPHID();
35 $phids = array($author_phid);
37 $publisher = new PhabricatorFeedStoryPublisher();
38 $publisher->setStoryType($type);
39 $publisher->setStoryData($data);
40 $publisher->setStoryTime($time);
41 $publisher->setRelatedPHIDs($phids);
42 $publisher->setStoryAuthorPHID($author_phid);
44 $data = $publisher->publish();
46 return $data->getPHID();