### Install with yarn Source: https://vermaysha.github.io/hoyoapi/docs/guide/get-started Install the hoyoapi package using yarn. ```bash $ yarn add hoyoapi ``` -------------------------------- ### Install with npm Source: https://vermaysha.github.io/hoyoapi/docs/guide/get-started Install the hoyoapi package using npm. ```bash $ npm install hoyoapi ``` -------------------------------- ### Perform daily check-in operations Source: https://vermaysha.github.io/hoyoapi/docs/guide/genshin-impact Shows how to claim daily rewards, retrieve daily info, list rewards, and get a specific day's reward using the daily module. ```typescript import { GenshinImpact, LanguageEnum } from 'hoyoapi' async function main() { const genshin = new GenshinImpact({ cookie: 'YOUR COOKIE HERE', lang: LanguageEnum.ENGLISH, }) // Claim the daily rewards. const claim = await genshin.daily.claim() console.log(claim) // Retrieves daily information. const dailyInfo = await genshin.daily.info() console.log(dailyInfo) // Retrieve daily rewards information. const rewards = await genshin.daily.rewards() console.log(rewards) // Get the daily reward for a specific day or the current day const reward = await genshin.daily.reward() console.log(reward) } main() ``` -------------------------------- ### getHsrRegion(uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Gets the server region for Honkai: Star Rail based on the provided UID. ```APIDOC ## getHsrRegion(uid) ### Description Gets the server region for Honkai: Star Rail based on the provided UID. ### Parameters - **uid** (`number`) - Required - number UID ### Returns `HsrRegion` - The server region for the UID. ### Defined in src/client/hsr/hsr.helper.ts:10 ``` -------------------------------- ### dailyReward Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Get the daily reward for a specific day or the current day. Deprecated, use through Genshin.daily.reward() instead. ```APIDOC ## dailyReward(day?) ### Description Get the daily reward for a specific day or the current day. Deprecated, use through Genshin.daily.reward() instead. ### Method dailyReward ### Endpoint GenshinImpact.dailyReward(day?) ### Parameters #### Query Parameters - `day` (`null` | `number`) - Optional - day number or null ### Request Example ```json { "day": 1 } ``` ### Response #### Success Response - `Promise` - A promise that resolves with the daily reward. ``` -------------------------------- ### get account Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Getter for the account property. Returns the current game object associated with the account. ```APIDOC ## GET account ### Description Getter for the account property. Returns the current value of the account property. ### Method GET ### Endpoint account ### Response #### Success Response - `null` | `IGame` - The current value of the account property. #### Response Example ```json { "account": null } ``` ``` -------------------------------- ### reward(day?) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/DailyModule Gets the daily reward for a specific day or the current day. Throws if the specified day is not valid or the reward is undefined. ```APIDOC ## Method: reward(day?) ### Description Get the daily reward for a specific day or the current day. ### Parameters - **day** (null | number) - Optional - Default: null - The day to retrieve the reward for. If null, retrieve the reward for the current day. ### Returns `Promise` - A promise that resolves with the daily reward for the specified day or the current day. ### Throws - If the specified day is not a valid date in the current month or if the reward for the specified day is undefined. ### Defined in src/module/daily/daily.ts:170 ``` -------------------------------- ### Retrieve game accounts with gamesList Source: https://vermaysha.github.io/hoyoapi/docs/guide/hoyolab Fetches all user game accounts from all servers, or a specific game account with the highest level from all servers when a GamesEnum value is provided. The example uses GamesEnum.GENSHIN_IMPACT for Genshin Impact. ```typescript import { GamesEnum, Hoyolab, LanguageEnum } from 'hoyoapi' async function main() { const hoyolab = new Hoyolab({ cookie: 'YOUR COOKIE HERE', lang: LanguageEnum.ENGLISH, }) // Fetch all user game accounts from all servers const games = hoyolab.gamesList() console.log(games) // Fetch one game account that has the highest level from all servers const genshinAccount = hoyolab.gamesList(GamesEnum.GENSHIN_IMPACT) console.log(genshinAccount) } main() ``` -------------------------------- ### records() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinRecordModule Get user's Genshin Impact record. Throws an error if the UID parameter is missing or failed to be filled. ```APIDOC ## records() ### Description Get user's Genshin Impact record ### Method GET ### Endpoint Not specified ### Parameters None ### Returns Promise - User's Genshin Impact record ### Throws If UID parameter is missing or failed to be filled ### Remarks This method sends a request to the Genshin Impact API to get the daily note information for a user. The user's region and UID must be set before calling this method, otherwise an error will be thrown. ### Defined in src/client/gi/record/record.ts:55 ``` -------------------------------- ### new DailyModule(request, lang, game, region) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/DailyModule Constructs a new DailyModule instance with the provided request, language, game, and region. ```APIDOC ## Constructor: new DailyModule(request, lang, game, region) ### Description Creates a new DailyModule instance. ### Parameters - **request** (HTTPRequest) - Required - The HTTP request object. - **lang** (LanguageEnum) - Required - The language enum. - **game** (GamesEnum) - Required - The game enum. - **region** (null | string) - Required - The region, can be null or a string. ### Defined in src/module/daily/daily.ts:25 ``` -------------------------------- ### getHi3Region(uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Gets the Honkai region from a given UID. Throws an error if the UID is invalid. ```APIDOC ## getHi3Region(uid) ### Description Gets the Honkai region from a given UID. Throws an error if the UID is invalid. ### Parameters - **uid** (`number`) - Required - The UID to get the Honkai region for. ### Returns `HonkaiRegion` - The Honkai region for the given UID. ### Throws - If the UID is invalid. ### Defined in src/client/hi/hi.helper.ts:11 ``` -------------------------------- ### create(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Creates a new instance of the GenshinImpact class asynchronously. Throws an error if the CookieTokenV2 is not set. ```APIDOC ## create(options) ### Description Creates a new instance of the GenshinImpact class asynchronously. Throws an error if the CookieTokenV2 is not set. ### Method Static create ### Parameters - `options` (IGenshinOptions) - Required - The options object used to configure the object. ### Returns `Promise` - A promise that resolves with a new Genshin instance. ### Throws Error - When the CookieTokenV2 is not set. ### 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. ### Defined in src/client/gi/gi.ts:162 ``` -------------------------------- ### records Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Get user's Genshin Impact record. Deprecated, use through Genshin.record.records() instead. ```APIDOC ## records() ### Description Get user's Genshin Impact record. Deprecated, use through Genshin.record.records() instead. ### Method records ### Endpoint GenshinImpact.records() ### Response #### Success Response - `Promise` - A promise that resolves with the Genshin record. ``` -------------------------------- ### HonkaiImpact.create(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Static method to create a new HonkaiImpact instance using a Hoyolab account. It retrieves the account with the highest level if `uid` is not provided. ```APIDOC ## `HonkaiImpact.create(options)` ### Description Statically creates a new instance of HonkaiImpact. If `uid` is not provided in the options, the account with the highest level will be used. This method requires `options.cookie.cookieTokenV2` to be set, otherwise it throws an error. ### Parameters - **options** (`IHi3Options`) - Required - The options object used to configure the object. ### Returns `Promise` - A promise that resolves with a new HonkaiImpact instance. ### Throws Error if `options.cookie.cookieTokenV2` is not set. ``` -------------------------------- ### new HonkaiImpact(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Creates a new instance of HonkaiImpact with the provided options. ```APIDOC ## `new HonkaiImpact(options)` ### Description Creates a new instance of HonkaiImpact. This is the constructor for the HonkaiImpact class. ### Parameters - **options** (`IHi3Options`) - Required - The options object used to configure the object. ### Returns A new instance of HonkaiImpact. ``` -------------------------------- ### HonkaiStarRail.create(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiStarRail Static factory method to create a new HonkaiStarRail instance using a Hoyolab account. If uid is not provided, the account with the highest level is used. ```APIDOC ## HonkaiStarRail.create(options) ### Description Creates 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. This method requires `options.cookie.cookieTokenV2` to be set, otherwise it will throw an error. ### Method Static ### Parameters - **options** (IHsrOptions) - Required - The options for the HonkaiStarRail instance. ### Returns `Promise` - A promise that resolves with a new HonkaiStarRail instance. ``` -------------------------------- ### getGenshinRegion(uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Gets the Genshin Impact region based on the provided UID. Throws an error if the UID is invalid. ```APIDOC ## getGenshinRegion(uid) ### Description Gets the Genshin Impact region based on the provided UID. Throws an error if the UID is invalid. ### Parameters - **uid** (`number`) - Required - User ID. ### Returns `GenshinRegion` - Region for the UID. ### Throws `HoyoAPIError` when the UID is invalid. ### Defined in src/client/gi/gi.helper.ts:11 ``` -------------------------------- ### Initialize Hoyolab client Source: https://vermaysha.github.io/hoyoapi/docs/guide/hoyolab Creates a new Hoyolab instance with a cookie and language. The cookie is required for authentication, and the language is set to English using LanguageEnum.ENGLISH. ```typescript import { Hoyolab, LanguageEnum } from 'hoyoapi' const hoyolab = new Hoyolab({ cookie: 'YOUR COOKIE HERE', lang: LanguageEnum.ENGLISH, }) ``` -------------------------------- ### new RedeemModule(request, lang, game, region, uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/RedeemModule Constructs a new RedeemModule object with the provided request, language, game, region, and UID. ```APIDOC ## new RedeemModule(request, lang, game, region, uid) ### Description Constructs a new RedeemModule object. ### Parameters - **request** (HTTPRequest) - Required - The Request object used for making HTTP requests. - **lang** (LanguageEnum) - Required - The language to use for the API response. - **game** (GamesEnum) - Required - The game to redeem the code for. - **region** (null | string) - Required - The region of the user's account. If null, the API will use the default region for the game. - **uid** (null | number) - Required - The user ID of the account. If null, the API will use the user ID associated with the provided auth cookies. ### Returns No return value. ``` -------------------------------- ### new GenshinRecordModule(request, lang, region, uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinRecordModule Creates an instance of GenshinRecordModule with the provided request, language, region, and UID. ```APIDOC ## new GenshinRecordModule(request, lang, region, uid) ### Description Creates an instance of GenshinRecordModule. ### Parameters - **request** (HTTPRequest) - Required - An instance of Request class. - **lang** (LanguageEnum) - Required - The language code to be used in requests. - **region** (null | string) - Required - The server region code in which the user's account resides. - **uid** (null | number) - Required - The user ID of the Genshin Impact account. ### Defined in src/client/gi/record/record.ts:37 ``` -------------------------------- ### new HonkaiStarRail(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiStarRail Creates a new instance of the HonkaiStarRail class with the provided options. ```APIDOC ## new HonkaiStarRail(options) ### Description Creates a new instance of the HonkaiStarRail class. ### Constructor `new HonkaiStarRail(options)` ### Parameters - **options** (IHsrOptions) - Required - The options for the HonkaiStarRail instance. ### Returns A new HonkaiStarRail instance. ``` -------------------------------- ### new HIRecordModule(request, lang, region, uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HIRecordModule Creates an instance of HIRecordModule with the provided HTTPRequest, language, region, and UID. ```APIDOC ## new HIRecordModule(request, lang, region, uid) ### Description Creates an instance of HIRecordModule. ### Parameters - **request** (HTTPRequest) - Required - The HTTPRequest object used for making API requests. - **lang** (LanguageEnum) - Required - The language enum value. - **region** (null | string) - Required - The region string or null if not provided. - **uid** (null | number) - Required - The UID number or null if not provided. ### Returns HIRecordModule instance. ``` -------------------------------- ### basicInfo() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinTCGModule Retrieves basic information for the Genshin Impact TCG. Throws an error if there is an issue retrieving the data. ```APIDOC ## Method: basicInfo() ### Description Retrieves basic information for the Genshin Impact TCG. ### Throws If there is an error retrieving the data. ### Returns Promise - The Genshin Impact TCG basic information. ### Defined in src/client/gi/tcg/tcg.ts:50 ``` -------------------------------- ### Hoyolab Class Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/Hoyolab Documentation for the Hoyolab class, including its constructor, properties, and methods. ```APIDOC ## Class: Hoyolab ### Description Represents the Hoyolab API client. ### Constructor #### `new Hoyolab(options)` Creates a new instance of `Hoyolab`. **Throws:** If `ltuid` or `ltoken` keys are missing in the `ICookie` object. **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. ##### Parameters - `options` (IHoyolabOptions) - Required - The options to initialize the `Hoyolab` instance. ##### Defined in src/client/hoyolab/hoyolab.ts:48 ### Properties #### `cookie` (Readonly) - Type: `ICookie` - Description: The parsed ICookie object used to authenticate requests. - Defined in: src/client/hoyolab/hoyolab.ts:24 #### `lang` - Type: `LanguageEnum` - Description: The language used for API responses. - Defined in: src/client/hoyolab/hoyolab.ts:34 #### `request` (Readonly) - Type: `HTTPRequest` - Description: The underlying `Request` object used to make HTTP requests. - Defined in: src/client/hoyolab/hoyolab.ts:29 ### Methods #### `gameAccount(game)` Get the account of a specific game from the games list. **Async** **Throws:** If there is no game account on this hoyolab account. **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. ##### Parameters - `game` (GamesEnum) - Required - The game that the account belongs to. ##### Returns `Promise` - The game account. ##### Defined in src/client/hoyolab/hoyolab.ts:151 #### `gameRecordCard()` Retrieves the game record card. **Async** ##### Returns `Promise` - The game account. ##### Defined in src/client/hoyolab/hoyolab.ts:172 #### `gamesList(game?)` Get the list of games on this Hoyolab account. **Async** **Throws:** Thrown if there are no game accounts on this Hoyolab account. **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. ##### Parameters - `game?` (GamesEnum) - Optional - The optional game for which to retrieve accounts. ##### Returns `Promise` - The list of games on this Hoyolab account. ##### Defined in src/client/hoyolab/hoyolab.ts:94 ``` -------------------------------- ### dailyReward(day?) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Fetches a reward from daily login based on the day provided. Deprecated, use `HonkaiImpact.daily.reward()` instead. ```APIDOC ## `dailyReward(day?)` ### Description Fetches the reward for a specific day from daily login. This method is deprecated; use `HonkaiImpact.daily.reward()` instead. ### Alias `DailyModule.reward` ### Deprecated Use through `HonkaiImpact.daily.reward()` instead. ### Parameters - **day** (`null | number`) - Optional - Default: `null` - Description: The day for which to fetch the reward. ### Returns `Promise` ``` -------------------------------- ### DAILY_CLAIM_API(game) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Builds the API route for claiming daily rewards for a given game. ```APIDOC ## DAILY_CLAIM_API(game) ### Description Builds the API route for claiming daily rewards for a given game. ### Parameters - **game** (`GamesEnum`) - Required - The game for which to claim daily rewards. ### Returns `string` - The API route string. ### Defined in src/routes/routes.ts:66 ``` -------------------------------- ### dailyInfo() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Retrieves daily information. Deprecated, use `HonkaiImpact.daily.info()` instead. ```APIDOC ## `dailyInfo()` ### Description Retrieves daily information. This method is deprecated; use `HonkaiImpact.daily.info()` instead. ### Alias `DailyModule.info` ### Deprecated Use through `HonkaiImpact.daily.info()` instead. ### Returns `Promise` ``` -------------------------------- ### constructor Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HTTPRequest Constructs a new HTTPRequest instance with an optional cookie. ```APIDOC ## constructor ### Description Creates a new instance of the HTTPRequest class, optionally providing a cookie. ### Parameters - `cookie` (string) - Optional. The cookie for authentication. ### Returns - A new HTTPRequest instance. ``` -------------------------------- ### new GenshinTCGModule(request, lang, region, uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinTCGModule Creates an instance of the GenshinTCGModule. This constructor initializes the module with the provided HTTP request object, language enumeration, region, and UID. ```APIDOC ## Constructor: new GenshinTCGModule(request, lang, region, uid) ### Description Creates an instance of the GenshinTCGModule. ### Parameters - **request** (HTTPRequest) - Required - The HTTP request object. - **lang** (LanguageEnum) - Required - The language enumeration for the module. - **region** (null | string) - Required - The region string or null. - **uid** (null | number) - Required - The UID number or null. ### Defined in src/client/gi/tcg/tcg.ts:37 ``` -------------------------------- ### Instantiate HonkaiStarRail with UID Source: https://vermaysha.github.io/hoyoapi/docs/guide/honkai-star-rail Directly instantiate the HonkaiStarRail class by providing a cookie, language, and UID. Note that the UID is required for several modules and will throw an error if omitted. ```typescript import { HonkaiStarRail, LanguageEnum } from 'hoyoapi' const hsr = new HonkaiStarRail({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional uid: 837_678_687, // Several modules will require UID, which if not filled in will throw an error. }) ``` -------------------------------- ### DAILY_INFO_API(game) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Builds the API route for retrieving daily reward information for a given game. ```APIDOC ## DAILY_INFO_API(game) ### Description Builds the API route for retrieving daily reward information for a given game. ### Parameters - **game** (`GamesEnum`) - Required - The game for which to retrieve daily reward info. ### Returns `string` - The API route string. ### Defined in src/routes/routes.ts:54 ``` -------------------------------- ### Instantiate HonkaiImpact with provided data Source: https://vermaysha.github.io/hoyoapi/docs/guide/honkai-impact Creates a new HonkaiImpact instance with a required cookie, optional language, and a UID. Several modules require UID; if not filled in, an error will be thrown. ```typescript import { HonkaiImpact, LanguageEnum } from 'hoyoapi' const hi = new HonkaiImpact({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional uid: 837_678_687, // Several modules will require UID, which if not filled in will throw an error. }) ``` -------------------------------- ### DAILY_REWARD_API(game) Source: https://vermaysha.github.io/hoyoapi/docs/api/modules Builds the API route for retrieving daily reward details for a given game. ```APIDOC ## DAILY_REWARD_API(game) ### Description Builds the API route for retrieving daily reward details for a given game. ### Parameters - **game** (`GamesEnum`) - Required - The game for which to retrieve daily reward details. ### Returns `string` - The API route string. ### Defined in src/routes/routes.ts:60 ``` -------------------------------- ### dailyRewards() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Fetches daily rewards. Deprecated, use `HonkaiImpact.daily.rewards()` instead. ```APIDOC ## `dailyRewards()` ### Description Fetches daily rewards. This method is deprecated; use `HonkaiImpact.daily.rewards()` instead. ### Alias `DailyModule.rewards` ### Deprecated Use through `HonkaiImpact.daily.rewards()` instead. ### Returns `Promise` ``` -------------------------------- ### new GenshinDiaryModule(request, lang, region, uid) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinDiaryModule Constructs a GenshinDiaryModule instance with the provided request, language, region, and UID. ```APIDOC ## Constructor: new GenshinDiaryModule(request, lang, region, uid) ### Description Constructs a GenshinDiaryModule instance. ### Parameters - **request** (HTTPRequest) - Required - An instance of the Request class to make HTTP requests - **lang** (LanguageEnum) - Required - A LanguageEnum value for the language of the user - **region** (null | string) - Required - A string value for the region of the user - **uid** (null | number) - Required - A number value for the UID of the user ### Returns A new GenshinDiaryModule instance. ``` -------------------------------- ### info() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/DailyModule Retrieves daily information. Returns a promise that resolves to an IDailyInfo object. ```APIDOC ## Method: info() ### Description Retrieves daily information. ### Returns `Promise` - A promise that resolves to an IDailyInfo object. ### Defined in src/module/daily/daily.ts:41 ``` -------------------------------- ### Create HonkaiStarRail instance asynchronously Source: https://vermaysha.github.io/hoyoapi/docs/guide/honkai-star-rail Instantiate the HonkaiStarRail class using the create method, which returns a Promise and automatically fills data like the UID. ```typescript import { HonkaiStarRail, LanguageEnum } from 'hoyoapi' const hsr = HonkaiStarRail.create({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional }) ``` -------------------------------- ### new GenshinImpact(options) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Constructs a new GenshinImpact object with the provided options. The options object configures the client for interacting with Genshin Impact features. ```APIDOC ## new GenshinImpact(options) ### Description Constructs a new GenshinImpact object. The options object is used to configure the client for interacting with Genshin Impact features. ### Method Constructor ### Parameters - **options** (IGenshinOptions) - Required - The options object used to configure the object. ### Defined in src/client/gi/gi.ts:89 ``` -------------------------------- ### dailyInfo Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Retrieves daily information. Deprecated, use through Genshin.daily.info() instead. ```APIDOC ## dailyInfo() ### Description Retrieves daily information. Deprecated, use through Genshin.daily.info() instead. ### Method dailyInfo ### Endpoint GenshinImpact.dailyInfo() ### Response #### Success Response - `Promise` - A promise that resolves with the daily information. ``` -------------------------------- ### IGenshinOptions Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IGenshinOptions Interface representing the options for the Genshin Impact API. Inherits from IHoyolabOptions and includes properties for authentication, language, region, and player UID. ```APIDOC ## Interface: IGenshinOptions ### Description Interface representing the options for the Genshin Impact API. Inherits from `IHoyolabOptions`. ### Hierarchy - `IHoyolabOptions` - **`IGenshinOptions`** ### Properties #### cookie - **Type**: `string` | `Pick` - **Required**: Yes - **Description**: The cookie used to authenticate the request. This can be either a string or an ICookie object. - **Inherited from**: `IHoyolabOptions.cookie` - **Defined in**: `src/client/hoyolab/hoyolab.interface.ts:19` #### lang - **Type**: `LanguageEnum` - **Required**: No (Optional) - **Description**: The language to use for the request. This should be a value of `LanguageEnum`. - **Inherited from**: `IHoyolabOptions.lang` - **Defined in**: `src/client/hoyolab/hoyolab.interface.ts:26` #### region - **Type**: `GenshinRegion` - **Required**: No (Optional) - **Description**: The region of the Genshin Impact player. - **Defined in**: `src/client/gi/gi.interface.ts:39` #### uid - **Type**: `number` - **Required**: No (Optional) - **Description**: The UID of the Genshin Impact player. - **Defined in**: `src/client/gi/gi.interface.ts:35` ``` -------------------------------- ### dailyReward(day?) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiStarRail Fetches the reward from daily login based on the day. Deprecated, use HonkaiStarRail.daily.reward() instead. ```APIDOC ## dailyReward(day?) ### Description Fetches the reward from daily login based on the day. This method is deprecated; use `HonkaiStarRail.daily.reward()` instead. ### Method Instance method ### Parameters - **day** (null | number) - Optional - The day number for which to fetch the reward. Default is null. ### Returns `Promise` ``` -------------------------------- ### Instantiate HonkaiImpact with auto-filled data Source: https://vermaysha.github.io/hoyoapi/docs/guide/honkai-impact Creates a HonkaiImpact instance using the static create method, which automatically fills in data like UID and returns a Promise. Requires a cookie and optional language. ```typescript import { HonkaiImpact, LanguageEnum } from 'hoyoapi' const hi = HonkaiImpact.create({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional }) ``` -------------------------------- ### dailyInfo() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiStarRail Retrieves daily information. Deprecated, use HonkaiStarRail.daily.info() instead. ```APIDOC ## dailyInfo() ### Description Retrieves daily information. This method is deprecated; use `HonkaiStarRail.daily.info()` instead. ### Method Instance method ### Returns `Promise` ``` -------------------------------- ### dailyNote() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinRecordModule Retrieve the daily note information for a Genshin Impact user. Throws an error if the UID parameter is missing or failed to be filled. ```APIDOC ## dailyNote() ### Description Retrieve the daily note information for a Genshin Impact user. ### Method GET ### Endpoint Not specified ### Parameters None ### Returns Promise - The daily note information. ### Throws if the UID parameter is missing or failed to be filled. ### Remarks This method sends a request to the Genshin Impact API to get the daily note information for a user. The user's region and UID must be set before calling this method, otherwise an error will be thrown. ### Defined in src/client/gi/record/record.ts:259 ``` -------------------------------- ### charactersSummary(characterIds) Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinRecordModule Returns the summary information of Genshin Impact game characters. Throws an error if the UID parameter is missing or failed to be filled. ```APIDOC ## charactersSummary(characterIds) ### Description Returns the summary information of Genshin Impact game characters. ### Method GET ### Endpoint Not specified ### Parameters - **characterIds** (number[]) - Required - An array of character IDs to retrieve the summary information for. ### Returns Promise - A Promise that resolves to an object containing the summary information of the characters. ### Throws Throws an error if the UID parameter is missing or failed to be filled. ### Remarks This method sends a request to the Genshin Impact API to get the daily note information for a user. The user's region and UID must be set before calling this method, otherwise an error will be thrown. ### Defined in src/client/gi/record/record.ts:153 ``` -------------------------------- ### IDailyInfo Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IDailyInfo Interface representing daily sign-in information for a game user. ```APIDOC ## IDailyInfo ### Description Interface representing daily sign-in information for a game user. ### Properties - **total_sign_day** (`number`) - The total number of days the user has signed in. - **today** (`string`) - The current date in YYYY-MM-DD format. - **is_sign** (`boolean`) - Whether the user has signed in today. - **first_bind** (`boolean`) - Whether this is the user's first time signing in. - **is_sub** (`boolean`) - Whether the user has subscribed to the game. - **region** (`string`) - The region of the user's game account. - **month_last_day** (`boolean`) - Whether today is the last day of the current month. - **short_sign_day** (`number`) - (No description provided) - **sign_cnt_missed** (`number`) - (No description provided) ### Defined in src/module/daily/daily.interface.ts ``` -------------------------------- ### IGenshinRecordHome Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IGenshinRecordHome Interface representing Genshin Impact player's home record information. It contains properties describing the player's home, such as comfort level, item count, level, name, icon, and visit count. ```APIDOC ## Interface: IGenshinRecordHome ### Description Interface representing Genshin Impact player's home record information. ### Properties #### comfort_level_icon - **Type**: `string` - **Description**: The URL of the icon representing the comfort level of the player's home. #### comfort_level_name - **Type**: `string` - **Description**: The name of the comfort level of the player's home. #### comfort_num - **Type**: `number` - **Description**: The comfort level of the player's home. #### icon - **Type**: `string` - **Description**: The URL of the icon representing the player's home. #### item_num - **Type**: `number` - **Description**: The number of items the player has placed in their home. #### level - **Type**: `number` - **Description**: The level of the player's home. #### name - **Type**: `string` - **Description**: The name of the player's home. #### visit_num - **Type**: `number` - **Description**: The number of times the player has visited their home. ``` -------------------------------- ### charactersSummary Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinImpact Returns the summary information of Genshin Impact game characters. Deprecated, use through Genshin.record.charactersSummary() instead. ```APIDOC ## charactersSummary(characterIds) ### Description Returns the summary information of Genshin Impact game characters. Deprecated, use through Genshin.record.charactersSummary() instead. ### Method charactersSummary ### Endpoint GenshinImpact.charactersSummary(characterIds) ### Parameters #### Request Body - `characterIds` (`number[]`) - Required - Characters ID ### Request Example ```json { "characterIds": [1, 2] } ``` ### Response #### Success Response - `Promise` - A promise that resolves with the characters summary. ``` -------------------------------- ### IGenshinRecord Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IGenshinRecord Interface representing a Genshin Impact player record. This is an SDK reference for the TypeScript interface. ```APIDOC ## Interface: IGenshinRecord ### Description An interface representing a Genshin Impact player record. ### Properties #### avatars - **Type**: `IGenshinRecordAvatar[]` - **Description**: An array of the player's avatars. #### city_explorations - **Type**: `unknown[]` - **Description**: An array of the player's city explorations. The structure of this array is not specified. #### homes - **Type**: `IGenshinRecordHome[]` - **Description**: An array of the player's homes. #### role - **Type**: `Object` - **Description**: An object containing player role information. - `AvatarUrl`: `string` - The URL of the player's avatar image. - `level`: `number` - The player's level. - `nickname`: `string` - The player's nickname. - `region`: `string` - The region of the player's game account. #### stats - **Type**: `IGenshinRecordStat` - **Description**: An object containing the player's statistics. #### world_explorations - **Type**: `IGenshinRecordWorldExploration[]` - **Description**: An array of the player's world explorations. ``` -------------------------------- ### IHsrOptions Interface Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IHsrOptions The IHsrOptions interface defines the options object for accessing the Hoyolab API for Honkai: Star Rail. It includes properties for authentication, language, region, and user ID. ```APIDOC ## Interface: IHsrOptions ### Description Represents the options for accessing the Hoyolab API for Honkai: Star Rail. Extends IHoyolabOptions. ### Properties #### cookie - **Type**: string | Pick - **Required**: Yes - **Description**: The cookie used to authenticate the request. This can be either a string or an ICookie object. - **Inherited from**: IHoyolabOptions.cookie #### lang - **Type**: LanguageEnum (optional) - **Required**: No - **Description**: The language to use for the request. This should be a value of LanguageEnum. - **Inherited from**: IHoyolabOptions.lang #### region - **Type**: HsrRegion (optional) - **Required**: No - **Description**: The region for the Honkai: Star Rail account. #### uid - **Type**: number (optional) - **Required**: No - **Description**: The user ID for the Honkai: Star Rail account. ``` -------------------------------- ### Instantiate GenshinImpact with provided data Source: https://vermaysha.github.io/hoyoapi/docs/guide/genshin-impact Creates a GenshinImpact instance with a required cookie, optional language, and optional UID. If UID is not provided, modules that require it will throw an error. ```typescript import { GenshinImpact, LanguageEnum } from 'hoyoapi' const genshin = new GenshinImpact({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional uid: 837_678_687, // Several modules will require UID, which if not filled in will throw an error. }) ``` -------------------------------- ### challengeSchedule() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinTCGModule Retrieves the challenge schedule for the Genshin Impact TCG. Throws an error if there is an issue retrieving the data. ```APIDOC ## Method: challengeSchedule() ### Description Retrieves the challenge schedule for the Genshin Impact TCG. ### Throws If there is an error retrieving the data. ### Returns Promise - The Genshin Impact TCG challenge schedule. ### Defined in src/client/gi/tcg/tcg.ts:194 ``` -------------------------------- ### matchs() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinTCGModule Retrieves the match data for the Genshin Impact TCG. Throws an error if there is an issue retrieving the data. ```APIDOC ## Method: matchs() ### Description Retrieves the match data for the Genshin Impact TCG. ### Throws If there is an error retrieving the data. ### Returns Promise - The Genshin Impact TCG match data. ### Defined in src/client/gi/tcg/tcg.ts:153 ``` -------------------------------- ### IGenshinDailyNote Source: https://vermaysha.github.io/hoyoapi/docs/api/interfaces/IGenshinDailyNote Interface for Genshin Impact daily note. It contains properties representing the current state of daily activities such as resin, tasks, expeditions, home coins, and transformer. ```APIDOC ## Interface: IGenshinDailyNote ### Description Interface for Genshin Impact daily note. ### Properties #### calendar_url - **Type**: `string` - **Description**: URL of calendar. #### current_expedition_num - **Type**: `number` - **Description**: Current expedition number. #### current_home_coin - **Type**: `number` - **Description**: Current home coin. #### current_resin - **Type**: `number` - **Description**: Current resin. #### expeditions - **Type**: Array of objects with properties: - `avatar_side_icon` (`string`) - Avatar side icon. - `remained_time` (`string`) - Remained time. - `status` (`"Finished"` | `"Ongoing"`) - Status of expedition. - **Description**: List of expeditions. #### finished_task_num - **Type**: `number` - **Description**: Number of finished tasks. #### home_coin_recovery_time - **Type**: `string` - **Description**: Home coin recovery time. #### is_extra_task_reward_received - **Type**: `boolean` - **Description**: Whether extra task reward is received or not. #### max_expedition_num - **Type**: `number` - **Description**: Maximum expedition number. #### max_home_coin - **Type**: `number` - **Description**: Maximum home coin. #### max_resin - **Type**: `number` - **Description**: Maximum resin. #### remain_resin_discount_num - **Type**: `number` - **Description**: Remaining resin discount number. #### resin_discount_num_limit - **Type**: `number` - **Description**: Maximum resin discount number. #### resin_recovery_time - **Type**: `string` - **Description**: Resin recovery time. #### total_task_num - **Type**: `number` - **Description**: Total number of tasks. #### transformer - **Type**: Object with properties: - `latest_job_id` (`string`) - Latest job ID. - `noticed` (`boolean`) - Whether it is noticed or not. - `obtained` (`boolean`) - Whether it is obtained or not. - `recovery_time` (Object) - Recovery time with properties: - `Day` (`number`) - Days. - `Hour` (`number`) - Hours. - `Minute` (`number`) - Minutes. - `Second` (`number`) - Seconds. - `reached` (`boolean`) - Whether recovery time is reached or not. - `wiki` (`string`) - URL of the wiki page. - **Description**: Transformer information. ``` -------------------------------- ### Instantiate GenshinImpact with auto-filled data Source: https://vermaysha.github.io/hoyoapi/docs/guide/genshin-impact Creates a GenshinImpact instance using the static create method, which automatically fills data like UID and returns a Promise. ```typescript import { GenshinImpact, LanguageEnum } from 'hoyoapi' const genshin = GenshinImpact.create({ cookie: 'YOUR COOKIE HERE', // Required. Cookie can be string or object, see the api refeence below lang: LanguageEnum.ENGLISH, // optional }) ``` -------------------------------- ### dailyClaim() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/HonkaiImpact Claims the current daily reward. Deprecated, use `HonkaiImpact.daily.claim()` instead. ```APIDOC ## `dailyClaim()` ### Description Claims the current daily reward. This method is deprecated; use `HonkaiImpact.daily.claim()` instead. ### Alias `DailyModule.claim` ### Deprecated Use through `HonkaiImpact.daily.claim()` instead. ### Returns `Promise` ``` -------------------------------- ### characters() Source: https://vermaysha.github.io/hoyoapi/docs/api/classes/GenshinRecordModule Retrieves the Genshin characters of the user. Throws an error if the UID parameter is missing or failed to be filled. ```APIDOC ## characters() ### Description Retrieves the Genshin characters of the user. ### Method GET ### Endpoint Not specified ### Parameters None ### Returns Promise - A Promise that contains the Genshin characters object. ### Throws If UID parameter is missing or failed to be filled. ### Remarks This method sends a request to the Genshin Impact API to get the daily note information for a user. The user's region and UID must be set before calling this method, otherwise an error will be thrown. ### Defined in src/client/gi/record/record.ts:105 ```