3.3.0 • Published 10 days ago

@irohalab/mira-bangumi-provider-sdk v3.3.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 days ago

mira-bangumi-provider-sdk

A typescript sdk for mira-bangumi-provider API.

Install

Install from npm:

$ npm install @irohalab/mira-bangumi-provider-sdk --save

Install dependencies:

$ npm install axios tslib typescript --save-dev

Usage

All API method are defined in a class DefaultApi, you can either create an instance using its constructor or using a factory method

Both way need a Configuration instance as parameter. You usually need to provide a basePath, apiKey or accessKey based on your server

Here are three examples:

Using constructor to create a new instance:

import { Configuration, DefaultApi } from '@irohalab/mira-bangumi-provider-sdk';

export class MyAppClient {
    private _apiInstance: DefaultApi;

    constructor() {
        const config = new Configuration({basePath: 'http://localhost:8085'});
        this._apiInstance = new DefaultApi(config);
    }
    
    public async getJobList(status: string): Promise<Job[]> {
        try {
            const resp = await this._apiInstance.listJobs(status, 0, 10);
            return resp.data.data as Job[];
        } catch (ex) {
            return null;
        }
    }
}

Using factory method

import { DefaultApiFactory, Configuration } from '@irohalab/mira-bangumi-provider-sdk';

async function getJobList(status: string): Promise<Job[]> {
    try {
        const resp = await DefaultApiFactory(new Configuration({basePath: 'http://localhost:8085'})).listJobs(status, 0, 10);
        return resp.data.data as Job[];
    } catch (ex) {
        return null;
    }
}
3.3.0

10 days ago

3.2.0

2 months ago

3.1.1

2 months ago

3.1.0

2 months ago

3.0.1

2 months ago

1.2.2

8 months ago

2.0.0

7 months ago

1.2.1

10 months ago

1.2.0

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago