listPhoneNumbersV2 method

Future<ListPhoneNumbersV2Response> listPhoneNumbersV2({
  1. String? instanceId,
  2. int? maxResults,
  3. String? nextToken,
  4. List<PhoneNumberCountryCode>? phoneNumberCountryCodes,
  5. String? phoneNumberPrefix,
  6. List<PhoneNumberType>? phoneNumberTypes,
  7. String? targetArn,
})

Lists phone numbers claimed to your Connect Customer instance or traffic distribution group. If the provided TargetArn is a traffic distribution group, you can call this API in both Amazon Web Services Regions associated with traffic distribution group.

For more information about phone numbers, see Set Up Phone Numbers for Your Contact Center in the Connect Customer Administrator Guide.

  • When given an instance ARN, ListPhoneNumbersV2 returns only the phone numbers claimed to the instance.
  • When given a traffic distribution group ARN ListPhoneNumbersV2 returns only the phone numbers claimed to the traffic distribution group.

May throw AccessDeniedException. May throw InternalServiceException. May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter instanceId : The identifier of the Connect Customer instance that phone numbers are claimed to. You can find the instance ID in the Amazon Resource Name (ARN) of the instance. If both TargetArn and InstanceId are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.

Parameter maxResults : The maximum number of results to return per page.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Parameter phoneNumberCountryCodes : The ISO country code.

Parameter phoneNumberPrefix : The prefix of the phone number. If provided, it must contain + as part of the country code.

Parameter phoneNumberTypes : The type of phone number.

Parameter targetArn : The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. If both TargetArn and InstanceId input are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.

Implementation

Future<ListPhoneNumbersV2Response> listPhoneNumbersV2({
  String? instanceId,
  int? maxResults,
  String? nextToken,
  List<PhoneNumberCountryCode>? phoneNumberCountryCodes,
  String? phoneNumberPrefix,
  List<PhoneNumberType>? phoneNumberTypes,
  String? targetArn,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $payload = <String, dynamic>{
    if (instanceId != null) 'InstanceId': instanceId,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
    if (phoneNumberCountryCodes != null)
      'PhoneNumberCountryCodes':
          phoneNumberCountryCodes.map((e) => e.value).toList(),
    if (phoneNumberPrefix != null) 'PhoneNumberPrefix': phoneNumberPrefix,
    if (phoneNumberTypes != null)
      'PhoneNumberTypes': phoneNumberTypes.map((e) => e.value).toList(),
    if (targetArn != null) 'TargetArn': targetArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/phone-number/list',
    exceptionFnMap: _exceptionFns,
  );
  return ListPhoneNumbersV2Response.fromJson(response);
}