getUsersWithHttpInfo method
Get users
Get a page of a list of users. Based on query string parameters, select users from a team, channel, or select users not in a specific channel. Since server version 4.0, some basic sorting is available using the sort
query parameter. Sorting is currently only supported when selecting users on a team. ##### Permissions Requires an active session and (if specified) membership to the channel or team being selected from.
Note: This method returns the HTTP Response
.
Parameters:
-
int page: The page to select.
-
int perPage: The number of users per page. There is a maximum limit of 200 users per page.
-
String inTeam: The ID of the team to get users for.
-
String notInTeam: The ID of the team to exclude users for. Must not be used with "in_team" query parameter.
-
String inChannel: The ID of the channel to get users for.
-
String notInChannel: The ID of the channel to exclude users for. Must be used with "in_channel" query parameter.
-
String inGroup: The ID of the group to get users for. Must have
manage_system
permission. -
bool groupConstrained: When used with
not_in_channel
ornot_in_team
, returns only the users that are allowed to join the channel or team based on its group constrains. -
bool withoutTeam: Whether or not to list users that are not on any team. This option takes precendence over
in_team
,in_channel
, andnot_in_channel
. -
bool active: Whether or not to list only users that are active. This option cannot be used along with the
inactive
option. -
bool inactive: Whether or not to list only users that are deactivated. This option cannot be used along with the
active
option. -
String role: Returns users that have this role.
-
String sort: Sort is only available in conjunction with certain options below. The paging parameter is also always available. #####
in_team
Can be "", "last_activity_at" or "create_at". When left blank, sorting is done by username. Minimum server version: 4.0 #####in_channel
Can be "", "status". When left blank, sorting is done by username.status
will sort by User's current status (Online, Away, DND, Offline), then by Username. Minimum server version: 4.7 -
String roles: Comma separated string used to filter users based on any of the specified system roles Example:
?roles=system_admin,system_user
will return users that are either system admins or system users Minimum server version: 5.26 -
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 return users that are only channel users and not admins or guests Minimum server version: 5.26 -
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 return users that are only team users and not admins or guests Minimum server version: 5.26
Implementation
Future<Response> getUsersWithHttpInfo({
int? page,
int? perPage,
String? inTeam,
String? notInTeam,
String? inChannel,
String? notInChannel,
String? inGroup,
bool? groupConstrained,
bool? withoutTeam,
bool? active,
bool? inactive,
String? role,
String? sort,
String? roles,
String? channelRoles,
String? teamRoles,
}) async {
// ignore: prefer_const_declarations
final path = r'/users';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <MmQueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (page != null) {
queryParams.addAll(_queryParams('', 'page', page));
}
if (perPage != null) {
queryParams.addAll(_queryParams('', 'per_page', perPage));
}
if (inTeam != null) {
queryParams.addAll(_queryParams('', 'in_team', inTeam));
}
if (notInTeam != null) {
queryParams.addAll(_queryParams('', 'not_in_team', notInTeam));
}
if (inChannel != null) {
queryParams.addAll(_queryParams('', 'in_channel', inChannel));
}
if (notInChannel != null) {
queryParams.addAll(_queryParams('', 'not_in_channel', notInChannel));
}
if (inGroup != null) {
queryParams.addAll(_queryParams('', 'in_group', inGroup));
}
if (groupConstrained != null) {
queryParams.addAll(_queryParams('', 'group_constrained', groupConstrained));
}
if (withoutTeam != null) {
queryParams.addAll(_queryParams('', 'without_team', withoutTeam));
}
if (active != null) {
queryParams.addAll(_queryParams('', 'active', active));
}
if (inactive != null) {
queryParams.addAll(_queryParams('', 'inactive', inactive));
}
if (role != null) {
queryParams.addAll(_queryParams('', 'role', role));
}
if (sort != null) {
queryParams.addAll(_queryParams('', 'sort', sort));
}
if (roles != null) {
queryParams.addAll(_queryParams('', 'roles', roles));
}
if (channelRoles != null) {
queryParams.addAll(_queryParams('', 'channel_roles', channelRoles));
}
if (teamRoles != null) {
queryParams.addAll(_queryParams('', 'team_roles', teamRoles));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}