Skip to content

list_invoice_units async

list_invoice_units(
    *,
    config_overrides: Optional[AsyncInvoicingClientConfig] = None,
    filters: Optional[Filters] = None,
    next_token: Optional[NextTokenString] = None,
    max_results: Optional[MaxResultsInteger] = None,
    as_of: Optional[AsOfTimestamp] = None,
) -> ListInvoiceUnitsResponse

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

Parameters:

  • filters (Optional[Filters], default: None ) –

    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.

  • next_token (Optional[NextTokenString], default: None ) –

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

  • max_results (Optional[MaxResultsInteger], default: None ) –

    The maximum number of invoice units that can be returned.

  • as_of (Optional[AsOfTimestamp], default: None ) –

    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.

Raises:

Examples:

ListInvoiceUnits without filters as of current time

>>> await client.list_invoice_units()
ListInvoiceUnits with filters as of specified time
>>> await client.list_invoice_units(as_of=1733097600, filters={'InvoiceReceivers': ['333333333333']})
ListInvoiceUnits with pagination - first page
>>> await client.list_invoice_units(max_results=1)
ListInvoiceUnits with pagination - second page
>>> await client.list_invoice_units(max_results=1, next_token='nextTokenExample')
Source code in docs_src/capo_invoicing/_services/async_invoicing.py
async def list_invoice_units(
    self,
    *,
    config_overrides: Optional[AsyncInvoicingClientConfig] = None,
    filters: Optional["capo_invoicing.types.filters.Filters"] = None,
    next_token: Optional[
        "capo_invoicing.types.next_token_string.NextTokenString"
    ] = None,
    max_results: Optional[
        "capo_invoicing.types.max_results_integer.MaxResultsInteger"
    ] = None,
    as_of: Optional["capo_invoicing.types.as_of_timestamp.AsOfTimestamp"] = None,
) -> "capo_invoicing.types.list_invoice_units_response.ListInvoiceUnitsResponse":
    """<p>This fetches a list of all invoice unit definitions for a given account, as of the provided <code>AsOf</code> date.</p>

    Args:
        filters: <p> 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 <code>InvoiceReceivers</code>, <code>Names</code>, and <code>Accounts</code>. </p>
        next_token: <p>The next token used to indicate where the returned list should start from. </p>
        max_results: <p>The maximum number of invoice units that can be returned. </p>
        as_of: <p> The state of an invoice unit at a specified time. You can see legacy invoice units that are currently deleted if the <code>AsOf</code> time is set to before it was deleted. If an <code>AsOf</code> is not provided, the default value is the current time. </p>

    Raises:
        capo_invoicing.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_invoicing.errors.internal_server_exception.InternalServerException: <p>The processing request failed because of an unknown error, exception, or failure. </p>
        capo_invoicing.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_invoicing.errors.validation_exception.ValidationException: <p> The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
        capo_invoicing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        ListInvoiceUnits without filters as of current time

        >>> await client.list_invoice_units()
        ListInvoiceUnits with filters as of specified time

        >>> await client.list_invoice_units(as_of=1733097600, filters={'InvoiceReceivers': ['333333333333']})
        ListInvoiceUnits with pagination - first page

        >>> await client.list_invoice_units(max_results=1)
        ListInvoiceUnits with pagination - second page

        >>> await client.list_invoice_units(max_results=1, next_token='nextTokenExample')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_invoicing.types.list_invoice_units_request.ListInvoiceUnitsRequest]",
    ) -> AsyncOperationResponse[
        "capo_invoicing.types.list_invoice_units_response.ListInvoiceUnitsResponse"
    ]:
        import capo_invoicing._operations.invoicing.list_invoice_units

        (
            output,
            http_response,
        ) = await capo_invoicing._operations.invoicing.list_invoice_units.async_list_invoice_units(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListInvoiceUnits")
    )
    input_: capo_invoicing.types.list_invoice_units_request.ListInvoiceUnitsRequest = {}
    if filters is not None:
        input_["filters"] = filters
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if as_of is not None:
        input_["as_of"] = as_of

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output