Skip to main content

Class: GenshinDiaryModule

A module to interact with the Genshin Impact diary endpoints of the Hoyolab API

Constructors

constructor

new GenshinDiaryModule(request, lang, region, uid)

Constructs a DiaryModule instance

Parameters

NameTypeDescription
requestHTTPRequestAn instance of the Request class to make HTTP requests
langLanguageEnumA LanguageEnum value for the language of the user
regionnull | stringA string value for the region of the user
uidnull | numberA number value for the UID of the user

Defined in

src/client/gi/diary/diary.ts:31

Properties

lang

Private lang: LanguageEnum

A LanguageEnum value for the language of the user

Defined in

src/client/gi/diary/diary.ts:33


region

Private region: null | string

A string value for the region of the user

Defined in

src/client/gi/diary/diary.ts:34


request

Private request: HTTPRequest

An instance of the Request class to make HTTP requests

Defined in

src/client/gi/diary/diary.ts:32


uid

Private uid: null | number

A number value for the UID of the user

Defined in

src/client/gi/diary/diary.ts:35

Methods

detail

detail(type, month?): Promise<IGenshinDiaryDetail>

Returns the diary details of a given type and month for a user

Throws

HoyoAPIError when the uid or region parameter is missing or invalid, or when the type or month parameter is invalid

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

NameTypeDefault valueDescription
typeDiaryEnumundefinedA DiaryEnum value for the type of diary details requested
monthDiaryMonthEnumDiaryMonthEnum.CURRENTA DiaryMonthEnum value for the month of the diary details requested. Default is CURRENT.

Returns

Promise<IGenshinDiaryDetail>

A promise that resolves to an IGenshinDiaryDetail object

Defined in

src/client/gi/diary/diary.ts:105


list

list(month?): Promise<IGenshinDiaryInfo>

Returns the diary information of a given month for a user

Throws

HoyoAPIError when the uid or region parameter is missing or invalid

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

NameTypeDefault valueDescription
monthDiaryMonthEnumDiaryMonthEnum.CURRENTA DiaryMonthEnum value for the month of the diary information requested. Default is CURRENT.

Returns

Promise<IGenshinDiaryInfo>

A promise that resolves to an IGenshinDiaryInfo object

Defined in

src/client/gi/diary/diary.ts:48