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.

Client method usage example#

# ChimeClient usage example

from boto3.session import Session


session = Session()

client = session.client("chime")  # (1)
result = client.batch_create_room_membership()  # (2)
  1. client: ChimeClient
  2. result: BatchCreateRoomMembershipResponseTypeDef

Paginator usage example#

# 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.

Client method usage example#

# 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 BatchCreateRoomMembershipResponseTypeDef
from mypy_boto3_chime.type_defs import BatchCreateRoomMembershipRequestTypeDef


session = Session()

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

kwargs: BatchCreateRoomMembershipRequestTypeDef = {...}
result: BatchCreateRoomMembershipResponseTypeDef = client.batch_create_room_membership(**kwargs)

Paginator usage example#

# 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)