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 OvokReferenceA 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
reference | String | positional | |
display | String? | named |
OvokReference.fromJson
OvokReference.fromJson(Map<String, dynamic> json)Reads a FHIR Reference object; a non-string display becomes null.
| Parameter | Type | Kind | Default |
|---|---|---|---|
json | Map<String, dynamic> | positional |
Properties
OvokReference.reference
final String referenceThe relative reference, such as Patient/123.
OvokReference.display
final String? displayThe 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 SessionThe 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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
accessToken | String | required named | |
refreshToken | String? | required named | |
expiresAt | DateTime | required named | |
project | OvokReference | required named | |
profile | OvokReference | required named |
Session.fromLogin
Session.fromLogin(Map<String, dynamic> tokens, DateTime now)Reads a login, register or social sign-in response.
| Parameter | Type | Kind | Default |
|---|---|---|---|
tokens | Map<String, dynamic> | positional | |
now | DateTime | positional |
Properties
Session.accessToken
final String accessTokenThe bearer token sent with each request.
Session.refreshToken
final String? refreshTokenExchanged for a new accessToken; null when the sign-in issued none.
Session.expiresAt
final DateTime expiresAtWhen accessToken expires.
Session.project
final OvokReference projectThe project (tenant) the user signed in to.
Session.profile
final OvokReference profileThe signed-in user's profile resource, such as Patient/123.
Session.canRefresh
bool get canRefreshWhether the session holds a refresh token.
Methods
Session.fromJson
Session? fromJson(Object? json)Null for anything but a complete stored session.
| Parameter | Type | Kind | Default |
|---|---|---|---|
json | Object? | positional |
Returns Session?.
Session.isStaleAt
bool isStaleAt(DateTime now)Stale a minute early, so a token never expires between the check and the request.
| Parameter | Type | Kind | Default |
|---|---|---|---|
now | DateTime | positional |
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.
| Parameter | Type | Kind | Default |
|---|---|---|---|
token | Map<String, dynamic> | positional | |
now | DateTime | positional |
Returns Session.
Session.toJson
Map<String, Object?> toJson()The stored form, which Session.fromJson reads back.
Returns Map<String, Object?>.
Last updated on