UNPKG

@yeci226/hoyoapi

Version:

HoYoAPI is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.

137 lines (135 loc) 5.13 kB
import { DailyModule } from '../../module/daily'; import { RedeemModule } from '../../module/redeem'; import { MimoModule } from '../../module/mimo'; import { WikiModule } from '../../module/wiki'; import { IZZZOptions } from './zzz.interface'; import { ICookie } from '../../cookie'; import { IGame } from '../hoyolab'; import { ZZZRecordModule } from './record'; /** * The `ZZZ` class provides an interface to interact with ZZZ-related features on the Mihoyo website. * It contains references to various modules such as `DailyModule`, `RedeemModule`, `ZZZRecordModule`, and `ZZZDiaryModule` which allow you to perform various operations related to these features. * * @class * @category Main */ export declare class ZenlessZoneZero { /** * The `DailyModule` object provides an interface to interact with the daily check-in feature in Zenless Zone Zero. * */ readonly daily: DailyModule; /** * The `RedeemModule` object provides an interface to interact with the code redemption feature in Zenless Zone Zero. * */ readonly redeem: RedeemModule; /** * The `ZZZRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails. * */ readonly record: ZZZRecordModule; /** * The `MimoModule` object provides an interface to interact with the Mimo travel event for ZZZ. */ readonly mimo: MimoModule; /** * The `WikiModule` object provides an interface to search the Hoyolab ZZZ wiki. */ readonly wiki: WikiModule; /** * HoyYolab account object * */ private _account; /** * The cookie object to be used in requests. */ readonly cookie: ICookie; /** * The `Request` object used to make requests. */ private request; /** * The UID of the user, if available. */ readonly uid: number | null; /** * The region of the user, if available. */ readonly region: string | null; /** * The language to be used in requests. */ private lang; /** * Constructs a new `ZZZ` object. * * @param options The options object used to configure the object. */ constructor(options: IZZZOptions); /** * Create a new instance of the ZenlessZoneZero class asynchronously. * * @param options The options object used to configure the object. * @throws {HoyoAPIError} Error Wnen the CookieTokenV2 is not set. * @returns {Promise<ZenLessZoneZero>} A promise that resolves with a new ZZZ instance. * * @remarks * If an object is instantiated from this method but options.cookie.cookieTokenV2 is not set, * it will throw an error. This method will access an Endpoint that contains a list of game accounts, * which requires the cookieTokenV2 option. * @remarks * Because CookieTokenV2 has a short expiration time and cannot be refreshed so far. * It is evident that every few days, when logging in, it always requests authentication first. * Therefore, this method that uses CookieTokenV2 is not suitable if filled statically. */ static create(options: IZZZOptions): Promise<ZenlessZoneZero>; /** * Setter for the account property. Prevents from changing the value once set * @param game The game object to set as the account. */ set account(game: IGame | null); /** * Getter for the account property. * @returns {IGame | null} The current value of the account property. */ get account(): IGame | null; /** * Retrieves daily information. * * @alias {@link ZenLessZoneZero.daily | ZZZ.daily.info()} * @deprecated Use through {@link ZenLessZoneZero.daily | ZZZ.daily.info()} instead */ dailyInfo(): Promise<import("../../module/daily").IDailyInfo>; /** * Retrieve daily rewards information. * * @alias {@link ZenLessZoneZero.daily | ZZZ.daily.rewards()} * @deprecated Use through {@link ZenLessZoneZero.daily | ZZZ.daily.rewards()} instead */ dailyRewards(): Promise<import("../../module/daily").IDailyRewards>; /** * Get the daily reward for a specific day or the current day * * @param day number | null * @alias {@link ZenLessZoneZero.daily | ZZZ.daily.reward()} * @deprecated Use through {@link ZenLessZoneZero.daily | ZZZ.daily.reward()} instead */ dailyReward(day?: number | null): Promise<import("../../module/daily").IDailyReward>; /** * Claim current reward * * @alias {@link ZenLessZoneZero.daily | ZZZ.daily.claim()} * @deprecated Use through {@link ZenLessZoneZero.daily | ZZZ.daily.claim()} instead */ dailyClaim(): Promise<import("../../module/daily").IDailyClaim>; /** * Redeems a code for a specific account. * * @param code string * @alias {@link ZenLessZoneZero.daily | ZZZ.redeem.claim()} * @deprecated Use through {@link ZenLessZoneZero.daily | ZZZ.redeem.claim()} instead */ redeemCode(code: string): Promise<import("../../module/redeem").IRedeemCode>; }