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-aioboto3[opensearchserverless] package installed.

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

# OpenSearchServiceServerlessClient usage example

from aioboto3.session import Session


session = Session()

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

Explicit type annotations#

With types-aioboto3-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 aioboto3.session import 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 = Session()

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