getTopReactionsForTeam method

Future<MmTopReactionList?> getTopReactionsForTeam(
  1. String teamId,
  2. String timeRange, {
  3. int? page,
  4. int? perPage,
})

Get a list of the top reactions for a team.

Get a list of the top reactions across all public and private channels (the user is a member of) for a given team. ##### Permissions Must have view_team permission for the team.

Parameters:

  • String teamId (required): Team GUID

  • String timeRange (required): Time range can be "today", "7_day", or "28_day". - today: reactions posted on the current day. - 7_day: reactions posted in the last 7 days. - 28_day: reactions posted in the last 28 days.

  • int page: The page to select.

  • int perPage: The number of items per page, up to a maximum of 200.

Implementation

Future<MmTopReactionList?> getTopReactionsForTeam(
  String teamId,
  String timeRange, {
  int? page,
  int? perPage,
}) async {
  final response = await getTopReactionsForTeamWithHttpInfo(
    teamId,
    timeRange,
    page: page,
    perPage: perPage,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'MmTopReactionList',
    ) as MmTopReactionList;
  }
  return null;
}