Skip to content

Examples#

Index > QConnect > Examples

Auto-generated documentation for QConnect type annotations stubs module mypy-boto3-qconnect.

Client#

Implicit type annotations#

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

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

# QConnectClient usage example

from boto3.session import Session


session = Session()

client = session.client("qconnect")  # (1)
result = client.create_ai_agent()  # (2)
  1. client: QConnectClient
  2. result: CreateAIAgentResponseTypeDef
# ListAIAgentVersionsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_ai_agent_versions")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: QConnectClient
  2. paginator: ListAIAgentVersionsPaginator
  3. item: ListAIAgentVersionsResponseTypeDef

Explicit type annotations#

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

# QConnectClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_qconnect.client import QConnectClient
from mypy_boto3_qconnect.type_defs import CreateAIAgentResponseTypeDef
from mypy_boto3_qconnect.type_defs import CreateAIAgentRequestRequestTypeDef


session = Session()

client: QConnectClient = session.client("qconnect")

kwargs: CreateAIAgentRequestRequestTypeDef = {...}
result: CreateAIAgentResponseTypeDef = client.create_ai_agent(**kwargs)
# ListAIAgentVersionsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_qconnect.client import QConnectClient
from mypy_boto3_qconnect.paginator import ListAIAgentVersionsPaginator
from mypy_boto3_qconnect.type_defs import ListAIAgentVersionsResponseTypeDef


session = Session()
client: QConnectClient = session.client("qconnect")

paginator: ListAIAgentVersionsPaginator = client.get_paginator("list_ai_agent_versions")
for item in paginator.paginate(...):
    item: ListAIAgentVersionsResponseTypeDef
    print(item)