[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/feed/conduit/ -> FeedPublishConduitAPIMethod.php (source)

   1  <?php
   2  
   3  final class FeedPublishConduitAPIMethod extends FeedConduitAPIMethod {
   4  
   5    public function getAPIMethodName() {
   6      return 'feed.publish';
   7    }
   8  
   9    public function getMethodStatus() {
  10      return self::METHOD_STATUS_UNSTABLE;
  11    }
  12  
  13    public function getMethodDescription() {
  14      return 'Publish a story to the feed.';
  15    }
  16  
  17    public function defineParamTypes() {
  18      return array(
  19        'type' => 'required string',
  20        'data' => 'required dict',
  21        'time' => 'optional int',
  22      );
  23    }
  24  
  25    public function defineErrorTypes() {
  26      return array(
  27      );
  28    }
  29  
  30    public function defineReturnType() {
  31      return 'nonempty phid';
  32    }
  33  
  34    protected function execute(ConduitAPIRequest $request) {
  35      $type = $request->getValue('type');
  36      $data = $request->getValue('data');
  37      $time = $request->getValue('time');
  38  
  39      $author_phid = $request->getUser()->getPHID();
  40      $phids = array($author_phid);
  41  
  42      $publisher = new PhabricatorFeedStoryPublisher();
  43      $publisher->setStoryType($type);
  44      $publisher->setStoryData($data);
  45      $publisher->setStoryTime($time);
  46      $publisher->setRelatedPHIDs($phids);
  47      $publisher->setStoryAuthorPHID($author_phid);
  48  
  49      $data = $publisher->publish();
  50  
  51      return $data->getPHID();
  52    }
  53  
  54  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1