getTotalUsersStatsFiltered method
Get total count of users in the system matching the specified filters
Get a count of users in the system matching the specified filters. Minimum server version: 5.26 ##### Permissions Must have manage_system
permission.
Parameters:
-
String inTeam: The ID of the team to get user stats for.
-
String inChannel: The ID of the channel to get user stats for.
-
bool includeDeleted: If deleted accounts should be included in the count.
-
bool includeBots: If bot accounts should be included in the count.
-
String roles: Comma separated string used to filter users based on any of the specified system roles Example:
?roles=system_admin,system_user
will include users that are either system admins or system users -
String channelRoles: Comma separated string used to filter users based on any of the specified channel roles, can only be used in conjunction with
in_channel
Example:?in_channel=4eb6axxw7fg3je5iyasnfudc5y&channel_roles=channel_user
will include users that are only channel users and not admins or guests -
String teamRoles: Comma separated string used to filter users based on any of the specified team roles, can only be used in conjunction with
in_team
Example:?in_team=4eb6axxw7fg3je5iyasnfudc5y&team_roles=team_user
will include users that are only team users and not admins or guests
Implementation
Future<MmUsersStats?> getTotalUsersStatsFiltered({
String? inTeam,
String? inChannel,
bool? includeDeleted,
bool? includeBots,
String? roles,
String? channelRoles,
String? teamRoles,
}) async {
final response = await getTotalUsersStatsFilteredWithHttpInfo(
inTeam: inTeam,
inChannel: inChannel,
includeDeleted: includeDeleted,
includeBots: includeBots,
roles: roles,
channelRoles: channelRoles,
teamRoles: teamRoles,
);
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),
'MmUsersStats',
) as MmUsersStats;
}
return null;
}