Skip to content

Examples#

Index > Invoicing > Examples

Auto-generated documentation for Invoicing type annotations stubs module mypy-boto3-invoicing.

Client#

Implicit type annotations#

Can be used with boto3-stubs[invoicing] package installed.

Write your Invoicing code as usual, type checking and code completion should work out of the box.

Client method usage example#

# InvoicingClient usage example

from boto3.session import Session


session = Session()

client = session.client("invoicing")  # (1)
result = client.batch_get_invoice_profile()  # (2)
  1. client: InvoicingClient
  2. result: BatchGetInvoiceProfileResponseTypeDef

Paginator usage example#

# ListInvoiceUnitsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("invoicing")  # (1)

paginator = client.get_paginator("list_invoice_units")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: InvoicingClient
  2. paginator: ListInvoiceUnitsPaginator
  3. item: ListInvoiceUnitsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[invoicing] or a standalone mypy_boto3_invoicing package, you have to explicitly specify client: InvoicingClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

Client method usage example#

# InvoicingClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_invoicing.client import InvoicingClient
from mypy_boto3_invoicing.type_defs import BatchGetInvoiceProfileResponseTypeDef
from mypy_boto3_invoicing.type_defs import BatchGetInvoiceProfileRequestTypeDef


session = Session()

client: InvoicingClient = session.client("invoicing")

kwargs: BatchGetInvoiceProfileRequestTypeDef = {...}
result: BatchGetInvoiceProfileResponseTypeDef = client.batch_get_invoice_profile(**kwargs)

Paginator usage example#

# ListInvoiceUnitsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_invoicing.client import InvoicingClient
from mypy_boto3_invoicing.paginator import ListInvoiceUnitsPaginator
from mypy_boto3_invoicing.type_defs import ListInvoiceUnitsResponseTypeDef


session = Session()
client: InvoicingClient = session.client("invoicing")

paginator: ListInvoiceUnitsPaginator = client.get_paginator("list_invoice_units")
for item in paginator.paginate(...):
    item: ListInvoiceUnitsResponseTypeDef
    print(item)