searchCases method

Future<SearchCasesResponse> searchCases({
  1. required String domainId,
  2. List<FieldIdentifier>? fields,
  3. CaseFilter? filter,
  4. int? maxResults,
  5. String? nextToken,
  6. String? searchTerm,
  7. List<Sort>? sorts,
})

Searches for cases within their associated Cases domain. Search results are returned as a paginated list of abridged case documents.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter domainId : The unique identifier of the Cases domain.

Parameter fields : The list of field identifiers to be returned as part of the response.

Parameter filter : A list of filter objects.

Parameter maxResults : The maximum number of cases to return. When no value is provided, 25 is the default.

Parameter nextToken : The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Parameter searchTerm : A word or phrase used to perform a quick search.

Parameter sorts : A list of sorts where each sort specifies a field and their sort order to be applied to the results.

Implementation

Future<SearchCasesResponse> searchCases({
  required String domainId,
  List<FieldIdentifier>? fields,
  CaseFilter? filter,
  int? maxResults,
  String? nextToken,
  String? searchTerm,
  List<Sort>? sorts,
}) async {
  final $payload = <String, dynamic>{
    if (fields != null) 'fields': fields,
    if (filter != null) 'filter': filter,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
    if (searchTerm != null) 'searchTerm': searchTerm,
    if (sorts != null) 'sorts': sorts,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/domains/${Uri.encodeComponent(domainId)}/cases-search',
    exceptionFnMap: _exceptionFns,
  );
  return SearchCasesResponse.fromJson(response);
}