From: Michael J. Rubinsky Date: Wed, 29 Apr 2009 18:52:11 +0000 (-0400) Subject: Implement Streams.get X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=71ddbccba76bad89d0dc8dae83dc202d660dff81;p=horde.git Implement Streams.get --- diff --git a/framework/Service_Facebook/lib/Horde/Service/Facebook/Streams.php b/framework/Service_Facebook/lib/Horde/Service/Facebook/Streams.php index 9a1b54111..7fa1c0b13 100644 --- a/framework/Service_Facebook/lib/Horde/Service/Facebook/Streams.php +++ b/framework/Service_Facebook/lib/Horde/Service/Facebook/Streams.php @@ -14,22 +14,38 @@ class Horde_Service_Facebook_Streams extends Horde_Service_Facebook_Base * Get a user's stream * http://wiki.developers.facebook.com/index.php/Stream.get * + * Note: This requires the READ_STREAM extended permission to be added for + * the application. + * + * @param string $viewerId The user id or page id of the page whose stream + * to read. + * @param array $sourceIds + * @param timestamp $start + * @param timestamp $end + * @param int $limit + * @param string $filterKey */ - function &get($viewerId, $sourceIds = array(), $start = '', $end = '', + function &get($viewerId = '', $sourceIds = array(), $start = '', $end = '', $limit = '', $filterKey = '') { - return $this->_facebook->callMethod('Stream.get', - array('viewer_id' => $viewerId, + if (empty($viewerId) && !$session_key = $this->_facebook->auth->getSessionKey()) { + throw new Horde_Service_Facebook_Exception('users.hasAppPermission requires either a uid or a session_key', + Horde_Service_Facebook_ErrorCodes::API_EC_PARAM_SESSION_KEY); + } + $params = array('viewer_id' => $viewerId, 'source_ids' => $sourceIds, 'start_time' => $start, 'end_time' => $end, - 'filter_key' => $filterKey)); + 'filter_key' => $filterKey); + if (!empty($session_key)) { + $params['session_key'] = $session_key; + } + + return $this->_facebook->callMethod('Stream.get', $params); } /** * Get a post's comments. - * - * */ function &getComments($post_id) {