searchAvailablePhoneNumbers method
Searches the provisioned phone numbers in an organization.
May throw AccessDeniedException.
May throw BadRequestException.
May throw ForbiddenException.
May throw ServiceFailureException.
May throw ServiceUnavailableException.
May throw ThrottledClientException.
May throw UnauthorizedClientException.
Parameter areaCode :
Confines a search to just the phone numbers associated with the specified
area code.
Parameter city :
Confines a search to just the phone numbers associated with the specified
city.
Parameter country :
Confines a search to just the phone numbers associated with the specified
country.
Parameter maxResults :
The maximum number of results to return.
Parameter nextToken :
The token used to return the next page of results.
Parameter phoneNumberType :
Confines a search to just the phone numbers associated with the specified
phone number type, either local or toll-free.
Parameter state :
Confines a search to just the phone numbers associated with the specified
state.
Parameter tollFreePrefix :
Confines a search to just the phone numbers associated with the specified
toll-free prefix.
Implementation
Future<SearchAvailablePhoneNumbersResponse> searchAvailablePhoneNumbers({
String? areaCode,
String? city,
String? country,
int? maxResults,
String? nextToken,
PhoneNumberType? phoneNumberType,
String? state,
String? tollFreePrefix,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
500,
);
final $query = <String, List<String>>{
if (areaCode != null) 'area-code': [areaCode],
if (city != null) 'city': [city],
if (country != null) 'country': [country],
if (maxResults != null) 'max-results': [maxResults.toString()],
if (nextToken != null) 'next-token': [nextToken],
if (phoneNumberType != null) 'phone-number-type': [phoneNumberType.value],
if (state != null) 'state': [state],
if (tollFreePrefix != null) 'toll-free-prefix': [tollFreePrefix],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/search?type=phone-numbers',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return SearchAvailablePhoneNumbersResponse.fromJson(response);
}