destroy method

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

Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.

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-destroy-id.

Implementation

Future<Tweet> destroy({
  required String id,
  bool? trimUser,
  String tweetMode = 'extended',
  bool? includeExtEditControl,
  TransformResponse<Tweet> transform = defaultTweetTransform,
}) async {
  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/destroy/$id.json'),
        body: body,
      )
      .then(transform);
}