countNotifications method

Future<int> countNotifications({
  1. bool? read,
  2. bool? archived,
  3. List<String> tags = const [],
})

Implementation

Future<int> countNotifications({bool? read, bool? archived, List<String> tags = const [] }) async {
  var response = (await _client.get<Map<String, dynamic>>(
      'notifications/count',
      queryParameters: {
        'filters': jsonEncode([{
          if (tags.isNotEmpty == true) 'tags': tags,
          if (read != null) 'read': read,
          if (archived != null) 'archived': archived
        }])
      }
  )).data!;

  return response['data'].first['count'];
}