listInvoiceUnits method

Future<ListInvoiceUnitsResponse> listInvoiceUnits({
  1. DateTime? asOf,
  2. Filters? filters,
  3. int? maxResults,
  4. String? nextToken,
})

This fetches a list of all invoice unit definitions for a given account, as of the provided AsOf date.

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

Parameter asOf : The state of an invoice unit at a specified time. You can see legacy invoice units that are currently deleted if the AsOf time is set to before it was deleted. If an AsOf is not provided, the default value is the current time.

Parameter filters : An optional input to the list API. If multiple filters are specified, the returned list will be a configuration that match all of the provided filters. Supported filter types are InvoiceReceivers, Names, and Accounts.

Parameter maxResults : The maximum number of invoice units that can be returned.

Parameter nextToken : The next token used to indicate where the returned list should start from.

Implementation

Future<ListInvoiceUnitsResponse> listInvoiceUnits({
  DateTime? asOf,
  Filters? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'Invoicing.ListInvoiceUnits'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (asOf != null) 'AsOf': unixTimestampToJson(asOf),
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListInvoiceUnitsResponse.fromJson(jsonResponse.body);
}