count method

  1. @override
Future<int> count({
  1. required CountBody body,
  2. String? authorization,
})
override

Implementation

@override
Future<int> count({required CountBody body, String? authorization}) async {
  final response = await _client.request(
    method: 'GET',
    path: '/db/count',
    headers: {'authorization': authorization},
    query: {'body': body},
  );

  final _body = await response.transform(utf8.decoder).join();

  if (jsonDecode(_body) case {'data': final int data}) {
    return data;
  }

  throw Exception('Invalid response');
}