search method

Future<SearchMessagesResponse> search (
  1. Map<String, dynamic> filters,
  2. List<SortOption> sort,
  3. String query,
  4. PaginationParams paginationParams
)

A message search.

Implementation

Future<SearchMessagesResponse> search(
  Map<String, dynamic> filters,
  List<SortOption> sort,
  String query,
  PaginationParams paginationParams,
) async {
  final payload = {
    'filter_conditions': filters,
    'query': query,
    'sort': sort,
  };

  if (paginationParams != null) {
    payload.addAll(paginationParams.toJson());
  }

  final response = await get('/search',
      queryParameters: {'payload': json.encode(payload)});
  return decode<SearchMessagesResponse>(
      response.data, SearchMessagesResponse.fromJson);
}