Skip to content

Examples#

Index > CloudDirectory > Examples

Auto-generated documentation for CloudDirectory type annotations stubs module types-aiobotocore-clouddirectory.

Client#

Implicit type annotations#

Can be used with types-aioboto3[clouddirectory] package installed.

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

# CloudDirectoryClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("clouddirectory") as client:  # (1)
    result = await client.apply_schema()  # (2)
  1. client: CloudDirectoryClient
  2. result: ApplySchemaResponseTypeDef
# ListAppliedSchemaArnsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("clouddirectory") as client:  # (1)
    paginator = client.get_paginator("list_applied_schema_arns")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: CloudDirectoryClient
  2. paginator: ListAppliedSchemaArnsPaginator
  3. item: ListAppliedSchemaArnsResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[clouddirectory] or a standalone types_aiobotocore_clouddirectory package, you have to explicitly specify client: CloudDirectoryClient 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.

# CloudDirectoryClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_clouddirectory.client import CloudDirectoryClient
from types_aiobotocore_clouddirectory.type_defs import ApplySchemaResponseTypeDef
from types_aiobotocore_clouddirectory.type_defs import ApplySchemaRequestRequestTypeDef


session = Session()

client: CloudDirectoryClient
async with session.client("clouddirectory") as client:  # (1)
    kwargs: ApplySchemaRequestRequestTypeDef = {...}  # (2)
    result: ApplySchemaResponseTypeDef = await client.apply_schema(**kwargs)  # (3)
  1. client: CloudDirectoryClient
  2. kwargs: ApplySchemaRequestRequestTypeDef
  3. result: ApplySchemaResponseTypeDef
# ListAppliedSchemaArnsPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_clouddirectory.client import CloudDirectoryClient
from types_aiobotocore_clouddirectory.paginator import ListAppliedSchemaArnsPaginator
from types_aiobotocore_clouddirectory.type_defs import ListAppliedSchemaArnsResponseTypeDef


session = Session()

client: CloudDirectoryClient
async with session.client("clouddirectory") as client:  # (1)
    paginator: ListAppliedSchemaArnsPaginator = client.get_paginator("list_applied_schema_arns")  # (2)
    async for item in paginator.paginate(...):
        item: ListAppliedSchemaArnsResponseTypeDef
        print(item)  # (3)
  1. client: CloudDirectoryClient
  2. paginator: ListAppliedSchemaArnsPaginator
  3. item: ListAppliedSchemaArnsResponseTypeDef