twitter4j.Twitter.retweetStatus()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中twitter4j.Twitter.retweetStatus()方法的一些代码示例,展示了Twitter.retweetStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Twitter.retweetStatus()方法的具体详情如下:
包路径:twitter4j.Twitter
类名称:Twitter
方法名:retweetStatus

Twitter.retweetStatus介绍

[英]Retweets a tweet. Requires the id parameter of the tweet you are retweeting. Returns the original tweet with retweet details embedded.
This method calls http://twitter.com/statuses/retweet
[中]转发推文。需要转发推文的id参数。返回嵌入转发详细信息的原始推文。
此方法调用http://twitter.com/statuses/retweet

代码示例

代码示例来源:origin: stackoverflow.com

Twitter twitter = new TwitterFactory().getInstance();
twitter.retweetStatus(idOfStatusToRetweet);

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    Status status = twitter.retweetStatus(statusId);
    for (TwitterListener listener : listeners) {
      try {
        listener.retweetedStatus(status);
      } catch (Exception e) {
        logger.warn("Exception at retweetStatus", e);
      }
    }
  }
});

代码示例来源:origin: org.mule.modules/mule-module-twitter

/**
 * Retweets a tweet. Returns the original tweet with retweet details embedded. <br>
 * This method calls http://api.twitter.com/1.1/statuses/retweet
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:retweetStatus}
 *
 * @param statusId The ID of the status to retweet.
 * @return the retweeted {@link Status}
 * @throws TwitterException when Twitter service or network is unavailable
 * @see <a href="http://dev.twitter.com/doc/post/statuses/retweet/:id">POST
 * statuses/retweet/:id | dev.twitter.com</a>
 */
@Processor
public Status retweetStatus(long statusId) throws TwitterException {
  return getConnectionManagement().getTwitterClient().retweetStatus(statusId);
}

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Retweets a given tweet
 *
 * @param tweet the tweet to retweet
 *
 * @return the tweet's retweet-created tweet (a retweet is a tweet from the retweeting user)
 */
Status retweet(final Status tweet) {
  return sessionManager.doWithCurrentTwitter(twitter -> twitter.retweetStatus(tweet.getId()))
             .onSuccess(resultingStatus -> LOG.debug(
                 "User {} retweeted tweet {}",
                 getCurrentScreenName(),
                 resultingStatus.getId()
             ))
             .onFailure(err -> displayExceptionPane("Could not retweet tweet!", err.getMessage(), err))
             .get();
}

相关文章