describePhoneNumbers method

Future<DescribePhoneNumbersResult> describePhoneNumbers({
  1. List<PhoneNumberFilter>? filters,
  2. int? maxResults,
  3. String? nextToken,
  4. Owner? owner,
  5. List<String>? phoneNumberIds,
})

Describes the specified origination phone number, or all the phone numbers in your account.

If you specify phone number IDs, the output includes information for only the specified phone numbers. If you specify filters, the output includes information for only those phone numbers that meet the filter criteria. If you don't specify phone number IDs or filters, the output includes information for all phone numbers.

If you specify a phone number ID that isn't valid, an error is returned.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter filters : An array of PhoneNumberFilter objects to filter the results.

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

Parameter nextToken : The token to be used for the next set of paginated results. You don't need to supply a value for this field in the initial request.

Parameter owner : Use SELF to filter the list of phone numbers to ones your account owns or use SHARED to filter on phone numbers shared with your account. The Owner and PhoneNumberIds parameters can't be used at the same time.

Parameter phoneNumberIds : The unique identifier of phone numbers to find information about. This is an array of strings that can be either the PhoneNumberId or PhoneNumberArn.

Implementation

Future<DescribePhoneNumbersResult> describePhoneNumbers({
  List<PhoneNumberFilter>? filters,
  int? maxResults,
  String? nextToken,
  Owner? owner,
  List<String>? phoneNumberIds,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.DescribePhoneNumbers'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (owner != null) 'Owner': owner.value,
      if (phoneNumberIds != null) 'PhoneNumberIds': phoneNumberIds,
    },
  );

  return DescribePhoneNumbersResult.fromJson(jsonResponse.body);
}