getTeamsForScheme method

Future<List<MmTeam>?> getTeamsForScheme(
  1. String schemeId, {
  2. int? page,
  3. int? perPage,
})

Get a page of teams which use this scheme.

Get a page of teams which use this scheme. The provided Scheme ID should be for a Team-scoped Scheme. Use the query parameters to modify the behaviour of this endpoint. ##### Permissions manage_system permission is required. Minimum server version: 5.0

Parameters:

  • String schemeId (required): Scheme GUID

  • int page: The page to select.

  • int perPage: The number of teams per page.

Implementation

Future<List<MmTeam>?> getTeamsForScheme(
  String schemeId, {
  int? page,
  int? perPage,
}) async {
  final response = await getTeamsForSchemeWithHttpInfo(
    schemeId,
    page: page,
    perPage: perPage,
  );
  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;
}