searchAvailablePhoneNumbers method
Searches phone numbers that can be ordered.
May throw BadRequestException. May throw ForbiddenException. May throw AccessDeniedException. May throw UnauthorizedClientException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.
Parameter areaCode
:
The area code used to filter results.
Parameter city
:
The city used to filter results.
Parameter country
:
The country used to filter results.
Parameter maxResults
:
The maximum number of results to return in a single call.
Parameter nextToken
:
The token to use to retrieve the next page of results.
Parameter state
:
The state used to filter results.
Parameter tollFreePrefix
:
The toll-free prefix that you use to filter results.
Implementation
Future<SearchAvailablePhoneNumbersResponse> searchAvailablePhoneNumbers({
String? areaCode,
String? city,
String? country,
int? maxResults,
String? nextToken,
String? state,
String? tollFreePrefix,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
500,
);
_s.validateStringLength(
'tollFreePrefix',
tollFreePrefix,
3,
3,
);
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 (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);
}