createChannelBan method
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 ForbiddenException. May throw UnauthorizedClientException. May throw ConflictException. May throw ResourceLimitExceededException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.
Parameter channelArn
:
The ARN of the ban request.
Parameter memberArn
:
The ARN of the member being banned.
Implementation
Future<CreateChannelBanResponse> createChannelBan({
required String channelArn,
required String memberArn,
}) async {
ArgumentError.checkNotNull(channelArn, 'channelArn');
_s.validateStringLength(
'channelArn',
channelArn,
5,
1600,
isRequired: true,
);
ArgumentError.checkNotNull(memberArn, 'memberArn');
_s.validateStringLength(
'memberArn',
memberArn,
5,
1600,
isRequired: true,
);
final $payload = <String, dynamic>{
'MemberArn': memberArn,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/channels/${Uri.encodeComponent(channelArn)}/bans',
exceptionFnMap: _exceptionFns,
);
return CreateChannelBanResponse.fromJson(response);
}