Session

Generated reference for ovok_sdk: session.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.23+d339d81

OvokReference

class OvokReference

A FHIR reference such as Project/123, with an optional display name.

Constructors

OvokReference.new

OvokReference(String reference, {String? display})

Creates a reference to reference, labelled display.

ParameterTypeKindDefault
referenceStringpositional
displayString?named

OvokReference.fromJson

OvokReference.fromJson(Map<String, dynamic> json)

Reads a FHIR Reference object; a non-string display becomes null.

ParameterTypeKindDefault
jsonMap<String, dynamic>positional

Properties

OvokReference.reference

final String reference

The relative reference, such as Patient/123.

OvokReference.display

final String? display

The human-readable label, when the server sent one.

Methods

OvokReference.toJson

Map<String, Object?> toJson()

The FHIR Reference JSON this was read from.

Returns Map<String, Object?>.

Session

class Session

The signed-in user's tokens; stored with the same JSON keys as @ovok/core/next.

Constructors

Session.new

Session({
  required String accessToken,
  required String? refreshToken,
  required DateTime expiresAt,
  required OvokReference project,
  required OvokReference profile,
})

Creates a session from its parts; sign-in builds one for you.

ParameterTypeKindDefault
accessTokenStringrequired named
refreshTokenString?required named
expiresAtDateTimerequired named
projectOvokReferencerequired named
profileOvokReferencerequired named

Session.fromLogin

Session.fromLogin(Map<String, dynamic> tokens, DateTime now)

Reads a login, register or social sign-in response.

ParameterTypeKindDefault
tokensMap<String, dynamic>positional
nowDateTimepositional

Properties

Session.accessToken

final String accessToken

The bearer token sent with each request.

Session.refreshToken

final String? refreshToken

Exchanged for a new accessToken; null when the sign-in issued none.

Session.expiresAt

final DateTime expiresAt

When accessToken expires.

Session.project

final OvokReference project

The project (tenant) the user signed in to.

Session.profile

final OvokReference profile

The signed-in user's profile resource, such as Patient/123.

Session.canRefresh

bool get canRefresh

Whether the session holds a refresh token.

Methods

Session.fromJson

Session? fromJson(Object? json)

Null for anything but a complete stored session.

ParameterTypeKindDefault
jsonObject?positional

Returns Session?.

Session.isStaleAt

bool isStaleAt(DateTime now)

Stale a minute early, so a token never expires between the check and the request.

ParameterTypeKindDefault
nowDateTimepositional

Returns bool.

Session.refreshedWith

Session refreshedWith(Map<String, dynamic> token, DateTime now)

Reads an /oauth2/token response; a missing refresh token keeps the current one.

ParameterTypeKindDefault
tokenMap<String, dynamic>positional
nowDateTimepositional

Returns Session.

Session.toJson

Map<String, Object?> toJson()

The stored form, which Session.fromJson reads back.

Returns Map<String, Object?>.

Last updated on

On this page