Spring Social Twitter

org.springframework.social.twitter.api
Interface SearchOperations


public interface SearchOperations

Interface defining the operations for searching Twitter and retrieving trending data.

Author:
Craig Walls

Method Summary
 SavedSearch createSavedSearch(java.lang.String query)
          Creates a new saved search for the authenticating user.
 void deleteSavedSearch(long searchId)
          Deletes a saved search
 Trends getLocalTrends(long whereOnEarthId)
          Retrieves the top 10 trending topics for a given location, identified by its "Where on Earth" (WOE) ID.
 Trends getLocalTrends(long whereOnEarthId, boolean excludeHashtags)
          Retrieves the top 10 trending topics for a given location, identified by its "Where on Earth" (WOE) ID.
 SavedSearch getSavedSearch(long searchId)
          Retrieves a single saved search by the saved search's ID.
 java.util.List<SavedSearch> getSavedSearches()
          Retrieves the authenticating user's saved searches.
 SearchResults search(SearchParameters searchParameters)
          Searches Twitter, returning a set of results
 SearchResults search(java.lang.String query)
          Searches Twitter, returning the first 50 matching Tweets
 SearchResults search(java.lang.String query, int pageSize)
          Searches Twitter, returning a specific page out of the complete set of results.
 SearchResults search(java.lang.String query, int pageSize, long sinceId, long maxId)
          Searches Twitter, returning a specific page out of the complete set of results.
 

Method Detail

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
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.
See Also:
SearchResults, Tweet

search

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

Parameters:
query - The search query string
pageSize - The number of Tweets per query
Returns:
a SearchResults containing the search results metadata and a list of matching Tweets
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.
See Also:
SearchResults, Tweet

search

SearchResults search(java.lang.String query,
                     int pageSize,
                     long sinceId,
                     long 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
pageSize - The number of Tweets per query
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
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.
See Also:
SearchResults, Tweet

search

SearchResults search(SearchParameters searchParameters)
Searches Twitter, returning a set of results

Parameters:
searchParameters - The search parameters
Returns:
a SearchResults containing the search results metadata and a list of matching Tweets
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.
See Also:
SearchResults, Tweet

getSavedSearches

java.util.List<SavedSearch> getSavedSearches()
Retrieves the authenticating user's saved searches.

Returns:
a list of SavedSearch items
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.

getSavedSearch

SavedSearch getSavedSearch(long searchId)
Retrieves a single saved search by the saved search's ID.

Parameters:
searchId - the ID of the saved search
Returns:
a SavedSearch
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.

createSavedSearch

SavedSearch createSavedSearch(java.lang.String query)
Creates a new saved search for the authenticating user.

Parameters:
query - the search query to save
Returns:
the SavedSearch
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.

deleteSavedSearch

void deleteSavedSearch(long searchId)
Deletes a saved search

Parameters:
searchId - the ID of the saved search
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.

getLocalTrends

Trends getLocalTrends(long whereOnEarthId)
Retrieves the top 10 trending topics for a given location, identified by its "Where on Earth" (WOE) ID. This includes hashtagged topics. See http://developer.yahoo.com/geo/geoplanet/guide/concepts.html for more information on WOE.

Parameters:
whereOnEarthId - the Where on Earth ID for the location to retrieve trend data.
Returns:
A Trends object with the top 10 trending topics for the location.
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.

getLocalTrends

Trends getLocalTrends(long whereOnEarthId,
                      boolean excludeHashtags)
Retrieves the top 10 trending topics for a given location, identified by its "Where on Earth" (WOE) ID. See http://developer.yahoo.com/geo/geoplanet/guide/concepts.html for more information on WOE.

Parameters:
whereOnEarthId - the Where on Earth ID for the location to retrieve trend data.
excludeHashtags - if true, hashtagged topics will be excluded from the trends list.
Returns:
A Trends object with the top 10 trending topics for the given location.
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.

Spring Social Twitter