Skip to main content

Class: RedeemModule

Class representing the Redeem module for Genshin Impact's Hoyolab API.

Constructors​

constructor​

• new RedeemModule(request, lang, game, region, uid)

Constructs a new RedeemModule object.

Parameters​

NameTypeDescription
requestHTTPRequestThe Request object used for making HTTP requests.
langLanguageEnumThe language to use for the API response.
gameGamesEnumThe game to redeem the code for.
regionnull | stringThe region of the user's account. If null, the API will use the default region for the game.
uidnull | numberThe user ID of the account. If null, the API will use the user ID associated with the provided auth cookies.

Defined in​

src/module/redeem/redeem.ts:24

Properties​

game​

• Private game: GamesEnum

The game to redeem the code for.

Defined in​

src/module/redeem/redeem.ts:27


lang​

• Private lang: LanguageEnum

The language to use for the API response.

Defined in​

src/module/redeem/redeem.ts:26


region​

• Private region: null | string

The region of the user's account. If null, the API will use the default region for the game.

Defined in​

src/module/redeem/redeem.ts:28


request​

• Private request: HTTPRequest

The Request object used for making HTTP requests.

Defined in​

src/module/redeem/redeem.ts:25


uid​

• Private uid: null | number

The user ID of the account. If null, the API will use the user ID associated with the provided auth cookies.

Defined in​

src/module/redeem/redeem.ts:29

Methods​

claim​

▸ claim(code): Promise<IRedeemCode>

Redeems a code for a specific game and account.

Throws

HoyoAPIError if the API returns an error.

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.

Parameters​

NameTypeDescription
codestringThe code to redeem.

Returns​

Promise<IRedeemCode>

A promise that resolves to an IRedeemCode object containing information about the redemption status.

Defined in​

src/module/redeem/redeem.ts:42