listCollections method

Future<ListCollectionsResponse> listCollections({
  1. CollectionFilters? collectionFilters,
  2. int? maxResults,
  3. String? nextToken,
})

Lists all OpenSearch Serverless collections. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

May throw InternalServerException. May throw ValidationException.

Parameter collectionFilters : A list of filter names and values that you can use for requests.

Parameter maxResults : The maximum number of results to return. Default is 20. You can use nextToken to get the next page of results.

Parameter nextToken : If your initial ListCollections operation returns a nextToken, you can include the returned nextToken in subsequent ListCollections operations, which returns results in the next page.

Implementation

Future<ListCollectionsResponse> listCollections({
  CollectionFilters? collectionFilters,
  int? maxResults,
  String? nextToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.ListCollections'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (collectionFilters != null) 'collectionFilters': collectionFilters,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListCollectionsResponse.fromJson(jsonResponse.body);
}