Class TwitterV2Client
java.lang.Object
com.northconcepts.datapipeline.twitter2.TwitterV2Client
Minimal Twitter API v2 client (tweet search, followers, timelines, filtered stream) used by this package's readers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResponsegetAllTweets(String query, LocalDateTime startDateTime, LocalDateTime endDateTime, int maxResult, String nextToken) Currently only available via the Academic Research product track https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-referenceReturns the active rules on the streaming endpoint.ResponsegetFollowers(String username, int maxResult, String nextToken) Returns the Followers of a given Twitter handle.ResponsegetFollowing(String username, int maxResult, String nextToken) Returns the Twitter users that the provided Twitter handle is following.ResponsegetRecentTweets(String query, LocalDateTime startDateTime, LocalDateTime endDateTime, int maxResult, String nextToken) Returns filtered public Tweets posted over the last 7 days.ResponsegetUserTimelineMentions(String username, LocalDateTime startDateTime, LocalDateTime endDateTime, String sinceId, String untilId, int maxResult, String nextToken) Returns Tweets mentioning a specific Twitter user.ResponsegetUserTimelineTweets(String username, LocalDateTime startDateTime, LocalDateTime endDateTime, String sinceId, String untilId, int maxResult, String nextToken) Returns Tweets, Retweets, replies, and Quote Tweets published by a specific Twitter account.searchUser(String username) Returns the unique identifier of the provided Twitter handle.voidsetupFilteredStreamRules(Map<String, String> rules) Replaces the rules currently active on the streaming endpoint with the ones sent as parameter.<T> Future<Response> startFilteredStream(<any> callback) Streams filtered Tweets in real-time based on the added filter rules.
-
Field Details
-
DATE_TIME_FORMATTER
-
-
Constructor Details
-
TwitterV2Client
-
-
Method Details
-
getRecentTweets
public Response getRecentTweets(String query, LocalDateTime startDateTime, LocalDateTime endDateTime, int maxResult, String nextToken) Returns filtered public Tweets posted over the last 7 days. -
getAllTweets
public Response getAllTweets(String query, LocalDateTime startDateTime, LocalDateTime endDateTime, int maxResult, String nextToken) Currently only available via the Academic Research product track https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference -
searchUser
Returns the unique identifier of the provided Twitter handle. -
getFollowers
Returns the Followers of a given Twitter handle. -
getFollowing
Returns the Twitter users that the provided Twitter handle is following. -
getUserTimelineTweets
public Response getUserTimelineTweets(String username, LocalDateTime startDateTime, LocalDateTime endDateTime, String sinceId, String untilId, int maxResult, String nextToken) Returns Tweets, Retweets, replies, and Quote Tweets published by a specific Twitter account. -
getUserTimelineMentions
public Response getUserTimelineMentions(String username, LocalDateTime startDateTime, LocalDateTime endDateTime, String sinceId, String untilId, int maxResult, String nextToken) Returns Tweets mentioning a specific Twitter user. Replies to Tweets by the specified user are also included. -
startFilteredStream
Streams filtered Tweets in real-time based on the added filter rules. -
setupFilteredStreamRules
Replaces the rules currently active on the streaming endpoint with the ones sent as parameter.- Throws:
Throwable
-
getFilteredStreamRules
Returns the active rules on the streaming endpoint.- Throws:
Throwable
-