listFavorites method

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

Returns the 20 most recent Tweets liked by the authenticating or specified user.

userId: The ID of the user for whom to return results.

screenName: The screen name of the user for whom to return results.

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.

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/post-and-engage/api-reference/get-favorites-list.

Implementation

Future<List<Tweet>> listFavorites({
  String? userId,
  String? screenName,
  int? count,
  String? sinceId,
  String? maxId,
  bool? includeEntities,
  bool? includeExtEditControl,
  String tweetMode = 'extended',
  TransformResponse<List<Tweet>> transform = defaultTweetListTransform,
}) async {
  final params = <String, String>{}
    ..addParameter('user_id', userId)
    ..addParameter('screen_name', screenName)
    ..addParameter('count', count)
    ..addParameter('since_id', sinceId)
    ..addParameter('max_id', maxId)
    ..addParameter('include_entities', includeEntities)
    ..addParameter('include_ext_edit_control', includeExtEditControl)
    ..addParameter('tweet_mode', tweetMode);

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