createProfile method

Future<CreateProfileResponse> createProfile({
  1. required String address,
  2. required DistanceUnit distanceUnit,
  3. required String profileName,
  4. required TemperatureUnit temperatureUnit,
  5. required String timezone,
  6. required WakeWord wakeWord,
  7. String? clientRequestToken,
  8. String? locale,
  9. int? maxVolumeLimit,
  10. CreateMeetingRoomConfiguration? meetingRoomConfiguration,
  11. bool? pSTNEnabled,
  12. bool? setupModeDisabled,
  13. List<Tag>? tags,
})

Creates a new room profile with the specified details.

May throw LimitExceededException. May throw AlreadyExistsException. May throw ConcurrentModificationException.

Parameter address : The valid address for the room.

Parameter distanceUnit : The distance unit to be used by devices in the profile.

Parameter profileName : The name of a room profile.

Parameter temperatureUnit : The temperature unit to be used by devices in the profile.

Parameter timezone : The time zone used by a room profile.

Parameter wakeWord : A wake word for Alexa, Echo, Amazon, or a computer.

Parameter clientRequestToken : The user-specified token that is used during the creation of a profile.

Parameter locale : The locale of the room profile. (This is currently only available to a limited preview audience.)

Parameter maxVolumeLimit : The maximum volume limit for a room profile.

Parameter meetingRoomConfiguration : The meeting room settings of a room profile.

Parameter pSTNEnabled : Whether PSTN calling is enabled.

Parameter setupModeDisabled : Whether room profile setup is enabled.

Parameter tags : The tags for the profile.

Implementation

Future<CreateProfileResponse> createProfile({
  required String address,
  required DistanceUnit distanceUnit,
  required String profileName,
  required TemperatureUnit temperatureUnit,
  required String timezone,
  required WakeWord wakeWord,
  String? clientRequestToken,
  String? locale,
  int? maxVolumeLimit,
  CreateMeetingRoomConfiguration? meetingRoomConfiguration,
  bool? pSTNEnabled,
  bool? setupModeDisabled,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(address, 'address');
  _s.validateStringLength(
    'address',
    address,
    1,
    500,
    isRequired: true,
  );
  ArgumentError.checkNotNull(distanceUnit, 'distanceUnit');
  ArgumentError.checkNotNull(profileName, 'profileName');
  _s.validateStringLength(
    'profileName',
    profileName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(temperatureUnit, 'temperatureUnit');
  ArgumentError.checkNotNull(timezone, 'timezone');
  _s.validateStringLength(
    'timezone',
    timezone,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(wakeWord, 'wakeWord');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    10,
    150,
  );
  _s.validateStringLength(
    'locale',
    locale,
    1,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AlexaForBusiness.CreateProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Address': address,
      'DistanceUnit': distanceUnit.toValue(),
      'ProfileName': profileName,
      'TemperatureUnit': temperatureUnit.toValue(),
      'Timezone': timezone,
      'WakeWord': wakeWord.toValue(),
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (locale != null) 'Locale': locale,
      if (maxVolumeLimit != null) 'MaxVolumeLimit': maxVolumeLimit,
      if (meetingRoomConfiguration != null)
        'MeetingRoomConfiguration': meetingRoomConfiguration,
      if (pSTNEnabled != null) 'PSTNEnabled': pSTNEnabled,
      if (setupModeDisabled != null) 'SetupModeDisabled': setupModeDisabled,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateProfileResponse.fromJson(jsonResponse.body);
}