UNPKG

@azurapi/azurapi

Version:

Open Source Azur Lane Local Database

59 lines (58 loc) 1.71 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import Updater from './CacheUpdater'; import { Ships } from './api/api_ship'; import { Equipments } from './api/api_equipment'; import { Barrages } from './api/api_barrage'; import { Chapters } from './api/api_chapter'; import { Voicelines } from './api/api_voiceline'; import { datatype } from './Data'; export declare type Source = 'uncached' | 'local'; export interface CacheOptions { source?: Source; autoupdate?: boolean; rate?: number; } export declare let instance: AzurAPI; /** * The main AzurAPI class */ export declare class AzurAPI extends EventEmitter { options: CacheOptions; source: string; autoupdate: boolean; rate: number; updater: Updater; ships: Ships; equipments: Equipments; chapters: Chapters; voicelines: Voicelines; barrages: Barrages; apis: { ships: Ships; equipments: Equipments; chapters: Chapters; voicelines: Voicelines; barrages: Barrages; }; /** * Cache client * @param options options for the cache */ constructor(options?: CacheOptions); /** * Set data in cache * @param type A type of data (ship, equipment, voiceline, chapter, or barrage) * @param raw Raw data in array */ set(type: datatype, raw: any[]): Ships | Equipments | Chapters | Voicelines | Barrages | undefined; /** * Bodge until we can rewrite * query string matches a ship's name. */ queryIsShipName(query: string): boolean; /** * Another bodge... */ getShipIdByName(name: string): string; }