twitter4j
Class Twitter

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

public class Twitter
extends TwitterOAuthSupportBaseImpl
implements java.io.Serializable, SearchMethods, TrendsMethods, TimelineMethods, StatusMethods, UserMethods, ListMethods, ListMembersMethods, ListSubscribersMethods, DirectMessageMethods, FriendshipMethods, FriendsFollowersMethods, 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.
Currently this class is not carefully designed to be extended. It is suggested to extend this class only for mock testing purporse.

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

Field Summary
private static long serialVersionUID
           
 
Fields inherited from class twitter4j.TwitterOAuthSupportBaseImpl
id, screenName
 
Fields inherited from class twitter4j.TwitterOAuthSupportBase
http, rateLimitStatusListener
 
Fields inherited from class twitter4j.TwitterBase
auth, conf
 
Fields inherited from interface twitter4j.internal.http.HttpResponseCode
BAD_GATEWAY, BAD_REQUEST, ENHANCE_YOUR_CLAIM, FORBIDDEN, INTERNAL_SERVER_ERROR, MULTIPLE_CHOICES, NOT_ACCEPTABLE, NOT_FOUND, NOT_MODIFIED, OK, SERVICE_UNAVAILABLE, UNAUTHORIZED
 
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(String,String) 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)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(int userId, boolean follow)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(java.lang.String screenName)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 User createFriendship(java.lang.String screenName, boolean follow)
          Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
 SavedSearch createSavedSearch(java.lang.String query)
          Creates a saved search for the authenticated user.
 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)
          Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful.
 User destroyFriendship(java.lang.String screenName)
          Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful.
 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.
Usage note: The authenticating user must be the author of the specified status.
 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)
          Returns if the authenticating user is blocking a target user.
 boolean existsBlock(java.lang.String screenName)
          Returns if the authenticating user is blocking a target user.
 boolean existsFriendship(java.lang.String userA, java.lang.String userB)
          Tests for the existence of friendship 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 a user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(int userId)
          Returns a user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(int userId, long cursor)
          Returns a user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(long cursor)
          Returns a user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(java.lang.String screenName)
          Returns a user's friends, each with current status inline.
 PagableResponseList<User> getFriendsStatuses(java.lang.String screenName, long cursor)
          Returns a user's friends, each with current status inline.
 ResponseList<Status> getFriendsTimeline()
          Returns the 20 most recent statuses posted by the authenticating user and that user's friends.
 ResponseList<Status> getFriendsTimeline(Paging paging)
          Returns the 20 most recent statuses posted by the authenticating user and that user's friends.
 Place getGeoDetails(java.lang.String id)
          Find out more details of a place that was returned from the GeoMethodsAsync.reverseGeoCode(twitter4j.GeoQuery) 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.
 IDs getIncomingFriendships(long cursor)
          Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
 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.
 IDs getOutgoingFriendships(long cursor)
          Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
 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<User> getRetweetedBy(long statusId)
          Show user objects of up to 100 members who retweeted the status.
 ResponseList<User> getRetweetedBy(long statusId, Paging paging)
          Show user objects of up to 100 members who retweeted the status.
 IDs getRetweetedByIDs(long statusId)
          Show user ids of up to 100 users who retweeted the status represented by id
This method calls http://api.twitter.com/1/statuses/id/retweeted_by/ids.format
 IDs getRetweetedByIDs(long statusId, Paging paging)
          Show user ids of up to 100 users who retweeted the status.
 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.
It is recommended that end clients cache this data for no more than one hour.
 ResponseList<Status> getUserTimeline()
          Returns the 20 most recent statuses posted from the authenticating user.
 ResponseList<Status> getUserTimeline(int userId)
          Returns the 20 most recent statuses posted from the authenticating user.
 ResponseList<Status> getUserTimeline(int userId, Paging paging)
          Returns the 20 most recent statuses posted from the authenticating user.
 ResponseList<Status> getUserTimeline(Paging paging)
          Returns the 20 most recent statuses posted from the authenticating user.
 ResponseList<Status> getUserTimeline(java.lang.String screenName)
          Returns the 20 most recent statuses posted from the authenticating user.
 ResponseList<Status> getUserTimeline(java.lang.String screenName, Paging paging)
          Returns the 20 most recent statuses posted from the authenticating user.
 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.
 ResponseList<User> lookupUsers(int[] ids)
          Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
 ResponseList<User> lookupUsers(java.lang.String[] screenNames)
          Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
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 the Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API.
Usage note: It is only possible to retrieve the first 1000 matches from this API.
 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.
 Relationship showFriendship(int sourceId, int targetId)
          Returns detailed information about the relationship between two users.
 Relationship showFriendship(java.lang.String sourceScreenName, java.lang.String targetScreenName)
          Returns detailed information about the relationship between two users.
 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 below.
 User showUser(int userId)
          Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
 User showUser(java.lang.String screenName)
          Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
 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 authenticating user's status.
 Status updateStatus(java.lang.String status)
          Updates the authenticating user's status.
 Status updateStatus(java.lang.String status, GeoLocation location)
          Updates the authenticating user's status.
 Status updateStatus(java.lang.String status, long inReplyToStatusId)
          Updates the authenticating user's status.
 Status updateStatus(java.lang.String status, long inReplyToStatusId, GeoLocation location)
          Updates the authenticating 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.TwitterOAuthSupportBaseImpl
getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, isOAuthEnabled, setOAuthAccessToken, setOAuthAccessToken, setOAuthConsumer
 
Methods inherited from class twitter4j.TwitterOAuthSupportBase
equals, hashCode, httpResponseReceived, setRateLimitStatusListener, shutdown
 
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
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(String,String) 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.json

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:
GET search | dev.twitter.com, Twitter API / Search Operators

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.json

Specified by:
getTrends in interface TrendsMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET trends | dev.twitter.com

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.json

Specified by:
getCurrentTrends in interface TrendsMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET trends/current | dev.twitter.com

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.json

Specified by:
getCurrentTrends in interface TrendsMethods
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:
GET trends/current | dev.twitter.com

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.json

Specified by:
getDailyTrends in interface TrendsMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET trends/daily | dev.twitter.com

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.json

Specified by:
getDailyTrends in interface TrendsMethods
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:
GET trends/daily | dev.twitter.com

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.json

Specified by:
getWeeklyTrends in interface TrendsMethods
Returns:
the result
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET trends/weekly | dev.twitter.com

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.json

Specified by:
getWeeklyTrends in interface TrendsMethods
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:
GET trends/weekly | dev.twitter.com

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 and requesting it more often than that is unproductive and 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:
GET statuses/public_timeline | dev.twitter.com

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.
Usage note: This home_timeline call is identical to statuses/friends_timeline, except that home_timeline also contains retweets, while statuses/friends_timeline does not for backwards compatibility reasons. In a future version of the API, statuses/friends_timeline will be deprected and replaced by home_timeline.
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:
GET statuses/home_timeline | dev.twitter.com

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.
Usage note: This home_timeline call is identical to statuses/friends_timeline, except that home_timeline also contains retweets, while statuses/friends_timeline does not for backwards compatibility reasons. In a future version of the API, statuses/friends_timeline will be deprected and replaced by home_timeline.
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:
GET statuses/home_timeline | dev.twitter.com

getFriendsTimeline

public ResponseList<Status> getFriendsTimeline()
                                        throws TwitterException
Returns the 20 most recent statuses 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/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:
GET statuses/friends_timeline | dev.twitter.com

getFriendsTimeline

public ResponseList<Status> getFriendsTimeline(Paging paging)
                                        throws TwitterException
Returns the 20 most recent statuses 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/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:
GET statuses/friends_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline(java.lang.String screenName,
                                            Paging paging)
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline(int userId,
                                            Paging paging)
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline(java.lang.String screenName)
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline(int userId)
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline()
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

getUserTimeline

public ResponseList<Status> getUserTimeline(Paging paging)
                                     throws TwitterException
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.

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:
GET statuses/user_timeline | dev.twitter.com

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:
GET statuses/mentions | dev.twitter.com

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:
GET statuses/mentions | dev.twitter.com

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:
GET statuses/retweeted_by_me | dev.twitter.com

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:
GET statuses/retweeted_by_me | dev.twitter.com

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:
GET statuses/retweeted_to_me | dev.twitter.com

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:
GET statuses/retweeted_to_me | dev.twitter.com

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 StatusMethods
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:
GET statuses/retweets_of_me | dev.twitter.com

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 StatusMethods
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:
GET statuses/retweets_of_me | dev.twitter.com

getRetweetedBy

public ResponseList<User> getRetweetedBy(long statusId)
                                  throws TwitterException
Show user objects of up to 100 members who retweeted the status.
This method calls http://api.twitter.com/1/statuses/id/retweeted_by

Specified by:
getRetweetedBy in interface StatusMethods
Parameters:
statusId - The ID of the status you want to get retweeters of
Returns:
the list of users who retweeted your status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/:id/retweeted_by | dev.twitter.com

getRetweetedBy

public ResponseList<User> getRetweetedBy(long statusId,
                                         Paging paging)
                                  throws TwitterException
Show user objects of up to 100 members who retweeted the status.
This method calls http://api.twitter.com/1/statuses/id/retweeted_by

Specified by:
getRetweetedBy in interface StatusMethods
Parameters:
statusId - The ID of the status you want to get retweeters of
paging - specify your paging requirements
Returns:
the list of users who retweeted your status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/:id/retweeted_by | dev.twitter.com

getRetweetedByIDs

public IDs getRetweetedByIDs(long statusId)
                      throws TwitterException
Show user ids of up to 100 users who retweeted the status represented by id
This method calls http://api.twitter.com/1/statuses/id/retweeted_by/ids.format

Specified by:
getRetweetedByIDs in interface StatusMethods
Parameters:
statusId - The ID of the status you want to get retweeters of
Returns:
IDs of users who retweeted the stats
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/:id/retweeted_by/ids | dev.twitter.com

getRetweetedByIDs

public IDs getRetweetedByIDs(long statusId,
                             Paging paging)
                      throws TwitterException
Show user ids of up to 100 users who retweeted the status.
This method calls http://api.twitter.com/1/statuses/id/retweeted_by/ids.format

Specified by:
getRetweetedByIDs in interface StatusMethods
Parameters:
statusId - The ID of the status you want to get retweeters of
paging - specify your paging requirements
Returns:
IDs of users who retweeted the stats
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/:id/retweeted_by/ids | dev.twitter.com

showStatus

public Status showStatus(long id)
                  throws TwitterException
Returns a single status, specified by the id parameter below. 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:
GET statuses/show | dev.twitter.com

updateStatus

public Status updateStatus(java.lang.String status)
                    throws TwitterException
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
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:
POST statuses/update | dev.twitter.com

updateStatus

public Status updateStatus(java.lang.String status,
                           GeoLocation location)
                    throws TwitterException
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
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:
POST statuses/update | dev.twitter.com

updateStatus

public Status updateStatus(java.lang.String status,
                           long inReplyToStatusId)
                    throws TwitterException
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
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:
POST statuses/update | dev.twitter.com

updateStatus

public Status updateStatus(java.lang.String status,
                           long inReplyToStatusId,
                           GeoLocation location)
                    throws TwitterException
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
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:
POST statuses/update | dev.twitter.com

updateStatus

public Status updateStatus(StatusUpdate latestStatus)
                    throws TwitterException
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
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 - when Twitter service or network is unavailable
See Also:
POST statuses/update | dev.twitter.com

destroyStatus

public Status destroyStatus(long statusId)
                     throws TwitterException
Destroys the status specified by the required ID parameter.
Usage note: 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:
POST statuses/destroy | dev.twitter.com

retweetStatus

public Status retweetStatus(long statusId)
                     throws TwitterException
Retweets a tweet. 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:
POST statuses/retweet/:id | dev.twitter.com

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:
Tweets Resources › statuses/retweets

showUser

public User showUser(java.lang.String screenName)
              throws TwitterException
Returns extended information of a given user, specified by ID or screen name as per the required id parameter. The author's most recent status will be returned inline.
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:
GET users/show | dev.twitter.com

showUser

public User showUser(int userId)
              throws TwitterException
Returns extended information of a given user, specified by ID or screen name as per the required id parameter. The author's most recent status will be returned inline.
This method calls http://api.twitter.com/1/users/show.json

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:
GET users/show | dev.twitter.com

lookupUsers

public ResponseList<User> lookupUsers(java.lang.String[] screenNames)
                               throws TwitterException
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline.
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:
GET users/lookup | dev.twitter.com

lookupUsers

public ResponseList<User> lookupUsers(int[] ids)
                               throws TwitterException
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline.
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:
GET users/lookup | dev.twitter.com

searchUsers

public ResponseList<User> searchUsers(java.lang.String query,
                                      int page)
                               throws TwitterException
Run a search for users similar to the Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API.
Usage note: 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:
GET users/search | dev.twitter.com

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
See Also:
GET users/suggestions | dev.twitter.com

getUserSuggestions

public ResponseList<User> getUserSuggestions(java.lang.String categorySlug)
                                      throws TwitterException
Access the users in a given category of the Twitter suggested user list.
It is recommended that end clients cache this data for no more than one hour.
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
See Also:
GET users/suggestions/slug | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses()
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
This method calls http://api.twitter.com/1/statuses/friends.json

Specified by:
getFriendsStatuses in interface UserMethods
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/friends | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(long cursor)
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
This method calls http://api.twitter.com/1/statuses/friends.json

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:
GET statuses/friends | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(java.lang.String screenName)
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.) This method automatically provides a value of cursor=-1 to begin paging.
This method calls http://api.twitter.com/1/statuses/friends.json

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:
GET statuses/friends | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(int userId)
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.) This method automatically provides a value of cursor=-1 to begin paging.
This method calls http://api.twitter.com/1/statuses/friends.json

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:
GET statuses/friends | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(java.lang.String screenName,
                                                    long cursor)
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
This method calls http://api.twitter.com/1/statuses/friends.json

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:
GET statuses/friends | dev.twitter.com

getFriendsStatuses

public PagableResponseList<User> getFriendsStatuses(int userId,
                                                    long cursor)
                                             throws TwitterException
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
This method calls http://api.twitter.com/1/statuses/friends.json

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:
GET statuses/friends | dev.twitter.com

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.json

Specified by:
getFollowersStatuses in interface UserMethods
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET statuses/followers | dev.twitter.com

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.json

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:
GET statuses/followers | dev.twitter.com

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.json

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:
GET statuses/followers | dev.twitter.com

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.json

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:
GET statuses/followers | dev.twitter.com

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.json

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:
GET statuses/followers | dev.twitter.com

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.json

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:
GET statuses/followers | dev.twitter.com

createUserList

public UserList createUserList(java.lang.String listName,
                               boolean isPublicList,
                               java.lang.String description)
                        throws TwitterException
Creates a new list for the authenticated user. Accounts are limited to 20 lists.
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:
POST :user/lists | dev.twitter.com

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:
POST :user/lists/:id | dev.twitter.com

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:
GET :user/lists | dev.twitter.com

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:
GET :user/lists/:id | dev.twitter.com

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:
DELETE :user/lists/:id | dev.twitter.com

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:
GET :user/lists/:id/statuses | dev.twitter.com

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:
GET :user/lists/memberships | dev.twitter.com

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:
GET :user/lists/subscriptions | dev.twitter.com

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:
GET :user/:list_id/members | dev.twitter.com

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:
POST :user/:list_id/members | dev.twitter.com

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:
DELETE :user/:id/members | dev.twitter.com

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:
GET :user/:list_id/members/:id | dev.twitter.com

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:
GET :user/:list_id/subscribers | dev.twitter.com

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:
POST :user/:list_id/subscribers | dev.twitter.com

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:
DELETE :user/:id/subscribers | dev.twitter.com

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:
GET :user/:list_id/subscribers/:id | dev.twitter.com

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:
GET direct_messages | dev.twitter.com

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:
GET direct_messages | dev.twitter.com

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:
GET direct_messages/sent | dev.twitter.com

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:
GET direct_messages/sent | dev.twitter.com

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:
POST direct_messages/new | dev.twitter.com

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:
POST direct_messages/new | dev.twitter.com

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:
POST direct_messages/destroy | dev.twitter.com

createFriendship

public User createFriendship(java.lang.String screenName)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
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:
POST friendships/create/:id | dev.twitter.com

createFriendship

public User createFriendship(int userId)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
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:
POST friendships/create/:id | dev.twitter.com

createFriendship

public User createFriendship(java.lang.String screenName,
                             boolean follow)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
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:
POST friendships/create/:id | dev.twitter.com

createFriendship

public User createFriendship(int userId,
                             boolean follow)
                      throws TwitterException
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful. If you are already friends with the user an HTTP 403 will be returned.
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:
POST friendships/create/:id | dev.twitter.com

destroyFriendship

public User destroyFriendship(java.lang.String screenName)
                       throws TwitterException
Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed 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:
POST friendships/destroy | dev.twitter.com

destroyFriendship

public User destroyFriendship(int userId)
                       throws TwitterException
Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed 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:
POST friendships/destroy | dev.twitter.com

existsFriendship

public boolean existsFriendship(java.lang.String userA,
                                java.lang.String userB)
                         throws TwitterException
Tests for the existence of friendship between two users. Will return true if user_a follows user_b, otherwise will return false.
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:
GET friendships/exists | dev.twitter.com

showFriendship

public Relationship showFriendship(java.lang.String sourceScreenName,
                                   java.lang.String targetScreenName)
                            throws TwitterException
Returns detailed information about the relationship between two users.
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:
GET friendships/show | dev.twitter.com

showFriendship

public Relationship showFriendship(int sourceId,
                                   int targetId)
                            throws TwitterException
Returns detailed information about the relationship between two users.
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:
GET friendships/show | dev.twitter.com

getIncomingFriendships

public IDs getIncomingFriendships(long cursor)
                           throws TwitterException
Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
This method calls http://api.twitter.com/1/friendships/incoming.json

Specified by:
getIncomingFriendships in interface FriendshipMethods
Parameters:
cursor - Breaks the results into pages. A single page contains 5000 identifiers. Provide a value of -1 to begin paging.
Returns:
an array of numeric IDs for every user who has a pending request to follow the authenticating user.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET friendships/incoming | dev.twitter.com

getOutgoingFriendships

public IDs getOutgoingFriendships(long cursor)
                           throws TwitterException
Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
This method calls http://api.twitter.com/1/friendships/outgoing.json

Specified by:
getOutgoingFriendships in interface FriendshipMethods
Parameters:
cursor - Breaks the results into pages. A single page contains 5000 identifiers. Provide a value of -1 to begin paging.
Returns:
an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
GET friendships/outgoing | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET friends/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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 FriendsFollowersMethods
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:
GET followers/ids | dev.twitter.com

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:
GET account/verify_credentials | dev.twitter.com

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:
POST account/update_profile | dev.twitter.com

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:
GET account/rate_limit_status | dev.twitter.com

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:
POST account/update_delivery_device | dev.twitter.com

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. Each parameter's value must be a valid hexidecimal value, and may be either three or six characters (ex: #fff or #ffffff).
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:
POST account/update_profile_colors | dev.twitter.com

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:
POST account/update_profile_image | dev.twitter.com

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:
POST account/update_profile_background_image | dev.twitter.com

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:
GET favorites | dev.twitter.com

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:
GET favorites | dev.twitter.com

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:
GET favorites | dev.twitter.com

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:
GET favorites | dev.twitter.com

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:
POST favorites/:id/create | dev.twitter.com

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:
POST favorites/destroy | dev.twitter.com

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.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:
POST notifications/follow | dev.twitter.com

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.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:
POST notifications/follow | dev.twitter.com

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.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:
POST notifications/leave | dev.twitter.com

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.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:
POST notifications/leave | dev.twitter.com

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:
POST blocks/create | dev.twitter.com

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:
POST blocks/create | dev.twitter.com

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:
POST blocks/destroy | dev.twitter.com

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:
POST blocks/destroy | dev.twitter.com

existsBlock

public boolean existsBlock(java.lang.String screenName)
                    throws TwitterException
Returns if the authenticating user is blocking a target user. Will return the blocked user's object if a block exists, and error with a HTTP 404 response code otherwise.
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:
GET blocks/exists | dev.twitter.com

existsBlock

public boolean existsBlock(int userId)
                    throws TwitterException
Returns if the authenticating user is blocking a target user. Will return the blocked user's object if a block exists, and error with a HTTP 404 response code otherwise.
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:
GET blocks/exists | dev.twitter.com

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:
GET blocks/blocking | dev.twitter.com

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:
GET blocks/blocking | dev.twitter.com

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:
GET blocks/blocking/ids | dev.twitter.com

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:
POST report_spam | dev.twitter.com

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:
POST report_spam | dev.twitter.com

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:
GET saved_searches | dev.twitter.com

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:
GET saved_searches/show | dev.twitter.com

createSavedSearch

public SavedSearch createSavedSearch(java.lang.String query)
                              throws TwitterException
Creates a saved search for the authenticated user.
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:
POST saved_searches/create | dev.twitter.com

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:
POST saved_searches/destroy | dev.twitter.com

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:
GET trends/available | dev.twitter.com

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:
GET trends/available | dev.twitter.com

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:
GET trends/location/:woeid | dev.twitter.com

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.
There are multiple granularities of places that can be returned -- "neighborhoods", "cities", etc. At this time, only United States data is available through this method.
This API call is meant to be an informative call and will deliver generalized results about geography.
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:
GET geo/reverse_geocode | dev.twitter.com

getGeoDetails

public Place getGeoDetails(java.lang.String id)
                    throws TwitterException
Find out more details of a place that was returned from the GeoMethodsAsync.reverseGeoCode(twitter4j.GeoQuery) 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:
GET geo/id/:place_id | dev.twitter.com

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:
GET help/test | dev.twitter.com

toString

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