tuitio-client/README.md

48 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

2023-02-08 18:14:57 +02:00
# Tuitio client
2023-02-07 00:32:31 +02:00
## Introduction
2023-02-11 05:06:14 +02:00
Tuitio client is an npm package written in typescript that facilitates the integration of a javascript application with [Tuitio](https://lab.code-rove.com/gitea/tudor.stanciu/tuitio).
2023-02-07 00:32:31 +02:00
## Package installation
The package installation can be done in two ways:
2023-02-08 18:14:57 +02:00
- from the command line: `npm install @flare/tuitio-client@1.0.0`
- from the package.json file: `"@flare/tuitio-client": "1.0.0"`
2023-02-07 00:32:31 +02:00
## How to use the package
2023-02-11 15:58:48 +02:00
```javascript!
const { TuitioClient, fetch } = require("@flare/tuitio-client");
2023-02-11 15:58:48 +02:00
const TuitioClient = require("@flare/tuitio-client");
2023-03-18 00:41:42 +02:00
const type { TuitioLoginResponse, TuitioLogoutResponse, TuitioState } = require("@flare/tuitio-client");
2023-02-11 15:58:48 +02:00
```
```javascript!
import { TuitioClient, fetch } from "@flare/tuitio-client";
2023-02-11 15:58:48 +02:00
import TuitioClient from "@flare/tuitio-client";
2023-03-18 00:41:42 +02:00
import type { TuitioLoginResponse, TuitioLogoutResponse, TuitioState } from "@flare/tuitio-client";
2023-02-11 15:58:48 +02:00
```
2023-02-07 00:32:31 +02:00
## Unit testing
2023-02-11 16:01:16 +02:00
Unit testing is done using [Jest](https://jestjs.io/). This is an awesome testing framework created by Facebook.
The files containing tests are identified by the extension `*.test.ts`.
2023-02-07 00:32:31 +02:00
All tests in the package can be executed by running: `npm test`.
## Changelog
1.0.0 - Package initialization.
1.0.1 - Export Tuitio types.
1.0.2 - Validate that Tuitio's URL parameter is a valid URL.
1.0.3 - Added LICENSE file.
1.0.4 - TuitioState's token property can be null.
1.1.0 - In this version, the account logout method and the latest changes published by Tuitio were implemented.
1.2.0 - Has been implemented the "user-info" method exposed by the Tuitio API.
1.2.1 - Added decodeToken function. The token is obtained directly by the function from local storage. If the token is missing, the function returns null.
1.2.2 - Upgraded @flare/js-utils package.
2023-04-04 08:56:49 +03:00
1.2.3 - Added user group and role types after enriching the "user-info" result.
1.2.4 - Password encoding at login.
1.2.5 - The token "expires in" information measuring unit was changed from milliseconds to seconds.