getTopChannelsForUser method
Get a list of the top channels for a user.
Get a list of the top public and private channels (the user is a member of) for a given user. ##### 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
: channels with posts on the current day. -7_day
: channels with posts in the last 7 days. -28_day
: channels with posts 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. ##### Permissions Must have
view_team
permission for the team.
Implementation
Future<MmTopReactionList?> getTopChannelsForUser(
String userId,
String timeRange, {
int? page,
int? perPage,
String? teamId,
}) async {
final response = await getTopChannelsForUserWithHttpInfo(
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;
}