1.0.0 • Published 3 years ago

zionip v1.0.0

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

Zionip

⚡ TypeScript wrapper around the API of Zeus IONIS.

Usage

In order to use the wrapper, create a Zionip object.

You must provide it with an access token in order to work.

import { Zionip, types } from "zionip";

const api = new Zionip("YOUR_TOKEN_HERE");

(Note that the types of the API are available under types - see the import above)

You can then use the many endpoints available and documented here.

Below are a few examples.

(async () =>
{
    // Gets all the courses in the database
    // Endpoint: /api/course
    const courses = await api.course.all();

    // Gets the group with ID 123
    // Endpoint: /api/group/{id}
    const group = await api.group.get(123);

    // Gets the reservations of group 123 from 8 Nov. 2021 to 14 Nov. 2021
    // Endpoint: /api/reservation/filter
    const reservations = await api.reservation.filter({
        groups: [123],
        startDate: new Date(2021, 10, 8),
        endDate: new Date(2021, 10, 14)
    });

    // Gets details about the first reservation of the response
    // Endpoint: /api/reservation/{id}/details
    const details = await api.reservation.details(reservations[0].id);
}) ();

Documentation

Every function and most of the fields come with comments to describe them.

These were taken directly from the original documentation.

Dependencies

This library depends on superagent to make its HTTP requests.

There are no other dependencies.

Installing

Install this library using npm by running npm install zionip.

Testing

A test suite is provided under tests which uses jest.

In order for the tests to work, you must provide an access token under the environment variable ZEUS_ACCESS_TOKEN.

Start the tests using npm by running npm run test.

⚠️ Some of the tests may fail because of some database changes.

0.0.1

4 years ago

1.0.0

3 years ago

0.0.0

4 years ago