getSessionListWithHttpInfo method

Future<Response> getSessionListWithHttpInfo({
  1. String? clientId,
  2. String? userId,
  3. String? status,
  4. bool? paginated,
  5. int? limit,
  6. int? offset,
})

List all sessions

Returns a list of all sessions. The sessions are returned sorted by creation date, with the newest sessions appearing first. Deprecation Notice (2024-01-01): All parameters were initially considered optional, however moving forward at least one of client_id or user_id parameters should be provided.

Note: This method returns the HTTP Response.

Parameters:

  • String clientId: List sessions for the given client

  • String userId: List sessions for the given user

  • String status: Filter sessions by the provided status

  • bool paginated: Whether to paginate the results. If true, the results will be paginated. If false, the results will not be paginated.

  • int limit: Applies a limit to the number of results returned. Can be used for paginating the results together with offset.

  • int offset: Skip the first offset results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit.

Implementation

Future<http.Response> getSessionListWithHttpInfo({
  String? clientId,
  String? userId,
  String? status,
  bool? paginated,
  int? limit,
  int? offset,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/sessions';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (clientId != null) {
    queryParams.addAll(_queryParams('', 'client_id', clientId));
  }
  if (userId != null) {
    queryParams.addAll(_queryParams('', 'user_id', userId));
  }
  if (status != null) {
    queryParams.addAll(_queryParams('', 'status', status));
  }
  if (paginated != null) {
    queryParams.addAll(_queryParams('', 'paginated', paginated));
  }
  if (limit != null) {
    queryParams.addAll(_queryParams('', 'limit', limit));
  }
  if (offset != null) {
    queryParams.addAll(_queryParams('', 'offset', offset));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}