Skip to content

Examples#

Index > IoTThingsGraph > Examples

Auto-generated documentation for IoTThingsGraph type annotations stubs module types-aiobotocore-iotthingsgraph.

Client#

Implicit type annotations#

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

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

# IoTThingsGraphClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("iotthingsgraph") as client:  # (1)
    result = await client.create_flow_template()  # (2)
  1. client: IoTThingsGraphClient
  2. result: CreateFlowTemplateResponseTypeDef
# GetFlowTemplateRevisionsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("iotthingsgraph") as client:  # (1)
    paginator = client.get_paginator("get_flow_template_revisions")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: IoTThingsGraphClient
  2. paginator: GetFlowTemplateRevisionsPaginator
  3. item: GetFlowTemplateRevisionsResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[iotthingsgraph] or a standalone types_aiobotocore_iotthingsgraph package, you have to explicitly specify client: IoTThingsGraphClient 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.

# IoTThingsGraphClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_iotthingsgraph.client import IoTThingsGraphClient
from types_aiobotocore_iotthingsgraph.type_defs import CreateFlowTemplateResponseTypeDef
from types_aiobotocore_iotthingsgraph.type_defs import CreateFlowTemplateRequestRequestTypeDef


session = get_session()

async with session.create_client("iotthingsgraph") as client:
    client: IoTThingsGraphClient
    kwargs: CreateFlowTemplateRequestRequestTypeDef = {...}
    result: CreateFlowTemplateResponseTypeDef = await client.create_flow_template(**kwargs)
# GetFlowTemplateRevisionsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_iotthingsgraph.client import IoTThingsGraphClient
from types_aiobotocore_iotthingsgraph.paginator import GetFlowTemplateRevisionsPaginator
from types_aiobotocore_iotthingsgraph.type_defs import GetFlowTemplateRevisionsResponseTypeDef


session = get_session()

async with session.create_client("iotthingsgraph") as client:
    client: IoTThingsGraphClient
    paginator: GetFlowTemplateRevisionsPaginator = client.get_paginator("get_flow_template_revisions")
    async for item in paginator.paginate(...):
        item: GetFlowTemplateRevisionsResponseTypeDef
        print(item)