Skip to content

Examples

Index > CodeStarNotifications > Examples

Auto-generated documentation for CodeStarNotifications type annotations stubs module types-aiobotocore-codestar-notifications.

Client

Implicit type annotations

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

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

Client usage example
from aioboto3.session import Session


session = Session()

async with session.client("codestar-notifications") as client:  # (1)
    result = await client.create_notification_rule()  # (2)
  1. client: CodeStarNotificationsClient
  2. result: CreateNotificationRuleResultTypeDef
Paginator usage example
from aioboto3.session import Session


session = Session()

async with session.client("codestar-notifications") as client:  # (1)
    paginator = client.get_paginator("list_event_types")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: CodeStarNotificationsClient
  2. paginator: ListEventTypesPaginator
  3. item: ListEventTypesResultTypeDef

Explicit type annotations

With types-aioboto3-lite[codestar-notifications] or a standalone types_aiobotocore_codestar_notifications package, you have to explicitly specify client: CodeStarNotificationsClient 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 usage example
from aioboto3.session import Session

from types_aiobotocore_codestar_notifications.client import CodeStarNotificationsClient
from types_aiobotocore_codestar_notifications.type_defs import CreateNotificationRuleResultTypeDef
from types_aiobotocore_codestar_notifications.type_defs import CreateNotificationRuleRequestRequestTypeDef


session = Session()

client: CodeStarNotificationsClient
async with session.client("codestar-notifications") as client:  # (1)
    kwargs: CreateNotificationRuleRequestRequestTypeDef = {...}  # (2)
    result: CreateNotificationRuleResultTypeDef = await client.create_notification_rule(**kwargs)  # (3)
  1. client: CodeStarNotificationsClient
  2. kwargs: CreateNotificationRuleRequestRequestTypeDef
  3. result: CreateNotificationRuleResultTypeDef
Paginator usage example
from aioboto3.session import Session

from types_aiobotocore_codestar_notifications.client import CodeStarNotificationsClient
from types_aiobotocore_codestar_notifications.paginator import ListEventTypesPaginator
from types_aiobotocore_codestar_notifications.type_defs import ListEventTypesResultTypeDef


session = Session()

client: CodeStarNotificationsClient
async with session.client("codestar-notifications") as client:  # (1)
    paginator: ListEventTypesPaginator = client.get_paginator("list_event_types")  # (2)
    async for item in paginator.paginate(...):
        item: ListEventTypesResultTypeDef
        print(item)  # (3)
  1. client: CodeStarNotificationsClient
  2. paginator: ListEventTypesPaginator
  3. item: ListEventTypesResultTypeDef