twitter4j
Class Twitter

java.lang.Object
  extended by twitter4j.TwitterBase
      extended by twitter4j.TwitterOAuthSupportBase
          extended by twitter4j.Twitter
All Implemented Interfaces:
java.io.Serializable, AccountMethods, BlockMethods, DirectMessageMethods, FavoriteMethods, FriendshipMethods, GeoMethods, HelpMethods, ListMembersMethods, ListMethods, ListSubscribersMethods, LocalTrendsMethods, NotificationMethods, SavedSearchesMethods, SearchMethods, SocialGraphMethods, SpamReportingMethods, StatusMethods, TimelineMethods, UserMethods, OAuthSupport, twitter4j.internal.http.HttpResponseListener

public final class Twitter
extends TwitterOAuthSupportBase
implements java.io.Serializable, SearchMethods, TimelineMethods, StatusMethods, UserMethods, ListMethods, ListMembersMethods, ListSubscribersMethods, DirectMessageMethods, FriendshipMethods, SocialGraphMethods, AccountMethods, FavoriteMethods, NotificationMethods, BlockMethods, SpamReportingMethods, SavedSearchesMethods, LocalTrendsMethods, GeoMethods, HelpMethods

A java representation of the Twitter API
This class is thread safe and can be cached/re-used and used concurrently.

Author:
Yusuke Yamamoto - yusuke at mac.com
See Also:
Serialized Form

Field Summary
private  int id
           
private  java.lang.String screenName
           
private static long serialVersionUID
           
 
Fields inherited from class twitter4j.TwitterOAuthSupportBase
http, rateLimitStatusListener
 
Fields inherited from class twitter4j.TwitterBase
auth, conf
 
Constructor Summary
Twitter()
          Deprecated. use TwitterFactory.getInstance() instead
Twitter(Configuration conf)
           
Twitter(Configuration conf, Authorization auth)
           
Twitter(Configuration conf, java.lang.String screenName, java.lang.String password)
           
Twitter(java.lang.String screenName, java.lang.String password)
          Deprecated. use TwitterFactory.getInstance(screenName, password) instead
 
Method Summary
private  void addParameterToList(java.util.List<twitter4j.internal.http.HttpParameter> colors, java.lang.String paramName, java.lang.String color)
           
 UserList addUserListMember(int listId, int userId)
          Adds a member to a list.
private  void checkFileValidity(java.io.File image)
          Check the existence, and the type of the specified file.
 User checkUserListMembership(java.lang.String listOwnerScreenName, int listId, int userId)
          Check if a user is a member of the specified list.

This method calls http://api.twitter.com/1/[listOwner]/[listId]/members/id.json
 User checkUserListSubscription(java.lang.String listOwnerScreenName, int listId, int userId)
          Check if the specified user is a subscriber of the specified list.
 User createBlock(int userId)
          Blocks the user specified in the ID parameter as the authenticating user.
 User createBlock(java.lang.String screenName)
          Blocks the user specified in the ID parameter as the authenticating user.
 Status createFavorite(long id)
          Favorites the status specified in the ID parameter as the authenticating user.
 User createFriendship(int userId)
          Befriends the user specified in the ID parameter as the authenticating user.
 User createFriendship(int userId, boolean follow)
          Befriends the user specified in the ID parameter as the authenticating user.
 User createFriendship(java.lang.String screenName)
          Befriends the user specified in the ID parameter as the authenticating user.
 User createFriendship(java.lang.String screenName, boolean follow)
          Befriends the user specified in the ID parameter as the authenticating user.
 SavedSearch createSavedSearch(java.lang.String query)
          Retrieve the data for a saved search owned by the authenticating user specified by the given id.
 UserList createUserList(java.lang.String listName, boolean isPublicList, java.lang.String description)
          Creates a new list for the authenticated user.
 UserList deleteUserListMember(int listId, int userId)
          Removes the specified member from the list.
 User destroyBlock(int userId)
          Un-blocks the user specified in the ID parameter as the authenticating user.
 User destroyBlock(java.lang.String screen_name)
          Un-blocks the user specified in the ID parameter as the authenticating user.
 DirectMessage destroyDirectMessage(int id)
          Destroys the direct message specified in the required ID parameter.
 Status destroyFavorite(long id)
          Un-favorites the status specified in the ID parameter as the authenticating user.
 User destroyFriendship(int userId)
          Discontinues friendship with the user specified in the ID parameter as the authenticating user.
 User destroyFriendship(java.lang.String screenName)
          Discontinues friendship with the user specified in the ID parameter as the authenticating user.
 SavedSearch destroySavedSearch(int id)
          Destroys a saved search for the authenticated user.
 Status destroyStatus(long statusId)
          Destroys the status specified by the required ID parameter.
 UserList destroyUserList(int listId)
          Deletes the specified list.
 User disableNotification(int userId)
          Disables notifications for updates from the specified user to the authenticating user.
 User disableNotification(java.lang.String screenName)
          Disables notifications for updates from the specified user to the authenticating user.
 User enableNotification(int userId)
          Enables notifications for updates from the specified user to the authenticating user.
 User enableNotification(java.lang.String screenName)
          Enables notifications for updates from the specified user to the authenticating user.
 boolean existsBlock(int userId)
          Tests if a friendship exists between two users.
 boolean existsBlock(java.lang.String screenName)
          Tests if a friendship exists between two users.
 boolean existsFriendship(java.lang.String userA, java.lang.String userB)
          Tests if a friendship exists between two users.
 ResponseList<Location> getAvailableTrends()
          Returns the locations that Twitter has trending topic information for.
 ResponseList<Location> getAvailableTrends(GeoLocation location)
          Returns the sorted locations that Twitter has trending topic information for.
 ResponseList<User> getBlockingUsers()
          Returns a list of user objects that the authenticating user is blocking.
 ResponseList<User> getBlockingUsers(int page)
          Returns a list of user objects that the authenticating user is blocking.
 IDs getBlockingUsersIDs()
          Returns an array of numeric user ids the authenticating user is blocking.
 Trends getCurrentTrends()
          Returns the current top 10 trending topics on Twitter.
 Trends getCurrentTrends(boolean excludeHashTags)
          Returns the current top 10 trending topics on Twitter.
 java.util.List<Trends> getDailyTrends()
          Returns the top 20 trending topics for each hour in a given day.
 java.util.List<Trends> getDailyTrends(java.util.Date date, boolean excludeHashTags)
          Returns the top 20 trending topics for each hour in a given day.
 ResponseList<DirectMessage> getDirectMessages()
          Returns a list of the direct messages sent to the authenticating user.
 ResponseList<DirectMessage> getDirectMessages(Paging paging)
          Returns a list of the direct messages sent to the authenticating user.
 ResponseList<Status> getFavorites()
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 ResponseList<Status> getFavorites(int page)
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 ResponseList<Status> getFavorites(java.lang.String id)
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 ResponseList<Status> getFavorites(java.lang.String id, int page)
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 IDs getFollowersIDs()
          Returns an array of numeric IDs for every user the specified user is followed by.
 IDs getFollowersIDs(int userId)
          Returns an array of numeric IDs for every user the specified user is followed by.
 IDs getFollowersIDs(int userId, long cursor)
          Returns an array of numeric IDs for every user the specified user is followed by.
 IDs getFollowersIDs(long cursor)
          Returns an array of numeric IDs for every user the specified user is followed by.
 IDs getFollowersIDs(java.lang.String screenName)
          Returns an array of numeric IDs for every user the specified user is followed by.
 IDs getFollowersIDs(java.lang.String screenName, long cursor)
          Returns an array of numeric IDs for every user the specified user is followed by.
 PagableResponseList<User> getFollowersStatuses()
          Returns the authenticating user's followers, each with current status inline.
 PagableResponseList<User> getFollowersStatuses(int userId)
          Returns the specified user's followers, each with current status inline.
 PagableResponseList<User> getFollowersStatuses(int userId, long cursor)
          Returns the specified user's followers, each with current status inline.
 PagableResponseList<User> getFollowersStatuses(long cursor)
          Returns the authenticating user's followers, each with current status inline.
 PagableResponseList<User> getFollowersStatuses(java.lang.String screenName)
          Returns the specified user's followers, each with current status inline.
 PagableResponseList<User> getFollowersStatuses(java.lang.String screenName, long cursor)
          Returns the specified user's followers, each with current status inline.
 IDs getFriendsIDs()
          Returns an array of numeric IDs for every user the authenticating user is following.
 IDs getFriendsIDs(int userId)
          Returns an array of numeric IDs for every user the specified user is following.
all IDs are attempted to be returned, but large sets of IDs will likely fail with timeout errors.
 IDs getFriendsIDs(int userId, long cursor)
          Returns an array of numeric IDs for every user the specified user is following.
 IDs getFriendsIDs(long cursor)
          Returns an array of numeric IDs for every user the authenticating user is following.
 IDs getFriendsIDs(java.lang.String screenName)
          Returns an array of numeric IDs for every user the specified user is following.
 IDs getFriendsIDs(java.lang.String screenName, long cursor)
          Returns an array of numeric IDs for every user the specified user is following.
 PagableResponseList<User> getFriendsStatuses()
          Returns the specified user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(int userId)
          Returns the specified user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(int userId, long cursor)
          Returns the specified user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(long cursor)
          Returns the user's friends, each with current status inline.

This method calls http://api.twitter.com/1/statuses/friends
 PagableResponseList<User> getFriendsStatuses(java.lang.String screenName)
          Returns the specified user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(java.lang.String screenName, long cursor)
          Returns the specified user's friends, each with current status inline.
 ResponseList<Status> getFriendsTimeline()
          Returns the 20 most recent statuses posted in the last 24 hours from the authenticating1 user and that user's friends.
 ResponseList<Status> getFriendsTimeline(Paging paging)
          Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.
 Place getGeoDetails(java.lang.String id)
          Find out more details of a place that was returned from the geo/reverse_geocode method.
 ResponseList<Status> getHomeTimeline()
          Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends.
 ResponseList<Status> getHomeTimeline(Paging paging)
          Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends.
 int getId()
          Returns authenticating user's user id.
This method may internally call verifyCredentials() on the first invocation if
- this instance is authenticated by Basic and email address is supplied instead of screen name, or - this instance is authenticated by OAuth.
 Trends getLocationTrends(int woeid)
          Returns the top 10 trending topics for a specific location Twitter has trending topic information for.
 ResponseList<Status> getMentions()
          Returns the 20 most recent mentions (status containing @username) for the authenticating user.
 ResponseList<Status> getMentions(Paging paging)
          Returns the 20 most recent mentions (status containing @username) for the authenticating user.
 ResponseList<Place> getNearbyPlaces(GeoQuery query)
          Search for places (cities and neighborhoods) that can be attached to a statuses/update.
private  OAuthSupport getOAuth()
           
 AccessToken getOAuthAccessToken()
          Returns an access token associated with this instance.
If no access token is associated with this instance, this will retrieve a new access token.
 AccessToken getOAuthAccessToken(RequestToken requestToken)
          Retrieves an access token associated with the supplied request token and sets userId.
 AccessToken getOAuthAccessToken(RequestToken requestToken, java.lang.String oauthVerifier)
          Retrieves an access token associated with the supplied request token and sets userId.
 AccessToken getOAuthAccessToken(java.lang.String oauthVerifier)
          Retrieves an access token.
 AccessToken getOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret)
          Deprecated. Use TwitterFactory.getInstance(AccessToken accessToken)
 AccessToken getOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret, java.lang.String pin)
          Retrieves an access token associated with the supplied request token.
 RequestToken getOAuthRequestToken()
          Retrieves a request token
 RequestToken getOAuthRequestToken(java.lang.String callbackUrl)
          Retrieves a request token
 ResponseList<Status> getPublicTimeline()
          Returns the 20 most recent statuses from non-protected users who have set a custom user icon.
 RateLimitStatus getRateLimitStatus()
          Returns the remaining number of API requests available to the requesting user before the API limit is reached for the current hour.
 ResponseList<Status> getRetweetedByMe()
          Returns the 20 most recent retweets posted by the authenticating user.
 ResponseList<Status> getRetweetedByMe(Paging paging)
          Returns the 20 most recent retweets posted by the authenticating user.
 ResponseList<Status> getRetweetedToMe()
          Returns the 20 most recent retweets posted by the authenticating user's friends.
 ResponseList<Status> getRetweetedToMe(Paging paging)
          Returns the 20 most recent retweets posted by the authenticating user's friends.
 ResponseList<Status> getRetweets(long statusId)
          Returns up to 100 of the first retweets of a given tweet.
 ResponseList<Status> getRetweetsOfMe()
          Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
 ResponseList<Status> getRetweetsOfMe(Paging paging)
          Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
 java.util.List<SavedSearch> getSavedSearches()
          Returns the authenticated user's saved search queries.
 java.lang.String getScreenName()
          Returns authenticating user's screen name.
This method may internally call verifyCredentials() on the first invocation if
- this instance is authenticated by Basic and email address is supplied instead of screen name, or - this instance is authenticated by OAuth.
Note that this method returns a transiently cached (will be lost upon serialization) screen name while it is possible to change a user's screen name.
 ResponseList<DirectMessage> getSentDirectMessages()
          Returns a list of the direct messages sent by the authenticating user.
 ResponseList<DirectMessage> getSentDirectMessages(Paging paging)
          Returns a list of the direct messages sent by the authenticating user.
 ResponseList<Category> getSuggestedUserCategories()
          Access to Twitter's suggested user list.
 Trends getTrends()
          Returns the top ten topics that are currently trending on Twitter.
 PagableResponseList<User> getUserListMembers(java.lang.String listOwnerScreenName, int listId, long cursor)
          Returns the members of the specified list.
 PagableResponseList<UserList> getUserListMemberships(java.lang.String listOwnerScreenName, long cursor)
          List the lists the specified user has been added to.
 PagableResponseList<UserList> getUserLists(java.lang.String listOwnerScreenName, long cursor)
          List the lists of the specified user.
 ResponseList<Status> getUserListStatuses(java.lang.String listOwnerScreenName, int id, Paging paging)
          Show tweet timeline for members of the specified list.
 PagableResponseList<User> getUserListSubscribers(java.lang.String listOwnerScreenName, int listId, long cursor)
          Returns the subscribers of the specified list.
 PagableResponseList<UserList> getUserListSubscriptions(java.lang.String listOwnerScreenName, long cursor)
          List the lists the specified user follows.
 ResponseList<User> getUserSuggestions(java.lang.String categorySlug)
          Access the users in a given category of the Twitter suggested user list.
 ResponseList<Status> getUserTimeline()
          Returns the most recent statuses posted in the last 24 hours from the authenticating user.
 ResponseList<Status> getUserTimeline(int userId)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 ResponseList<Status> getUserTimeline(int userId, Paging paging)
          Returns the most recent statuses posted in the last 24 hours from the specified screen name.
 ResponseList<Status> getUserTimeline(Paging paging)
          Returns the most recent statuses posted in the last 24 hours from the authenticating user.
 ResponseList<Status> getUserTimeline(java.lang.String screenName)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 ResponseList<Status> getUserTimeline(java.lang.String screenName, Paging paging)
          Returns the most recent statuses posted in the last 24 hours from the specified screen name.
 java.util.List<Trends> getWeeklyTrends()
          Returns the top 30 trending topics for each day in a given week.
 java.util.List<Trends> getWeeklyTrends(java.util.Date date, boolean excludeHashTags)
          Returns the top 30 trending topics for each day in a given week.
 boolean isOAuthEnabled()
          tests if the instance is authenticated by Basic
 ResponseList<User> lookupUsers(int[] ids)
          Return up to 20 users worth of extended information, specified by either ID.
 ResponseList<User> lookupUsers(java.lang.String[] screenNames)
          Return up to 20 users worth of extended information, specified by screen name.
private  twitter4j.internal.http.HttpParameter[] mergeParameters(twitter4j.internal.http.HttpParameter[] params1, twitter4j.internal.http.HttpParameter[] params2)
           
 User reportSpam(int userId)
          The user specified in the id is blocked by the authenticated user and reported as a spammer.
 User reportSpam(java.lang.String screenName)
          The user specified in the id is blocked by the authenticated user and reported as a spammer.
 Status retweetStatus(long statusId)
          Retweets a tweet.
 ResponseList<Place> reverseGeoCode(GeoQuery query)
          Search for places (cities and neighborhoods) that can be attached to a statuses/update.
 QueryResult search(Query query)
          Returns tweets that match a specified query.
 ResponseList<User> searchUsers(java.lang.String query, int page)
          Run a search for users similar to Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API (about being listed in the People Search).
 DirectMessage sendDirectMessage(int userId, java.lang.String text)
          Sends a new direct message to the specified user from the authenticating user.
 DirectMessage sendDirectMessage(java.lang.String screenName, java.lang.String text)
          Sends a new direct message to the specified user from the authenticating user.
 void setOAuthAccessToken(AccessToken accessToken)
          Deprecated. Use TwitterFactory.getInstance(AccessToken accessToken)
 void setOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret)
          Deprecated. Use Twitter getInstance(AccessToken accessToken)
 void setOAuthConsumer(java.lang.String consumerKey, java.lang.String consumerSecret)
          sets the OAuth consumer key and consumer secret
 Relationship showFriendship(int sourceId, int targetId)
          Gets the detailed relationship status between a source user and a target user
This method calls http://api.twitter.com/1/friendships/show.json
 Relationship showFriendship(java.lang.String sourceScreenName, java.lang.String targetScreenName)
          Gets the detailed relationship status between a source user and a target user
This method calls http://api.twitter.com/1/friendships/show.json
 SavedSearch showSavedSearch(int id)
          Retrieve the data for a saved search owned by the authenticating user specified by the given id.
 Status showStatus(long id)
          Returns a single status, specified by the id parameter.
 User showUser(int userId)
          Returns extended information of a given user, specified by ID.
 User showUser(java.lang.String screenName)
          Returns extended information of a given user, specified by screen name as per the required id parameter below.
 UserList showUserList(java.lang.String listOwnerScreenName, int id)
          Show the specified list.
 UserList subscribeUserList(java.lang.String listOwnerScreenName, int listId)
          Make the authenticated user follow the specified list.
 boolean test()
          Returns the string "ok" in the requested format with a 200 OK HTTP status code.
private  java.lang.String toDateStr(java.util.Date date)
           
 java.lang.String toString()
           
 UserList unsubscribeUserList(java.lang.String listOwnerScreenName, int listId)
          Unsubscribes the authenticated user form the specified list.
 User updateDeliveryDevice(Device device)
          Sets which device Twitter delivers updates to for the authenticating user.
 User updateProfile(java.lang.String name, java.lang.String email, java.lang.String url, java.lang.String location, java.lang.String description)
          Sets values that users are able to set under the "Account" tab of their settings page.
 User updateProfileBackgroundImage(java.io.File image, boolean tile)
          Updates the authenticating user's profile background image.
 User updateProfileColors(java.lang.String profileBackgroundColor, java.lang.String profileTextColor, java.lang.String profileLinkColor, java.lang.String profileSidebarFillColor, java.lang.String profileSidebarBorderColor)
          Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com.
 User updateProfileImage(java.io.File image)
          Updates the authenticating user's profile image.
 Status updateStatus(StatusUpdate latestStatus)
          Updates the user's status.
 Status updateStatus(java.lang.String status)
          Updates the user's status.
 Status updateStatus(java.lang.String status, GeoLocation location)
          Updates the user's status.
 Status updateStatus(java.lang.String status, long inReplyToStatusId)
          Updates the user's status.
 Status updateStatus(java.lang.String status, long inReplyToStatusId, GeoLocation location)
          Updates the user's status.
 UserList updateUserList(int listId, java.lang.String newListName, boolean isPublicList, java.lang.String newDescription)
          Updates the specified list.
 User verifyCredentials()
          Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not.
 
Methods inherited from class twitter4j.TwitterOAuthSupportBase
equals, hashCode, httpResponseReceived, setRateLimitStatusListener
 
Methods inherited from class twitter4j.TwitterBase
ensureAuthorizationEnabled, ensureBasicEnabled, getAuthorization, isBasicAuthEnabled
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

screenName

private transient java.lang.String screenName

id

private transient int id
Constructor Detail

Twitter

Twitter(Configuration conf)

Twitter

public Twitter()
Deprecated. use TwitterFactory.getInstance() instead

Creates an unauthenticated Twitter instance


Twitter

public Twitter(java.lang.String screenName,
               java.lang.String password)
Deprecated. use TwitterFactory.getInstance(screenName, password) instead

Creates a Twitter instance with supplied id

Parameters:
screenName - the screen name of the user
password - the password of the user

Twitter

Twitter(Configuration conf,
        java.lang.String screenName,
        java.lang.String password)

Twitter

Twitter(Configuration conf,
        Authorization auth)
Method Detail

mergeParameters

private twitter4j.internal.http.HttpParameter[] mergeParameters(twitter4j.internal.http.HttpParameter[] params1,
                                                                twitter4j.internal.http.HttpParameter[] params2)

getScreenName

public java.lang.String getScreenName()
                               throws TwitterException,
                                      java.lang.IllegalStateException
Returns authenticating user's screen name.
This method may internally call verifyCredentials() on the first invocation if
- this instance is authenticated by Basic and email address is supplied instead of screen name, or - this instance is authenticated by OAuth.
Note that this method returns a transiently cached (will be lost upon serialization) screen name while it is possible to change a user's screen name.

Returns:
the authenticating screen name
Throws:
TwitterException - when verifyCredentials threw an exception.
java.lang.IllegalStateException - if no credentials are supplied. i.e.) this is an anonymous Twitter instance
Since:
Twitter4J 2.1.1

getId

public int getId()
          throws TwitterException,
                 java.lang.IllegalStateException
Returns authenticating user's user id.
This method may internally call verifyCredentials() on the first invocation if
- this instance is authenticated by Basic and email address is supplied instead of screen name, or - this instance is authenticated by OAuth.

Returns:
the authenticating user's id
Throws:
TwitterException - when verifyCredentials threw an exception.
java.lang.IllegalStateException - if no credentials are supplied. i.e.) this is an anonymous Twitter instance
Since:
Twitter4J 2.1.1

search

public QueryResult search(Query query)
                   throws TwitterException
Returns tweets that match a specified query.
This method calls http://search.twitter.com/search

Specified by:
search in interface SearchMethods
Parameters:
query - - the search condition
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter Search API Method: search

getTrends

public Trends getTrends()
                 throws TwitterException
Returns the top ten topics that are currently trending on Twitter. The response includes the time of the request, the name of each trend, and the url to the Twitter Search results page for that topic.
This method calls http://search.twitter.com/trends

Specified by:
getTrends in interface SearchMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends

getCurrentTrends

public Trends getCurrentTrends()
                        throws TwitterException
Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
This method calls http://search.twitter.com/trends/current

Specified by:
getCurrentTrends in interface SearchMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends

getCurrentTrends

public Trends getCurrentTrends(boolean excludeHashTags)
                        throws TwitterException
Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
This method calls http://search.twitter.com/trends/current

Specified by:
getCurrentTrends in interface SearchMethods
Parameters:
excludeHashTags - Setting this to true will remove all hashtags from the trends list.
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends

getDailyTrends

public java.util.List<Trends> getDailyTrends()
                                      throws TwitterException
Returns the top 20 trending topics for each hour in a given day.
This method calls http://search.twitter.com/trends/daily

Specified by:
getDailyTrends in interface SearchMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends daily

getDailyTrends

public java.util.List<Trends> getDailyTrends(java.util.Date date,
                                             boolean excludeHashTags)
                                      throws TwitterException
Returns the top 20 trending topics for each hour in a given day.
This method calls http://search.twitter.com/trends/daily

Specified by:
getDailyTrends in interface SearchMethods
Parameters:
date - Permits specifying a start date for the report.
excludeHashTags - Setting this to true will remove all hashtags from the trends list.
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends daily

toDateStr

private java.lang.String toDateStr(java.util.Date date)

getWeeklyTrends

public java.util.List<Trends> getWeeklyTrends()
                                       throws TwitterException
Returns the top 30 trending topics for each day in a given week.
This method calls http://search.twitter.com/trends/weekly

Specified by:
getWeeklyTrends in interface SearchMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends weekly

getWeeklyTrends

public java.util.List<Trends> getWeeklyTrends(java.util.Date date,
                                              boolean excludeHashTags)
                                       throws TwitterException
Returns the top 30 trending topics for each day in a given week.
This method calls http://search.twitter.com/trends/weekly

Specified by:
getWeeklyTrends in interface SearchMethods
Parameters:
date - Permits specifying a start date for the report.
excludeHashTags - Setting this to true will remove all hashtags from the trends list.
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter Search API Method: trends weekly

getPublicTimeline

public ResponseList<Status> getPublicTimeline()
                                       throws TwitterException
Returns the 20 most recent statuses from non-protected users who have set a custom user icon. The public timeline is cached for 60 seconds so requesting it more often than that is a waste of resources.
This method calls http://api.twitter.com/1/statuses/public_timeline

Specified by:
getPublicTimeline in interface TimelineMethods
Returns:
list of statuses of the Public Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses public_timeline

getHomeTimeline

public ResponseList<Status> getHomeTimeline()
                                     throws TwitterException
Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
This method calls http://api.twitter.com/1/statuses/home_timeline

Specified by:
getHomeTimeline in interface TimelineMethods
Returns:
list of the home Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses home_timeline

getHomeTimeline

public ResponseList<Status> getHomeTimeline(Paging paging)
                                     throws TwitterException
Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
This method calls http://api.twitter.com/1/statuses/home_timeline

Specified by:
getHomeTimeline in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
list of the home Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses home_timeline

getFriendsTimeline

public ResponseList<Status> getFriendsTimeline()
                                        throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating1 user and that user's friends. It's also possible to request another user's friends_timeline via the id parameter below.
Note: Retweets will not appear in the friends_timeline for backwards compatibility. If you want retweets included use getHomeTimeline().
This method calls http://api.twitter.com/1/statuses/friends_timeline

Specified by:
getFriendsTimeline in interface TimelineMethods
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getFriendsTimeline

public ResponseList<Status> getFriendsTimeline(Paging paging)
                                        throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.
This method calls http://api.twitter.com/1/statuses/friends_timeline

Specified by:
getFriendsTimeline in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline(java.lang.String screenName,
                                            Paging paging)
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified screen name.
This method calls http://api.twitter.com/1/statuses/user_timeline.json

Specified by:
getUserTimeline in interface TimelineMethods
Parameters:
screenName - specifies the screen name of the user for whom to return the user_timeline
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
list of the user Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline(int userId,
                                            Paging paging)
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified screen name.
This method calls http://api.twitter.com/1/statuses/user_timeline.json

Specified by:
getUserTimeline in interface TimelineMethods
Parameters:
userId - specifies the ID of the user for whom to return the user_timeline
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
list of the user Timeline
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline(java.lang.String screenName)
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.
This method calls http://api.twitter.com/1/statuses/user_timeline

Specified by:
getUserTimeline in interface TimelineMethods
Parameters:
screenName - specifies the screen name of the user for whom to return the user_timeline
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline(int userId)
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.
This method calls http://api.twitter.com/1/statuses/user_timeline

Specified by:
getUserTimeline in interface TimelineMethods
Parameters:
userId - specifies the ID of the user for whom to return the user_timeline
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline()
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the authenticating user.
This method calls http://api.twitter.com/1/statuses/user_timeline

Specified by:
getUserTimeline in interface TimelineMethods
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getUserTimeline

public ResponseList<Status> getUserTimeline(Paging paging)
                                     throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the authenticating user.
This method calls http://api.twitter.com/1/statuses/user_timeline

Specified by:
getUserTimeline in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends_timeline

getMentions

public ResponseList<Status> getMentions()
                                 throws TwitterException
Returns the 20 most recent mentions (status containing @username) for the authenticating user.
This method calls http://api.twitter.com/1/statuses/mentions

Specified by:
getMentions in interface TimelineMethods
Returns:
the 20 most recent replies
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses mentions

getMentions

public ResponseList<Status> getMentions(Paging paging)
                                 throws TwitterException
Returns the 20 most recent mentions (status containing @username) for the authenticating user.
This method calls http://api.twitter.com/1/statuses/mentions

Specified by:
getMentions in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
the 20 most recent replies
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses mentions

getRetweetedByMe

public ResponseList<Status> getRetweetedByMe()
                                      throws TwitterException
Returns the 20 most recent retweets posted by the authenticating user.
This method calls http://api.twitter.com/1/statuses/retweeted_by_me

Specified by:
getRetweetedByMe in interface TimelineMethods
Returns:
the 20 most recent retweets posted by the authenticating user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweeted_by_me

getRetweetedByMe

public ResponseList<Status> getRetweetedByMe(Paging paging)
                                      throws TwitterException
Returns the 20 most recent retweets posted by the authenticating user.
This method calls http://api.twitter.com/1/statuses/retweeted_by_me

Specified by:
getRetweetedByMe in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
the 20 most recent retweets posted by the authenticating user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweeted_by_me

getRetweetedToMe

public ResponseList<Status> getRetweetedToMe()
                                      throws TwitterException
Returns the 20 most recent retweets posted by the authenticating user's friends.
This method calls http://api.twitter.com/1/statuses/retweeted_to_me

Specified by:
getRetweetedToMe in interface TimelineMethods
Returns:
the 20 most recent retweets posted by the authenticating user's friends.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweeted_to_me

getRetweetedToMe

public ResponseList<Status> getRetweetedToMe(Paging paging)
                                      throws TwitterException
Returns the 20 most recent retweets posted by the authenticating user's friends.
This method calls http://api.twitter.com/1/statuses/retweeted_to_me

Specified by:
getRetweetedToMe in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
the 20 most recent retweets posted by the authenticating user's friends.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweeted_to_me

getRetweetsOfMe

public ResponseList<Status> getRetweetsOfMe()
                                     throws TwitterException
Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
This method calls http://api.twitter.com/1/statuses/retweets_of_me

Specified by:
getRetweetsOfMe in interface TimelineMethods
Returns:
the 20 most recent tweets of the authenticated user that have been retweeted by others.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweets_of_me

getRetweetsOfMe

public ResponseList<Status> getRetweetsOfMe(Paging paging)
                                     throws TwitterException
Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
This method calls http://api.twitter.com/1/statuses/retweets_of_me

Specified by:
getRetweetsOfMe in interface TimelineMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
the 20 most recent tweets of the authenticated user that have been retweeted by others.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses/retweets_of_me

showStatus

public Status showStatus(long id)
                  throws TwitterException
Returns a single status, specified by the id parameter. The status's author will be returned inline.
This method calls http://api.twitter.com/1/statuses/show

Specified by:
showStatus in interface StatusMethods
Parameters:
id - the numerical ID of the status you're trying to retrieve
Returns:
a single status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses show

updateStatus

public Status updateStatus(java.lang.String status)
                    throws TwitterException
Updates the user's status.
Statuses over 140 characters will be forcibly truncated.
This method calls http://api.twitter.com/1/statuses/update

Specified by:
updateStatus in interface StatusMethods
Parameters:
status - the text of your status update
Returns:
the latest status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses update

updateStatus

public Status updateStatus(java.lang.String status,
                           GeoLocation location)
                    throws TwitterException
Updates the user's status.
Statuses over 140 characters will be forcibly truncated.
This method calls http://api.twitter.com/1/statuses/update

Specified by:
updateStatus in interface StatusMethods
Parameters:
status - the text of your status update
location - The location that this tweet refers to.
Returns:
the latest status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses update

updateStatus

public Status updateStatus(java.lang.String status,
                           long inReplyToStatusId)
                    throws TwitterException
Updates the user's status.
Statuses over 140 characters will be forcibly truncated.
This method calls http://api.twitter.com/1/statuses/update

Specified by:
updateStatus in interface StatusMethods
Parameters:
status - the text of your status update
inReplyToStatusId - The ID of an existing status that the status to be posted is in reply to. This implicitly sets the in_reply_to_user_id attribute of the resulting status to the user ID of the message being replied to. Invalid/missing status IDs will be ignored.
Returns:
the latest status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses update

updateStatus

public Status updateStatus(java.lang.String status,
                           long inReplyToStatusId,
                           GeoLocation location)
                    throws TwitterException
Updates the user's status.
Statuses over 140 characters will be forcibly truncated.
This method calls http://api.twitter.com/1/statuses/update

Specified by:
updateStatus in interface StatusMethods
Parameters:
status - the text of your status update
inReplyToStatusId - The ID of an existing status that the status to be posted is in reply to. This implicitly sets the in_reply_to_user_id attribute of the resulting status to the user ID of the message being replied to. Invalid/missing status IDs will be ignored.
location - The location that this tweet refers to.
Returns:
the latest status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses update

updateStatus

public Status updateStatus(StatusUpdate latestStatus)
                    throws TwitterException
Updates the user's status.
Statuses over 140 characters will be forcibly truncated.
This method calls http://api.twitter.com/1/statuses/update

Specified by:
updateStatus in interface StatusMethods
Parameters:
latestStatus - the latest status to be updated.
Returns:
the latest status
Throws:
TwitterException

destroyStatus

public Status destroyStatus(long statusId)
                     throws TwitterException
Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status.
This method calls http://api.twitter.com/1/statuses/destroy

Specified by:
destroyStatus in interface StatusMethods
Parameters:
statusId - The ID of the status to destroy.
Returns:
the deleted status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses destroy

retweetStatus

public Status retweetStatus(long statusId)
                     throws TwitterException
Retweets a tweet. Requires the id parameter of the tweet you are retweeting. Returns the original tweet with retweet details embedded.
This method calls http://api.twitter.com/1/statuses/retweet

Specified by:
retweetStatus in interface StatusMethods
Parameters:
statusId - The ID of the status to retweet.
Returns:
the retweeted status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses retweet

getRetweets

public ResponseList<Status> getRetweets(long statusId)
                                 throws TwitterException
Returns up to 100 of the first retweets of a given tweet.
This method calls http://api.twitter.com/1/statuses/retweets

Specified by:
getRetweets in interface StatusMethods
Parameters:
statusId - The numerical ID of the tweet you want the retweets of.
Returns:
the retweets of a given tweet
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses retweets

showUser

public User showUser(java.lang.String screenName)
              throws TwitterException
Returns extended information of a given user, specified by screen name as per the required id parameter below. This information includes design settings, so third party developers can theme their widgets according to a given user's preferences.
This method calls http://api.twitter.com/1/users/show.json

Specified by:
showUser in interface UserMethods
Parameters:
screenName - the screen name of the user for whom to request the detail
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: users show

showUser

public User showUser(int userId)
              throws TwitterException
Returns extended information of a given user, specified by ID. This information includes design settings, so third party developers can theme their widgets according to a given user's preferences.
This method calls http://api.twitter.com/1/users/show

Specified by:
showUser in interface UserMethods
Parameters:
userId - the ID of the user for whom to request the detail
Returns:
users
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: users show

lookupUsers

public ResponseList<User> lookupUsers(java.lang.String[] screenNames)
                               throws TwitterException
Return up to 20 users worth of extended information, specified by screen name. The author's most recent status (if the authenticating user has permission) will be returned inline. Users can, at most, look up 1000 users in an hour.
This method calls http://api.twitter.com/1/users/lookup.json

Specified by:
lookupUsers in interface UserMethods
Parameters:
screenNames - Specifies the screen names of the users to return.
Returns:
users
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: users lookup

lookupUsers

public ResponseList<User> lookupUsers(int[] ids)
                               throws TwitterException
Return up to 20 users worth of extended information, specified by either ID. The author's most recent status (if the authenticating user has permission) will be returned inline. Users can, at most, look up 1000 users in an hour.
This method calls http://api.twitter.com/1/users/lookup.json

Specified by:
lookupUsers in interface UserMethods
Parameters:
ids - Specifies the screen names of the users to return.
Returns:
users
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: users lookup

searchUsers

public ResponseList<User> searchUsers(java.lang.String query,
                                      int page)
                               throws TwitterException
Run a search for users similar to Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API (about being listed in the People Search). It is only possible to retrieve the first 1000 matches from this API.
This method calls http://api.twitter.com/1/users/search.json

Specified by:
searchUsers in interface UserMethods
Parameters:
query - The query to run against people search.
page - Specifies the page of results to retrieve. Number of statuses per page is fixed to 20.
Returns:
the list of Users matches the provided
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: users search

getSuggestedUserCategories

public ResponseList<Category> getSuggestedUserCategories()
                                                  throws TwitterException
Access to Twitter's suggested user list. This returns the list of suggested user categories. The category can be used in the users/suggestions/category endpoint to get the users in that category.
This method calls http://api.twitter.com/1/users/suggestions.json

Specified by:
getSuggestedUserCategories in interface UserMethods
Returns:
list of suggested user categories.
Throws:
TwitterException - when Twitter service or network is unavailable

getUserSuggestions

public ResponseList<User> getUserSuggestions(java.lang.String categorySlug)
                                      throws TwitterException
Access the users in a given category of the Twitter suggested user list.
This method calls http://api.twitter.com/1/users/suggestions/[slug].json

Specified by:
getUserSuggestions in interface UserMethods
Parameters:
categorySlug - slug
Returns:
list of suggested users
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses()
                                             throws TwitterException
Returns the specified user's friends, each with current status inline.
This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(long cursor)
                                             throws TwitterException
Returns the user's friends, each with current status inline.

This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Parameters:
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(java.lang.String screenName)
                                             throws TwitterException
Returns the specified user's friends, each with current status inline. This method automatically provides a value of cursor=-1 to begin paging.
This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Parameters:
screenName - the screen name of the user for whom to request a list of friends
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(int userId)
                                             throws TwitterException
Returns the specified user's friends, each with current status inline. This method automatically provides a value of cursor=-1 to begin paging.
This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Parameters:
userId - the ID of the user for whom to request a list of friends
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(java.lang.String screenName,
                                                    long cursor)
                                             throws TwitterException
Returns the specified user's friends, each with current status inline.
This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Parameters:
screenName - the screen name of the user for whom to request a list of friends
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(int userId,
                                                    long cursor)
                                             throws TwitterException
Returns the specified user's friends, each with current status inline.
This method calls http://api.twitter.com/1/statuses/friends

Specified by:
getFriendsStatuses in interface UserMethods
Parameters:
userId - the ID of the user for whom to request a list of friends
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses friends

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses()
                                               throws TwitterException
Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method automatically provides a value of cursor=-1 to begin paging.
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses(long cursor)
                                               throws TwitterException
Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Parameters:
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses(java.lang.String screenName)
                                               throws TwitterException
Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Parameters:
screenName - The screen name of the user for whom to request a list of followers.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses(int userId)
                                               throws TwitterException
Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Parameters:
userId - The ID of the user for whom to request a list of followers.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses(java.lang.String screenName,
                                                      long cursor)
                                               throws TwitterException
Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Parameters:
screenName - The screen name of the user for whom to request a list of followers.
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

getFollowersStatuses

public PagableResponseList<User> getFollowersStatuses(int userId,
                                                      long cursor)
                                               throws TwitterException
Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
This method calls http://api.twitter.com/1/statuses/followers

Specified by:
getFollowersStatuses in interface UserMethods
Parameters:
userId - The ID of the user for whom to request a list of followers.
cursor - Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: statuses followers

createUserList

public UserList createUserList(java.lang.String listName,
                               boolean isPublicList,
                               java.lang.String description)
                        throws TwitterException
Creates a new list for the authenticated user.
This method calls http://api.twitter.com/1/user/lists.json

Specified by:
createUserList in interface ListMethods
Parameters:
listName - The name of the list you are creating. Required.
isPublicList - set true if you wish to make a public list
description - The description of the list you are creating. Optional.
Returns:
the list that was created
Throws:
TwitterException - when Twitter service or network is unavailable, or the authenticated user already has 20 lists(TwitterException.getStatusCode() == 403).
See Also:
Twitter REST API Method: POST lists

updateUserList

public UserList updateUserList(int listId,
                               java.lang.String newListName,
                               boolean isPublicList,
                               java.lang.String newDescription)
                        throws TwitterException
Updates the specified list.
This method calls http://api.twitter.com/1/user/lists/id.json

Specified by:
updateUserList in interface ListMethods
Parameters:
listId - The id of the list to update.
newListName - What you'd like to change the list's name to.
isPublicList - Whether your list is public or private. Optional. Values can be public or private. Lists are public by default if no mode is specified.
newDescription - What you'd like to change the list description to.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: POST lists id

getUserLists

public PagableResponseList<UserList> getUserLists(java.lang.String listOwnerScreenName,
                                                  long cursor)
                                           throws TwitterException
List the lists of the specified user. Private lists will be included if the authenticated users is the same as the user whose lists are being returned.
This method calls http://api.twitter.com/1/user/lists.json

Specified by:
getUserLists in interface ListMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
cursor - Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of lists
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET lists

showUserList

public UserList showUserList(java.lang.String listOwnerScreenName,
                             int id)
                      throws TwitterException
Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
This method calls http://api.twitter.com/1/user/lists/id.json

Specified by:
showUserList in interface ListMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
id - The id of the list to show
Returns:
the specified list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET list id

destroyUserList

public UserList destroyUserList(int listId)
                         throws TwitterException
Deletes the specified list. Must be owned by the authenticated user.
This method calls http://api.twitter.com/1/[user]/lists/[id].json

Specified by:
destroyUserList in interface ListMethods
Parameters:
listId - The id of the list to delete
Returns:
the deleted list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: DELETE /:user/lists/:id

getUserListStatuses

public ResponseList<Status> getUserListStatuses(java.lang.String listOwnerScreenName,
                                                int id,
                                                Paging paging)
                                         throws TwitterException
Show tweet timeline for members of the specified list.
http://api.twitter.com/1/user/lists/list_id/statuses.json

Specified by:
getUserListStatuses in interface ListMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
id - The id of the list to delete
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
list of statuses for members of the specified list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET list statuses

getUserListMemberships

public PagableResponseList<UserList> getUserListMemberships(java.lang.String listOwnerScreenName,
                                                            long cursor)
                                                     throws TwitterException
List the lists the specified user has been added to.
This method calls http://api.twitter.com/1/user/lists/memberships.json

Specified by:
getUserListMemberships in interface ListMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
cursor - Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of lists
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET /:user/lists/memberships

getUserListSubscriptions

public PagableResponseList<UserList> getUserListSubscriptions(java.lang.String listOwnerScreenName,
                                                              long cursor)
                                                       throws TwitterException
List the lists the specified user follows.
This method calls http://api.twitter.com/1/[user]/lists/subscriptions.json

Specified by:
getUserListSubscriptions in interface ListMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
cursor - Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the list of lists
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET list subscriptions

getUserListMembers

public PagableResponseList<User> getUserListMembers(java.lang.String listOwnerScreenName,
                                                    int listId,
                                                    long cursor)
                                             throws TwitterException
Returns the members of the specified list.
This method calls http://api.twitter.com/1/[user]/[list_id]/members.json

Specified by:
getUserListMembers in interface ListMembersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list
cursor - Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the members of the specified list.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET /:user/:list_id/members

addUserListMember

public UserList addUserListMember(int listId,
                                  int userId)
                           throws TwitterException
Adds a member to a list. The authenticated user must own the list to be able to add members to it. Lists are limited to having 500 members.
This method calls http://api.twitter.com/1/[listOwner]/[listId]/members.json

Specified by:
addUserListMember in interface ListMembersMethods
Parameters:
listId - The id of the list.
userId - The id of the user to add as a member of the list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: POST /:user/:id/members

deleteUserListMember

public UserList deleteUserListMember(int listId,
                                     int userId)
                              throws TwitterException
Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list.
This method calls http://api.twitter.com/1/[listOwner]/[listId]/members.json

Specified by:
deleteUserListMember in interface ListMembersMethods
Parameters:
listId - The id of the list.
userId - The screen name of the member you wish to remove from the list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: DELETE /:user/:list_id/members

checkUserListMembership

public User checkUserListMembership(java.lang.String listOwnerScreenName,
                                    int listId,
                                    int userId)
                             throws TwitterException
Check if a user is a member of the specified list.

This method calls http://api.twitter.com/1/[listOwner]/[listId]/members/id.json

Specified by:
checkUserListMembership in interface ListMembersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list.
userId - The id of the user who you want to know is a member or not of the specified list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
See Also:
Twitter REST API Method: GET /:user/:list_id/members/:id

getUserListSubscribers

public PagableResponseList<User> getUserListSubscribers(java.lang.String listOwnerScreenName,
                                                        int listId,
                                                        long cursor)
                                                 throws TwitterException
Returns the subscribers of the specified list.
This method calls http://api.twitter.com/1/[user]/[list_id]/subscribers.json

Specified by:
getUserListSubscribers in interface ListSubscribersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list
cursor - Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Returns:
the members of the specified list.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET /:user/:list_id/members

subscribeUserList

public UserList subscribeUserList(java.lang.String listOwnerScreenName,
                                  int listId)
                           throws TwitterException
Make the authenticated user follow the specified list.
This method calls http://api.twitter.com/1/[listOwner]/[listId]/subscribers.json

Specified by:
subscribeUserList in interface ListSubscribersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: POST /:user/:id/members

unsubscribeUserList

public UserList unsubscribeUserList(java.lang.String listOwnerScreenName,
                                    int listId)
                             throws TwitterException
Unsubscribes the authenticated user form the specified list.
This method calls http://api.twitter.com/1/[listOwner]/[listId]/subscribers.json

Specified by:
unsubscribeUserList in interface ListSubscribersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: DELETE /:user/:list_id/members

checkUserListSubscription

public User checkUserListSubscription(java.lang.String listOwnerScreenName,
                                      int listId,
                                      int userId)
                               throws TwitterException
Check if the specified user is a subscriber of the specified list.
This method calls http://api.twitter.com/1/[listOwner]/[listId]/subscribers/[userId].json

Specified by:
checkUserListSubscription in interface ListSubscribersMethods
Parameters:
listOwnerScreenName - The screen name of the list owner
listId - The id of the list.
userId - The id of the user who you want to know is a member or not of the specified list.
Returns:
the updated list
Throws:
TwitterException - when Twitter service or network is unavailable , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
See Also:
Twitter REST API Method: GET /:user/:list_id/subscribers/:id

getDirectMessages

public ResponseList<DirectMessage> getDirectMessages()
                                              throws TwitterException
Returns a list of the direct messages sent to the authenticating user.
This method calls http://api.twitter.com/1/direct_messages

Specified by:
getDirectMessages in interface DirectMessageMethods
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages

getDirectMessages

public ResponseList<DirectMessage> getDirectMessages(Paging paging)
                                              throws TwitterException
Returns a list of the direct messages sent to the authenticating user.
This method calls http://api.twitter.com/1/direct_messages

Specified by:
getDirectMessages in interface DirectMessageMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages

getSentDirectMessages

public ResponseList<DirectMessage> getSentDirectMessages()
                                                  throws TwitterException
Returns a list of the direct messages sent by the authenticating user.
This method calls http://api.twitter.com/1/direct_messages/sent

Specified by:
getSentDirectMessages in interface DirectMessageMethods
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages sent

getSentDirectMessages

public ResponseList<DirectMessage> getSentDirectMessages(Paging paging)
                                                  throws TwitterException
Returns a list of the direct messages sent by the authenticating user.
This method calls http://api.twitter.com/1/direct_messages/sent

Specified by:
getSentDirectMessages in interface DirectMessageMethods
Parameters:
paging - controls pagination. Supports since_id, max_id, count and page parameters.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages sent

sendDirectMessage

public DirectMessage sendDirectMessage(java.lang.String screenName,
                                       java.lang.String text)
                                throws TwitterException
Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls http://api.twitter.com/1/direct_messages/new

Specified by:
sendDirectMessage in interface DirectMessageMethods
Parameters:
screenName - the screen name of the user to whom send the direct message
text - The text of your direct message.
Returns:
DirectMessage
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages new

sendDirectMessage

public DirectMessage sendDirectMessage(int userId,
                                       java.lang.String text)
                                throws TwitterException
Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters below. The text will be trimmed if the length of the text is exceeding 140 characters.
This method calls http://api.twitter.com/1/direct_messages/new

Specified by:
sendDirectMessage in interface DirectMessageMethods
Parameters:
userId - the screen name of the user to whom send the direct message
text - The text of your direct message.
Returns:
DirectMessage
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages new

destroyDirectMessage

public DirectMessage destroyDirectMessage(int id)
                                   throws TwitterException
Destroys the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct message.
This method calls http://api.twitter.com/1/direct_messages/destroy

Specified by:
destroyDirectMessage in interface DirectMessageMethods
Parameters:
id - the ID of the direct message to destroy
Returns:
the deleted direct message
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: direct_messages destroy

createFriendship

public User createFriendship(java.lang.String screenName)
                      throws TwitterException
Befriends the user specified in the ID parameter as the authenticating user. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Specified by:
createFriendship in interface FriendshipMethods
Parameters:
screenName - the screen name of the user to be befriended
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships create

createFriendship

public User createFriendship(int userId)
                      throws TwitterException
Befriends the user specified in the ID parameter as the authenticating user. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Specified by:
createFriendship in interface FriendshipMethods
Parameters:
userId - the ID of the user to be befriended
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships create

createFriendship

public User createFriendship(java.lang.String screenName,
                             boolean follow)
                      throws TwitterException
Befriends the user specified in the ID parameter as the authenticating user. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Specified by:
createFriendship in interface FriendshipMethods
Parameters:
screenName - the screen name of the user to be befriended
follow - Enable notifications for the target user in addition to becoming friends.
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships create

createFriendship

public User createFriendship(int userId,
                             boolean follow)
                      throws TwitterException
Befriends the user specified in the ID parameter as the authenticating user. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/create/[id].json

Specified by:
createFriendship in interface FriendshipMethods
Parameters:
userId - the ID of the user to be befriended
follow - Enable notifications for the target user in addition to becoming friends.
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships create

destroyFriendship

public User destroyFriendship(java.lang.String screenName)
                       throws TwitterException
Discontinues friendship with the user specified in the ID parameter as the authenticating user. Returns the un-friended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/destroy/[id].json

Specified by:
destroyFriendship in interface FriendshipMethods
Parameters:
screenName - the screen name of the user for whom to request a list of friends
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships destroy

destroyFriendship

public User destroyFriendship(int userId)
                       throws TwitterException
Discontinues friendship with the user specified in the ID parameter as the authenticating user. Returns the un-friended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
This method calls http://api.twitter.com/1/friendships/destroy/[id].json

Specified by:
destroyFriendship in interface FriendshipMethods
Parameters:
userId - the ID of the user for whom to request a list of friends
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships destroy

existsFriendship

public boolean existsFriendship(java.lang.String userA,
                                java.lang.String userB)
                         throws TwitterException
Tests if a friendship exists between two users.
This method calls http://api.twitter.com/1/friendships/exists.json

Specified by:
existsFriendship in interface FriendshipMethods
Parameters:
userA - The ID or screen_name of the first user to test friendship for.
userB - The ID or screen_name of the second user to test friendship for.
Returns:
if a friendship exists between two users.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships exists

showFriendship

public Relationship showFriendship(java.lang.String sourceScreenName,
                                   java.lang.String targetScreenName)
                            throws TwitterException
Gets the detailed relationship status between a source user and a target user
This method calls http://api.twitter.com/1/friendships/show.json

Specified by:
showFriendship in interface FriendshipMethods
Parameters:
sourceScreenName - the screen name of the source user
targetScreenName - the screen name of the target user
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships show

showFriendship

public Relationship showFriendship(int sourceId,
                                   int targetId)
                            throws TwitterException
Gets the detailed relationship status between a source user and a target user
This method calls http://api.twitter.com/1/friendships/show.json

Specified by:
showFriendship in interface FriendshipMethods
Parameters:
sourceId - the screen ID of the source user
targetId - the screen ID of the target user
Returns:
Relationship
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friendships show

getFriendsIDs

public IDs getFriendsIDs()
                  throws TwitterException
Returns an array of numeric IDs for every user the authenticating user is following.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Returns:
an array of numeric IDs for every user the authenticating user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friends ids

getFriendsIDs

public IDs getFriendsIDs(long cursor)
                  throws TwitterException
Returns an array of numeric IDs for every user the authenticating user is following.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Parameters:
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
an array of numeric IDs for every user the authenticating user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friends ids

getFriendsIDs

public IDs getFriendsIDs(int userId)
                  throws TwitterException
Returns an array of numeric IDs for every user the specified user is following.
all IDs are attempted to be returned, but large sets of IDs will likely fail with timeout errors.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Parameters:
userId - Specifies the ID of the user for whom to return the friends list.
Returns:
an array of numeric IDs for every user the specified user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friends ids

getFriendsIDs

public IDs getFriendsIDs(int userId,
                         long cursor)
                  throws TwitterException
Returns an array of numeric IDs for every user the specified user is following.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Parameters:
userId - Specifies the ID of the user for whom to return the friends list.
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
an array of numeric IDs for every user the specified user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: friends ids

getFriendsIDs

public IDs getFriendsIDs(java.lang.String screenName)
                  throws TwitterException
Returns an array of numeric IDs for every user the specified user is following.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Parameters:
screenName - Specifies the screen name of the user for whom to return the friends list.
Returns:
an array of numeric IDs for every user the specified user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / REST API Documentation - Social Graph Methods - friends/ids

getFriendsIDs

public IDs getFriendsIDs(java.lang.String screenName,
                         long cursor)
                  throws TwitterException
Returns an array of numeric IDs for every user the specified user is following.
This method calls http://api.twitter.com/1/friends/ids.json

Specified by:
getFriendsIDs in interface SocialGraphMethods
Parameters:
screenName - Specifies the screen name of the user for whom to return the friends list.
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
an array of numeric IDs for every user the specified user is following
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / REST API Documentation - Social Graph Methods - friends/ids

getFollowersIDs

public IDs getFollowersIDs()
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

getFollowersIDs

public IDs getFollowersIDs(long cursor)
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Parameters:
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

getFollowersIDs

public IDs getFollowersIDs(int userId)
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Parameters:
userId - Specifies the ID of the user for whom to return the followers list.
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

getFollowersIDs

public IDs getFollowersIDs(int userId,
                           long cursor)
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Parameters:
userId - Specifies the ID of the user for whom to return the followers list.
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

getFollowersIDs

public IDs getFollowersIDs(java.lang.String screenName)
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Parameters:
screenName - Specifies the screen name of the user for whom to return the followers list.
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

getFollowersIDs

public IDs getFollowersIDs(java.lang.String screenName,
                           long cursor)
                    throws TwitterException
Returns an array of numeric IDs for every user the specified user is followed by.
This method calls http://api.twitter.com/1/followers/ids.json

Specified by:
getFollowersIDs in interface SocialGraphMethods
Parameters:
screenName - Specifies the screen name of the user for whom to return the followers list.
cursor - Specifies the page number of the results beginning at 1. A single page contains 5000 ids. This is recommended for users with large ID lists. If not provided all ids are returned.
Returns:
The ID or screen_name of the user to retrieve the friends ID list for.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: followers ids

verifyCredentials

public User verifyCredentials()
                       throws TwitterException
Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid.
This method calls http://api.twitter.com/1/account/verify_credentials.json

Specified by:
verifyCredentials in interface AccountMethods
Returns:
user
Throws:
TwitterException - when Twitter service or network is unavailable, or if supplied credential is wrong (TwitterException.getStatusCode() == 401)
See Also:
Twitter API Wiki / Twitter REST API Method: account verify_credentials

updateProfile

public User updateProfile(java.lang.String name,
                          java.lang.String email,
                          java.lang.String url,
                          java.lang.String location,
                          java.lang.String description)
                   throws TwitterException
Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified(non-null) will be updated.
This method calls http://api.twitter.com/1/account/update_profile.json

Specified by:
updateProfile in interface AccountMethods
Parameters:
name - Optional. Maximum of 20 characters.
email - Optional. Maximum of 40 characters. Must be a valid email address.
url - Optional. Maximum of 100 characters. Will be prepended with "http://" if not present.
location - Optional. Maximum of 30 characters. The contents are not normalized or geocoded in any way.
description - Optional. Maximum of 160 characters.
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Documentation > Account Methods > account/update_location

getRateLimitStatus

public RateLimitStatus getRateLimitStatus()
                                   throws TwitterException
Returns the remaining number of API requests available to the requesting user before the API limit is reached for the current hour. Calls to rate_limit_status do not count against the rate limit. If authentication credentials are provided, the rate limit status for the authenticating user is returned. Otherwise, the rate limit status for the requester's IP address is returned.

This method calls http://api.twitter.com/1/account/rate_limit_status.json

Specified by:
getRateLimitStatus in interface AccountMethods
Returns:
the rate limit status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: account rate_limit_status

updateDeliveryDevice

public User updateDeliveryDevice(Device device)
                          throws TwitterException
Sets which device Twitter delivers updates to for the authenticating user. Sending none as the device parameter will disable IM or SMS updates.
This method calls http://api.twitter.com/1/account/update_delivery_device.json

Specified by:
updateDeliveryDevice in interface AccountMethods
Parameters:
device - new Delivery device. Must be one of: IM, SMS, NONE.
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: account update_delivery_device

updateProfileColors

public User updateProfileColors(java.lang.String profileBackgroundColor,
                                java.lang.String profileTextColor,
                                java.lang.String profileLinkColor,
                                java.lang.String profileSidebarFillColor,
                                java.lang.String profileSidebarBorderColor)
                         throws TwitterException
Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. These values are also returned in the verifyCredentials() method.
This method calls http://api.twitter.com/1/account/update_profile_colors.json

Specified by:
updateProfileColors in interface AccountMethods
Parameters:
profileBackgroundColor - optional, can be null
profileTextColor - optional, can be null
profileLinkColor - optional, can be null
profileSidebarFillColor - optional, can be null
profileSidebarBorderColor - optional, can be null
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: account update_profile_colors

addParameterToList

private void addParameterToList(java.util.List<twitter4j.internal.http.HttpParameter> colors,
                                java.lang.String paramName,
                                java.lang.String color)

updateProfileImage

public User updateProfileImage(java.io.File image)
                        throws TwitterException
Updates the authenticating user's profile image.
This method calls http://api.twitter.com/1/account/update_profile_image.json

Specified by:
updateProfileImage in interface AccountMethods
Parameters:
image - Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 500 pixels will be scaled down.
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable, or when the specified file is not found (FileNotFoundException will be nested), or when the specified file object in not representing a file (IOException will be nested)
See Also:
Twitter API Wiki / Twitter REST API Method: account update_profile_image

updateProfileBackgroundImage

public User updateProfileBackgroundImage(java.io.File image,
                                         boolean tile)
                                  throws TwitterException
Updates the authenticating user's profile background image.
This method calls http://api.twitter.com/1/account/update_profile_background_image.json

Specified by:
updateProfileBackgroundImage in interface AccountMethods
Parameters:
image - Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forceably scaled down.
tile - If set to true the background image will be displayed tiled. The image will not be tiled otherwise.
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable, or when the specified file is not found (FileNotFoundException will be nested), or when the specified file object in not representing a file (IOException will be nested)
See Also:
Twitter API Wiki / Twitter REST API Method: account update_profile_background_image

checkFileValidity

private void checkFileValidity(java.io.File image)
                        throws TwitterException
Check the existence, and the type of the specified file.

Parameters:
image - image to be uploaded
Throws:
TwitterException - when the specified file is not found (FileNotFoundException will be nested) , or when the specified file object is not representing a file(IOException will be nested).

getFavorites

public ResponseList<Status> getFavorites()
                                  throws TwitterException
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
This method calls http://api.twitter.com/1/favorites.json

Specified by:
getFavorites in interface FavoriteMethods
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites

getFavorites

public ResponseList<Status> getFavorites(int page)
                                  throws TwitterException
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
This method calls http://api.twitter.com/1/favorites.json

Specified by:
getFavorites in interface FavoriteMethods
Parameters:
page - the number of page
Returns:
ResponseList
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites

getFavorites

public ResponseList<Status> getFavorites(java.lang.String id)
                                  throws TwitterException
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.

Specified by:
getFavorites in interface FavoriteMethods
Parameters:
id - the ID or screen name of the user for whom to request a list of favorite statuses
Returns:
ResponseList
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites

getFavorites

public ResponseList<Status> getFavorites(java.lang.String id,
                                         int page)
                                  throws TwitterException
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
This method calls http://api.twitter.com/1/favorites/[id].json

Specified by:
getFavorites in interface FavoriteMethods
Parameters:
id - the ID or screen name of the user for whom to request a list of favorite statuses
page - the number of page
Returns:
ResponseList
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites

createFavorite

public Status createFavorite(long id)
                      throws TwitterException
Favorites the status specified in the ID parameter as the authenticating user. Returns the favorite status when successful.
This method calls http://api.twitter.com/1/favorites/create/[id].json

Specified by:
createFavorite in interface FavoriteMethods
Parameters:
id - the ID of the status to favorite
Returns:
Status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites create

destroyFavorite

public Status destroyFavorite(long id)
                       throws TwitterException
Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful.
This method calls http://api.twitter.com/1/favorites/destroy/[id].json

Specified by:
destroyFavorite in interface FavoriteMethods
Parameters:
id - the ID of the status to un-favorite
Returns:
Status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: favorites destroy

enableNotification

public User enableNotification(java.lang.String screenName)
                        throws TwitterException
Enables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
This method calls http://api.twitter.com/1/notifications/follow/[id].json

Specified by:
enableNotification in interface NotificationMethods
Parameters:
screenName - Specifies the screen name of the user to follow with device updates.
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: notifications follow

enableNotification

public User enableNotification(int userId)
                        throws TwitterException
Enables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
This method calls http://api.twitter.com/1/notifications/follow/[id].json

Specified by:
enableNotification in interface NotificationMethods
Parameters:
userId - Specifies the ID of the user to follow with device updates.
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: notifications follow

disableNotification

public User disableNotification(java.lang.String screenName)
                         throws TwitterException
Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
This method calls http://api.twitter.com/1/notifications/leave/[id].json

Specified by:
disableNotification in interface NotificationMethods
Parameters:
screenName - Specifies the screen name of the user to disable device notifications.
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: notifications leave

disableNotification

public User disableNotification(int userId)
                         throws TwitterException
Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
This method calls http://api.twitter.com/1/notifications/leave/[id].json

Specified by:
disableNotification in interface NotificationMethods
Parameters:
userId - Specifies the ID of the user to disable device notifications.
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: notifications leave

createBlock

public User createBlock(java.lang.String screenName)
                 throws TwitterException
Blocks the user specified in the ID parameter as the authenticating user. Returns the blocked user in the requested format when successful.
This method calls http://api.twitter.com/1/blocks/create/[id].json

Specified by:
createBlock in interface BlockMethods
Parameters:
screenName - the screen_name of the user to block
Returns:
the blocked user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks create

createBlock

public User createBlock(int userId)
                 throws TwitterException
Blocks the user specified in the ID parameter as the authenticating user. Returns the blocked user in the requested format when successful.
This method calls http://api.twitter.com/1/blocks/create/[id].json

Specified by:
createBlock in interface BlockMethods
Parameters:
userId - the ID of the user to block
Returns:
the blocked user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks create

destroyBlock

public User destroyBlock(java.lang.String screen_name)
                  throws TwitterException
Un-blocks the user specified in the ID parameter as the authenticating user. Returns the un-blocked user in the requested format when successful.
This method calls http://api.twitter.com/1/blocks/destroy/[id].json

Specified by:
destroyBlock in interface BlockMethods
Parameters:
screen_name - the screen_name of the user to block
Returns:
the unblocked user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks destroy

destroyBlock

public User destroyBlock(int userId)
                  throws TwitterException
Un-blocks the user specified in the ID parameter as the authenticating user. Returns the un-blocked user in the requested format when successful.
This method calls http://api.twitter.com/1/blocks/destroy/[id].json

Specified by:
destroyBlock in interface BlockMethods
Parameters:
userId - the ID of the user to block
Returns:
the unblocked user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks destroy

existsBlock

public boolean existsBlock(java.lang.String screenName)
                    throws TwitterException
Tests if a friendship exists between two users.
This method calls http://api.twitter.com/1/blocks/exists/[id].json

Specified by:
existsBlock in interface BlockMethods
Parameters:
screenName - The screen_name of the potentially blocked user.
Returns:
if the authenticating user is blocking a target user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks exists

existsBlock

public boolean existsBlock(int userId)
                    throws TwitterException
Tests if a friendship exists between two users.
This method calls http://api.twitter.com/1/blocks/exists/[id].json

Specified by:
existsBlock in interface BlockMethods
Parameters:
userId - The ID of the potentially blocked user.
Returns:
if the authenticating user is blocking a target user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks exists

getBlockingUsers

public ResponseList<User> getBlockingUsers()
                                    throws TwitterException
Returns a list of user objects that the authenticating user is blocking.
This method calls http://api.twitter.com/1/blocks/blocking.json

Specified by:
getBlockingUsers in interface BlockMethods
Returns:
a list of user objects that the authenticating user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks blocking

getBlockingUsers

public ResponseList<User> getBlockingUsers(int page)
                                    throws TwitterException
Returns a list of user objects that the authenticating user is blocking.
This method calls http://api.twitter.com/1/blocks/blocking.json

Specified by:
getBlockingUsers in interface BlockMethods
Parameters:
page - the number of page
Returns:
a list of user objects that the authenticating user
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks blocking

getBlockingUsersIDs

public IDs getBlockingUsersIDs()
                        throws TwitterException
Returns an array of numeric user ids the authenticating user is blocking.
This method calls http://api.twitter.com/1/blocks/blocking/ids

Specified by:
getBlockingUsersIDs in interface BlockMethods
Returns:
Returns an array of numeric user ids the authenticating user is blocking.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: blocks blocking ids

reportSpam

public User reportSpam(int userId)
                throws TwitterException
The user specified in the id is blocked by the authenticated user and reported as a spammer.
This method calls http://api.twitter.com/1/report_spam.json

Specified by:
reportSpam in interface SpamReportingMethods
Parameters:
userId - The ID of the user you want to report as a spammer.
Returns:
The User reported as a spammer.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: report_spam

reportSpam

public User reportSpam(java.lang.String screenName)
                throws TwitterException
The user specified in the id is blocked by the authenticated user and reported as a spammer.
This method calls http://api.twitter.com/1/report_spam.json

Specified by:
reportSpam in interface SpamReportingMethods
Parameters:
screenName - The screen name of the user you want to report as a spammer.
Returns:
The User reported as a spammer.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: report_spam

getSavedSearches

public java.util.List<SavedSearch> getSavedSearches()
                                             throws TwitterException
Returns the authenticated user's saved search queries.
This method calls http://api.twitter.com/1/saved_searches.json

Specified by:
getSavedSearches in interface SavedSearchesMethods
Returns:
Returns an array of numeric user ids the authenticating user is blocking.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: saved_searches

showSavedSearch

public SavedSearch showSavedSearch(int id)
                            throws TwitterException
Retrieve the data for a saved search owned by the authenticating user specified by the given id.
This method calls http://api.twitter.com/1/saved_searches/show/id.json

Specified by:
showSavedSearch in interface SavedSearchesMethods
Parameters:
id - The id of the saved search to be retrieved.
Returns:
the data for a saved search
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: saved_searches show

createSavedSearch

public SavedSearch createSavedSearch(java.lang.String query)
                              throws TwitterException
Retrieve the data for a saved search owned by the authenticating user specified by the given id.
This method calls http://api.twitter.com/1/saved_searches/saved_searches/create.json

Specified by:
createSavedSearch in interface SavedSearchesMethods
Parameters:
query - the query string
Returns:
the data for a created saved search
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: saved_searches create

destroySavedSearch

public SavedSearch destroySavedSearch(int id)
                               throws TwitterException
Destroys a saved search for the authenticated user. The search specified by id must be owned by the authenticating user.
This method calls http://api.twitter.com/1/saved_searches/destroy/id.json

Specified by:
destroySavedSearch in interface SavedSearchesMethods
Parameters:
id - The id of the saved search to be deleted.
Returns:
the data for a destroyed saved search
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: saved_searches destroy

getAvailableTrends

public ResponseList<Location> getAvailableTrends()
                                          throws TwitterException
Returns the locations that Twitter has trending topic information for. The response is an array of "locations" that encode the location's WOEID (a Yahoo! Where On Earth ID) and some other human-readable information such as a canonical name and country the location belongs in.
This method calls http://api.twitter.com/1/trends/available.json

Specified by:
getAvailableTrends in interface LocalTrendsMethods
Returns:
the locations
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET /:user/:list_id/members

getAvailableTrends

public ResponseList<Location> getAvailableTrends(GeoLocation location)
                                          throws TwitterException
Returns the sorted locations that Twitter has trending topic information for. The response is an array of "locations" that encode the location's WOEID (a Yahoo! Where On Earth ID) and some other human-readable information such as a canonical name and country the location belongs in.
This method calls http://api.twitter.com/1/trends/available.json

Specified by:
getAvailableTrends in interface LocalTrendsMethods
Parameters:
location - the available trend locations will be sorted by distance to the lat and long passed in. The sort is nearest to furthest.
Returns:
the locations
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: GET /:user/:list_id/members

getLocationTrends

public Trends getLocationTrends(int woeid)
                         throws TwitterException
Returns the top 10 trending topics for a specific location Twitter has trending topic information for. The response is an array of "trend" objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Search, and the direct URL that can be issued against Search. This information is cached for five minutes, and therefore users are discouraged from querying these endpoints faster than once every five minutes. Global trends information is also available from this API by using a WOEID of 1.
This method calls http://api.twitter.com/1/trends/[woeid].json

Specified by:
getLocationTrends in interface LocalTrendsMethods
Parameters:
woeid - The WOEID of the location to be querying for
Returns:
trends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter REST API Method: trends location

getNearbyPlaces

public ResponseList<Place> getNearbyPlaces(GeoQuery query)
                                    throws TwitterException
Search for places (cities and neighborhoods) that can be attached to a statuses/update. Given a latitude and a longitude pair, or an IP address, return a list of all the valid cities and neighborhoods that can be used as a place_id when updating a status. Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the ID of this location up with a call to statuses/update.
This method calls http://api.twitter.com/1/geo/nearby_places.json

Specified by:
getNearbyPlaces in interface GeoMethods
Parameters:
query - search query
Returns:
places (cities and neighborhoods) that can be attached to a statuses/update
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: GET geo nearby_places

reverseGeoCode

public ResponseList<Place> reverseGeoCode(GeoQuery query)
                                   throws TwitterException
Search for places (cities and neighborhoods) that can be attached to a statuses/update. Given a latitude and a longitude, return a list of all the valid places that can be used as a place_id when updating a status. Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the ID of this location up with a call to statuses/update.
This method calls http://api.twitter.com/1/geo/reverse_geocode.json

Specified by:
reverseGeoCode in interface GeoMethods
Parameters:
query - search query
Returns:
places (cities and neighborhoods) that can be attached to a statuses/update
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: GET geo reverse_geocode

getGeoDetails

public Place getGeoDetails(java.lang.String id)
                    throws TwitterException
Find out more details of a place that was returned from the geo/reverse_geocode method.
This method calls http://api.twitter.com/1/geo/id/:id.json

Specified by:
getGeoDetails in interface GeoMethods
Parameters:
id - The ID of the location to query about.
Returns:
details of the specified place
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:

test

public boolean test()
             throws TwitterException
Returns the string "ok" in the requested format with a 200 OK HTTP status code.

Specified by:
test in interface HelpMethods
Returns:
true if the API is working
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki / Twitter REST API Method: help test

getOAuth

private OAuthSupport getOAuth()

setOAuthConsumer

public void setOAuthConsumer(java.lang.String consumerKey,
                             java.lang.String consumerSecret)
sets the OAuth consumer key and consumer secret

Specified by:
setOAuthConsumer in class TwitterOAuthSupportBase
Parameters:
consumerKey - OAuth consumer key
consumerSecret - OAuth consumer secret

getOAuthRequestToken

public RequestToken getOAuthRequestToken()
                                  throws TwitterException
Retrieves a request token

Specified by:
getOAuthRequestToken in interface OAuthSupport
Specified by:
getOAuthRequestToken in class TwitterOAuthSupportBase
Returns:
generated request token.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki - OAuth FAQ, OAuth Core 1.0a - 6.1. Obtaining an Unauthorized Request Token

getOAuthRequestToken

public RequestToken getOAuthRequestToken(java.lang.String callbackUrl)
                                  throws TwitterException
Retrieves a request token

Specified by:
getOAuthRequestToken in interface OAuthSupport
Specified by:
getOAuthRequestToken in class TwitterOAuthSupportBase
Parameters:
callbackUrl - callback URL
Returns:
generated request token
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API Wiki - OAuth FAQ, OAuth Core 1.0a - 6.1. Obtaining an Unauthorized Request Token

getOAuthAccessToken

public AccessToken getOAuthAccessToken()
                                throws TwitterException
Returns an access token associated with this instance.
If no access token is associated with this instance, this will retrieve a new access token. Basic authenticated instance of this class will try acquiring an AccessToken using xAuth.
In order to get access acquire AccessToken using xAuth, you must apply by sending an email to api@twitter.com all other applications will receive an HTTP 401 error. Web-based applications will not be granted access, except on a temporary basis for when they are converting from basic-authentication support to full OAuth support.
Storage of Twitter usernames and passwords is forbidden. By using xAuth, you are required to store only access tokens and access token secrets. If the access token expires or is expunged by a user, you must ask for their login and password again before exchanging the credentials for an access token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Returns:
access token
Throws:
TwitterException - When Twitter service or network is unavailable, when the user has not authorized, or when the client application is not permitted to use xAuth
See Also:
Twitter REST API Method: oauth access_token for xAuth

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String oauthVerifier)
                                throws TwitterException
Retrieves an access token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
oauthVerifier - OAuth verifier. AKA pin.
Returns:
access token
Throws:
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
Twitter API Wiki - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

getOAuthAccessToken

public AccessToken getOAuthAccessToken(RequestToken requestToken)
                                throws TwitterException
Retrieves an access token associated with the supplied request token and sets userId.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
requestToken - the request token
Returns:
access token associated with the supplied request token.
Throws:
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
Twitter API Wiki - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

getOAuthAccessToken

public AccessToken getOAuthAccessToken(RequestToken requestToken,
                                       java.lang.String oauthVerifier)
                                throws TwitterException
Retrieves an access token associated with the supplied request token and sets userId.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
requestToken - the request token
oauthVerifier - OAuth verifier. AKA pin.
Returns:
access token associated with the supplied request token.
Throws:
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
OAuth Core 1.0a - 6.2. Obtaining User Authorization

setOAuthAccessToken

public void setOAuthAccessToken(AccessToken accessToken)
Deprecated. Use TwitterFactory.getInstance(AccessToken accessToken)

Sets the access token

Specified by:
setOAuthAccessToken in interface OAuthSupport
Specified by:
setOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
accessToken - accessToken

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String token,
                                       java.lang.String tokenSecret)
                                throws TwitterException
Deprecated. Use TwitterFactory.getInstance(AccessToken accessToken)

Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Throws:
TwitterException

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String token,
                                       java.lang.String tokenSecret,
                                       java.lang.String pin)
                                throws TwitterException
Retrieves an access token associated with the supplied request token.

Specified by:
getOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
token - request token
tokenSecret - request token secret
pin - pin
Returns:
access token associated with the supplied request token.
Throws:
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
Twitter API Wiki - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

setOAuthAccessToken

public void setOAuthAccessToken(java.lang.String token,
                                java.lang.String tokenSecret)
Deprecated. Use Twitter getInstance(AccessToken accessToken)

Sets the access token

Specified by:
setOAuthAccessToken in class TwitterOAuthSupportBase
Parameters:
token - access token
tokenSecret - access token secret
Throws:
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
Since:
Twitter 2.0.0

isOAuthEnabled

public boolean isOAuthEnabled()
tests if the instance is authenticated by Basic

Overrides:
isOAuthEnabled in class TwitterOAuthSupportBase
Returns:
returns true if the instance is authenticated by Basic

toString

public java.lang.String toString()
Overrides:
toString in class TwitterBase