Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / feed / conduit / FeedPublishConduitAPIMethod.php
blob5f83e73b3dc436ec18ffb0fb0a58583a0cc50b4a
1 <?php
3 final class FeedPublishConduitAPIMethod extends FeedConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'feed.publish';
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() {
18 return array(
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();