batchCreateChannelMembership method

Future<BatchCreateChannelMembershipResponse> batchCreateChannelMembership({
  1. required String channelArn,
  2. required String chimeBearer,
  3. required List<String> memberArns,
  4. String? subChannelId,
  5. ChannelMembershipType? type,
})

Adds a specified number of users and bots to a channel.

May throw BadRequestException. May throw ForbiddenException. May throw NotFoundException. May throw ResourceLimitExceededException. May throw ServiceFailureException. May throw ServiceUnavailableException. May throw ThrottledClientException. May throw UnauthorizedClientException.

Parameter channelArn : The ARN of the channel to which you're adding users or bots.

Parameter chimeBearer : The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.

Parameter memberArns : The ARNs of the members you want to add to the channel. Only AppInstanceUsers and AppInstanceBots can be added as a channel member.

Parameter subChannelId : The ID of the SubChannel in the request.

Parameter type : The membership type of a user, DEFAULT or HIDDEN. Default members are always returned as part of ListChannelMemberships. Hidden members are only returned if the type filter in ListChannelMemberships equals HIDDEN. Otherwise hidden members are not returned. This is only supported by moderators.

Implementation

Future<BatchCreateChannelMembershipResponse> batchCreateChannelMembership({
  required String channelArn,
  required String chimeBearer,
  required List<String> memberArns,
  String? subChannelId,
  ChannelMembershipType? type,
}) async {
  final headers = <String, String>{
    'x-amz-chime-bearer': chimeBearer.toString(),
  };
  final $payload = <String, dynamic>{
    'MemberArns': memberArns,
    if (subChannelId != null) 'SubChannelId': subChannelId,
    if (type != null) 'Type': type.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/channels/${Uri.encodeComponent(channelArn)}/memberships?operation=batch-create',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return BatchCreateChannelMembershipResponse.fromJson(response);
}