banUser method

Future<void> banUser(
  1. {required String userId,
  2. int seconds = -1,
  3. String? description}
)

Bans a user. Operators can ban users from this channel. Banned user is kicked out of this channel and cannot enter during the specified seconds. If you want to ban the user indefinitely, pass -1 to seconds as the argument.

Implementation

Future<void> banUser({
  required String userId,
  int seconds = -1,
  String? description,
}) async {
  sbLog.i(StackTrace.current, 'userId: $userId');
  checkUnsupportedAction();

  if (userId.isEmpty) {
    throw InvalidParameterException();
  }

  await chat.apiClient.send(ChannelUserBanRequest(
    chat,
    targetId: userId,
    channelType: channelType,
    channelUrl: channelUrl,
    description: description,
    seconds: seconds,
  ));
}