getAllTeams method
Get teams
For regular users only returns open teams. Users with the "manage_system" permission will return teams regardless of type. The result is based on query string parameters - page and per_page. ##### Permissions Must be authenticated. "manage_system" permission is required to show all teams.
Parameters:
-
int page: The page to select.
-
int perPage: The number of teams per page.
-
bool includeTotalCount:
-
bool excludePolicyConstrained: If set to true, teams which are part of a data retention policy will be excluded. The
sysconsole_read_compliance
permission is required to use this parameter. Minimum server version: 5.35
Implementation
Future<List<MmTeam>?> getAllTeams({
int? page,
int? perPage,
bool? includeTotalCount,
bool? excludePolicyConstrained,
}) async {
final response = await getAllTeamsWithHttpInfo(
page: page,
perPage: perPage,
includeTotalCount: includeTotalCount,
excludePolicyConstrained: excludePolicyConstrained,
);
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) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<MmTeam>') as List).cast<MmTeam>().toList();
}
return null;
}