Class Hoyolab

Represents the Hoyolab API client.

Constructors

  • Creates a new instance of Hoyolab.

    Parameters

    Returns Hoyolab

    If ltuidV2 or ltokenV2 keys are missing in the ICookie object.

    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.

Properties

cookie: ICookie

The parsed ICookie object used to authenticate requests.

The language used for API responses.

request: HTTPRequest

The underlying Request object used to make HTTP requests.

Methods

  • Get the account of a specific game from the games list.

    Parameters

    • game: GamesEnum

      The game that the account belongs to.

    Returns Promise<IGame>

    The game account.

    If there is no game account on this hoyolab account.

    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.

  • Get the list of games on this Hoyolab account.

    Parameters

    • Optionalgame: GamesEnum

      The optional game for which to retrieve accounts.

    Returns Promise<IGame[]>

    The list of games on this Hoyolab account.

    Thrown if there are no game accounts on this Hoyolab account.

    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.