friendshipsUpdate method

Future<Relationship> friendshipsUpdate({
  1. String? screenName,
  2. String? userId,
  3. bool? device,
  4. bool? retweets,
  5. TransformResponse<Relationship> transform = defaultRelationshipTransform,
})

Enable or disable Retweets and device notifications from the specified user.

screenName: The screen name of the user being followed.

userId: The ID of the user being followed.

device: Turn on/off device notifications from the target user.

retweets: Turn on/off Retweets from the target user.

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

See https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update.

Implementation

Future<Relationship> friendshipsUpdate({
  String? screenName,
  String? userId,
  bool? device,
  bool? retweets,
  TransformResponse<Relationship> transform = defaultRelationshipTransform,
}) async {
  final body = <String, String>{}
    ..addParameter('screen_name', screenName)
    ..addParameter('user_id', userId)
    ..addParameter('device', device)
    ..addParameter('retweets', retweets);

  return client
      .post(
        Uri.https('api.twitter.com', '1.1/friendships/update.json'),
        body: body,
      )
      .then(transform);
}