listPhoneNumbers method
Provides information about the phone numbers for the specified Connect Customer instance.
For more information about phone numbers, see Set Up Phone Numbers for Your Contact Center in the Connect Customer Administrator Guide.
-
We recommend using ListPhoneNumbersV2
to return phone number types. ListPhoneNumbers doesn't support number
types
UIFN,SHARED,THIRD_PARTY_TF, andTHIRD_PARTY_DID. While it returns numbers of those types, it incorrectly lists them asTOLL_FREEorDID. -
The phone number
Arnvalue that is returned from each of the items in the PhoneNumberSummaryList cannot be used to tag phone number resources. It will fail with aResourceNotFoundException. Instead, use the ListPhoneNumbersV2 API. It returns the new phone number ARN that can be used to tag phone number resources.
May throw InternalServiceException.
May throw InvalidParameterException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter instanceId :
The identifier of the Connect Customer instance. You can find
the instance ID in the Amazon Resource Name (ARN) of the instance.
Parameter maxResults :
The maximum number of results to return per page. The default MaxResult
size is 100.
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 phoneNumberTypes :
The type of phone number.
Implementation
Future<ListPhoneNumbersResponse> listPhoneNumbers({
required String instanceId,
int? maxResults,
String? nextToken,
List<PhoneNumberCountryCode>? phoneNumberCountryCodes,
List<PhoneNumberType>? phoneNumberTypes,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1000,
);
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
if (phoneNumberCountryCodes != null)
'phoneNumberCountryCodes':
phoneNumberCountryCodes.map((e) => e.value).toList(),
if (phoneNumberTypes != null)
'phoneNumberTypes': phoneNumberTypes.map((e) => e.value).toList(),
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/phone-numbers-summary/${Uri.encodeComponent(instanceId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListPhoneNumbersResponse.fromJson(response);
}