0.1.3 • Published 2 years ago

sdui-sdk-js v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

📆 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 node-current \ CI

✅ 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:

npm install sdui-sdk-js

💻 Usage

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

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:

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

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

0.1.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago