saniq-praxis-api-connector
v0.4.3
Published
API-Wrappers für SaniQ-Praxis
Downloads
2
Readme
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.
- Import the module
import {Authorization} from 'saniq-praxis-api-connector'
- 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")
})
```