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 SDK Voice Connector.

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

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

Parameter voiceConnectorId : The Voice Connector ID.

Parameter forceAssociate : If true, associates the provided phone numbers with the provided Amazon Chime SDK 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 {
  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);
}