homeTimeline method

Future<List<Tweet>> homeTimeline({
  1. int? count,
  2. String? sinceId,
  3. String? maxId,
  4. bool? trimUser,
  5. bool? excludeReplies,
  6. bool? includeEntities,
  7. bool? includeExtEditControl,
  8. String tweetMode = 'extended',
  9. TransformResponse<List<Tweet>> transform = defaultTweetListTransform,
})

Returns a collection of the most recent Tweets and Retweets posted by the authenticating user and the users they follow. The home timeline is central to how most users interact with the Twitter service.

Up to 800 Tweets are obtainable on the home timeline. It is more volatile for users that follow many users or follow users who Tweet frequently.

count: Specifies the number of records to retrieve. Must be less than or equal to 200. Defaults to 20. The value of count is best thought of as a limit to the number of tweets to return because suspended or deleted content is removed after the count has been applied.

sinceId: Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occurred since the sinceId, the sinceId will be forced to the oldest ID available.

maxId: Returns results with an ID less than (that is, older than) or equal to the specified ID.

trimUser: When true, each Tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object.

excludeReplies: This parameter will prevent replies from appearing in the returned timeline. Using excludeReplies with the count parameter will mean you will receive up-to count Tweets — this is because the count parameter retrieves that many Tweets before filtering out retweets and replies.

includeEntities: The entities node will not be included when set to false.

includeExtEditControl: The includeExtEditControl node will not be included when set to false. See https://developer.twitter.com/en/docs/twitter-api/v1/edit-tweets

tweetMode: When set to extended, uses the extended Tweets. See https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#extendedtweet.

transform: Can be used to parse the request. By default, the response is parsed in an isolate.

See https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline.

Implementation

Future<List<Tweet>> homeTimeline({
  int? count,
  String? sinceId,
  String? maxId,
  bool? trimUser,
  bool? excludeReplies,
  bool? includeEntities,
  bool? includeExtEditControl,
  String tweetMode = 'extended',
  TransformResponse<List<Tweet>> transform = defaultTweetListTransform,
}) async {
  final params = <String, String>{}
    ..addParameter('count', count)
    ..addParameter('since_id', sinceId)
    ..addParameter('max_id', maxId)
    ..addParameter('trim_user', trimUser)
    ..addParameter('exclude_replies', excludeReplies)
    ..addParameter('include_entities', includeEntities)
    ..addParameter('include_ext_edit_control', includeExtEditControl)
    ..addParameter('tweet_mode', 'extended');

  return client
      .get(Uri.https(
        'api.twitter.com',
        '1.1/statuses/home_timeline.json',
        params,
      ))
      .then(transform);
}