Skip to content

Examples#

Index > ConnectCampaignService > Examples

Auto-generated documentation for ConnectCampaignService type annotations stubs module mypy-boto3-connectcampaigns.

Client#

Implicit type annotations#

Can be used with boto3-stubs[connectcampaigns] package installed.

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

# ConnectCampaignServiceClient usage example

from boto3.session import Session


session = Session()

client = session.client("connectcampaigns")  # (1)
result = client.create_campaign()  # (2)
  1. client: ConnectCampaignServiceClient
  2. result: CreateCampaignResponseTypeDef
# ListCampaignsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("connectcampaigns")  # (1)

paginator = client.get_paginator("list_campaigns")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ConnectCampaignServiceClient
  2. paginator: ListCampaignsPaginator
  3. item: ListCampaignsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[connectcampaigns] or a standalone mypy_boto3_connectcampaigns package, you have to explicitly specify client: ConnectCampaignServiceClient 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.

# ConnectCampaignServiceClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_connectcampaigns.client import ConnectCampaignServiceClient
from mypy_boto3_connectcampaigns.type_defs import CreateCampaignResponseTypeDef
from mypy_boto3_connectcampaigns.type_defs import CreateCampaignRequestRequestTypeDef


session = Session()

client: ConnectCampaignServiceClient = session.client("connectcampaigns")

kwargs: CreateCampaignRequestRequestTypeDef = {...}
result: CreateCampaignResponseTypeDef = client.create_campaign(**kwargs)
# ListCampaignsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_connectcampaigns.client import ConnectCampaignServiceClient
from mypy_boto3_connectcampaigns.paginator import ListCampaignsPaginator
from mypy_boto3_connectcampaigns.type_defs import ListCampaignsResponseTypeDef


session = Session()
client: ConnectCampaignServiceClient = session.client("connectcampaigns")

paginator: ListCampaignsPaginator = client.get_paginator("list_campaigns")
for item in paginator.paginate(...):
    item: ListCampaignsResponseTypeDef
    print(item)