createRoomMembership method

Future<CreateRoomMembershipResponse> createRoomMembership({
  1. required String accountId,
  2. required String memberId,
  3. required String roomId,
  4. RoomMembershipRole? role,
})

Adds a member to a chat room in an Amazon Chime Enterprise account. A member can be either a user or a bot. The member role designates whether the member is a chat room administrator or a general chat room member.

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

Parameter accountId : The Amazon Chime account ID.

Parameter memberId : The Amazon Chime member ID (user ID or bot ID).

Parameter roomId : The room ID.

Parameter role : The role of the member.

Implementation

Future<CreateRoomMembershipResponse> createRoomMembership({
  required String accountId,
  required String memberId,
  required String roomId,
  RoomMembershipRole? role,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  ArgumentError.checkNotNull(memberId, 'memberId');
  ArgumentError.checkNotNull(roomId, 'roomId');
  final $payload = <String, dynamic>{
    'MemberId': memberId,
    if (role != null) 'Role': role.toValue(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(accountId)}/rooms/${Uri.encodeComponent(roomId)}/memberships',
    exceptionFnMap: _exceptionFns,
  );
  return CreateRoomMembershipResponse.fromJson(response);
}