Page History
...
Følgende eksempel mapper en napMessage til en SAMLassertion og PatientInforPatientInfo.
Code Block | ||
---|---|---|
| ||
import { FHIRValueGetter, NAPMessage, NAPPatientInfo } from 'nap-typescript-sdk'; const sessionToken = FHIRValueGetter.getSessionValue(napMessage); const patientData: NAPPatientInfo = FHIRValueGetter.getSessionValue(napMessage); |
...
Enums som gør det nemmere at lave NAPMessages indholdende data.
Følgende er et eksempel på Fhir-Value-Setter, hvordan der sendes en fejlbesked.
Code Block | ||
---|---|---|
| ||
import {NAPMessage, NAPEventCatalogue, FHIRValueSetter} from 'nap-typescript-sdk'; import { v4 as UUID } from 'uuid'; const napMessageSessionError: NAPMessage = { date: new Date().toISOString(), id: UUID(), event: { type: NAPEventCatalogue.v1.SessionError, context: [ { resource: { resourceType: FHIRValueSetter.FHIRResourceType.Basic, code: { coding: [ { code: NAPEventCatalogue.v1.SessionError, system: FHIRValueSetter.FHIRSystem.NAP, }, ], }, identifier: [ { system: FHIRValueSetter.FHIRIdentifierSystem.NAPErrorMessage, value: 'This is my error message', }, { system: FHIRValueSetter.FHIRIdentifierSystem.NAPErrorDescription, value: 'This is a longere description of the error message', }, ], }, }, ], }, }; NapTypescriptSdk.send(napMessageSessionError) |
...