twitter4j
Class Twitter

java.lang.Object
  twitter4j.Twitter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AsyncTwitter

public class Twitter
extends java.lang.Object
implements java.io.Serializable

A java reporesentation of the Twitter API

See Also:
Serialized Form

Field Summary
protected  HttpClient http
           
static twitter4j.Twitter.Device IM
           
static twitter4j.Twitter.Device NONE
           
static twitter4j.Twitter.Device SMS
           
 
Constructor Summary
Twitter()
           
Twitter(java.lang.String baseURL)
           
Twitter(java.lang.String id, java.lang.String password)
           
Twitter(java.lang.String id, java.lang.String password, java.lang.String baseURL)
           
 
Method Summary
 User block(java.lang.String id)
          Blocks the user specified in the ID parameter as the authenticating user.
 User create(java.lang.String id)
          Befriends 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.
 DirectMessage deleteDirectMessage(int id)
          Destroys the direct message specified in the required ID parameter.
 User destroy(java.lang.String id)
          Discontinues friendship with the user specified in the ID parameter as the authenticating user.
 Status destroyFavorite(long id)
          Un-favorites the status specified in the ID parameter as the authenticating user.
 Status destroyStatus(long statusId)
          Destroys the status specified by the required ID parameter.
 boolean equals(java.lang.Object o)
           
 boolean exists(java.lang.String user_a, java.lang.String user_b)
          Tests if a friendship exists between two users.
 java.util.List<Status> favorites()
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 java.util.List<Status> favorites(int page)
          Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 java.util.List<Status> favorites(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.
 java.util.List<Status> favorites(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.
 User follow(java.lang.String id)
          Enables notifications for updates from the specified user to the authenticating user.
 void forceUsePost(boolean forceUsePost)
          set true to force using POST method communicating to the server
protected  Response get(java.lang.String url, PostParameter[] params, boolean authenticate)
          issues an HTTP GET request.
protected  Response get(java.lang.String url, java.lang.String name1, java.lang.String value1, boolean authenticate)
          issues an HTTP GET request.
protected  Response get(java.lang.String url, java.lang.String name1, java.lang.String value1, java.lang.String name2, java.lang.String value2, boolean authenticate)
          issues an HTTP GET request.
 UserWithStatus getAuthenticatedUser()
          Returns extended information of the authenticated user.
 java.lang.String getBaseURL()
          Returns the base URL
 java.util.List<DirectMessage> getDirectMessages()
          Returns a list of the direct messages sent to the authenticating user.
 java.util.List<DirectMessage> getDirectMessages(java.util.Date since)
          Returns a list of the direct messages sent to the authenticating user.
 java.util.List<DirectMessage> getDirectMessages(int sinceId)
          Returns a list of the direct messages sent to the authenticating user.
 java.util.List<DirectMessage> getDirectMessagesByPage(int page)
          Returns a list of the direct messages sent to the authenticating user.
 java.lang.String getDowntimeSchedule()
          Returns the same text displayed on http://twitter.com/home when a maintenance window is scheduled, in the requested format.
 java.util.List<User> getFeatured()
          Returns a list of the users currently featured on the site with their current statuses inline.
 java.util.List<User> getFollowers()
          Returns the authenticating user's followers, each with current status inline.
 java.util.List<User> getFollowers(int page)
          Returns the authenticating user's followers, each with current status inline.
 java.util.List<User> getFollowers(java.lang.String id)
          Returns the authenticating user's followers, each with current status inline.
 java.util.List<User> getFollowers(java.lang.String id, int page)
          Returns the authenticating user's followers, each with current status inline.
 java.util.List<User> getFriends()
          Returns the specified user's friends, each with current status inline.
 java.util.List<User> getFriends(int page)
          Returns the specified user's friends, each with current status inline.
 java.util.List<User> getFriends(java.lang.String id)
          Returns the user's friends, each with current status inline.
 java.util.List<User> getFriends(java.lang.String id, int page)
          Returns the user's friends, each with current status inline.
 java.util.List<Status> getFriendsTimeline()
          Returns the 20 most recent statuses posted in the last 24 hours from the authenticating1 user and that user's friends.
 java.util.List<Status> getFriendsTimeline(java.util.Date since)
          Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user.
 java.util.List<Status> getFriendsTimeline(java.lang.String id)
          Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.
 java.util.List<Status> getFriendsTimeline(java.lang.String id, java.util.Date since)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 java.util.List<Status> getFriendsTimelineByPage(int page)
          Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user.
 java.util.List<Status> getFriendsTimelineByPage(java.lang.String id, int page)
          Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.
 java.lang.String getPassword()
          Returns authenticating password
 java.util.List<Status> getPublicTimeline()
          Returns the 20 most recent statuses from non-protected users who have set a custom user icon.
 java.util.List<Status> getPublicTimeline(int sinceID)
          Returns only public statuses with an ID greater than (that is, more recent than) the specified ID.
 java.util.List<Status> getReplies()
          Returns the 20 most recent replies (status updates prefixed with @username) to the authenticating user.
 java.util.List<Status> getRepliesByPage(int page)
          Returns the most recent replies (status updates prefixed with @username) to the authenticating user.
 java.lang.String getSearchBaseURL()
          returns the search base url
 java.util.List<DirectMessage> getSentDirectMessages()
          Returns a list of the direct messages sent by the authenticating user.
 java.util.List<DirectMessage> getSentDirectMessages(java.util.Date since)
          Returns a list of the direct messages sent by the authenticating user.
 java.util.List<DirectMessage> getSentDirectMessages(int sinceId)
          Returns a list of the direct messages sent by the authenticating user.
 java.lang.String getSource()
          Returns the source
 UserWithStatus getUserDetail(java.lang.String id)
          Returns extended information of a given user, specified by ID or screen name as per the required id parameter below.
 java.lang.String getUserId()
          Returns authenticating userid
 java.util.List<Status> getUserTimeline()
          Returns the most recent statuses posted in the last 24 hours from the authenticating user.
 java.util.List<Status> getUserTimeline(int count, java.util.Date since)
          Returns the most recent statuses posted in the last 24 hours from the authenticating user.
 java.util.List<Status> getUserTimeline(java.lang.String id)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 java.util.List<Status> getUserTimeline(java.lang.String id, java.util.Date since)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 java.util.List<Status> getUserTimeline(java.lang.String id, int count)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 java.util.List<Status> getUserTimeline(java.lang.String id, int count, java.util.Date since)
          Returns the most recent statuses posted in the last 24 hours from the specified userid.
 int hashCode()
           
 boolean isUsePostForced()
           
 User leave(java.lang.String id)
          Disables notifications for updates from the specified user to the authenticating user.
 RateLimitStatus rateLimitStatus()
          Returns the remaining number of API requests available to the requesting user before the API limit is reached for the current hour.
 QueryResult search(Query query)
           
 DirectMessage sendDirectMessage(java.lang.String id, java.lang.String text)
          Sends a new direct message to the specified user from the authenticating user.
 void setBaseURL(java.lang.String baseURL)
          Sets the base URL
 void setHttpConnectionTimeout(int connectionTimeout)
          Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the Twitter API.
 void setHttpProxy(java.lang.String proxyHost, int proxyPort)
          Enables use of HTTP proxy
 void setHttpProxyAuth(java.lang.String proxyUser, java.lang.String proxyPass)
          Adds authentication on HTTP proxy
 void setHttpReadTimeout(int readTimeout)
          Sets the read timeout to a specified timeout, in milliseconds.
 void setPassword(java.lang.String password)
          Sets the password
 void setRequestHeader(java.lang.String name, java.lang.String value)
          sets the request header name/value combination see Twitter Fan Wiki for detail.
 void setRetryCount(int retryCount)
           
 void setRetryIntervalSecs(int retryIntervalSecs)
           
 void setSearchBaseURL(java.lang.String searchBaseURL)
          Sets the search base URL
 void setSource(java.lang.String source)
          Sets the source parameter that will be passed by updating methods
 void setUserId(java.lang.String userId)
          Sets the userid
 Status show(int id)
          Deprecated. Use show(long id) instead.
 Status show(long id)
          Returns a single status, specified by the id parameter.
 boolean test()
          Returns the string "ok" in the requested format with a 200 OK HTTP status code.
 java.lang.String toString()
           
 User unblock(java.lang.String id)
          Un-blocks the user specified in the ID parameter as the authenticating user.
 Status update(java.lang.String status)
          Updates the user's status.
 Status update(java.lang.String status, long inReplyToStatusId)
          Updates the user's status.
 User updateDeliverlyDevice(twitter4j.Twitter.Device device)
          Sets which device Twitter delivers updates to for the authenticating user.
 User updateLocation(java.lang.String location)
          Update the location
 boolean verifyCredentials()
          Returns true if authentication was successful.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

http

protected HttpClient http

IM

public static final twitter4j.Twitter.Device IM

SMS

public static final twitter4j.Twitter.Device SMS

NONE

public static final twitter4j.Twitter.Device NONE
Constructor Detail

Twitter

public Twitter()

Twitter

public Twitter(java.lang.String baseURL)

Twitter

public Twitter(java.lang.String id,
               java.lang.String password)

Twitter

public Twitter(java.lang.String id,
               java.lang.String password,
               java.lang.String baseURL)
Method Detail

setBaseURL

public void setBaseURL(java.lang.String baseURL)
Sets the base URL

Parameters:
baseURL - String the base URL

getBaseURL

public java.lang.String getBaseURL()
Returns the base URL

Returns:
the base URL

setSearchBaseURL

public void setSearchBaseURL(java.lang.String searchBaseURL)
Sets the search base URL

Parameters:
searchBaseURL - - the search base URL
Since:
twitter4j 1.1.7

getSearchBaseURL

public java.lang.String getSearchBaseURL()
returns the search base url

Returns:
search base url
Since:
twitter4j 1.1.7

setUserId

public void setUserId(java.lang.String userId)
Sets the userid

Parameters:
userId - new userid

getUserId

public java.lang.String getUserId()
Returns authenticating userid

Returns:
userid

setPassword

public void setPassword(java.lang.String password)
Sets the password

Parameters:
password - new password

getPassword

public java.lang.String getPassword()
Returns authenticating password

Returns:
password

setHttpProxy

public void setHttpProxy(java.lang.String proxyHost,
                         int proxyPort)
Enables use of HTTP proxy

Parameters:
proxyHost -
proxyPort -
Since:
twitter4j 1.1.6

setHttpProxyAuth

public void setHttpProxyAuth(java.lang.String proxyUser,
                             java.lang.String proxyPass)
Adds authentication on HTTP proxy

Parameters:
proxyUser -
proxyPass -
Since:
twitter4j 1.1.6

setHttpConnectionTimeout

public void setHttpConnectionTimeout(int connectionTimeout)
Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the Twitter API.

Parameters:
connectionTimeout - - an int that specifies the connect timeout value in milliseconds
Since:
twitter4j 1.1.6

setHttpReadTimeout

public void setHttpReadTimeout(int readTimeout)
Sets the read timeout to a specified timeout, in milliseconds.

Parameters:
readTimeout - - an int that specifies the timeout value to be used in milliseconds
Since:
twitter4j 1.1.6

setSource

public void setSource(java.lang.String source)
Sets the source parameter that will be passed by updating methods

Parameters:
source - the new source
See Also:
How do I get "from [MyApp]" appended to updates sent from my API application?, Twitter - Request a link to your application

getSource

public java.lang.String getSource()
Returns the source

Returns:
source

setRequestHeader

public void setRequestHeader(java.lang.String name,
                             java.lang.String value)
sets the request header name/value combination see Twitter Fan Wiki for detail. http://twitter.pbwiki.com/API-Docs#RequestHeaders

Parameters:
name - the name of the request header
value - the value of the request header

forceUsePost

public void forceUsePost(boolean forceUsePost)
set true to force using POST method communicating to the server

Parameters:
forceUsePost - if true POST method will be used forcibly

isUsePostForced

public boolean isUsePostForced()
Returns:
true if POST is used forcibly

get

protected Response get(java.lang.String url,
                       java.lang.String name1,
                       java.lang.String value1,
                       boolean authenticate)
                throws TwitterException
issues an HTTP GET request. POST method will be used instead in case forceUsePost is set true.

Parameters:
url - the request url
authenticate - if true, the request will be sent with BASIC authentication header
name1 - the name of the first parameter
value1 - the value of the first parameter
Returns:
the response
Throws:
TwitterException - when Twitter service or network is unavailable

get

protected Response get(java.lang.String url,
                       java.lang.String name1,
                       java.lang.String value1,
                       java.lang.String name2,
                       java.lang.String value2,
                       boolean authenticate)
                throws TwitterException
issues an HTTP GET request. POST method will be used instead in case forceUsePost is set true.

Parameters:
url - the request url
name1 - the name of the first parameter
value1 - the value of the first parameter
name2 - the name of the second parameter
value2 - the value of the second parameter
authenticate - if true, the request will be sent with BASIC authentication header
Returns:
the response
Throws:
TwitterException - when Twitter service or network is unavailable

get

protected Response get(java.lang.String url,
                       PostParameter[] params,
                       boolean authenticate)
                throws TwitterException
issues an HTTP GET request. POST method will be used instead in case forceUsePost is set true.

Parameters:
url - the request url
params - the request parameters
authenticate - if true, the request will be sent with BASIC authentication header
Returns:
the response
Throws:
TwitterException - when Twitter service or network is unavailable

getPublicTimeline

public java.util.List<Status> getPublicTimeline()
                                         throws TwitterException
Returns the 20 most recent statuses from non-protected users who have set a custom user icon.

Returns:
list of statuses of the Public Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getPublicTimeline

public java.util.List<Status> getPublicTimeline(int sinceID)
                                         throws TwitterException
Returns only public statuses with an ID greater than (that is, more recent than) the specified ID.

Parameters:
sinceID - returns only public statuses with an ID greater than (that is, more recent than) the specified ID
Returns:
the 20 most recent statuses
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimeline

public java.util.List<Status> getFriendsTimeline()
                                          throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating1 user and that user's friends. It's also possible to request another user's friends_timeline via the id parameter below.

Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimelineByPage

public java.util.List<Status> getFriendsTimelineByPage(int page)
                                                throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user.

Parameters:
page - the number of page
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimeline

public java.util.List<Status> getFriendsTimeline(java.lang.String id)
                                          throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the friends_timeline
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimelineByPage

public java.util.List<Status> getFriendsTimelineByPage(java.lang.String id,
                                                       int page)
                                                throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the friends_timeline
page - the number of page
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimeline

public java.util.List<Status> getFriendsTimeline(java.util.Date since)
                                          throws TwitterException
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user.

Parameters:
since - narrows the returned results to just those statuses created after the specified HTTP-formatted date
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getFriendsTimeline

public java.util.List<Status> getFriendsTimeline(java.lang.String id,
                                                 java.util.Date since)
                                          throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the friends_timeline
since - narrows the returned results to just those statuses created after the specified HTTP-formatted date
Returns:
list of the Friends Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getUserTimeline

public java.util.List<Status> getUserTimeline(java.lang.String id,
                                              int count,
                                              java.util.Date since)
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the user_timeline
count - specifies the number of statuses to retrieve. May not be greater than 200 for performance purposes
since - narrows the returned results to just those statuses created after the specified HTTP-formatted date
Returns:
list of the user Timeline
Throws:
TwitterException - when Twitter service or network is unavailable

getUserTimeline

public java.util.List<Status> getUserTimeline(java.lang.String id,
                                              java.util.Date since)
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the user_timeline
since - narrows the returned results to just those statuses created after the specified HTTP-formatted date
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable

getUserTimeline

public java.util.List<Status> getUserTimeline(java.lang.String id,
                                              int count)
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or screen name of the user for whom to return the user_timeline
count - specifies the number of statuses to retrieve. May not be greater than 200 for performance purposes
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable

getUserTimeline

public java.util.List<Status> getUserTimeline(int count,
                                              java.util.Date since)
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the authenticating user.

Parameters:
count - specifies the number of statuses to retrieve. May not be greater than 200 for performance purposes
since - narrows the returned results to just those statuses created after the specified HTTP-formatted date
Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable

getUserTimeline

public java.util.List<Status> getUserTimeline(java.lang.String id)
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the specified userid.

Parameters:
id - specifies the ID or 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

getUserTimeline

public java.util.List<Status> getUserTimeline()
                                       throws TwitterException
Returns the most recent statuses posted in the last 24 hours from the authenticating user.

Returns:
the 20 most recent statuses posted in the last 24 hours from the user
Throws:
TwitterException - when Twitter service or network is unavailable

show

public Status show(int id)
            throws TwitterException
Deprecated. Use show(long id) instead.

Returns a single status, specified by the id parameter. The status's author will be returned inline.

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

show

public Status show(long id)
            throws TwitterException
Returns a single status, specified by the id parameter. The status's author will be returned inline.

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
Since:
1.1.1

update

public Status update(java.lang.String status)
              throws TwitterException
Updates the user's status. The text will be trimed if the length of the text is exceeding 160 characters.

Parameters:
status - the text of your status update
Returns:
the latest status
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
Twitter API > Status Methods > update

update

public Status update(java.lang.String status,
                     long inReplyToStatusId)
              throws TwitterException
Updates the user's status. The text will be trimed if the length of the text is exceeding 160 characters.

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

getReplies

public java.util.List<Status> getReplies()
                                  throws TwitterException
Returns the 20 most recent replies (status updates prefixed with @username) to the authenticating user. Replies are only available to the authenticating user; you can not request a list of replies to another user whether public or protected.

Returns:
the 20 most recent replies
Throws:
TwitterException - when Twitter service or network is unavailable

getRepliesByPage

public java.util.List<Status> getRepliesByPage(int page)
                                        throws TwitterException
Returns the most recent replies (status updates prefixed with @username) to the authenticating user. Replies are only available to the authenticating user; you can not request a list of replies to another user whether public or protected.

Parameters:
page - the number of page
Returns:
the 20 most recent replies
Throws:
TwitterException - when Twitter service or network is unavailable

destroyStatus

public Status destroyStatus(long statusId)
                     throws TwitterException
Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status.

Parameters:
statusId - The ID of the status to destroy.
Returns:
the deleted status
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
1.0.5

getFriends

public java.util.List<User> getFriends()
                                throws TwitterException
Returns the specified user's friends, each with current status inline.

Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable

getFriends

public java.util.List<User> getFriends(int page)
                                throws TwitterException
Returns the specified user's friends, each with current status inline.

Parameters:
page - number of page
Returns:
the list of friends
Throws:
TwitterException - when Twitter service or network is unavailable

getFriends

public java.util.List<User> getFriends(java.lang.String id)
                                throws TwitterException
Returns the user's friends, each with current status inline.

Parameters:
id - the ID or 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

getFriends

public java.util.List<User> getFriends(java.lang.String id,
                                       int page)
                                throws TwitterException
Returns the user's friends, each with current status inline.

Parameters:
id - the ID or screen name of the user for whom to request a list of friends
page - the number of page
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getFollowers

public java.util.List<User> getFollowers()
                                  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).

Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getFollowers

public java.util.List<User> getFollowers(int page)
                                  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).

Parameters:
page - Retrieves the next 100 followers.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.1.0

getFollowers

public java.util.List<User> getFollowers(java.lang.String id)
                                  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).

Parameters:
id - The ID or screen name of the user for whom to request a list of followers.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.1.0

getFollowers

public java.util.List<User> getFollowers(java.lang.String id,
                                         int page)
                                  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).

Parameters:
id - The ID or screen name of the user for whom to request a list of followers.
page - Retrieves the next 100 followers.
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.1.0

getFeatured

public java.util.List<User> getFeatured()
                                 throws TwitterException
Returns a list of the users currently featured on the site with their current statuses inline.

Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getUserDetail

public UserWithStatus getUserDetail(java.lang.String id)
                             throws TwitterException
Returns extended information of a given user, specified by ID or screen name as per the required id parameter below. This information includes design settings, so third party developers can theme their widgets according to a given user's preferences.

Parameters:
id - the ID or screen name of the user for whom to request the detail
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable

getDirectMessages

public java.util.List<DirectMessage> getDirectMessages()
                                                throws TwitterException
Returns a list of the direct messages sent to the authenticating user.

Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getDirectMessagesByPage

public java.util.List<DirectMessage> getDirectMessagesByPage(int page)
                                                      throws TwitterException
Returns a list of the direct messages sent to the authenticating user.

Parameters:
page - the number of page
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getDirectMessages

public java.util.List<DirectMessage> getDirectMessages(int sinceId)
                                                throws TwitterException
Returns a list of the direct messages sent to the authenticating user.

Parameters:
sinceId - int
Returns:
list of direct messages
Throws:
TwitterException - when Twitter service or network is unavailable

getDirectMessages

public java.util.List<DirectMessage> getDirectMessages(java.util.Date since)
                                                throws TwitterException
Returns a list of the direct messages sent to the authenticating user.

Parameters:
since - narrows the resulting list of direct messages to just those sent after the specified HTTP-formatted date
Returns:
list of direct messages
Throws:
TwitterException - when Twitter service or network is unavailable

getSentDirectMessages

public java.util.List<DirectMessage> getSentDirectMessages()
                                                    throws TwitterException
Returns a list of the direct messages sent by the authenticating user.

Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getSentDirectMessages

public java.util.List<DirectMessage> getSentDirectMessages(java.util.Date since)
                                                    throws TwitterException
Returns a list of the direct messages sent by the authenticating user.

Parameters:
since - narrows the resulting list of direct messages to just those sent after the specified HTTP-formatted date
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

getSentDirectMessages

public java.util.List<DirectMessage> getSentDirectMessages(int sinceId)
                                                    throws TwitterException
Returns a list of the direct messages sent by the authenticating user.

Parameters:
sinceId - returns only sent direct messages with an ID greater than (that is, more recent than) the specified ID
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

sendDirectMessage

public DirectMessage sendDirectMessage(java.lang.String id,
                                       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 trimed if the length of the text is exceeding 140 characters.

Parameters:
id - the ID or screen name of the user to whom send the direct message
text - String
Returns:
DirectMessage
Throws:
TwitterException - when Twitter service or network is unavailable

deleteDirectMessage

public DirectMessage deleteDirectMessage(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.

Parameters:
id - the ID of the direct message to destroy
Returns:
the deleted direct message
Throws:
TwitterException - when Twitter service or network is unavailable

create

public User create(java.lang.String id)
            throws TwitterException
Befriends the user specified in the ID parameter as the authenticating user. Returns the befriended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.

Parameters:
id - the ID or screen name of the user to be befriended
Returns:
the befriended user
Throws:
TwitterException - when Twitter service or network is unavailable

destroy

public User destroy(java.lang.String id)
             throws TwitterException
Discontinues friendship with the user specified in the ID parameter as the authenticating user. Returns the un-friended user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.

Parameters:
id - the ID or screen name of the user for whom to request a list of friends
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable

exists

public boolean exists(java.lang.String user_a,
                      java.lang.String user_b)
               throws TwitterException
Tests if a friendship exists between two users.

Parameters:
user_a - The ID or screen_name of the first user to test friendship for.
user_b - 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

verifyCredentials

public boolean verifyCredentials()
Returns true if authentication was successful. Use this method to test if supplied user credentials are valid with minimal overhead.

Returns:
success

updateLocation

public User updateLocation(java.lang.String location)
                    throws TwitterException
Update the location

Parameters:
location - the current location of the user
Returns:
the updated user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.0.4

rateLimitStatus

public RateLimitStatus rateLimitStatus()
                                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.
See Twitter REST API Documentation > Account Methods > rate_limit_status for detail.

Returns:
the rate limit status
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.1.4

updateDeliverlyDevice

public User updateDeliverlyDevice(twitter4j.Twitter.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.

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
Since:
twitter4j 1.0.4

favorites

public java.util.List<Status> favorites()
                                 throws TwitterException
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.

Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

favorites

public java.util.List<Status> favorites(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.

Parameters:
page - the number of page
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

favorites

public java.util.List<Status> favorites(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.

Parameters:
id - the ID or screen name of the user for whom to request a list of favorite statuses
Returns:
List
Throws:
TwitterException - when Twitter service or network is unavailable

favorites

public java.util.List<Status> favorites(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.

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:
List
Throws:
TwitterException - when Twitter service or network is unavailable

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.

Parameters:
id - the ID of the status to favorite
Returns:
Status
Throws:
TwitterException - when Twitter service or network is unavailable

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.

Parameters:
id - the ID of the status to un-favorite
Returns:
Status
Throws:
TwitterException - when Twitter service or network is unavailable

follow

public User follow(java.lang.String id)
            throws TwitterException
Enables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.

Parameters:
id - String
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable

leave

public User leave(java.lang.String id)
           throws TwitterException
Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.

Parameters:
id - String
Returns:
User
Throws:
TwitterException - when Twitter service or network is unavailable

block

public User block(java.lang.String id)
           throws TwitterException
Blocks the user specified in the ID parameter as the authenticating user. Returns the blocked user in the requested format when successful.

Parameters:
id - the ID or screen_name of the user to block
Returns:
the blocked user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.0.4

unblock

public User unblock(java.lang.String id)
             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.

Parameters:
id - the ID or screen_name of the user to block
Returns:
the unblocked user
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.0.4

test

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

Returns:
true if the API is working
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.0.4

getAuthenticatedUser

public UserWithStatus getAuthenticatedUser()
                                    throws TwitterException
Returns extended information of the authenticated user. This information includes design settings, so third party developers can theme their widgets according to a given user's preferences.
The call Twitter.getAuthenticatedUser() is equivalent to the call:
twitter.getUserDetail(twitter.getUserId());

Returns:
UserWithStatus
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.1.3

getDowntimeSchedule

public java.lang.String getDowntimeSchedule()
                                     throws TwitterException
Returns the same text displayed on http://twitter.com/home when a maintenance window is scheduled, in the requested format.

Returns:
the schedule
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
twitter4j 1.0.4

search

public QueryResult search(Query query)
                   throws TwitterException
Parameters:
query - - the search condition
Returns:
the result
Throws:
TwitterException
Since:
twitter4j 1.1.7
See Also:
Twitter API / Search API Documentation, Twitter API / Search Operators

setRetryCount

public void setRetryCount(int retryCount)

setRetryIntervalSecs

public void setRetryIntervalSecs(int retryIntervalSecs)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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