createRoom method

Future<CreateRoomResponse> createRoom({
  1. required String roomName,
  2. String? clientRequestToken,
  3. String? description,
  4. String? profileArn,
  5. String? providerCalendarId,
  6. List<Tag>? tags,
})

Creates a room with the specified details.

May throw AlreadyExistsException. May throw LimitExceededException.

Parameter roomName : The name for the room.

Parameter clientRequestToken : A unique, user-specified identifier for this request that ensures idempotency.

Parameter description : The description for the room.

Parameter profileArn : The profile ARN for the room. This is required.

Parameter providerCalendarId : The calendar ARN for the room.

Parameter tags : The tags for the room.

Implementation

Future<CreateRoomResponse> createRoom({
  required String roomName,
  String? clientRequestToken,
  String? description,
  String? profileArn,
  String? providerCalendarId,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(roomName, 'roomName');
  _s.validateStringLength(
    'roomName',
    roomName,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    10,
    150,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    200,
  );
  _s.validateStringLength(
    'providerCalendarId',
    providerCalendarId,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AlexaForBusiness.CreateRoom'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'RoomName': roomName,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
      if (profileArn != null) 'ProfileArn': profileArn,
      if (providerCalendarId != null)
        'ProviderCalendarId': providerCalendarId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRoomResponse.fromJson(jsonResponse.body);
}