declineJoinApplication method

Future<void> declineJoinApplication(
  1. String groupId,
  2. String username, {
  3. String? reason,
})

Declines a group join application. Only the group owner can call this method.

Param groupId The group ID. Param username The applicant's username. Param reason The reason for declining the application.

Returns None.

Throws Exception description, see ChatError.

Implementation

Future<void> declineJoinApplication(
  String groupId,
  String username, {
  String? reason,
}) async {
  try {
    Map req = {'groupId': groupId, 'userId': username};
    req.putIfNotNull('reason', reason);

    Map result = await platform_interface.Client.instance.groupManager
        .callNativeMethod(ChatMethodKeys.declineJoinApplication, req);
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}