0.4.3 • Published 3 years ago

saniq-praxis-api-connector v0.4.3

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Introduction

API Wrappers for SaniQ Praxis.

Getting Started

Install via npm install saniq-praxis-api-connector --save

Authorization

Authorization is done via the Authorization class.

  1. Import the module import {Authorization} from 'saniq-praxis-api-connector'
  2. Authorize with birth date and code - birth date must be in format "yyyy-MM-dd" Authorization.authorize(birthDate, code) Method returns a Promise object of type: {isLoggedIn: bool, credentials: Authorization}.

If you have persisted your credentials in a store then you can rebuild the authorization with: Authorization.setCredentials(patientId, token, tenantName)

Attention: by setting the credentials manually no validation will be performed.

Since a promise is returned you can also wait for resolving of the promise with: var isLoginSuccess = await Authorization.authorize(birthDate, code)

Models

All models are returning a promise. Please make sure to be authorized before calling model functions

Patient

Patient.current()

Measurements

Measurement.all()

Survey

Survey.all()

If you want to send answers to a survey you can do it like this:

var survey = await Survey.all()[0]
survey.questions.forEach(q => {
    // Answer for simple | multiple
    q.addAnswer(q.answers[0])
    // Answer for slider
    q.addAnswer(q.answers[0], sliderValue)
    // Answer for rest
    q.addAnswer(null, "Some Value")
})
```
0.4.3

3 years ago

0.3.9

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.4.2

3 years ago

0.3.3

3 years ago

0.1.0

3 years ago