Skip to content

Examples#

Index > PartnerCentralBenefits > Examples

Auto-generated documentation for PartnerCentralBenefits type annotations stubs module mypy-boto3-partnercentral-benefits.

Client#

Implicit type annotations#

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

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

Client method usage example#

# PartnerCentralBenefitsClient usage example

from boto3.session import Session


session = Session()

client = session.client("partnercentral-benefits")  # (1)
result = client.associate_benefit_application_resource()  # (2)
  1. client: PartnerCentralBenefitsClient
  2. result: AssociateBenefitApplicationResourceOutputTypeDef

Paginator usage example#

# ListBenefitAllocationsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("partnercentral-benefits")  # (1)

paginator = client.get_paginator("list_benefit_allocations")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: PartnerCentralBenefitsClient
  2. paginator: ListBenefitAllocationsPaginator
  3. item: ListBenefitAllocationsOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[partnercentral-benefits] or a standalone mypy_boto3_partnercentral_benefits package, you have to explicitly specify client: PartnerCentralBenefitsClient 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 method usage example#

# PartnerCentralBenefitsClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_partnercentral_benefits.client import PartnerCentralBenefitsClient
from mypy_boto3_partnercentral_benefits.type_defs import AssociateBenefitApplicationResourceOutputTypeDef
from mypy_boto3_partnercentral_benefits.type_defs import AssociateBenefitApplicationResourceInputTypeDef


session = Session()

client: PartnerCentralBenefitsClient = session.client("partnercentral-benefits")

kwargs: AssociateBenefitApplicationResourceInputTypeDef = {...}
result: AssociateBenefitApplicationResourceOutputTypeDef = client.associate_benefit_application_resource(**kwargs)

Paginator usage example#

# ListBenefitAllocationsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_partnercentral_benefits.client import PartnerCentralBenefitsClient
from mypy_boto3_partnercentral_benefits.paginator import ListBenefitAllocationsPaginator
from mypy_boto3_partnercentral_benefits.type_defs import ListBenefitAllocationsOutputTypeDef


session = Session()
client: PartnerCentralBenefitsClient = session.client("partnercentral-benefits")

paginator: ListBenefitAllocationsPaginator = client.get_paginator("list_benefit_allocations")
for item in paginator.paginate(...):
    item: ListBenefitAllocationsOutputTypeDef
    print(item)