# Class: Hoyolab
Represents the Hoyolab API client.
# Table of contents
# Constructors
# Properties
# Methods
# Constructors
# constructor
• new Hoyolab(options
)
Creates a new instance of Hoyolab
.
Throws
If ltuid
or ltoken
keys are missing in the ICookie
object.
# Parameters
Name | Type | Description |
---|---|---|
options | IHoyolabOptions | The options to initialize the Hoyolab instance. |
# Defined in
src/games/hoyolab/hoyolab.ts:38 (opens new window)
# Properties
# cookie
• Readonly
cookie: ICookie
The parsed ICookie object used to authenticate requests.
# Defined in
src/games/hoyolab/hoyolab.ts:19 (opens new window)
# lang
• lang: LanguageEnum
The language used for API responses.
# Defined in
src/games/hoyolab/hoyolab.ts:29 (opens new window)
# request
• Readonly
request: Request
The underlying Request
object used to make HTTP requests.
# Defined in
src/games/hoyolab/hoyolab.ts:24 (opens new window)
# Methods
# gameAccount
▸ gameAccount(game
): Promise
<IGame
>
Get the account of a specific game from the games list.
Async
Throws
If there is no game account on this hoyolab account.
# Parameters
Name | Type | Description |
---|---|---|
game | GamesEnum | The game that the account belongs to. |
# Returns
Promise
<IGame
>
The game account.
# Defined in
src/games/hoyolab/hoyolab.ts:107 (opens new window)
# gamesList
▸ gamesList(game?
): Promise
<IGame
[]>
Get the list of games on this Hoyolab account.
Async
Throws
Thrown if there are no game accounts on this Hoyolab account.
# Parameters
Name | Type | Description |
---|---|---|
game? | GamesEnum | The optional game for which to retrieve accounts. |
# Returns
Promise
<IGame
[]>
The list of games on this Hoyolab account.