org.springframework.social.twitter.api
Interface UserOperations


public interface UserOperations

Interface defining the operations for retrieving information about Twitter users.


Method Summary
 AccountSettings getAccountSettings()
          Retrives the authenticating user's account settings.
 long getProfileId()
          Retrieves the authenticated user's Twitter ID.
 Map<ResourceFamily,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.
 String getScreenName()
          Retrieves the authenticated user's Twitter screen name
 List<SuggestionCategory> getSuggestionCategories()
          Retrieves a list of categories from which suggested users to follow may be found.
 List<TwitterProfile> getSuggestions(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(String screenName)
          Retrieves a specific user's Twitter profile details.
 List<TwitterProfile> getUsers(long... userIds)
          Retrieves a list of Twitter profiles for the given list of user IDs.
 List<TwitterProfile> getUsers(String... screenNames)
          Retrieves a list of Twitter profiles for the given list of screen names.
 List<TwitterProfile> searchForUsers(String query)
          Searches for up to 20 users that match a given query.
 List<TwitterProfile> searchForUsers(String query, int page, int pageSize)
          Searches for users that match a given query.
 AccountSettings updateAccountSettings(AccountSettingsData accountSettingsData)
          Updates the authenticating user's account settings.
 

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

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(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

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

List<TwitterProfile> getUsers(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

List<TwitterProfile> searchForUsers(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

List<TwitterProfile> searchForUsers(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

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

List<TwitterProfile> getSuggestions(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

Map<ResourceFamily,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.

getAccountSettings

AccountSettings getAccountSettings()
Retrives the authenticating user's account settings.

Returns:
the authenticating user's account settings.
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.

updateAccountSettings

AccountSettings updateAccountSettings(AccountSettingsData accountSettingsData)
Updates the authenticating user's account settings.

Parameters:
accountSettingsData - An AccountSettingsData with the settings to be changed.
Returns:
The updated account settings.