public class Twitter extends Object implements Account, AccountActivity, DirectMessages, Favorites, Followers, Friends, SevenDaySearch, Statuses, SuggestedUsers, ThirtyDaySearch, ThirtyDaySearchCounts, Users, WelcomeMessages, WelcomeMessageRules
Statuses.RetweetsRequestAnnotations, Statuses.StatusesShowRequestAnnotations
path
Modifier and Type | Method and Description |
---|---|
List<SuggestedUserCategory> |
categories(String lang)
Access to Twitter’s suggested user list.
|
Boolean |
deleteWebhook(Long webhookId)
Removes the webhook from the provided application’s configuration.
|
Boolean |
deleteWebhookSubscriptions(Long webhookId)
Deactivates subscription for the provided user context and app.
|
DirectMessage |
destroy(Long id)
Publishes a new message_create event resulting in a Direct Message sent to a specified user from the authenticating user.
|
void |
destroyWelcomeMessage(Long id)
Deletes a Welcome Message by the given id.
|
void |
destroyWelcomeMessageRule(Long id)
Deletes a Welcome Message Rule by the given id.
|
static Twitter |
getInstance() |
static Twitter |
getInstance(TwitterConfiguration configuration) |
List<Webhook> |
getWebhooks()
Returns all URLs and their statuses for the given app.
|
Boolean |
getWebhookSubscription(Long webhookId)
Provides a way to determine if a webhook configuration is subscribed to the provided user’s Direct Messages.
|
List<Tweet> |
homeTimeline(StatusesHomeTimelineRequest parameters)
Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
|
FollowersIdsResponse |
ids(FollowersIdsRequest parameters)
Returns a cursored collection of user IDs for every user following the specified user.
|
FriendsIdsResponse |
ids(FriendsIdsRequest parameters)
Returns a cursored collection of user IDs for every user the specified user is following.
|
List<DirectMessage> |
list(DirectMessagesListRequest parameters)
Returns the 20 most recent direct messages sent to the authenticating user.
|
List<Tweet> |
list(FavoritesListRequest parameters)
Returns the 20 most recent Tweets favorited by the authenticating or specified user.
|
FollowersListResponse |
list(FollowersListRequest parameters)
Returns a cursored collection of user objects for users following the specified user.
|
FriendsListResponse |
list(FriendsListRequest parameters)
Returns a cursored collection of user objects for every user the specified user is following.
|
EventsListResponse |
listEvents(EventsListRequest parameters)
Returns all Direct Message events (both sent and received) within the last 30 days.
|
WelcomeMessageRulesListResponse |
listWelcomeMessageRules(WelcomeMessageRulesListRequest parameters)
Returns a list of Welcome Message Rules.
|
WelcomeMessagesListResponse |
listWelcomeMessages(WelcomeMessagesListRequest parameters)
Returns a list of Welcome Messages.
|
List<Tweet> |
lookup(StatusesLookupRequest parameters)
Returns fully-hydrated Tweet objects for up to 100 Tweets per request, as specified by comma-separated values passed to the id parameter.
|
List<User> |
lookup(UsersLookupRequest parameters)
Returns fully-hydrated user objects for up to 100 users per request, as specified by comma-separated values passed to the user_id and/or screen_name parameters.
|
List<User> |
members(String slug)
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.
|
List<Tweet> |
mentionsTimeline(StatusesMentionsTimelineRequest parameters)
Returns the 20 most recent mentions (Tweets containing a users’s @screen_name) for the authenticating user.
|
DirectMessage |
newDM(DirectMessageNewRequest parameters)
Destroys the direct message specified in the required ID parameter.
|
DirectMessageEvent |
newEvent(MessageCreateRequest event)
Destroys the direct message specified in the required ID parameter.
|
WelcomeMessageNewResponse |
newWelcomeMessage(WelcomeMessageNewRequest parameters)
Creates a new Welcome Message that will be stored and sent in the future from the authenticating user in defined circumstances.
|
WelcomeMessageRule |
newWelcomeMessageRule(WelcomeMessageNewRuleRequest body)
Creates a new Welcome Message Rule that determines which Welcome Message will be shown in a given conversation.
|
Boolean |
putWebhook(Long webhookId)
Triggers the challenge response check (CRC) for the given webhook’s URL.
|
Webhook |
registerWebhook(String url)
Registers a new webhook URL for the given application context.
|
Boolean |
registerWebhookSubscriptions(Long webhookId)
Subscribes the provided app to events for the provided user context.
|
RetweeterIdsResponse |
retweeterIds(RetweeterIdsRequest parameters)
Returns a collection of up to 100 user IDs belonging to users who have retweeted the Tweet specified by the id parameter.
|
List<Tweet> |
retweets(RetweetsRequest parameters)
Returns a collection of the 100 most recent retweets of the Tweet specified by the id parameter.
|
List<User> |
search(UsersSearchRequest parameters)
Provides a simple, relevance-based search interface to public user accounts on Twitter.
|
List<DirectMessage> |
sent(DirectMessagesSentRequest parameters)
Returns the 20 most recent direct messages sent to the authenticating user.
|
AccountSettings |
settings()
Returns settings (including current trend, geo and sleep time information) for the authenticating user.
|
SevenDaySearchResponse |
sevenDaySearch(SevenDaySearchRequest event)
Returns a collection of relevant Tweets matching a specified query.
|
DirectMessage |
show(Long id)
The ID of the direct message.
|
Tweet |
show(StatusesShowRequest parameters)
Returns a single Tweet, specified by the id parameter.
|
User |
show(UsersShowRequest parameters)
Returns a variety of information about the user specified by the required user_id or screen_name parameter.
|
EventShowResponse |
showEvent(Long id)
Returns a single Direct Message event by the given id.
|
WelcomeMessage |
showWelcomeMessage(Long id)
Returns a Welcome Message by the given id.
|
WelcomeMessageRule |
showWelcomeMessageRule(Long id)
Returns a Welcome Message Rule by the given id.
|
SuggestedUserCategory |
suggestions(String slug,
String lang)
Access the users in a given category of the Twitter suggested user list.
|
ThirtyDaySearchResponse |
thirtyDaySearch(String environment,
ThirtyDaySearchRequest searchRequest)
Returns a collection of relevant Tweets matching a specified query.
|
ThirtyDaySearchCountsResponse |
thirtyDaySearchCounts(String environment,
ThirtyDaySearchCountsRequest searchCountsRequest)
Returns counts of relevant Tweets matching a specified query.
|
User |
updateProfile(UpdateProfileRequest parameters)
Sets some values that users are able to set under the “Account” tab of their settings page.
|
AccountSettings |
updateSettings(UpdateProfileRequest parameters)
Updates the authenticating user’s settings.
|
List<Tweet> |
userTimeline(StatusesUserTimelineRequest parameters)
Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
|
User |
verifyCredentials()
Returns user credentials for the authenticating user.
|
public static Twitter getInstance() throws InstantiationException
InstantiationException
public static Twitter getInstance(TwitterConfiguration configuration) throws InstantiationException
InstantiationException
public List<Tweet> userTimeline(StatusesUserTimelineRequest parameters)
Statuses
userTimeline
in interface Statuses
parameters
- StatusesUserTimelineRequest
List
[Tweet
]public List<Tweet> retweets(RetweetsRequest parameters)
Statuses
retweets
in interface Statuses
parameters
- RetweetsRequest
List
[Tweet
]public RetweeterIdsResponse retweeterIds(RetweeterIdsRequest parameters)
Statuses
retweeterIds
in interface Statuses
parameters
- RetweeterIdsRequest
RetweeterIdsResponse
public List<Tweet> homeTimeline(StatusesHomeTimelineRequest parameters)
Statuses
homeTimeline
in interface Statuses
parameters
- StatusesHomeTimelineRequest
List
[Tweet
]public List<Tweet> lookup(StatusesLookupRequest parameters)
Statuses
lookup
in interface Statuses
parameters
- StatusesLookupRequest
List
[Tweet
]public List<Tweet> mentionsTimeline(StatusesMentionsTimelineRequest parameters)
Statuses
mentionsTimeline
in interface Statuses
parameters
- StatusesMentionsTimelineRequest
List
[Tweet
]public Tweet show(StatusesShowRequest parameters)
Statuses
show
in interface Statuses
parameters
- StatusesShowRequest
Tweet
public FriendsIdsResponse ids(FriendsIdsRequest parameters)
Friends
ids
in interface Friends
parameters
- FriendsIdsRequest
public FriendsListResponse list(FriendsListRequest parameters)
Friends
list
in interface Friends
parameters
- FriendsListRequest
public FollowersIdsResponse ids(FollowersIdsRequest parameters)
Followers
ids
in interface Followers
parameters
- FollowersIdsRequest
public FollowersListResponse list(FollowersListRequest parameters)
Followers
list
in interface Followers
parameters
- FollowersListRequest
public List<User> lookup(UsersLookupRequest parameters)
Users
lookup
in interface Users
parameters
- UsersLookupRequest
List
[User
]public List<User> search(UsersSearchRequest parameters)
Users
search
in interface Users
parameters
- UsersSearchRequest
List
[User
]public User show(UsersShowRequest parameters)
Users
show
in interface Users
List
[User
]public List<Tweet> list(FavoritesListRequest parameters)
Favorites
list
in interface Favorites
parameters
- FavoritesListRequest
public AccountSettings settings()
Account
settings
in interface Account
AccountSettings
public User verifyCredentials()
Account
verifyCredentials
in interface Account
User
public User updateProfile(UpdateProfileRequest parameters)
Account
updateProfile
in interface Account
User
public AccountSettings updateSettings(UpdateProfileRequest parameters)
Account
updateSettings
in interface Account
AccountSettings
public WelcomeMessagesListResponse listWelcomeMessages(WelcomeMessagesListRequest parameters)
WelcomeMessages
listWelcomeMessages
in interface WelcomeMessages
WelcomeMessagesListResponse
public WelcomeMessage showWelcomeMessage(Long id)
WelcomeMessages
showWelcomeMessage
in interface WelcomeMessages
WelcomeMessage
public WelcomeMessageNewResponse newWelcomeMessage(WelcomeMessageNewRequest parameters)
WelcomeMessages
newWelcomeMessage
in interface WelcomeMessages
WelcomeMessage
public void destroyWelcomeMessage(Long id)
WelcomeMessages
destroyWelcomeMessage
in interface WelcomeMessages
public WelcomeMessageRulesListResponse listWelcomeMessageRules(WelcomeMessageRulesListRequest parameters)
WelcomeMessageRules
listWelcomeMessageRules
in interface WelcomeMessageRules
WelcomeMessageRulesListResponse
public WelcomeMessageRule showWelcomeMessageRule(Long id)
WelcomeMessageRules
showWelcomeMessageRule
in interface WelcomeMessageRules
WelcomeMessageRule
public WelcomeMessageRule newWelcomeMessageRule(WelcomeMessageNewRuleRequest body)
WelcomeMessageRules
newWelcomeMessageRule
in interface WelcomeMessageRules
WelcomeMessageRule
public void destroyWelcomeMessageRule(Long id)
WelcomeMessageRules
destroyWelcomeMessageRule
in interface WelcomeMessageRules
public List<Webhook> getWebhooks()
AccountActivity
getWebhooks
in interface AccountActivity
public Webhook registerWebhook(String url)
AccountActivity
registerWebhook
in interface AccountActivity
public Boolean deleteWebhook(Long webhookId)
AccountActivity
deleteWebhook
in interface AccountActivity
public Boolean putWebhook(Long webhookId)
AccountActivity
putWebhook
in interface AccountActivity
webhookId
- Webhook ID. Defined in resource path.public Boolean getWebhookSubscription(Long webhookId)
AccountActivity
getWebhookSubscription
in interface AccountActivity
webhookId
- Webhook ID. Defined in resource path.public Boolean registerWebhookSubscriptions(Long webhookId)
AccountActivity
registerWebhookSubscriptions
in interface AccountActivity
webhookId
- Webhook ID. Defined in resource path.public Boolean deleteWebhookSubscriptions(Long webhookId)
AccountActivity
deleteWebhookSubscriptions
in interface AccountActivity
webhookId
- Webhook ID. Defined in resource path.public EventsListResponse listEvents(EventsListRequest parameters)
DirectMessages
listEvents
in interface DirectMessages
parameters
- EventsListRequest
EventsListResponse
public EventShowResponse showEvent(Long id)
DirectMessages
showEvent
in interface DirectMessages
EventShowResponse
public DirectMessageEvent newEvent(MessageCreateRequest event)
DirectMessages
newEvent
in interface DirectMessages
event
- MessageCreateRequest
DirectMessageEvent
public SevenDaySearchResponse sevenDaySearch(SevenDaySearchRequest event)
SevenDaySearch
sevenDaySearch
in interface SevenDaySearch
SevenDaySearchResponse
public ThirtyDaySearchResponse thirtyDaySearch(String environment, ThirtyDaySearchRequest searchRequest)
ThirtyDaySearch
thirtyDaySearch
in interface ThirtyDaySearch
environment
- "environment to use"searchRequest
- ThirtyDaySearchRequest
ThirtyDaySearchResponse
public ThirtyDaySearchCountsResponse thirtyDaySearchCounts(String environment, ThirtyDaySearchCountsRequest searchCountsRequest)
ThirtyDaySearchCounts
thirtyDaySearchCounts
in interface ThirtyDaySearchCounts
environment
- "environment to use"searchCountsRequest
- ThirtyDaySearchCountsRequest
ThirtyDaySearchCountsResponse
public DirectMessage destroy(Long id)
DirectMessages
destroy
in interface DirectMessages
id
- The ID of the direct message to delete.DirectMessage
public DirectMessage show(Long id)
DirectMessages
show
in interface DirectMessages
id
- The ID of the direct message to delete.DirectMessage
public List<DirectMessage> list(DirectMessagesListRequest parameters)
DirectMessages
list
in interface DirectMessages
parameters
- DirectMessagesListRequest
List
[DirectMessage
]public List<DirectMessage> sent(DirectMessagesSentRequest parameters)
DirectMessages
sent
in interface DirectMessages
parameters
- DirectMessagesSentRequest
List
[DirectMessage
]public DirectMessage newDM(DirectMessageNewRequest parameters)
DirectMessages
newDM
in interface DirectMessages
parameters
- DirectMessageNewRequest
DirectMessage
public List<SuggestedUserCategory> categories(String lang)
SuggestedUsers
categories
in interface SuggestedUsers
lang
- Restricts the suggested categories to the requested language. The language must be specified by the appropriate two letter ISO 639-1 representation.List
[SuggestedUserCategory
]public SuggestedUserCategory suggestions(String slug, String lang)
SuggestedUsers
suggestions
in interface SuggestedUsers
SuggestedUserCategory
public List<User> members(String slug)
SuggestedUsers
members
in interface SuggestedUsers
List
[User
]Copyright © 2018 The Apache Software Foundation. All rights reserved.