listSessions method
List All Sessions Listing all sessions that exist.
Parameters:
pageSize
- Items per Page 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.expand
- ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. If no value is provided, the expandable properties are skipped.cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
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>>> listSessions({
int? pageSize = 250,
String? pageToken,
bool? active,
BuiltList<String>? expand,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/admin/sessions';
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 (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)),
if (expand != null) r'expand': encodeCollectionQueryParameter<String>(_serializers, expand, const FullType(BuiltList, [FullType(String)]), format: ListFormat.multi,),
};
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,
);
}