updatePhoneNumber method

Future<UpdatePhoneNumberResponse> updatePhoneNumber({
  1. required String phoneNumberId,
  2. String? callingName,
  3. String? name,
  4. PhoneNumberProductType? productType,
})

Updates phone number details, such as product type, calling name, or phone number name for the specified phone number ID. You can update one phone number detail at a time. For example, you can update either the product type, calling name, or phone number name in one action.

For numbers outside the U.S., you must use the Amazon Chime SDK SIP Media Application Dial-In product type.

Updates to outbound calling names can take 72 hours to complete. Pending updates to outbound calling names must be complete before you can request another update.

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

Parameter phoneNumberId : The phone number ID.

Parameter callingName : The outbound calling name associated with the phone number.

Parameter name : Specifies the updated name assigned to one or more phone numbers.

Parameter productType : The product type.

Implementation

Future<UpdatePhoneNumberResponse> updatePhoneNumber({
  required String phoneNumberId,
  String? callingName,
  String? name,
  PhoneNumberProductType? productType,
}) async {
  final $payload = <String, dynamic>{
    if (callingName != null) 'CallingName': callingName,
    if (name != null) 'Name': name,
    if (productType != null) 'ProductType': productType.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/phone-numbers/${Uri.encodeComponent(phoneNumberId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdatePhoneNumberResponse.fromJson(response);
}