counters method

Future<ChannelCounters> counters(
  1. ChannelCountersFilter filter,
  2. Authentication authentication
)

Implementation

Future<ChannelCounters> counters(
  ChannelCountersFilter filter,
  Authentication authentication,
) async {
  http.Response response = await _httpService.getWithFilter(
    '/api/v1/channels.counters',
    filter,
    authentication,
  );

  if (response.statusCode == 200) {
    if (response.body.isNotEmpty == true) {
      return ChannelCounters.fromMap(jsonDecode(response.body));
    } else {
      return ChannelCounters();
    }
  }
  throw RocketChatException(response.body);
}