Example usage for Java twitter4j Twitter fields, constructors, methods, implement or subclass
The text is from its open source code.
User | createBlock(long userId) 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(long 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(long 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 | createMute(long userId) Mutes the user specified in the ID parameter as the authenticating user. |
SavedSearch | createSavedSearch(String query) Creates a saved search for the authenticated user. |
UserList | createUserList(String listName, boolean isPublicList, String description) Creates a new list for the authenticated user. |
UserList | createUserListMember(long listId, long userId) Adds a member to a list. |
UserList | createUserListMembers(long listId, long... userIds) Adds multiple members to a list, by specifying a comma-separated list of member ids or screen names. |
UserList | createUserListSubscription(long listId) Make the authenticated user follow the specified list. |
User | destroyBlock(long userId) Un-blocks the user specified in the ID parameter as the authenticating user. |
void | destroyDirectMessage(long id) Deletes 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(long 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 | destroyMute(long userId) Un-mutes the user specified in the ID parameter as the authenticating user. |
SavedSearch | destroySavedSearch(long 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(long listId) Deletes the specified list. |
UserList | destroyUserListMember(long listId, long userId) Removes the specified member from the list. |
UserList | destroyUserListSubscription(long listId) Unsubscribes the authenticated user form the specified list. |
AccountSettings | getAccountSettings() Returns the current trend, geo, language, timezone and sleep time information for the authenticating user. |
ResponseList | getAvailableTrends() Returns the locations that Twitter has trending topic information for. |
IDs | getBlocksIDs() Returns an array of numeric user ids the authenticating user is blocking. |
PagableResponseList | getBlocksList(long cursor) Returns a list of user objects that the authenticating user is blocking. |
ResponseList | getClosestTrends(GeoLocation location) Returns the locations that Twitter has trending topic information for, closest to a specified location. The response is an array of "locations" that encode the location's WOEID and some other human-readable information such as a canonical name and country the location belongs in. A WOEID is a Yahoo! |
DirectMessageList | getDirectMessages(int count) Returns all Direct Message events (both sent and received) within the last 30 days. |
ResponseList | getFavorites(long userId) Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format. |
ResponseList | getFavorites(long userId, Paging paging) Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format. |
ResponseList | getFavorites() Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format. |
IDs | getFollowersIDs(long 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(long userId, long cursor, int count) Returns an array of numeric IDs for every user the specified user is followed by. |
PagableResponseList | getFollowersList(long userId, long cursor) Returns a cursored collection of user objects for users following the specified user. At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. |
PagableResponseList | getFollowersList(long userId, long cursor, int count) Returns a cursored collection of user objects for users following the specified user. At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. |
IDs | getFriendsIDs(long cursor) Returns an array of numeric IDs for every user the authenticating user is following. |
IDs | getFriendsIDs(long userId, long cursor) Returns an array of numeric IDs for every user the specified user is following. |
PagableResponseList | getFriendsList(long userId, long cursor, int count) Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends"). At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. |
PagableResponseList | getFriendsList(long userId, long cursor) Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends"). At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. |
Place | getGeoDetails(String placeId) Find out more details of a place that was returned from the PlacesGeoResources#reverseGeoCode(twitter4j.GeoQuery) method. |
ResponseList | getHomeTimeline() Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. |
ResponseList | getHomeTimeline(Paging paging) Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. |
IDs | getIncomingFriendships(long cursor) Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user. |
ResponseList | getMemberSuggestions(String categorySlug) Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user. |
ResponseList | getMentionsTimeline(Paging paging) Returns the 20 most recent mentions (tweets containing a users's @screen_name) for the authenticating user. The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com. This method can only return up to 800 tweets. See Working with Timelines for instructions on traversing timelines. |
ResponseList | getMentionsTimeline() Returns the 20 most recent mentions (tweets containing a users's @screen_name) for the authenticating user. The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com. This method can only return up to 800 tweets. See Working with Timelines for instructions on traversing timelines. |
IDs | getMutesIDs(long cursor) Returns an array of numeric user ids the authenticating user is muting. |
OAuth2Token | getOAuth2Token() Obtains an OAuth 2 Bearer token. |
AccessToken | getOAuthAccessToken(RequestToken requestToken, String oauthVerifier) Retrieves an access token associated with the supplied request token and sets userId. |
AccessToken | getOAuthAccessToken(String oauthVerifier) Retrieves an access token. |
AccessToken | getOAuthAccessToken() Returns an access token associated with this instance. If no access token is associated with this instance, this will retrieve a new access token. |
RequestToken | getOAuthRequestToken() Retrieves a request token |
RequestToken | getOAuthRequestToken(String callbackURL) Retrieves a request token |
IDs | getOutgoingFriendships(long cursor) Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request. |
Trends | getPlaceTrends(int woeid) Returns the top 10 trending topics for a specific WOEID, if trending information is available for it. 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 Twitter Search, and the Twitter Search URL. This information is cached for 5 minutes. |
String | getPrivacyPolicy() Returns Twitter's Privacy Policy. |
Map | getRateLimitStatus() Returns the current rate limits for methods belonging to the specified resource families. Each 1.1 API resource belongs to a "resource family" which is indicated in its method documentation. |
Map | getRateLimitStatus(String... resources) Returns the current rate limits for methods belonging to the specified resource families. Each 1.1 API resource belongs to a "resource family" which is indicated in its method documentation. |
ResponseList | getRetweets(long statusId) Returns up to 100 of the first retweets of a given tweet. |
ResponseList | getRetweetsOfMe(Paging paging) Returns the 20 most recent tweets of the authenticated user that have been retweeted by others. |
ResponseList | getRetweetsOfMe() Returns the 20 most recent tweets of the authenticated user that have been retweeted by others. |
ResponseList | getSavedSearches() Returns the authenticated user's saved search queries. |
ResponseList | getSimilarPlaces(GeoLocation location, String name, String containedWithin, String streetAddress) Locates places near the given coordinates which are similar in name. |
ResponseList | getSuggestedUserCategories() Access to Twitter's suggested user list. |
String | getTermsOfService() Returns Twitter's' Terms of Service. |
PagableResponseList | getUserListMembers(long listId, long cursor) Returns the members of the specified list. |
PagableResponseList | getUserListMembers(long listId, int count, long cursor) Returns the members of the specified list. |
PagableResponseList | getUserListMemberships(int count, long cursor) List the lists the authenticating user has been added to. |
ResponseList | getUserLists(String listOwnerScreenName, boolean reverse) List the lists of the specified user. |
ResponseList | getUserLists(String listOwnerScreenName) List the lists of the specified user. |
ResponseList | getUserListStatuses(long listId, Paging paging) Show tweet timeline for members of the specified list. |
PagableResponseList | getUserListSubscribers(long listId, long cursor) Returns the subscribers of the specified list. |
PagableResponseList | getUserListSubscriptions(String listSubscriberScreenName, long cursor) List the lists the specified user follows. |
ResponseList | getUserSuggestions(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 | getUserTimeline() Returns the 20 most recent statuses posted from the authenticating user. |
ResponseList | getUserTimeline(String screenName) Returns the 20 most recent statuses posted from the authenticating user. |
ResponseList | getUserTimeline(String screenName, Paging paging) Returns the 20 most recent statuses posted from the authenticating user. |
ResponseList | lookupFriendships(long... ids) Returns the relationship of the authenticating user to the specified users. |
ResponseList | lookupUsers(long... ids) Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. |
User | reportSpam(long userId) 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 | reverseGeoCode(GeoQuery query) Search for places (cities and neighborhoods) that can be attached to a statuses/update. |
SavedSearchesResources | savedSearches() |
QueryResult | search(Query query) Returns tweets that match a specified query. |
ResponseList | searchPlaces(GeoQuery query) Search for places that can be attached to a statuses/update. |
ResponseList | searchUsers(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(long userId, String text) Sends a new direct message to the specified user from the authenticating user. |
DirectMessage | sendDirectMessage(long userId, String text, QuickReply... quickReplies) Sends a new direct message to the specified user from the authenticating user. |
void | setOAuthAccessToken(AccessToken accessToken) Sets the access token |
void | setOAuthConsumer(String consumerKey, String consumerSecret) sets the OAuth consumer key and consumer secret |
DirectMessage | showDirectMessage(long id) Returns a single Direct Message event by the given id. |
Relationship | showFriendship(long sourceId, long targetId) Returns detailed information about the relationship between two users. |
SavedSearch | showSavedSearch(long 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(long userId) Returns extended information of a given user, specified by ID or screen name as per the required id parameter. |
UserList | showUserList(long listId) Show the specified list. |
User | showUserListMembership(long listId, long userId) Check if a user is a member of the specified list. This method calls https://api.twitter.com/1.1/lists/members/show.json |
User | showUserListSubscription(long listId, long userId) Check if the specified user is a subscriber of the specified list. |
TimelinesResources | timelines() |
Relationship | updateFriendship(long userId, boolean enableDeviceNotification, boolean retweets) Allows you to enable or disable retweets and device notifications from the specified user. |
User | updateProfile(String name, String url, String location, String description) Sets values that users are able to set under the "Account" tab of their settings page. |
User | updateProfileImage(File image) Updates the authenticating user's profile image. |
Status | updateStatus(String status) Updates the authenticating user's status. |
UserList | updateUserList(long listId, String newListName, boolean isPublicList, String newDescription) Updates the specified list. |
UploadedMedia | uploadMedia(File mediaFile) Uploads media image to be attached via #updateStatus(twitter4j.StatusUpdate) This method calls https://api.twitter.com/1.1/media/upload.json |
UploadedMedia | uploadMedia(String fileName, InputStream media) Uploads media image to be attached via #updateStatus(twitter4j.StatusUpdate) This method calls https://api.twitter.com/1.1/media/upload.json |
UsersResources | users() |
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. |