listIdentitySessions method

Future<Response<BuiltList<Session>>> listIdentitySessions({
  1. required String id,
  2. int? perPage = 250,
  3. int? page,
  4. int? pageSize = 250,
  5. String? pageToken = '1',
  6. bool? active,
  7. CancelToken? cancelToken,
  8. Map<String, dynamic>? headers,
  9. Map<String, dynamic>? extra,
  10. ValidateStatus? validateStatus,
  11. ProgressCallback? onSendProgress,
  12. ProgressCallback? onReceiveProgress,
})

List an Identity's Sessions This endpoint returns all sessions that belong to the given Identity.

Parameters:

  • id - ID is the identity's ID.
  • perPage - Deprecated Items per Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This is the number of items per page.
  • page - Deprecated Pagination Page DEPRECATED: Please use page_token instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the Link header.
  • pageSize - Page Size This is the number of items per page to return. For details on pagination please head over to the pagination documentation.
  • pageToken - Next Page Token The next page token. For details on pagination please head over to the pagination documentation.
  • active - Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned.
  • 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<Session> as data Throws DioError if API call or serialization fails

Implementation

Future<Response<BuiltList<Session>>> listIdentitySessions({
  required String id,
  int? perPage = 250,
  int? page,
  int? pageSize = 250,
  String? pageToken = '1',
  bool? active,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _path = r'/admin/identities/{id}/sessions'.replaceAll('{' r'id' '}', id.toString());
  final _options = Options(
    method: r'GET',
    headers: <String, dynamic>{
      ...?headers,
    },
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {
          'type': 'apiKey',
          'name': 'oryAccessToken',
          'keyName': 'Authorization',
          'where': 'header',
        },
      ],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final _queryParameters = <String, dynamic>{
    if (perPage != null) r'per_page': encodeQueryParameter(_serializers, perPage, const FullType(int)),
    if (page != null) r'page': encodeQueryParameter(_serializers, page, const FullType(int)),
    if (pageSize != null) r'page_size': encodeQueryParameter(_serializers, pageSize, const FullType(int)),
    if (pageToken != null) r'page_token': encodeQueryParameter(_serializers, pageToken, const FullType(String)),
    if (active != null) r'active': encodeQueryParameter(_serializers, active, const FullType(bool)),
  };

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

  BuiltList<Session>? _responseData;

  try {
    final rawResponse = _response.data;
    _responseData = rawResponse == null ? null : _serializers.deserialize(
      rawResponse,
      specifiedType: const FullType(BuiltList, [FullType(Session)]),
    ) as BuiltList<Session>;

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

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