createChannelBan method

Future<CreateChannelBanResponse> createChannelBan({
  1. required String channelArn,
  2. required String chimeBearer,
  3. required String memberArn,
})

Permanently bans a member from a channel. Moderators can't add banned members to a channel. To undo a ban, you first have to DeleteChannelBan, and then CreateChannelMembership. Bans are cleaned up when you delete users or channels.

If you ban a user who is already part of a channel, that user is automatically kicked from the channel.

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

Parameter channelArn : The ARN of the ban request.

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

Parameter memberArn : The AppInstanceUserArn of the member being banned.

Implementation

Future<CreateChannelBanResponse> createChannelBan({
  required String channelArn,
  required String chimeBearer,
  required String memberArn,
}) async {
  final headers = <String, String>{
    'x-amz-chime-bearer': chimeBearer.toString(),
  };
  final $payload = <String, dynamic>{
    'MemberArn': memberArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/channels/${Uri.encodeComponent(channelArn)}/bans',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateChannelBanResponse.fromJson(response);
}