Spring Social Twitter

org.springframework.social.twitter.api
Interface UserOperations


public interface UserOperations

Interface defining the operations for retrieving information about Twitter users.

Author:
Craig Walls

Method Summary
 long getProfileId()
          Retrieves the authenticated user's Twitter ID.
 java.util.Map<ResourceFamily,java.util.List<RateLimitStatus>> getRateLimitStatus(ResourceFamily... resources)
          Retrieves the rate limit statuses for each of the resource families passed as arguments Supports either user or application authorization.
 java.lang.String getScreenName()
          Retrieves the authenticated user's Twitter screen name
 java.util.List<SuggestionCategory> getSuggestionCategories()
          Retrieves a list of categories from which suggested users to follow may be found.
 java.util.List<TwitterProfile> getSuggestions(java.lang.String slug)
          Retrieves a list of suggestions of users to follow for a given category.
 TwitterProfile getUserProfile()
          Retrieves the authenticated user's Twitter profile details.
 TwitterProfile getUserProfile(long userId)
          Retrieves a specific user's Twitter profile details.
 TwitterProfile getUserProfile(java.lang.String screenName)
          Retrieves a specific user's Twitter profile details.
 java.util.List<TwitterProfile> getUsers(long... userIds)
          Retrieves a list of Twitter profiles for the given list of user IDs.
 java.util.List<TwitterProfile> getUsers(java.lang.String... screenNames)
          Retrieves a list of Twitter profiles for the given list of screen names.
 java.util.List<TwitterProfile> searchForUsers(java.lang.String query)
          Searches for up to 20 users that match a given query.
 java.util.List<TwitterProfile> searchForUsers(java.lang.String query, int page, int pageSize)
          Searches for users that match a given query.
 

Method Detail

getProfileId

long getProfileId()
Retrieves the authenticated user's Twitter ID.

Returns:
the user's ID at Twitter
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.

getScreenName

java.lang.String getScreenName()
Retrieves the authenticated user's Twitter screen name

Returns:
the user's screen name
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.

getUserProfile

TwitterProfile getUserProfile()
Retrieves the authenticated user's Twitter profile details.

Returns:
a TwitterProfile object representing the user's profile.
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.

getUserProfile

TwitterProfile getUserProfile(java.lang.String screenName)
Retrieves a specific user's Twitter profile details. Supports either user or application authorization.

Parameters:
screenName - the screen name for the user whose details are to be retrieved.
Returns:
a TwitterProfile object representing the user's profile.
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 or an application access token.

getUserProfile

TwitterProfile getUserProfile(long userId)
Retrieves a specific user's Twitter profile details. Supports either user or application authorization.

Parameters:
userId - the user ID for the user whose details are to be retrieved.
Returns:
a TwitterProfile object representing the user's profile.
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 or an application access token.

getUsers

java.util.List<TwitterProfile> getUsers(long... userIds)
Retrieves a list of Twitter profiles for the given list of user IDs. Supports either user or application authorization.

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 or an application access token.

getUsers

java.util.List<TwitterProfile> getUsers(java.lang.String... screenNames)
Retrieves a list of Twitter profiles for the given list of screen names. Supports either user or application authorization.

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 or an application access token.

searchForUsers

java.util.List<TwitterProfile> searchForUsers(java.lang.String query)
Searches for up to 20 users that match a given query.

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.

searchForUsers

java.util.List<TwitterProfile> searchForUsers(java.lang.String query,
                                              int page,
                                              int pageSize)
Searches for users that match a given query.

Parameters:
page - the page of search results to return
pageSize - the number of TwitterProfiles per page. Maximum of 20 per page.
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.

getSuggestionCategories

java.util.List<SuggestionCategory> getSuggestionCategories()
Retrieves a list of categories from which suggested users to follow may be found. Supports either user or application authorization.

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 or an application access token.

getSuggestions

java.util.List<TwitterProfile> getSuggestions(java.lang.String slug)
Retrieves a list of suggestions of users to follow for a given category. Supports either user or application authorization.

Parameters:
slug - the category's slug
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 or an application access token.

getRateLimitStatus

java.util.Map<ResourceFamily,java.util.List<RateLimitStatus>> getRateLimitStatus(ResourceFamily... resources)
Retrieves the rate limit statuses for each of the resource families passed as arguments Supports either user or application authorization.

Parameters:
resources - the list of resource families to inquire about
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 or an application access token.

Spring Social Twitter