# saniq-praxis-api-connector

> API-Wrappers für SaniQ-Praxis

Latest version **0.4.3** (published 2021-06-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install saniq-praxis-api-connector
pnpm add saniq-praxis-api-connector
yarn add saniq-praxis-api-connector
bun add saniq-praxis-api-connector
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2021-06-09 |
| First published | 2021-04-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Qurasoft GmbH |
| Maintainers | erwin.junker |

## Links

- npm: https://www.npmjs.com/package/saniq-praxis-api-connector
- npm.io page: https://npm.io/package/saniq-praxis-api-connector

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1

## Recent versions

- 0.4.3 (latest) — 2021-06-09
- 0.4.2 — 2021-04-28
- 0.4.1 — 2021-04-28
- 0.4.0 — 2021-04-28
- 0.3.9 — 2021-04-27
- 0.3.8 — 2021-04-27
- 0.3.7 — 2021-04-27
- 0.3.6 — 2021-04-27
- 0.3.5 — 2021-04-23
- 0.3.4 — 2021-04-22
- 0.3.3 — 2021-04-21
- 0.3.1 — 2021-04-21
- 0.3.0 — 2021-04-20
- 0.2.0 — 2021-04-20
- 0.1.0 — 2021-04-19

## 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.

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")
})
```

---
_Source: https://npm.io/package/saniq-praxis-api-connector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
