Skip to content

Examples#

Index > SSMContacts > Examples

Auto-generated documentation for SSMContacts type annotations stubs module types-aiobotocore-ssm-contacts.

Client#

Implicit type annotations#

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

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

# SSMContactsClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("ssm-contacts") as client:  # (1)
    result = await client.create_contact()  # (2)
  1. client: SSMContactsClient
  2. result: CreateContactResultTypeDef
# ListContactChannelsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("ssm-contacts") as client:  # (1)
    paginator = client.get_paginator("list_contact_channels")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: SSMContactsClient
  2. paginator: ListContactChannelsPaginator
  3. item: ListContactChannelsResultTypeDef

Explicit type annotations#

With types-aioboto3-lite[ssm-contacts] or a standalone types_aiobotocore_ssm_contacts package, you have to explicitly specify client: SSMContactsClient 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.

# SSMContactsClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_ssm_contacts.client import SSMContactsClient
from types_aiobotocore_ssm_contacts.type_defs import CreateContactResultTypeDef
from types_aiobotocore_ssm_contacts.type_defs import CreateContactRequestRequestTypeDef


session = Session()

client: SSMContactsClient
async with session.client("ssm-contacts") as client:  # (1)
    kwargs: CreateContactRequestRequestTypeDef = {...}  # (2)
    result: CreateContactResultTypeDef = await client.create_contact(**kwargs)  # (3)
  1. client: SSMContactsClient
  2. kwargs: CreateContactRequestRequestTypeDef
  3. result: CreateContactResultTypeDef
# ListContactChannelsPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_ssm_contacts.client import SSMContactsClient
from types_aiobotocore_ssm_contacts.paginator import ListContactChannelsPaginator
from types_aiobotocore_ssm_contacts.type_defs import ListContactChannelsResultTypeDef


session = Session()

client: SSMContactsClient
async with session.client("ssm-contacts") as client:  # (1)
    paginator: ListContactChannelsPaginator = client.get_paginator("list_contact_channels")  # (2)
    async for item in paginator.paginate(...):
        item: ListContactChannelsResultTypeDef
        print(item)  # (3)
  1. client: SSMContactsClient
  2. paginator: ListContactChannelsPaginator
  3. item: ListContactChannelsResultTypeDef