describeOptedOutNumbers method

Future<DescribeOptedOutNumbersResult> describeOptedOutNumbers({
  1. required String optOutListName,
  2. List<OptedOutFilter>? filters,
  3. int? maxResults,
  4. String? nextToken,
  5. List<String>? optedOutNumbers,
})

Describes the specified opted out destination numbers or all opted out destination numbers in an opt-out list.

If you specify opted out numbers, the output includes information for only the specified opted out numbers. If you specify filters, the output includes information for only those opted out numbers that meet the filter criteria. If you don't specify opted out numbers or filters, the output includes information for all opted out destination numbers in your opt-out list.

If you specify an opted out number that isn't valid, an exception is returned.

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

Parameter optOutListName : The OptOutListName or OptOutListArn of the OptOutList. You can use DescribeOptOutLists to find the values for OptOutListName and OptOutListArn.

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

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 optedOutNumbers : An array of phone numbers to search for in the OptOutList.

If you specify an opted out number that isn't valid, an exception is returned.

Implementation

Future<DescribeOptedOutNumbersResult> describeOptedOutNumbers({
  required String optOutListName,
  List<OptedOutFilter>? filters,
  int? maxResults,
  String? nextToken,
  List<String>? optedOutNumbers,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.DescribeOptedOutNumbers'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'OptOutListName': optOutListName,
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (optedOutNumbers != null) 'OptedOutNumbers': optedOutNumbers,
    },
  );

  return DescribeOptedOutNumbersResult.fromJson(jsonResponse.body);
}