diff --git a/twitter.inc b/twitter.inc index 3bcd894..25128e3 100644 --- a/twitter.inc +++ b/twitter.inc @@ -214,6 +214,16 @@ function twitter_fetch_user_timeline($id) { } /** + * Retweet a tweet. + */ +function twitter_retweet($twitter_account, $tweet_id) { + module_load_include('lib.php', 'twitter'); + + $twitter = twitter_connect($twitter_account); + $twitter->retweet($tweet_id, $twitter_account); +} + +/** * Fetches user's mentions of an authenticated account. */ function twitter_fetch_mentions_timeline($id) { diff --git a/twitter.lib.php b/twitter.lib.php index b1639e6..271266c 100644 --- a/twitter.lib.php +++ b/twitter.lib.php @@ -156,6 +156,16 @@ class Twitter { throw new TwitterException($error); } } + + /** + * + * @see https://dev.twitter.com/docs/api/1/post/statuses/retweet/%3Aid + */ + public function retweet($tweet_id, $params = array()) { + $params = array(); + $values = $this->call('statuses/retweet/' . $tweet_id, $params, 'POST', TRUE); + return new TwitterStatus($values); + } /** * Actually performs a request.