searchSampleQueries method

Future<SearchSampleQueriesResponse> searchSampleQueries({
  1. required String searchPhrase,
  2. int? maxResults,
  3. String? nextToken,
})

Searches sample queries and returns a list of sample queries that are sorted by relevance. To search for sample queries, provide a natural language SearchPhrase in English.

May throw InvalidParameterException. May throw OperationNotPermittedException. May throw UnsupportedOperationException.

Parameter searchPhrase : The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words.

Parameter maxResults : The maximum number of results to return on a single page. The default value is 10.

Parameter nextToken : A token you can use to get the next page of results. The length constraint is in characters, not words.

Implementation

Future<SearchSampleQueriesResponse> searchSampleQueries({
  required String searchPhrase,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.SearchSampleQueries'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SearchPhrase': searchPhrase,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return SearchSampleQueriesResponse.fromJson(jsonResponse.body);
}