org.springframework.social.twitter.api
Interface FriendOperations


public interface FriendOperations

Interface defining the operations for working with a user's friends and followers.


Method Summary
 TwitterProfile disableNotifications(long userId)
          Disable mobile device notifications from Twitter for the specified user.
 TwitterProfile disableNotifications(java.lang.String screenName)
          Disable mobile device notifications from Twitter for the specified user.
 TwitterProfile enableNotifications(long userId)
          Enable mobile device notifications from Twitter for the specified user.
 TwitterProfile enableNotifications(java.lang.String screenName)
          Enable mobile device notifications from Twitter for the specified user.
 java.lang.String follow(long userId)
          Allows the authenticated user to follow (create a friendship) with another user.
 java.lang.String follow(java.lang.String screenName)
          Allows the authenticated user to follow (create a friendship) with another user.
 boolean friendshipExists(java.lang.String userA, java.lang.String userB)
          Checks for a friendship between two users.
 java.util.List<java.lang.Long> getFollowerIds()
          Retrieves a list of IDs for the Twitter users that follow the authenticated user.
 java.util.List<java.lang.Long> getFollowerIds(long userId)
          Retrieves a list of IDs for the Twitter users that follow the given user.
 java.util.List<java.lang.Long> getFollowerIds(java.lang.String screenName)
          Retrieves a list of IDs for the Twitter users that follow the given user.
 java.util.List<TwitterProfile> getFollowers()
          Retrieves a list of users that the authenticated user is being followed by
 java.util.List<TwitterProfile> getFollowers(long userId)
          Retrieves a list of users that the given user is being followed by
 java.util.List<TwitterProfile> getFollowers(java.lang.String screenName)
          Retrieves a list of users that the given user is being followed by
 java.util.List<java.lang.Long> getFriendIds()
          Retrieves a list of IDs for the Twitter users that the authenticated user follows.
 java.util.List<java.lang.Long> getFriendIds(long userId)
          Retrieves a list of IDs for the Twitter users that the given user follows.
 java.util.List<java.lang.Long> getFriendIds(java.lang.String screenName)
          Retrieves a list of IDs for the Twitter users that the given user follows.
 java.util.List<TwitterProfile> getFriends()
          Retrieves a list of users that the authenticated user follows.
 java.util.List<TwitterProfile> getFriends(long userId)
          Retrieves a list of users that the given user follows.
 java.util.List<TwitterProfile> getFriends(java.lang.String screenName)
          Retrieves a list of users that the given user follows.
 java.util.List<java.lang.Long> getIncomingFriendships()
          Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
 java.util.List<java.lang.Long> getOutgoingFriendships()
          Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
 java.lang.String unfollow(long userId)
          Allows the authenticated use to unfollow (destroy a friendship) with another user
 java.lang.String unfollow(java.lang.String screenName)
          Allows the authenticated use to unfollow (destroy a friendship) with another user
 

Method Detail

getFriends

java.util.List<TwitterProfile> getFriends()
Retrieves a list of users that the authenticated user follows.

Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

getFriends

java.util.List<TwitterProfile> getFriends(long userId)
Retrieves a list of users that the given user follows.

Parameters:
userId - The user's Twitter ID
Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFriends

java.util.List<TwitterProfile> getFriends(java.lang.String screenName)
Retrieves a list of users that the given user follows.

Parameters:
screenName - The user's Twitter screen name
Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFriendIds

java.util.List<java.lang.Long> getFriendIds()
Retrieves a list of IDs for the Twitter users that the authenticated user follows.

Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

getFriendIds

java.util.List<java.lang.Long> getFriendIds(long userId)
Retrieves a list of IDs for the Twitter users that the given user follows.

Parameters:
userId - the user's Twitter ID
Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFriendIds

java.util.List<java.lang.Long> getFriendIds(java.lang.String screenName)
Retrieves a list of IDs for the Twitter users that the given user follows.

Parameters:
screenName - the user's Twitter screen name
Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFollowers

java.util.List<TwitterProfile> getFollowers()
Retrieves a list of users that the authenticated user is being followed by

Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

getFollowers

java.util.List<TwitterProfile> getFollowers(long userId)
Retrieves a list of users that the given user is being followed by

Parameters:
userId - The user's Twitter ID
Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFollowers

java.util.List<TwitterProfile> getFollowers(java.lang.String screenName)
Retrieves a list of users that the given user is being followed by

Parameters:
screenName - The user's Twitter screen name
Returns:
a list of TwitterProfiles
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFollowerIds

java.util.List<java.lang.Long> getFollowerIds()
Retrieves a list of IDs for the Twitter users that follow the authenticated user.

Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

getFollowerIds

java.util.List<java.lang.Long> getFollowerIds(long userId)
Retrieves a list of IDs for the Twitter users that follow the given user.

Parameters:
userId - the user's Twitter ID
Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getFollowerIds

java.util.List<java.lang.Long> getFollowerIds(java.lang.String screenName)
Retrieves a list of IDs for the Twitter users that follow the given user.

Parameters:
screenName - the user's Twitter screen name
Returns:
a list of user IDs
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

follow

java.lang.String follow(long userId)
Allows the authenticated user to follow (create a friendship) with another user.

Parameters:
userId - The Twitter ID of the user to follow
Returns:
the name of the followed user if successful
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

follow

java.lang.String follow(java.lang.String screenName)
Allows the authenticated user to follow (create a friendship) with another user.

Parameters:
screenName - The screen name of the user to follow
Returns:
the name of the followed user if successful
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

unfollow

java.lang.String unfollow(long userId)
Allows the authenticated use to unfollow (destroy a friendship) with another user

Parameters:
userId - the Twitter ID of the user to unfollow
Returns:
the name of the unfolloed user if successful
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

unfollow

java.lang.String unfollow(java.lang.String screenName)
Allows the authenticated use to unfollow (destroy a friendship) with another user

Parameters:
screenName - the screen name of the user to unfollow
Returns:
the name of the unfolloed user if successful
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

enableNotifications

TwitterProfile enableNotifications(long userId)
Enable mobile device notifications from Twitter for the specified user.

Parameters:
userId - the Twitter ID of the user to receive notifications for.
Returns:
the TwitterProfile for the user
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

enableNotifications

TwitterProfile enableNotifications(java.lang.String screenName)
Enable mobile device notifications from Twitter for the specified user.

Parameters:
screenName - the Twitter screen name of the user to receive notifications for.
Returns:
the TwitterProfile for the user
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

disableNotifications

TwitterProfile disableNotifications(long userId)
Disable mobile device notifications from Twitter for the specified user.

Parameters:
userId - the Twitter ID of the user to stop notifications for.
Returns:
the TwitterProfile for the user
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

disableNotifications

TwitterProfile disableNotifications(java.lang.String screenName)
Disable mobile device notifications from Twitter for the specified user.

Parameters:
screenName - the Twitter screen name of the user to stop notifications for.
Returns:
the TwitterProfile for the user
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

friendshipExists

boolean friendshipExists(java.lang.String userA,
                         java.lang.String userB)
Checks for a friendship between two users. Returns true if userA follows userB.

Parameters:
userA - the screen name of userA
userB - the screen name of userB
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.

getIncomingFriendships

java.util.List<java.lang.Long> getIncomingFriendships()
Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.

Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.

getOutgoingFriendships

java.util.List<java.lang.Long> getOutgoingFriendships()
Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.

Throws:
org.springframework.social.ApiException - if there is an error while communicating with Twitter.
org.springframework.social.MissingAuthorizationException - if TwitterTemplate was not created with OAuth credentials.