associatePhoneNumbersWithVoiceConnectorGroup method

Future<AssociatePhoneNumbersWithVoiceConnectorGroupResponse> associatePhoneNumbersWithVoiceConnectorGroup({
  1. required List<String> e164PhoneNumbers,
  2. required String voiceConnectorGroupId,
  3. bool? forceAssociate,
})

Associates phone numbers with the specified Amazon Chime Voice Connector group.

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 voiceConnectorGroupId : The Amazon Chime Voice Connector group ID.

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

Implementation

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