getTopReactionsForUser method
Get a list of the top reactions for a user.
Get a list of the top reactions across all public and private channels (the user is a member of) for a given user. If no team_id
is provided, this will also include reactions posted by the given user in direct and group messages. ##### Permissions Must be logged in as the user.
Parameters:
-
String userId (required): User 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.
-
String teamId: Team ID will scope the response to a given team and exclude direct and group messages. ##### Permissions Must have
view_team
permission for the team.
Implementation
Future<MmTopReactionList?> getTopReactionsForUser(
String userId,
String timeRange, {
int? page,
int? perPage,
String? teamId,
}) async {
final response = await getTopReactionsForUserWithHttpInfo(
userId,
timeRange,
page: page,
perPage: perPage,
teamId: teamId,
);
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;
}