Skip to content

Examples#

Index > OpenSearchServiceServerless > Examples

Auto-generated documentation for OpenSearchServiceServerless type annotations stubs module types-aiobotocore-opensearchserverless.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[opensearchserverless] package installed.

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

# OpenSearchServiceServerlessClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("opensearchserverless") as client:  # (1)
    result = await client.batch_get_collection()  # (2)
  1. client: OpenSearchServiceServerlessClient
  2. result: BatchGetCollectionResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[opensearchserverless] or a standalone types_aiobotocore_opensearchserverless package, you have to explicitly specify client: OpenSearchServiceServerlessClient 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.

# OpenSearchServiceServerlessClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_opensearchserverless.client import OpenSearchServiceServerlessClient
from types_aiobotocore_opensearchserverless.type_defs import BatchGetCollectionResponseTypeDef
from types_aiobotocore_opensearchserverless.type_defs import BatchGetCollectionRequestRequestTypeDef


session = get_session()

async with session.create_client("opensearchserverless") as client:
    client: OpenSearchServiceServerlessClient
    kwargs: BatchGetCollectionRequestRequestTypeDef = {...}
    result: BatchGetCollectionResponseTypeDef = await client.batch_get_collection(**kwargs)