getOrganizationUsers method

Future<Response<GetOrganizationUsersResponse>> getOrganizationUsers({
  1. required String orgCode,
  2. String? sort,
  3. int? pageSize,
  4. String? nextToken,
  5. String? permissions,
  6. String? roles,
  7. CancelToken? cancelToken,
  8. Map<String, dynamic>? headers,
  9. Map<String, dynamic>? extra,
  10. ValidateStatus? validateStatus,
  11. ProgressCallback? onSendProgress,
  12. ProgressCallback? onReceiveProgress,
})

List Organization Users Get users in an organization.

Parameters:

  • orgCode - The organization's code.
  • sort - Field and order to sort the result by.
  • pageSize - Number of results per page. Defaults to 10 if parameter not sent.
  • nextToken - A string to get the next page of results if there are more results.
  • permissions - Filter by user permissions comma separated (where all match)
  • roles - Filter by user roles comma separated (where all match)
  • 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 GetOrganizationUsersResponse as data Throws DioException if API call or serialization fails

Implementation

Future<Response<GetOrganizationUsersResponse>> getOrganizationUsers({
  required String orgCode,
  String? sort,
  int? pageSize,
  String? nextToken,
  String? permissions,
  String? roles,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final path = r'/api/v1/organizations/{org_code}/users'.replaceAll('{' r'org_code' '}', encodeQueryParameter(_serializers, orgCode, const FullType(String)).toString());
  final options = Options(
    method: r'GET',
    headers: <String, dynamic>{
      ...?headers,
    },
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {
          'type': 'http',
          'scheme': 'bearer',
          'name': 'kindeBearerAuth',
        },
      ],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final queryParameters = <String, dynamic>{
    r'sort': encodeQueryParameter(_serializers, sort, const FullType(String)),
    r'page_size': encodeQueryParameter(_serializers, pageSize, const FullType(int)),
    r'next_token': encodeQueryParameter(_serializers, nextToken, const FullType(String)),
    if (permissions != null) r'permissions': encodeQueryParameter(_serializers, permissions, const FullType(String)),
    if (roles != null) r'roles': encodeQueryParameter(_serializers, roles, const FullType(String)),
  };

  final response = await _dio.request<Object>(
    path,
    options: options,
    queryParameters: queryParameters,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );

  GetOrganizationUsersResponse? responseData;

  try {
    final rawResponse = response.data;
    responseData = rawResponse == null ? null : _serializers.deserialize(
      rawResponse,
      specifiedType: const FullType(GetOrganizationUsersResponse),
    ) as GetOrganizationUsersResponse;

  } catch (error, stackTrace) {
    throw DioException(
      requestOptions: response.requestOptions,
      response: response,
      type: DioExceptionType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }

  return Response<GetOrganizationUsersResponse>(
    data: responseData,
    headers: response.headers,
    isRedirect: response.isRedirect,
    requestOptions: response.requestOptions,
    redirects: response.redirects,
    statusCode: response.statusCode,
    statusMessage: response.statusMessage,
    extra: response.extra,
  );
}