Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Sokkuri/API

Repository files navigation

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));