/API

Wrapper for the Sokkuri API.

Primary LanguageTypeScriptMozilla Public License 2.0MPL-2.0

API

ci npm

Wrapper for the Sokkuri API.

Setup & Build

Install all dependencies:

npm install

Build:

npm run build

Usage

Initial configuration:

import { ApiConfig } from "@sokkuri/api";

ApiConfig.init({
    // Required
    baseUrl: "/api/",
    onAuthenticate: () => { return Promise.resolve("access_token"); },

    // Optional
    onError: (statusCode: number) => { ... }
});

Data Contexts

Import the context that you need and use it like this, for example:

import { AnimeDataContext } from "@sokkuri/api";

let context = new AnimeDataContext();
context.getAnime("ID").then(x => console.log(x));