enkanetwork
Version:
API wrapper for enka.network written on TypeScript which provides localization, caching and convenience
64 lines (63 loc) • 3.22 kB
TypeScript
import { AssetsFinder, AssetsUpdater } from "./helpers";
import { FetchEnkaHoyo, FetchEnkaHoyoBuilds, FetchEnkaProfile, FetchProfileInfo, FetchUserUID } from "./models";
import type { IAssetsUpdaterParams, TLanguage } from "./types";
export * from "./models";
/** The class in which all interaction with enka.network takes place
*
* [Documentation](https://kravets.gitbook.io/enkanetwork/class-description/enkanetwork)
**/
export declare class EnkaNetwork {
private readonly cache?;
language: TLanguage;
assets: AssetsFinder;
assetsUpdater?: AssetsUpdater;
userAgent?: string | false | null;
constructor({ language, caching, userAgent, assets, uiAssetsPath, }?: {
language?: TLanguage;
caching?: boolean;
userAgent?: string | false | null;
assets?: IAssetsUpdaterParams | false;
uiAssetsPath?: string;
});
request<T>(url: string, cacheKey?: string): Promise<T>;
/**
* Fetch only profile info by uid from the game.
* @param {number} uid `UID` from the game.
* @param {string} language The language to be used in the localization of names (character, artifacts, etc.). Default is EnkaNetwork.language.
*/
fetchProfileInfo(uid: number, language?: TLanguage): Promise<FetchProfileInfo>;
/**
* Fetch user by uid from the game.
*
* [Documentation](https://kravets.gitbook.io/enkanetwork/methods/fetchuser)
* @param {number} uid `UID` from the game.
* @param {string} language The language to be used in the localization of names (character, artifacts, etc.). Default is EnkaNetwork.language.
*/
fetchUser(uid: number, language?: TLanguage): Promise<FetchUserUID>;
/**
* Fetch enkaProfile by username from the site.
* @param {string} username `username` from the site.
*/
fetchEnkaProfile(username: string): Promise<FetchEnkaProfile>;
/**
* Fetch enkaProfile accounts by username from the site.
* @param {string} username `username` from the site.
* @param {string} language The language to be used in the localization of names (character, artifacts, etc.). Default is EnkaNetwork.language.
*/
fetchEnkaHoyos(username: string, language?: TLanguage): Promise<FetchEnkaHoyo[]>;
/**
* Fetch enkaProfile account by username and account hash from the site.
* @param {string} username `username` from the site.
* @param {string} hash account `hash` from the account.
* @param {string} language The language to be used in the localization of names (character, artifacts, etc.). Default is EnkaNetwork.language.
*/
fetchEnkaHoyo(username: string, hash: string, language?: TLanguage): Promise<FetchEnkaHoyo>;
/**
* Fetch enkaProfile builds for account from the site.
* @param {string} username `username` from the site.
* @param {string} hash account `hash` from the account.
* @param {string} language The language to be used in the localization of names (character, artifacts, etc.). Default is EnkaNetwork.language.
*/
fetchEnkaHoyoBuilds(username: string, hash: string, language?: TLanguage): Promise<FetchEnkaHoyoBuilds[]>;
setLanguage(language: TLanguage): this;
}