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

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

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

Twitter.showFriendship介绍

暂无

代码示例

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    Relationship relationship = twitter.showFriendship(sourceScreenName, targetScreenName);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotShowFriendship(relationship);
      } catch (Exception e) {
        logger.warn("Exception at showFriendship", e);
      }
    }
  }
});

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    Relationship relationship = twitter.showFriendship(sourceId, targetId);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotShowFriendship(relationship);
      } catch (Exception e) {
        logger.warn("Exception at showFriendship", e);
      }
    }
  }
});

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

/**
 * Checks if the given user has not yet been followed
 *
 * @param user The user for which to check the follow status
 *
 * @return true if and only if the given user has not yet been followed by the current user
 */
public boolean notYetFollowed(final User user) {
  return !sessionManager.doWithCurrentTwitter(twitter -> twitter.showFriendship(
      getCurrentScreenName(),
      user.getScreenName()
  )).map(Relationship::isSourceFollowingTarget).get();
}

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

/**
 * @return The {@link Relationship} between the current user in the direction of the {@link #targetUserProp}.
 */
private Relationship getRelationship() {
  return sessionManager.doWithCurrentTwitter(
      twitter -> sessionManager.currentSessionProperty()
                   .getValue()
                   .getTwitterUser()
                   .mapTry(us -> twitter.showFriendship(
                       us.getId(),
                       targetUserProp.getValue().getId()
                   )).get()
  ).getOrElseThrow((Function<? super Throwable, IllegalStateException>) IllegalStateException::new);
}

相关文章