|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectwinterwell.jtwitter.Twitter
public class Twitter
Java wrapper for the Twitter API version "1.7.3"
Example usage:
First, you should get the user to authorise access via OAuth. There are a
couple of ways of doing this -- we show one below -- see
OAuthSignpostClient for more details.
Note that you don't need to do this for some operations - e.g. you can look
up public posts without logging in (use the Twitter() constructor.
You can also - for now! - use username and password to login, but Twitter
plan to switch this off soon.
Now we can access Twitter:
// First, OAuth to login: Make an oauth client
OAuthSignpostClient oauthClient = new OAuthSignpostClient(JTWITTER_OAUTH_KEY, JTWITTER_OAUTH_SECRET, "oob");
// open the authorisation page in the user's browser
oauthClient.authorizeDesktop(); // Note: this only works on desktop PCs
// or direct the user to the webpage given by oauthClient.authorizeUrl()
// get the pin from the user since we're using "oob" instead of a callback servlet
String v = oauthClient.askUser("Please enter the verification PIN from Twitter");
oauthClient.setAuthorizationCode(v);
// You can store the authorisation token details for future use
Object accessToken = client.getAccessToken();
// Make a Twitter object
Twitter twitter = new Twitter("my-name", oauthClient);
// Print Winterstein's status
System.out.println(twitter.getStatus("winterstein"));
// Set my status
twitter.updateStatus("Messing about in Java");
If you can handle callbacks, then the OAuth login can be streamlined. You need a webserver and a servlet (eg. use Jetty or Tomcat) to handle callbacks. Replace "oob" with your callback url. Direct the user to client.authorizeUrl(). Twitter will then call your callback with the request token and verifier (authorisation code).
See http://www.winterwell.com/software/jtwitter.php for more
information about this wrapper. See ://apiwiki.twitter.com/Twitter-API-Documentation for more information about
the Twitter API.
Notes:
TwitterList - though getLists() is here) and some
profile/account settings (in TwitterAccount).
://www.winterwell.com/software/changelist.txt
| Nested Class Summary | |
|---|---|
static interface |
Twitter.ICallback
Use to register per-page callbacks for long-running searches. |
static interface |
Twitter.IHttpClient
Interface for an http client - e.g. |
static interface |
Twitter.ITweet
This gives common access to features that are common to both Twitter.Messages and Twitter.Statuses. |
static class |
Twitter.KEntityType
|
static class |
Twitter.Message
A Twitter direct message. |
static class |
Twitter.Status
A Twitter status post. |
static class |
Twitter.TweetEntity
TODO A special slice of text within a tweet. |
static class |
Twitter.User
A Twitter user. |
| Field Summary | |
|---|---|
static java.lang.String |
version
JTwitter version |
| Constructor Summary | |
|---|---|
Twitter()
Create a Twitter client without specifying a user. |
|
Twitter(java.lang.String screenName,
java.lang.String password)
Deprecated. |
|
Twitter(java.lang.String name,
Twitter.IHttpClient client)
Java wrapper for the Twitter API. |
|
| Method Summary | |
|---|---|
Twitter.User |
befriend(java.lang.String username)
Deprecated. Use follow(String) instead, which is equivalent. |
Twitter.User |
breakFriendship(java.lang.String username)
Deprecated. Please use stopFollowing(String) instead. |
java.util.List<Twitter.User> |
bulkShow(java.util.List<java.lang.String> screenNames)
Lookup user info. |
java.util.List<Twitter.User> |
bulkShowById(java.util.List<java.lang.Long> userIds)
Lookup user info. |
void |
destroy(Twitter.ITweet tweet)
Deletes the given Status or Message. |
void |
destroyStatus(long id)
Deletes the status specified by the required ID parameter. |
void |
destroyStatus(Twitter.Status status)
Deprecated. in favour of destroy(ITweet). This method will be
removed by the end of 2010. |
Twitter.User |
follow(java.lang.String username)
Start following a user. |
void |
follow(Twitter.User user)
Convenience for follow(String) |
static java.util.Date |
getDate(int year,
java.lang.String month,
int day)
Convenience method for making Dates. |
java.util.List<Twitter.Message> |
getDirectMessages()
Returns a list of the direct messages sent to the authenticating user. |
java.util.List<Twitter.Message> |
getDirectMessagesSent()
Returns a list of the direct messages sent *by* the authenticating user. |
java.util.List<Twitter.Status> |
getFavorites()
The most recent 20 favourite tweets. |
java.util.List<Twitter.Status> |
getFavorites(java.lang.String screenName)
The most recent 20 favourite tweets for the given user. |
java.util.List<Twitter.User> |
getFeatured()
Returns a list of the users currently featured on the site with their current statuses inline. |
java.util.List<java.lang.Long> |
getFollowerIDs()
Returns the IDs of the authenticating user's followers. |
java.util.List<java.lang.Long> |
getFollowerIDs(java.lang.String screenName)
Returns the IDs of the specified user's followers. |
java.util.List<Twitter.User> |
getFollowers()
Returns the authenticating user's (latest) followers, each with current status inline. |
java.util.List<Twitter.User> |
getFollowers(java.lang.String username)
Returns the (latest 100) given user's followers, each with current status inline. |
java.util.List<java.lang.Long> |
getFriendIDs()
Returns the IDs of the authenticating user's friends. |
java.util.List<java.lang.Long> |
getFriendIDs(java.lang.String screenName)
Returns the IDs of the specified user's friends. |
java.util.List<Twitter.User> |
getFriends()
Returns the authenticating user's (latest 100) friends, each with current status inline. |
java.util.List<Twitter.User> |
getFriends(java.lang.String username)
Returns the (latest 100) given user's friends, each with current status inline. |
java.util.List<Twitter.Status> |
getFriendsTimeline()
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user and that user's friends. |
java.util.List<Twitter.Status> |
getHomeTimeline()
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user and that user's friends, including retweets. |
Twitter.IHttpClient |
getHttpClient()
Provides access to the Twitter.IHttpClient which manages the low-level
authentication, posts and gets. |
java.util.List<TwitterList> |
getLists()
|
java.util.List<TwitterList> |
getLists(java.lang.String screenName)
|
java.lang.String |
getLongStatus(Twitter.Status truncatedStatus)
|
int |
getMaxResults()
Provides support for fetching many pages. |
java.util.List<Twitter.Status> |
getPublicTimeline()
Returns the 20 most recent statuses from non-protected users who have set a custom user icon. |
int |
getRateLimitStatus()
|
java.util.List<Twitter.Status> |
getReplies()
Returns the 20 most recent replies/mentions (status updates with |
java.util.List<Twitter.User> |
getRetweeters(Twitter.Status tweet)
Show users who (new-style) retweeted the given tweet. |
java.util.List<Twitter.Status> |
getRetweets(Twitter.Status tweet)
|
java.util.List<Twitter.Status> |
getRetweetsByMe()
|
java.util.List<Twitter.Status> |
getRetweetsOfMe()
|
java.lang.String |
getScreenName()
|
Twitter.Status |
getStatus()
|
Twitter.Status |
getStatus(long id)
Returns a single status, specified by the id parameter below. |
Twitter.Status |
getStatus(java.lang.String username)
|
java.util.List<java.lang.String> |
getTrends()
|
java.util.Date |
getUntilDate()
TODO document this please - DBW |
Twitter.User |
getUser(long userId)
Synonym for show(long). |
Twitter.User |
getUser(java.lang.String screenName)
Synonym for show(String). |
static Twitter.User |
getUser(java.lang.String screenName,
java.util.List<Twitter.User> users)
Convenience method: Finds a user with the given screen-name from the list. |
java.util.List<Twitter.Status> |
getUserTimeline()
Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user. |
java.util.List<Twitter.Status> |
getUserTimeline(java.lang.String screenName)
Returns the most recent statuses posted in the last 24 hours from the given user. |
java.util.List<Twitter.Status> |
getUserTimelineWithRetweets(java.lang.String screenName)
Returns the most recent statuses posted in the last 24 hours from the given user. |
boolean |
isFollower(java.lang.String userB)
Is the authenticating user followed by userB? |
boolean |
isFollower(java.lang.String followerScreenName,
java.lang.String followedScreenName)
|
boolean |
isFollowing(java.lang.String userB)
Does the authenticating user follow userB? |
boolean |
isFollowing(Twitter.User user)
Convenience for isFollowing(String) |
boolean |
isTwitlongerSetup()
|
boolean |
isValidLogin()
Are the login details used for authentication valid? |
protected static java.lang.String |
jsonGet(java.lang.String key,
org.json.JSONObject jsonObj)
Helper method to deal with JSON-in-Java weirdness |
Twitter.User |
leaveNotifications(java.lang.String screenName)
Switches off notifications for updates from the specified user who must already be a friend. |
static void |
main(java.lang.String[] args)
|
Twitter.User |
notify(java.lang.String username)
Enables notifications for updates from the specified user who must already be a friend. |
Twitter.Status |
retweet(Twitter.Status tweet)
Retweet (new-style) a tweet without any edits. |
java.util.List<Twitter.Status> |
search(java.lang.String searchTerm)
Perform a search of Twitter. |
java.util.List<Twitter.Status> |
search(java.lang.String searchTerm,
Twitter.ICallback callback,
int rpp)
Perform a search of Twitter. |
java.util.List<Twitter.User> |
searchUsers(java.lang.String searchTerm)
Warning: there is a bug within twitter.com which means that location-based searches are treated as OR. |
Twitter.Message |
sendMessage(java.lang.String recipient,
java.lang.String text)
Sends a new direct message to the specified user from the authenticating user. |
void |
setAPIRootUrl(java.lang.String url)
Set this to access sites other than Twitter that support the Twitter API. |
void |
setCount(java.lang.Integer count)
*Some* methods - the timeline ones for example - allow a count of number-of-tweets to return. |
void |
setFavorite(Twitter.Status status,
boolean isFavorite)
|
void |
setIncludeTweetEntities(boolean tweetEntities)
|
void |
setLanguage(java.lang.String language)
Set a language filter for search results. |
void |
setMaxResults(int maxResults)
|
void |
setMyLocation(double[] latitudeLongitude)
Set the location for your tweets. Warning: geo-tagging parameters are ignored if geo_enabled for the user is false (this is the default setting for all users unless the user has enabled geolocation in their settings)! |
void |
setPageNumber(java.lang.Integer pageNumber)
|
void |
setSearchLocation(double latitude,
double longitude,
java.lang.String radius)
Restricts search(String) to tweets by users located within a
given radius of the given latitude/longitude. |
void |
setSinceDate(java.util.Date sinceDate)
Date based filter on statuses and messages. |
void |
setSinceId(java.lang.Long statusId)
Narrows the returned results to just those statuses created after the specified status id. |
void |
setSource(java.lang.String sourceApp)
Set the source application. |
Twitter.Status |
setStatus(java.lang.String statusText)
Sets the authenticating user's status. |
void |
setUntilDate(java.util.Date untilDate)
|
void |
setupTwitlonger(java.lang.String twitlongerAppName,
java.lang.String twitlongerApiKey)
Set this to allow the use of twitlonger via updateLongStatus(String, long). |
Twitter.User |
show(long userId)
Returns information of a given user, specified by user-id. |
Twitter.User |
show(java.lang.String screenName)
Returns information of a given user, specified by screen name. |
java.util.List<java.lang.String> |
splitMessage(java.lang.String longStatus)
Split a long message up into shorter chunks suitable for use with setStatus(String) or sendMessage(String, String). |
Twitter.User |
stopFollowing(java.lang.String username)
Destroy: Discontinues friendship with the user specified in the ID parameter as the authenticating user. |
void |
stopFollowing(Twitter.User user)
Convenience for stopFollowing(String) |
Twitter.Status |
updateLongStatus(java.lang.String message,
long inReplyToStatusId)
Use twitlonger.com to post a lengthy tweet. |
Twitter.Status |
updateStatus(java.lang.String statusText)
Updates the authenticating user's status. |
Twitter.Status |
updateStatus(java.lang.String statusText,
long inReplyToStatusId)
Updates the authenticating user's status and marks it as a reply to the tweet with the given ID. |
boolean |
userExists(java.lang.String screenName)
Does a user with the specified name or id exist? |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String version
| Constructor Detail |
|---|
public Twitter()
public Twitter(java.lang.String name,
Twitter.IHttpClient client)
name - the authenticating user's name, if known. Can be null.client -
@Deprecated
public Twitter(java.lang.String screenName,
java.lang.String password)
screenName - The name of the Twitter user. Only used by some methods. Can
be null if you avoid methods requiring authentication.password - The password of the Twitter user. Can be null if you avoid
methods requiring authentication.| Method Detail |
|---|
public void setAPIRootUrl(java.lang.String url)
url - Format: "http://domain-name", e.g. "http://twitter.com" by
default.
public static java.util.Date getDate(int year,
java.lang.String month,
int day)
year - month - day -
public static Twitter.User getUser(java.lang.String screenName,
java.util.List<Twitter.User> users)
screenName - aka login nameusers -
protected static java.lang.String jsonGet(java.lang.String key,
org.json.JSONObject jsonObj)
public static void main(java.lang.String[] args)
args - Can be used as a command-line tweet tool. To do so, enter 3
arguments: name, password, tweet
If empty, prints version info.public void setCount(java.lang.Integer count)
count - null for default behaviour. 200 is the current maximum.
Twitter may reject or ignore high counts.
@Deprecated
public Twitter.User befriend(java.lang.String username)
throws TwitterException
follow(String) instead, which is equivalent.
follow(String). C.f.
http://apiwiki.twitter.com/Migrating-to-followers-terminology
username - Required. The screen name of the user to befriend.
TwitterException@Deprecated public Twitter.User breakFriendship(java.lang.String username)
stopFollowing(String) instead.
stopFollowing(String).
public void destroyStatus(long id)
throws TwitterException
TwitterExceptiondestroy(ITweet)
@Deprecated
public void destroyStatus(Twitter.Status status)
throws TwitterException
destroy(ITweet). This method will be
removed by the end of 2010.
#destroyStatus(int). The
authenticating user must be the author of the status post.
TwitterExceptiondestroy(ITweet)
public void destroy(Twitter.ITweet tweet)
throws TwitterException
TwitterException
public Twitter.User follow(java.lang.String username)
throws TwitterException
username - Required. The ID or screen name of the user to befriend.
TwitterException - if the user does not exist or has been suspended.public void follow(Twitter.User user)
follow(String)
user - public java.util.List<Twitter.Message> getDirectMessages()
Note: the Twitter API makes this available in rss if that's of interest.
public java.util.List<Twitter.Message> getDirectMessagesSent()
public java.util.List<Twitter.Status> getFavorites()
public void setFavorite(Twitter.Status status,
boolean isFavorite)
public java.util.List<Twitter.Status> getFavorites(java.lang.String screenName)
screenName - login-name.
public java.util.List<Twitter.User> getFeatured()
throws TwitterException
Note: This is no longer part of the Twitter API. Support is provided via other methods.
TwitterException
public java.util.List<java.lang.Long> getFollowerIDs()
throws TwitterException
TwitterException
public java.util.List<java.lang.Long> getFollowerIDs(java.lang.String screenName)
throws TwitterException
The - screen name of the user whose followers are to be fetched.
TwitterException
public java.util.List<Twitter.User> getFollowers()
throws TwitterException
TwitterException
public java.util.List<Twitter.User> getFollowers(java.lang.String username)
throws TwitterException
username - The screen name of the user for whom to request a list of
friends.
TwitterException
public java.util.List<java.lang.Long> getFriendIDs()
throws TwitterException
TwitterException
public java.util.List<java.lang.Long> getFriendIDs(java.lang.String screenName)
throws TwitterException
The - screen name of the user whose friends are to be fetched.
TwitterException
public java.util.List<Twitter.User> getFriends()
throws TwitterException
Note that there seems to be a small delay from Twitter in updates to this list.
TwitterExceptiongetFriendIDs(),
isFollowing(String)
public java.util.List<Twitter.User> getFriends(java.lang.String username)
throws TwitterException
username - The screen name of the user for whom to request a list of
friends.
TwitterException
public java.util.List<Twitter.Status> getFriendsTimeline()
throws TwitterException
TwitterException
public java.util.List<Twitter.Status> getHomeTimeline()
throws TwitterException
TwitterExceptionpublic java.lang.String getScreenName()
public java.util.List<Twitter.Status> getPublicTimeline()
throws TwitterException
Note: Twitter cache-and-refresh this every 60 seconds, so there is little point calling it more frequently than that.
TwitterExceptionpublic int getRateLimitStatus()
public java.util.List<Twitter.Status> getReplies()
throws TwitterException
TwitterExceptionpublic java.util.List<Twitter.Status> getRetweetsOfMe()
public java.util.List<TwitterList> getLists()
public java.util.List<TwitterList> getLists(java.lang.String screenName)
screenName -
public java.util.List<Twitter.Status> getRetweets(Twitter.Status tweet)
Dear developers: we could have it that this method made two calls to Twitter and merged the two lists, thereby getting both types of retweet. There are +s and -s to this, so I'm undecided. -- Daniel
public java.util.List<Twitter.User> getRetweeters(Twitter.Status tweet)
tweet - You can use a "fake" Status created via
Status#Status(User, String, long, Date) if you know
the id number.
public Twitter.Status getStatus()
throws TwitterException
TwitterException
public Twitter.Status getStatus(long id)
throws TwitterException
id - The numerical ID of the status you're trying to retrieve.
TwitterException
public Twitter.Status getStatus(java.lang.String username)
throws TwitterException
Warning: this can be null if the user has been doing enough new-style retweets. This is due to flaws in the Twitter API.
TwitterException
public java.util.List<Twitter.Status> getUserTimeline()
throws TwitterException
TwitterException
public java.util.List<Twitter.Status> getUserTimeline(java.lang.String screenName)
throws TwitterException
This method will authenticate if it can (i.e. if the Twitter object has a username and password). Authentication is needed to see the posts of a private user.
screenName - Can be null. Specifies the screen name of the user for whom to
return the user_timeline.
TwitterExceptiongetUserTimelineWithRetweets(String)
public java.util.List<Twitter.Status> getUserTimelineWithRetweets(java.lang.String screenName)
throws TwitterException
getUserTimeline(String), this includes
new-style retweets.
This method will authenticate if it can (i.e. if the Twitter object has a username and password). Authentication is needed to see the posts of a private user.
screenName - Can be null. Specifies the screen name of the user for whom to
return the user_timeline.
TwitterExceptionpublic void setIncludeTweetEntities(boolean tweetEntities)
public boolean isFollower(java.lang.String userB)
userB - The screen name of a Twitter user.
public boolean isFollower(java.lang.String followerScreenName,
java.lang.String followedScreenName)
TwitterException.E403 - if one of the users has protected their updates and you don't
have access. This can be counter-intuitive (and annoying) at
times! Also throws E403 if one of the users has been
suspended (we use the SuspendedUser exception
sub-class for this).public boolean isFollowing(java.lang.String userB)
userB - The screen name of a Twitter user.
public boolean isFollowing(Twitter.User user)
isFollowing(String)
user - public boolean isValidLogin()
which returns user infopublic Twitter.User leaveNotifications(java.lang.String screenName)
screenName - Stop getting notifications from this user, who must already be
one of your friends.
public Twitter.User notify(java.lang.String username)
username - Get notifications from this user, who must already be one of
your friends.
public java.util.List<Twitter.Status> search(java.lang.String searchTerm,
Twitter.ICallback callback,
int rpp)
Warning: the User objects returned by a search (as part of the Status
objects) are dummy-users. The only information that is set is the user's
screen-name and a profile image url. This reflects the current behaviour
of the Twitter API. If you need more info, call show(String)
with the screen name.
This supports maxResults and pagination. A language filter can
be set via setLanguage(String) Location can be set via
setSearchLocation(double, double, String)
Other advanced search features can be done via the query string. E.g.
"from:winterstein" - tweets from user winterstein
"to:winterstein" - tweets start with @winterstein
"source:jtwitter" - originating from the application JTwitter - your
query must also must contain at least one keyword parameter.
"filter:links" - tweets contain a link
"apples OR pears" - or ("apples pears" would give you apples and
pears).
searchTerm - This can include several space-separated keywords, #tags and @username
(for mentions), and use quotes for \"exact phrase\" searches.callback - an object whose process() method will be called on each new
page of results.the - number of results to fetch per page
public Twitter.Status retweet(Twitter.Status tweet)
tweet - Note: you cannot retweet your own tweets.
public java.util.List<Twitter.Status> search(java.lang.String searchTerm)
search(String, ICallback, int) with no callback and fetching 100
results.
searchTerm -
public java.util.List<Twitter.User> searchUsers(java.lang.String searchTerm)
searchTerm -
public void setupTwitlonger(java.lang.String twitlongerAppName,
java.lang.String twitlongerApiKey)
updateLongStatus(String, long). To get an api-key for your app,
contact twitlonger as described here: http://www.twitlonger.com/api
twitlongerAppName - twitlongerApiKey -
public void setSearchLocation(double latitude,
double longitude,
java.lang.String radius)
search(String) to tweets by users located within a
given radius of the given latitude/longitude.
The location of a tweet is preferentially taked from the Geotagging API, but will fall back to the Twitter profile.
latitude - longitude - radius - E.g. 3.5mi or 2km. Must be <2500kmpublic void setMyLocation(double[] latitudeLongitude)
latitudeLongitude - Can be null (which is the default), in which case your tweets
will not carry location data.
The valid ranges for latitude is -90.0 to +90.0 (North is positive) inclusive. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive.
which is completely
separate.
public Twitter.Message sendMessage(java.lang.String recipient,
java.lang.String text)
throws TwitterException
recipient - Required. The screen name of the recipient user.text - Required. The text of your direct message. Keep it under 140
characters! This should *not* include the "d username" portion
TwitterException.E403 - if the recipient is not following you. (you can \@mention
anyone but you can only dm people who follow you).
TwitterExceptionpublic void setMaxResults(int maxResults)
maxResults - if greater than zero, requests will attempt to fetch as many
pages as are needed! -1 by default, in which case most methods
return the first 20 statuses/messages. Zero is not allowed.
If setting a high figure, you should usually also set a sinceId or sinceDate to limit your Twitter usage. Otherwise you can easily exceed your rate limit.
public void setPageNumber(java.lang.Integer pageNumber)
pageNumber - null (the default) returns the first page. Pages are indexed
from 1. This is used once only! Then it is reset to nullpublic void setSinceDate(java.util.Date sinceDate)
If using this, you probably also want to increase
setMaxResults(int) - otherwise you get at most 20, and possibly
less (since the filtering is done client side).
sinceDate - public void setUntilDate(java.util.Date untilDate)
untilDate - the untilDate to setpublic java.util.Date getUntilDate()
public void setSinceId(java.lang.Long statusId)
If using this, you probably also want to increase
setMaxResults(int) (otherwise you just get the most recent 20).
statusId - public void setSource(java.lang.String sourceApp)
sourceApp - jtwitterlib by default. Set to null for no source.
public Twitter.Status setStatus(java.lang.String statusText)
throws TwitterException
Identical to updateStatus(String), but with a Java-style name
(updateStatus is the Twitter API name for this method).
statusText - The text of your status update. Must not be more than 160
characters and should not be more than 140 characters to
ensure optimal display.
TwitterException
public Twitter.User show(java.lang.String screenName)
throws TwitterException
screenName - The screen name of a user.
exception - if the user does not exist - or has been terminated (as
happens to spam bots).
TwitterExceptionshow(long)public Twitter.User show(long userId)
userId - The user-id of a user.
exception - if the user does not exist - or has been terminated (as
happens to spam bots).public java.util.List<Twitter.User> bulkShow(java.util.List<java.lang.String> screenNames)
screenNames -
bulkShowById(List)public java.util.List<Twitter.User> bulkShowById(java.util.List<java.lang.Long> userIds)
bulkShow(List), but works with Twitter
user-ID numbers.
userIds - public Twitter.User getUser(java.lang.String screenName)
show(String). show is the Twitter API name, getUser
feels more Java-like.
screenName - The screen name of a user.
public Twitter.User getUser(long userId)
show(long). show is the Twitter API name, getUser
feels more Java-like.
userId - The user-id of a user.
getUser(String)public java.util.List<java.lang.String> splitMessage(java.lang.String longStatus)
setStatus(String) or sendMessage(String, String).
longStatus -
public Twitter.User stopFollowing(java.lang.String username)
username - The screen name of the user with whom to discontinue
friendship.
public void stopFollowing(Twitter.User user)
stopFollowing(String)
user - public Twitter.Status updateStatus(java.lang.String statusText)
statusText - The text of your status update. Must not be more than 160
characters and should not be more than 140 characters to
ensure optimal display.
public Twitter.Status updateStatus(java.lang.String statusText,
long inReplyToStatusId)
throws TwitterException
statusText - The text of your status update. Must not be more than 160
characters and should not be more than 140 characters to
ensure optimal display.inReplyToStatusId - The ID of the tweet that this tweet is in response to. The
statusText must contain the username (with an "@" prefix) of
the owner of the tweet being replied to for for Twitter to
agree to mark the tweet as a reply. 0 or less to leave this
unset.
Warning: the microformat for direct messages is supported. BUT: the return value from this method will be null, and not the direct message. Other microformats (such as follow) may result in an exception being thrown.
TwitterException - if something goes wrong. There is a rare (but not rare
enough) bug whereby Twitter occasionally returns a success
code but the wrong tweet. If this happens, the update may or
may not have worked - wait a bit & check.public boolean isTwitlongerSetup()
setupTwitlonger(String, String) has been used to
provide twitlonger.com details.updateLongStatus(String, long)
public Twitter.Status updateLongStatus(java.lang.String message,
long inReplyToStatusId)
Note: You need to have called setupTwitlonger(String, String)
before calling this.
message - inReplyToStatusId -
setupTwitlonger(String, String)public java.lang.String getLongStatus(Twitter.Status truncatedStatus)
truncatedStatus - If this is a twitlonger.com truncated status, then call
twitlonger to fetch the full text.
updateLongStatus(String, long)public boolean userExists(java.lang.String screenName)
screenName - The screen name or user id of the suspected user.
public void setLanguage(java.lang.String language)
language - ISO code for language. Can be null for all languages.
Note: there are multiple different ISO codes! Twitter supports ISO 639-1. http://en.wikipedia.org/wiki/ISO_639-1
public java.util.List<java.lang.String> getTrends()
public Twitter.IHttpClient getHttpClient()
Twitter.IHttpClient which manages the low-level
authentication, posts and gets.
public int getMaxResults()
public java.util.List<Twitter.Status> getRetweetsByMe()
Twitter.Status.getOriginal()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||