listSearches method

Future<ListSearchesResponse> listSearches({
  1. required String workspaceName,
  2. ListSearchesFilters? listSearchesFilters,
  3. int? maxResults,
  4. String? nextToken,
})

Lists the searches in a workspace, most recently started first. Results can be narrowed with optional filters (status, search type, group, and started-at time range) and are paginated: when nextToken is present, pass it on a subsequent call to retrieve the next page.

May throw AccessDeniedException. May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter workspaceName : The name of the workspace whose searches are listed.

Parameter listSearchesFilters : Optional filters that restrict which searches are returned.

Parameter maxResults : The maximum number of searches to return in a single page. Valid range is 1 to 1,000; if omitted, a service-defined default is used.

Parameter nextToken : The pagination token returned by a previous ListSearches call. Provide it to retrieve the next page; omit it to retrieve the first page.

Implementation

Future<ListSearchesResponse> listSearches({
  required String workspaceName,
  ListSearchesFilters? listSearchesFilters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $payload = <String, dynamic>{
    if (listSearchesFilters != null)
      'listSearchesFilters': listSearchesFilters,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceName)}/searches/list',
    hostPrefix: 'data.',
    exceptionFnMap: _exceptionFns,
  );
  return ListSearchesResponse.fromJson(response);
}