releasePhoneNumber method

Future<ReleasePhoneNumberResult> releasePhoneNumber({
  1. required String phoneNumberId,
})

Releases an existing origination phone number in your account. Once released, a phone number is no longer available for sending messages.

If the origination phone number has deletion protection enabled or is associated with a pool, an error is returned.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter phoneNumberId : The PhoneNumberId or PhoneNumberArn of the phone number to release. You can use DescribePhoneNumbers to get the values for PhoneNumberId and PhoneNumberArn.

Implementation

Future<ReleasePhoneNumberResult> releasePhoneNumber({
  required String phoneNumberId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.ReleasePhoneNumber'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PhoneNumberId': phoneNumberId,
    },
  );

  return ReleasePhoneNumberResult.fromJson(jsonResponse.body);
}