The NodeSDK simplifies the process of integrating Flexpa by providing a strongly-typed client for calling Flexpa APIs.
With yarn:
yarn add @flexpa/node-sdk
With npm:
npm install @flexpa/node-sdk
With pnpm:
pnpm install @flexpa/node-sdk
Initialize FlexpaClient (from Link Exchange)
import FlexpaClient, { IntrospectResponse } from '@flexpa/node-sdk';
const flexpaClient = await FlexpaClient.fromExchange(myPublicToken, mySecretKey, 'https://api.flexpa.com');
const tokenData: IntrospectResponse = await flexpaClient.introspect();
Initialize FlexpaClient (from Access Token)
import FlexpaClient from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
// Or: const flexpaClient = new FlexpaClient(myAccessToken, "https://api.flexpa.com");
Reading a FHIR Resource
import * as r4 from 'fhir/r4';
import { FlexpaClient } from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
const patient: r4.Patient = await flepxaClient.read('Patient', '$PATIENT_ID');
Searching a FHIR Resource
import * as r4 from 'fhir/r4';
import { FlexpaClient } from '@flexpa/node-sdk';
const flexpaClient = new FlexpaClient(myAccessToken);
const bundle: r4.Bundle = await flepxaClient.search('Patient', { given: 'john', family: 'doe' });
- Run
yarn workspace @flexpa/node-sdk version patch | minor | major
to update the package's version. - Open a PR to merge the version changes into the
master
branch. - Once merged, run the Publish @flexpa/node-sdk github workflow to publish the new version to NPM.
- The NPM package will be available at https://www.npmjs.com/package/@flexpa/node-sdk
Topic | Answer | Comments |
---|---|---|
Runtime | Node | |
Build | Through yarn | yarn build |