membersCreateAll method
Adds multiple members to a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to add members to it. Note that lists can't have more than 5,000 members, and you are limited to adding up to 100 members to a list at a time with this method.
Please note that there can be issues with lists that rapidly remove and add memberships. Take care when using these methods such that you are not too rapidly switching between removals and adds on the same list.
ownerScreenName
The screen name of the user who owns the list being
requested by a slug
.
ownerId
The user ID of the user who owns the list being requested by
a slug
.
listId
The numerical id of the list.
slug
You can identify a list by its slug instead of its numerical id.
If you decide to do so, note that you'll also have to specify the list
owner using the ownerId
or ownerScreenName
parameters.
userId
A list of user IDs, up to 100 are allowed in a single request.
screenName
A comma separated list of screen names, up to 100 are
allowed in a single request.
Implementation
Future<void> membersCreateAll({
String? ownerScreenName,
String? ownerId,
String? listId,
String? slug,
List<String>? userId,
List<String>? screenName,
}) async {
final body = <String, String>{}
..addParameter('owner_screen_name', ownerScreenName)
..addParameter('owner_id', ownerId)
..addParameter('list_id', listId)
..addParameter('slug', slug)
..addParameter('user_id', userId)
..addParameter('screen_name', screenName);
await client.post(
Uri.https('api.twitter.com', '1.1/lists/members/create_all.json'),
body: body,
);
}