listPhoneNumbers method

Future<ListPhoneNumbersResponse> listPhoneNumbers({
  1. PhoneNumberAssociationName? filterName,
  2. String? filterValue,
  3. int? maxResults,
  4. String? nextToken,
  5. PhoneNumberProductType? productType,
  6. PhoneNumberStatus? status,
})

Lists the phone numbers for the specified Amazon Chime account, Amazon Chime user, Amazon Chime Voice Connector, or Amazon Chime Voice Connector group.

May throw UnauthorizedClientException. May throw ForbiddenException. May throw BadRequestException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter filterName : The filter to use to limit the number of results.

Parameter filterValue : The value to use for the filter.

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 productType : The phone number product type.

Parameter status : The phone number status.

Implementation

Future<ListPhoneNumbersResponse> listPhoneNumbers({
  PhoneNumberAssociationName? filterName,
  String? filterValue,
  int? maxResults,
  String? nextToken,
  PhoneNumberProductType? productType,
  PhoneNumberStatus? status,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    99,
  );
  final $query = <String, List<String>>{
    if (filterName != null) 'filter-name': [filterName.toValue()],
    if (filterValue != null) 'filter-value': [filterValue],
    if (maxResults != null) 'max-results': [maxResults.toString()],
    if (nextToken != null) 'next-token': [nextToken],
    if (productType != null) 'product-type': [productType.toValue()],
    if (status != null) 'status': [status.toValue()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/phone-numbers',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListPhoneNumbersResponse.fromJson(response);
}