Skip to content

Examples#

Index > Chime > Examples

Auto-generated documentation for Chime type annotations stubs module mypy-boto3-chime.

Client#

Implicit type annotations#

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

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

# ChimeClient usage example

from boto3.session import Session


session = Session()

client = session.client("chime")  # (1)
result = client.associate_phone_numbers_with_voice_connector()  # (2)
  1. client: ChimeClient
  2. result: AssociatePhoneNumbersWithVoiceConnectorResponseTypeDef
# ListAccountsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_accounts")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ChimeClient
  2. paginator: ListAccountsPaginator
  3. item: ListAccountsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[chime] or a standalone mypy_boto3_chime package, you have to explicitly specify client: ChimeClient 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.

# ChimeClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_chime.client import ChimeClient
from mypy_boto3_chime.type_defs import AssociatePhoneNumbersWithVoiceConnectorResponseTypeDef
from mypy_boto3_chime.type_defs import AssociatePhoneNumbersWithVoiceConnectorRequestRequestTypeDef


session = Session()

client: ChimeClient = session.client("chime")

kwargs: AssociatePhoneNumbersWithVoiceConnectorRequestRequestTypeDef = {...}
result: AssociatePhoneNumbersWithVoiceConnectorResponseTypeDef = client.associate_phone_numbers_with_voice_connector(**kwargs)
# ListAccountsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_chime.client import ChimeClient
from mypy_boto3_chime.paginator import ListAccountsPaginator
from mypy_boto3_chime.type_defs import ListAccountsResponseTypeDef


session = Session()
client: ChimeClient = session.client("chime")

paginator: ListAccountsPaginator = client.get_paginator("list_accounts")
for item in paginator.paginate(...):
    item: ListAccountsResponseTypeDef
    print(item)