org.springframework.social.twitter
Interface TwitterOperations

All Known Implementing Classes:
TwitterTemplate

public interface TwitterOperations

Interface specifying a basic set of operations for interacting with Twitter. Implemented by TwitterTemplate. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.


Method Summary
 java.util.List<java.lang.String> getFriends(java.lang.String screenName)
          Retrieves a list of users that the given user follows.
 java.lang.String getProfileId()
          Retrieves the user's Twitter screen name.
 void retweet(long tweetId)
          Posts a retweet of an existing tweet.
 SearchResults search(java.lang.String query)
          Searches Twitter, returning the first 50 matching Tweets
 SearchResults search(java.lang.String query, int page, int pageSize)
          Searches Twitter, returning a specific page out of the complete set of results.
 SearchResults search(java.lang.String query, int page, int resultsPerPage, int sinceId, int maxId)
          Searches Twitter, returning a specific page out of the complete set of results.
 void updateStatus(java.lang.String status)
          Updates the user's status.
 

Method Detail

getProfileId

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

Returns:
the user's screen name at Twitter

getFriends

java.util.List<java.lang.String> 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 user screen names

updateStatus

void updateStatus(java.lang.String status)
Updates the user's status.

Parameters:
status - The status message
Throws:
SocialException - if an error response is received from Twitter

retweet

void retweet(long tweetId)
Posts a retweet of an existing tweet.

Parameters:
tweetId - The ID of the tweet to be retweeted
Throws:
SocialException - if an error response is received from Twitter

search

SearchResults search(java.lang.String query)
Searches Twitter, returning the first 50 matching Tweets

Parameters:
query - The search query string
Returns:
a SearchResults containing the search results metadata and a list of matching Tweets
See Also:
SearchResults, [email protected] Tweet}

search

SearchResults search(java.lang.String query,
                     int page,
                     int pageSize)
Searches Twitter, returning a specific page out of the complete set of results.

Parameters:
query - The search query string
page - The page to return
pageSize - The number of Tweets per page
Returns:
a SearchResults containing the search results metadata and a list of matching Tweets
See Also:
SearchResults, [email protected] Tweet}

search

SearchResults search(java.lang.String query,
                     int page,
                     int resultsPerPage,
                     int sinceId,
                     int maxId)
Searches Twitter, returning a specific page out of the complete set of results. Results are filtered to those whose ID falls between sinceId and maxId

Parameters:
query - The search query string
page - The page to return
pageSize - The number of Tweets per page
sinceId - The minimum Tweet ID to return in the results
maxId - The maximum Tweet ID to return in the results
Returns:
a SearchResults containing the search results metadata and a list of matching Tweets
See Also:
SearchResults, [email protected] Tweet}