Skip to content

Examples#

Index > EndUserMessagingSocial > Examples

Auto-generated documentation for EndUserMessagingSocial type annotations stubs module mypy-boto3-socialmessaging.

Client#

Implicit type annotations#

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

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

# EndUserMessagingSocialClient usage example

from boto3.session import Session


session = Session()

client = session.client("socialmessaging")  # (1)
result = client.associate_whatsapp_business_account()  # (2)
  1. client: EndUserMessagingSocialClient
  2. result: AssociateWhatsAppBusinessAccountOutputTypeDef
# ListLinkedWhatsAppBusinessAccountsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_linked_whatsapp_business_accounts")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: EndUserMessagingSocialClient
  2. paginator: ListLinkedWhatsAppBusinessAccountsPaginator
  3. item: ListLinkedWhatsAppBusinessAccountsOutputTypeDef

Explicit type annotations#

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

# EndUserMessagingSocialClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_socialmessaging.client import EndUserMessagingSocialClient
from mypy_boto3_socialmessaging.type_defs import AssociateWhatsAppBusinessAccountOutputTypeDef
from mypy_boto3_socialmessaging.type_defs import AssociateWhatsAppBusinessAccountInputRequestTypeDef


session = Session()

client: EndUserMessagingSocialClient = session.client("socialmessaging")

kwargs: AssociateWhatsAppBusinessAccountInputRequestTypeDef = {...}
result: AssociateWhatsAppBusinessAccountOutputTypeDef = client.associate_whatsapp_business_account(**kwargs)
# ListLinkedWhatsAppBusinessAccountsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_socialmessaging.client import EndUserMessagingSocialClient
from mypy_boto3_socialmessaging.paginator import ListLinkedWhatsAppBusinessAccountsPaginator
from mypy_boto3_socialmessaging.type_defs import ListLinkedWhatsAppBusinessAccountsOutputTypeDef


session = Session()
client: EndUserMessagingSocialClient = session.client("socialmessaging")

paginator: ListLinkedWhatsAppBusinessAccountsPaginator = client.get_paginator("list_linked_whatsapp_business_accounts")
for item in paginator.paginate(...):
    item: ListLinkedWhatsAppBusinessAccountsOutputTypeDef
    print(item)