getAllTeams method

Future<Response<BuiltList<Team>>> getAllTeams({
  1. int? page = 0,
  2. int? perPage = 60,
  3. bool? includeTotalCount = false,
  4. bool? excludePolicyConstrained = false,
  5. CancelToken? cancelToken,
  6. Map<String, dynamic>? headers,
  7. Map<String, dynamic>? extra,
  8. ValidateStatus? validateStatus,
  9. ProgressCallback? onSendProgress,
  10. ProgressCallback? onReceiveProgress,
})

Get teams For regular users only returns open teams. Users with the &quot;manage_system&quot; permission will return teams regardless of type. The result is based on query string parameters - page and per_page. ##### Permissions Must be authenticated. &quot;manage_system&quot; permission is required to show all teams.

Parameters:

  • page - The page to select.
  • perPage - The number of teams per page.
  • includeTotalCount
  • 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
  • cancelToken - A CancelToken that can be used to cancel the operation
  • headers - Can be used to add additional headers to the request
  • extras - Can be used to add flags to the request
  • validateStatus - A ValidateStatus callback that can be used to determine request success based on the HTTP status of the response
  • onSendProgress - A ProgressCallback that can be used to get the send progress
  • onReceiveProgress - A ProgressCallback that can be used to get the receive progress

Returns a Future containing a Response with a BuiltList<Team> as data Throws DioError if API call or serialization fails

Implementation

Future<Response<BuiltList<Team>>> getAllTeams({
  int? page = 0,
  int? perPage = 60,
  bool? includeTotalCount = false,
  bool? excludePolicyConstrained = false,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _path = r'/teams';
  final _options = Options(
    method: r'GET',
    headers: <String, dynamic>{
      ...?headers,
    },
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {
          'type': 'http',
          'scheme': 'bearer',
          'name': 'bearerAuth',
        },
      ],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final _queryParameters = <String, dynamic>{
    if (page != null) r'page': encodeQueryParameter(_serializers, page, const FullType(int)),
    if (perPage != null) r'per_page': encodeQueryParameter(_serializers, perPage, const FullType(int)),
    if (includeTotalCount != null) r'include_total_count': encodeQueryParameter(_serializers, includeTotalCount, const FullType(bool)),
    if (excludePolicyConstrained != null) r'exclude_policy_constrained': encodeQueryParameter(_serializers, excludePolicyConstrained, const FullType(bool)),
  };

  final _response = await _dio.request<Object>(
    _path,
    options: _options,
    queryParameters: _queryParameters,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );

  BuiltList<Team> _responseData;

  try {
    const _responseType = FullType(BuiltList, [FullType(Team)]);
    _responseData = _serializers.deserialize(
      _response.data!,
      specifiedType: _responseType,
    ) as BuiltList<Team>;

  } catch (error, stackTrace) {
    throw DioError(
      requestOptions: _response.requestOptions,
      response: _response,
      type: DioErrorType.other,
      error: error,
    )..stackTrace = stackTrace;
  }

  return Response<BuiltList<Team>>(
    data: _responseData,
    headers: _response.headers,
    isRedirect: _response.isRedirect,
    requestOptions: _response.requestOptions,
    redirects: _response.redirects,
    statusCode: _response.statusCode,
    statusMessage: _response.statusMessage,
    extra: _response.extra,
  );
}