unretweet method

Future<Tweet> unretweet({
  1. required String id,
  2. bool? trimUser,
  3. bool? includeExtEditControl,
  4. String tweetMode = 'extended',
  5. TransformResponse<Tweet> transform = defaultTweetTransform,
})

Untweets a retweeted status. Returns the original Tweet with Retweet details embedded.

id: The numerical ID of the desired status.

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.

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.

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

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/post-statuses-unretweet-id.

Implementation

Future<Tweet> unretweet({
  required String id,
  bool? trimUser,
  bool? includeExtEditControl,
  String tweetMode = 'extended',
  TransformResponse<Tweet> transform = defaultTweetTransform,
}) {
  final body = <String, String>{}
    ..addParameter('tweet_mode', tweetMode)
    ..addParameter('trim_user', trimUser)
    ..addParameter('include_ext_edit_control', includeExtEditControl);

  return client
      .post(
        Uri.https('api.twitter.com', '1.1/statuses/unretweet/$id.json'),
        body: body,
      )
      .then(transform);
}