Skip to content

Examples#

Index > LexModelBuildingService > Examples

Auto-generated documentation for LexModelBuildingService type annotations stubs module types-aiobotocore-lex-models.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[lex-models] package installed.

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

# LexModelBuildingServiceClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("lex-models") as client:  # (1)
    result = await client.create_bot_version()  # (2)
  1. client: LexModelBuildingServiceClient
  2. result: CreateBotVersionResponseTypeDef
# GetBotAliasesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("lex-models") as client:  # (1)
    paginator = client.get_paginator("get_bot_aliases")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: LexModelBuildingServiceClient
  2. paginator: GetBotAliasesPaginator
  3. item: GetBotAliasesResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[lex-models] or a standalone types_aiobotocore_lex_models package, you have to explicitly specify client: LexModelBuildingServiceClient 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.

# LexModelBuildingServiceClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_lex_models.client import LexModelBuildingServiceClient
from types_aiobotocore_lex_models.type_defs import CreateBotVersionResponseTypeDef
from types_aiobotocore_lex_models.type_defs import CreateBotVersionRequestRequestTypeDef


session = get_session()

async with session.create_client("lex-models") as client:
    client: LexModelBuildingServiceClient
    kwargs: CreateBotVersionRequestRequestTypeDef = {...}
    result: CreateBotVersionResponseTypeDef = await client.create_bot_version(**kwargs)
# GetBotAliasesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_lex_models.client import LexModelBuildingServiceClient
from types_aiobotocore_lex_models.paginator import GetBotAliasesPaginator
from types_aiobotocore_lex_models.type_defs import GetBotAliasesResponseTypeDef


session = get_session()

async with session.create_client("lex-models") as client:
    client: LexModelBuildingServiceClient
    paginator: GetBotAliasesPaginator = client.get_paginator("get_bot_aliases")
    async for item in paginator.paginate(...):
        item: GetBotAliasesResponseTypeDef
        print(item)