associatePhoneNumbersWithVoiceConnector method

Future<AssociatePhoneNumbersWithVoiceConnectorResponse> associatePhoneNumbersWithVoiceConnector({
  1. required List<String> e164PhoneNumbers,
  2. required String voiceConnectorId,
  3. bool? forceAssociate,
})

Associates phone numbers with the specified Amazon Chime Voice Connector.

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

Parameter e164PhoneNumbers : List of phone numbers, in E.164 format.

Parameter voiceConnectorId : The Amazon Chime Voice Connector ID.

Parameter forceAssociate : If true, associates the provided phone numbers with the provided Amazon Chime Voice Connector and removes any previously existing associations. If false, does not associate any phone numbers that have previously existing associations.

Implementation

Future<AssociatePhoneNumbersWithVoiceConnectorResponse>
    associatePhoneNumbersWithVoiceConnector({
  required List<String> e164PhoneNumbers,
  required String voiceConnectorId,
  bool? forceAssociate,
}) async {
  ArgumentError.checkNotNull(e164PhoneNumbers, 'e164PhoneNumbers');
  ArgumentError.checkNotNull(voiceConnectorId, 'voiceConnectorId');
  final $payload = <String, dynamic>{
    'E164PhoneNumbers': e164PhoneNumbers,
    if (forceAssociate != null) 'ForceAssociate': forceAssociate,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/voice-connectors/${Uri.encodeComponent(voiceConnectorId)}?operation=associate-phone-numbers',
    exceptionFnMap: _exceptionFns,
  );
  return AssociatePhoneNumbersWithVoiceConnectorResponse.fromJson(response);
}