Examples#
Index > OpenSearchServiceServerless > Examples
Auto-generated documentation for OpenSearchServiceServerless type annotations stubs module types-boto3-opensearchserverless.
Client#
Implicit type annotations#
Can be used with types-boto3[opensearchserverless]
package installed.
Write your OpenSearchServiceServerless
code as usual,
type checking and code completion should work out of the box.
# OpenSearchServiceServerlessClient usage example
from boto3.session import Session
session = Session()
client = session.client("opensearchserverless") # (1)
result = client.batch_get_collection() # (2)
- client: OpenSearchServiceServerlessClient
- result: BatchGetCollectionResponseTypeDef
Explicit type annotations#
With types-boto3-lite[opensearchserverless]
or a standalone types_boto3_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 boto3.session import Session
from types_boto3_opensearchserverless.client import OpenSearchServiceServerlessClient
from types_boto3_opensearchserverless.type_defs import BatchGetCollectionResponseTypeDef
from types_boto3_opensearchserverless.type_defs import BatchGetCollectionRequestRequestTypeDef
session = Session()
client: OpenSearchServiceServerlessClient = session.client("opensearchserverless")
kwargs: BatchGetCollectionRequestRequestTypeDef = {...}
result: BatchGetCollectionResponseTypeDef = client.batch_get_collection(**kwargs)