@yeci226/hoyoapi
Version:
HoYoAPI is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.
155 lines (154 loc) • 5.51 kB
TypeScript
import { ICookie } from '../../cookie';
import { DailyModule } from '../../module/daily';
import { RedeemModule } from '../../module/redeem';
import { IHsrOptions } from './hsr.interface';
import { IGame } from '../hoyolab';
import { HSRRecordModule } from './record';
import { HSRDiaryEnum, HSRDiaryModule, HSRDiaryMonthEnum } from './diary';
/**
* Class representing the Honkai Star Rail game.
*
* @public
* @class
* @category Main
*/
export declare class HonkaiStarRail {
/**
* The Daily module for the Honkai Star Rail game.
*
*/
readonly daily: DailyModule;
/**
* The Redeem module for the Honkai Star Rail game.
*
*/
readonly redeem: RedeemModule;
/**
* The `HSRDiaryModule` object provides an interface to interact with the user diary feature in Honkai Star Rail.
*
*/
readonly diary: HSRDiaryModule;
/**
* The `HSRRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
readonly record: HSRRecordModule;
/**
* The cookie used for authentication.
*
*/
readonly cookie: ICookie;
/**
* The request object used to make HTTP requests.
*
*/
private request;
/**
* HoyYolab account object
*
*/
private _account;
/**
* The UID of the Honkai Star Rail account.
*
*/
readonly uid: number | null;
/**
* The region of the Honkai Star Rail account.
*
*/
readonly region: string | null;
/**
* The language of the Honkai Star Rail account.
*
*/
private lang;
/**
* Create a new instance of HonkaiStarRail.
*
* @constructor
* @param {IHsrOptions} options - The options for the HonkaiStarRail instance.
*/
constructor(options: IHsrOptions);
/**
* Create a new instance of HonkaiStarRail using a Hoyolab account.
* If `uid` is not provided in the `options`, the account with the highest level will be used.
*
* @param {IHsrOptions} options - The options for the HonkaiStarRail instance.
* @returns {Promise<HonkaiStarRail>} - A promise that resolves with a new HonkaiStarRail 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: IHsrOptions): Promise<HonkaiStarRail>;
/**
* 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 DailyModule.info | DailyModule.info }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.info() } instead
*/
dailyInfo(): Promise<import("../../module/daily").IDailyInfo>;
/**
*
* @alias {@link DailyModule.rewards | DailyModule.rewards }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.rewards() } instead
*/
dailyRewards(): Promise<import("../../module/daily").IDailyRewards>;
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @alias {@link DailyModule.reward | DailyModule.reward }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.reward() } instead
*/
dailyReward(day?: number | null): Promise<import("../../module/daily").IDailyReward>;
/**
* Claim current reward
*
* @alias {@link DailyModule.claim | DailyModule.claim }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.claim() } instead
*/
dailyClaim(): Promise<import("../../module/daily").IDailyClaim>;
/**
* Returns the diary information of a given month for a user
*
* @param month
* @alias {@link HonkaiStarRail.diary | HSR.diary.list()}
* @deprecated Use through {@link HonkaiStarRail.diary | HSR.diary.list()} instead
*/
diaryList(month?: HSRDiaryMonthEnum): Promise<import("./diary").IHSRDiaryInfo>;
/**
* Returns the diary details of a given type and month for a user
*
* @param type HSRDiaryEnum
* @param month DiaryMonthEnum
* @alias {@link HonkaiStarRail.diary | HSR.diary.detail()}
* @deprecated Use through {@link HonkaiStarRail.diary | HSR.diary.detail()} instead
*/
diaryDetail(type: HSRDiaryEnum, month?: HSRDiaryMonthEnum): Promise<import("./diary").IHSRDiaryDetail>;
/**
* Redeem Code
*
* @param code string
* @alias {@link RedeemModule.claim | RedeemModule.claim }
* @deprecated Use through { @link HonkaiStarRail.redeem | HonkaiStarRail.redeem.claim() } instead
*/
redeemCode(code: string): Promise<import("../../module/redeem").IRedeemCode>;
}