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

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

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

Twitter.destroyFriendship介绍

[英]Discontinues friendship with the user specified in the ID parameter as the authenticating user. Returns the un-friended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
[中]终止与ID参数中指定为身份验证用户的用户的友谊。成功时以请求的格式返回不友好的用户。返回一个字符串,描述失败时的失败条件。

代码示例

代码示例来源:origin: net.homeip.yusuke/twitter4j

/**
 * Discontinues friendship with the user specified in the ID parameter as the authenticating user.  Returns the un-friended user in the requested format when successful.  Returns a string describing the failure condition when unsuccessful.
 *
 * @param id the ID or screen name of the user for whom to request a list of friends
 * @return User
 * @throws TwitterException when Twitter service or network is unavailable
 * @deprecated Use destroyFriendship(String id) instead
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-friendships%C2%A0destroy">Twitter API Wiki / Twitter REST API Method: friendships destroy</a>
 */
public User destroy(String id) throws TwitterException {
  return destroyFriendship(id);
}

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    User user = twitter.destroyFriendship(screenName);
    for (TwitterListener listener : listeners) {
      try {
        listener.destroyedFriendship(user);
      } catch (Exception e) {
        logger.warn("Exception at destroyFriendship", e);
      }
    }
  }
});

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    User user = twitter.destroyFriendship(userId);
    for (TwitterListener listener : listeners) {
      try {
        listener.destroyedFriendship(user);
      } catch (Exception e) {
        logger.warn("Exception at destroyFriendship", e);
      }
    }
  }
});

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

/**
 * Unfollows a user
 *
 * @param user the user to unfollow
 *
 * @return the unfollowed user
 */
User unfollow(final User user) {
  return sessionManager.doWithCurrentTwitter(twitter -> twitter.destroyFriendship(user.getId()))
             .onSuccess(userUnfollowed -> LOG.debug(
                 "User {} unfollowed user {}",
                 getCurrentScreenName(),
                 userUnfollowed.getScreenName()
             ))
             .onFailure(err -> displayExceptionPane("Could not unfollow user!", err.getMessage(), err))
             .get();
}

相关文章