# sdui-sdk-js

> ### An Object-Oriented Asyncronous Javascript SDK for communicating with the Sdui API.

Latest version **0.1.3** (published 2022-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install sdui-sdk-js
pnpm add sdui-sdk-js
yarn add sdui-sdk-js
bun add sdui-sdk-js
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2022-04-05 |
| First published | 2022-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 241.8 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | AnnikenYT |
| Maintainers | anniken |

## Links

- npm: https://www.npmjs.com/package/sdui-sdk-js
- npm.io page: https://npm.io/package/sdui-sdk-js

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.26.0

## Recent versions

- 0.1.3 (latest) — 2022-04-05
- 0.1.1 — 2022-03-30
- 0.1.0 — 2022-03-30

## README

# 📆 Sdui SDK

### An Object-Oriented Asyncronous Javascript SDK for communicating with the Sdui API.

_Important note: This is a ***community*** project. Neither it nor the author is affiliated with Sdui GmBH._

![npm](https://img.shields.io/npm/v/sdui-sdk-js?style=for-the-badge)
![node-current](https://img.shields.io/node/v/sdui-sdk-js?style=for-the-badge) \
[![CI](https://github.com/AnnikenYT/sdui-sdk-js/actions/workflows/main.yml/badge.svg)](https://github.com/AnnikenYT/sdui-sdk-js/actions/workflows/main.yml)

## ✅ Features

- Login via Token and User ID
- Getting all lessons by time delta
- Getting current user
- Object Oriented
- Asyncronous
- Self documented
- More to come...

## 📝 Installation

You can install the package via [npm](https://www.npmjs.com/package/sdui-sdk-js):

```bash
npm install sdui-sdk-js
```

## 💻 Usage

To get startet, first you need to create an instance of the SDK:

```ts
import { Sdui } from 'sdui-sdk-js';

const sdui = new Sdui(
  "<your-sdui-token>", // Token
  000000, // User ID
  {} // Options (Optional)
);

```

From there, you can start using the SDK by getting the lessons for today:

```ts
sdui.getLessonsAsync(0)
    .then(lessons => {
        console.log(lessons);
    })
    .catch(error => {
        console.log(error);
    });
```

Most functions are self documented. A full list will come soon.

## ⚙ Options

```ts
export interface ISduiOptions {
  /**
   * The default delta for getLessons
   * @type {number}
   * @default 0
   */
  default_delta?: number;
  /**
   * If the data should be cached or not. Heavily recommended
   * @type {boolean}
   * @default true
   */
  cache_data?: boolean;
  /**
   * If the api url should be different from the default API
   * @type {string}
   * @default "https://api.sdui.app/v1"
   */
  api_url?: string;
  /**
   * Whether to authenticate the user automatically if no token or id is provided. If this is false, and no token or id is provided, you will need to authenticate manually.
   * @type {boolean}
   * @default true
   */
  no_auth?: boolean;
  /**
   * The sdk uses axios under the hood. Here you can pass in any axios options you want to use.
   * @todo not implemented yet.
   */
  axios_options?: any;
  /**
   * Whether to log the requests and responses to the console.
   * @type {boolean}
   * @default false
   */
  debug?: boolean;
}
```

## ❓ Future Features

[ ] Authentication via Username and Password

---
_Source: https://npm.io/package/sdui-sdk-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
