countRecent abstract method

Future<TwitterResponse<List<TweetCountData>, TweetCountMeta>> countRecent({
  1. required String query,
  2. String? nextToken,
  3. DateTime? startTime,
  4. DateTime? endTime,
  5. String? sinceTweetId,
  6. String? untilTweetId,
  7. TweetCountGranularity? granularity,
})

The recent Tweet counts endpoint returns count of Tweets from the last seven days that match a query.

Parameters

  • query: One query for matching Tweets. You can learn how to build this query by reading a build a query guide. If you have Essential or Elevated access, you can use the Basic operators when building your query and can make queries up to 512 characters long. If you have been approved for Academic Research access, you can use all available operators and can make queries up to 1,024 characters long. Learn more about our access levels on the about Twitter API page.

  • nextToken: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, assuming that your request contains more than 31 days-worth of results, and should not be modified. You can learn more by visiting our page on pagination.

  • startTime: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The oldest UTC timestamp from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). By default, a request will return Tweets from up to 30 days ago if you do not include this parameter.

  • endTime: YYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). Used with startTime. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (for example, 12:00:01 excludes the first second of the minute). If used without startTime, Tweets from 30 days before endTime will be returned by default. If not specified, endTime will default to now - 30 seconds.

  • sinceTweetId: Returns results with a Tweet ID greater than (that is, more recent than) the specified ID. The ID specified is exclusive and responses will not include it. If included with the same request as a startTime parameter, only sinceTweetId will be used.

  • untilTweetId: Returns results with a Tweet ID less than (that is, older than) the specified ID. The ID specified is exclusive and responses will not include it.

  • granularity: This is the granularity that you want the time series count data to be grouped by. You can request minute, hour, or day granularity. The default granularity, if not specified is hour.

Endpoint Url

Authentication Methods

  • OAuth 2.0 App-only

Rate Limits

  • App rate limit (OAuth 2.0 App Access Token): 300 requests per 15-minute window shared among all users of your app

Reference

Implementation

Future<TwitterResponse<List<TweetCountData>, TweetCountMeta>> countRecent({
  required String query,
  String? nextToken,
  DateTime? startTime,
  DateTime? endTime,
  String? sinceTweetId,
  String? untilTweetId,
  TweetCountGranularity? granularity,
});