@yeci226/hoyoapi
Version:
HoYoAPI is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.
910 lines (899 loc) • 28.3 kB
JavaScript
import {
DailyModule,
RedeemModule
} from "./chunk-TB4Z5SOA.mjs";
import {
Cookie,
DEFAULT_REFERER,
HSR_DIARY_DETAIL_API,
HSR_DIARY_LIST_API,
HSR_RECORD_ANOMALY_ARBITRATION_API,
HSR_RECORD_APOCALYPSE_PHANTOM_API,
HSR_RECORD_CHARACTER_API,
HSR_RECORD_FORGOTTEN_HALL_API,
HSR_RECORD_INDEX_API,
HSR_RECORD_NOTE_API,
HSR_RECORD_PURE_FICTION_API,
HTTPRequest,
HoyoAPIError,
Hoyolab,
Language,
MIMO_EXCHANGE_API,
MIMO_EXCHANGE_LIST_API,
MIMO_FINISH_TASK_API,
MIMO_INDEX_API,
MIMO_LOTTERY_API,
MIMO_LOTTERY_INFO_API,
MIMO_RECEIVE_POINT_API,
MIMO_TASK_LIST_API,
__publicField
} from "./chunk-FMPTW7AC.mjs";
// src/module/mimo/mimo.ts
var MimoModule = class {
/**
* @param request - HTTPRequest instance with auth cookies set.
* @param lang - Language for API responses.
* @param gameId - Mimo game ID (6 = HSR, 8 = ZZZ).
*/
constructor(request, lang, gameId) {
this.request = request;
this.lang = lang;
this.gameId = gameId;
}
/**
* Fetches the current Mimo version_id for this game.
* Returns null if the event is not active.
*/
async getVersionId() {
var _a, _b;
this.request.setQueryParams({ lang: this.lang });
const { response } = await this.request.send(MIMO_INDEX_API, "GET", 0);
const list = response == null ? void 0 : response.list;
return (_b = (_a = list == null ? void 0 : list.find((g) => g.game_id === this.gameId)) == null ? void 0 : _a.version_id) != null ? _b : null;
}
/**
* Retrieves the list of Mimo tasks for the current version.
*
* @param versionId - The version_id from {@link getVersionId}.
*/
async tasks(versionId) {
var _a;
this.request.setQueryParams({
game_id: this.gameId,
lang: this.lang,
version_id: versionId
});
const { response } = await this.request.send(MIMO_TASK_LIST_API, "GET", 0);
return (_a = response == null ? void 0 : response.list) != null ? _a : [];
}
/**
* Marks a task as finished (triggers completion for click-type tasks).
*
* @param versionId - The current version_id.
* @param taskId - ID of the task to finish.
*/
async finishTask(versionId, taskId) {
this.request.setBody({
game_id: this.gameId,
lang: this.lang,
version_id: versionId,
task_id: taskId
});
const { response } = await this.request.send(
MIMO_FINISH_TASK_API,
"POST",
0
);
return (response == null ? void 0 : response.retcode) === 0 || true;
}
/**
* Claims the reward points for a completed task.
*
* @param versionId - The current version_id.
* @param taskId - ID of the completed task.
*/
async claimTask(versionId, taskId) {
this.request.setQueryParams({
game_id: this.gameId,
lang: this.lang,
version_id: versionId,
task_id: taskId
});
const { response } = await this.request.send(
MIMO_RECEIVE_POINT_API,
"GET",
0
);
return !!response;
}
/**
* Completes all pending tasks and claims their rewards in one call.
* Returns the number of tasks successfully claimed.
*/
async claimAllTasks() {
const versionId = await this.getVersionId();
if (!versionId)
return 0;
const taskList = await this.tasks(versionId);
let claimed = 0;
for (const task of taskList) {
if (task.status === 0) {
await this.finishTask(versionId, task.id);
if (await this.claimTask(versionId, task.id))
claimed++;
} else if (task.status === 1) {
if (await this.claimTask(versionId, task.id))
claimed++;
}
}
return claimed;
}
/**
* Retrieves the Mimo shop exchange items.
*
* @param versionId - The current version_id.
*/
async exchangeList(versionId) {
var _a;
this.request.setQueryParams({
game_id: this.gameId,
lang: this.lang,
version_id: versionId
});
const { response } = await this.request.send(
MIMO_EXCHANGE_LIST_API,
"GET",
0
);
return (_a = response == null ? void 0 : response.list) != null ? _a : [];
}
/**
* Exchanges points for a shop item (typically returns a gift code).
*
* @param versionId - The current version_id.
* @param awardId - The award_id of the shop item.
*/
async exchange(versionId, awardId) {
this.request.setBody({
game_id: this.gameId,
lang: this.lang,
version_id: versionId,
award_id: awardId
});
const { response } = await this.request.send(MIMO_EXCHANGE_API, "POST", 0);
return response;
}
/**
* Gets current lottery state (total points, cost per draw, draws done).
*
* @param versionId - The current version_id.
*/
async lotteryInfo(versionId) {
this.request.setQueryParams({
game_id: this.gameId,
lang: this.lang,
version_id: versionId
});
const { response } = await this.request.send(
MIMO_LOTTERY_INFO_API,
"GET",
0
);
return response;
}
/**
* Performs one lottery draw.
*
* @param versionId - The current version_id.
*/
async lottery(versionId) {
this.request.setBody({
game_id: this.gameId,
lang: this.lang,
version_id: versionId
});
const { response } = await this.request.send(MIMO_LOTTERY_API, "POST", 0);
return !!response;
}
};
// src/module/wiki/wiki.ts
var WikiModule = class {
/**
* @param request - HTTPRequest instance (no auth needed for wiki).
* @param lang - Language for wiki responses.
* @param game - 'hsr' or 'zzz'.
*/
constructor(_request, lang, game) {
this.lang = lang;
__publicField(this, "searchApi");
__publicField(this, "entryApi");
__publicField(this, "entryListApi");
__publicField(this, "wikiHeaders");
const base = "https://sg-wiki-api-static.hoyolab.com/hoyowiki/".concat(game, "/wapi");
this.searchApi = "".concat(base, "/search");
this.entryApi = "".concat(base, "/entry_page");
this.entryListApi = "".concat(base, "/get_entry_page_list");
this.wikiHeaders = {
"x-rpc-wiki_app": game,
"x-rpc-language": lang,
Referer: "https://wiki.hoyolab.com/",
Origin: "https://wiki.hoyolab.com"
};
}
/**
* Searches the wiki by keyword.
* Returns the first matching entry page ID, or null if not found.
*
* @param keyword - Character/weapon/item name to search for.
*/
async search(keyword) {
var _a, _b;
const url = "".concat(this.searchApi, "?keyword=").concat(encodeURIComponent(keyword));
const resp = await fetch(url, { headers: this.wikiHeaders });
const data = await resp.json();
const results = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.results;
return (_b = results == null ? void 0 : results[0]) != null ? _b : null;
}
/**
* Retrieves the full entry page for a given entry_page_id.
*
* @param entryPageId - The entry_page_id from {@link search}.
*/
async entryPage(entryPageId) {
var _a, _b;
const url = "".concat(this.entryApi, "?entry_page_id=").concat(entryPageId, "&lang=").concat(this.lang);
const resp = await fetch(url, { headers: this.wikiHeaders });
const data = await resp.json();
return (_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.page) != null ? _b : null;
}
/**
* Lists entries in a wiki menu category.
*
* @param menuId - The menu_id for the category (e.g. characters, weapons).
* @param pageNum - Page number (1-indexed).
* @param pageSize - Results per page (max 100).
*/
async entryList(menuId, pageNum = 1, pageSize = 100) {
var _a, _b;
const resp = await fetch(this.entryListApi, {
method: "POST",
headers: {
...this.wikiHeaders,
"Content-Type": "application/json"
},
body: JSON.stringify({
filters: [],
menu_id: menuId,
page_num: pageNum,
page_size: pageSize,
use_es: true
})
});
const data = await resp.json();
return (_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.list) != null ? _b : [];
}
};
// src/client/hsr/hsr.interface.ts
var HsrRegion = /* @__PURE__ */ ((HsrRegion2) => {
HsrRegion2["USA"] = "prod_official_usa";
HsrRegion2["EUROPE"] = "prod_official_eur";
HsrRegion2["ASIA"] = "prod_official_asia";
HsrRegion2["CHINA_TAIWAN"] = "prod_official_cht";
return HsrRegion2;
})(HsrRegion || {});
// src/client/hsr/hsr.helper.ts
function getHsrRegion(uid) {
const server_region = Number(uid.toString().trim().slice(0, 1));
let key;
switch (server_region) {
case 6:
key = "USA";
break;
case 7:
key = "EUROPE";
break;
case 8:
key = "ASIA";
break;
case 9:
key = "CHINA_TAIWAN";
break;
default:
throw new HoyoAPIError("Given UID ".concat(uid, " is invalid !"));
}
return HsrRegion[key];
}
// src/client/hsr/record/record.enum.ts
var ForgottenHallScheduleEnum = /* @__PURE__ */ ((ForgottenHallScheduleEnum2) => {
ForgottenHallScheduleEnum2[ForgottenHallScheduleEnum2["CURRENT"] = 1] = "CURRENT";
ForgottenHallScheduleEnum2[ForgottenHallScheduleEnum2["PREVIOUS"] = 2] = "PREVIOUS";
return ForgottenHallScheduleEnum2;
})(ForgottenHallScheduleEnum || {});
var ForgottenHallModeEnum = /* @__PURE__ */ ((ForgottenHallModeEnum2) => {
ForgottenHallModeEnum2[ForgottenHallModeEnum2["NORMAL"] = 1] = "NORMAL";
ForgottenHallModeEnum2[ForgottenHallModeEnum2["STORY"] = 2] = "STORY";
return ForgottenHallModeEnum2;
})(ForgottenHallModeEnum || {});
// src/client/hsr/record/record.ts
var HSRRecordModule = class {
/**
* Creates an instance of HSRRecordModule.
*
* @param request The HTTPRequest object used for making API requests.
* @param lang The language enum value.
* @param region The region string or null if not provided.
* @param uid The UID number or null if not provided.
*/
constructor(request, lang, region, uid) {
this.request = request;
this.lang = lang;
this.region = region;
this.uid = uid;
}
/**
* Retrieves the characters associated with the provided region and UID.
*
* @returns {Promise<IHSRCharacterFull[]>} A Promise that resolves to an array of full HSR characters.
* @throws {HoyoAPIError} if the region or UID parameters are missing or failed to be filled.
* @throws {HoyoAPIError} if failed to retrieve data, please double-check the provided UID.
*/
async characters() {
var _a;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
this.request.setQueryParams({
server: this.region,
role_id: this.uid,
lang: this.lang
}).setDs(true);
const {
response: res,
body,
params,
headers
} = await this.request.send(HSR_RECORD_CHARACTER_API);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
const data = res.data;
return data.avatar_list;
}
/**
* Retrieves the records associated with the provided region and UID.
*
* @returns {Promise<IHSRRecord>} A Promise that resolves to the HSR record object.
* @throws {HoyoAPIError} if the region or UID parameters are missing or failed to be filled.
* @throws {HoyoAPIError} if failed to retrieve data, please double-check the provided UID.
*/
async records() {
var _a;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
this.request.setQueryParams({
server: this.region,
role_id: this.uid,
lang: this.lang
}).setDs(true);
const {
response: res,
body,
params,
headers
} = await this.request.send(HSR_RECORD_INDEX_API);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
return res.data;
}
/**
* Retrieves the note associated with the provided region and UID.
*
* @returns {Promise<IHSRNote>} A Promise that resolves to the HSR note object.
* @throws {HoyoAPIError} if the region or UID parameters are missing or failed to be filled.
* @throws {HoyoAPIError} if failed to retrieve data, please double-check the provided UID.
*/
async note() {
var _a;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
this.request.setQueryParams({
server: this.region,
role_id: this.uid,
lang: this.lang
}).setDs(true);
const {
response: res,
body,
params,
headers
} = await this.request.send(HSR_RECORD_NOTE_API);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
return res.data;
}
/**
* Retrieves the forgotten hall information associated with the provided region and UID.
*
* @param scheduleType The schedule type for the forgotten hall (optional, defaults to CURRENT).
* @param modeType The mod type for the forgotten hall(optional, defaults to NORMAL).
* @returns {Promise<IHSRForgottenHall>} A Promise that resolves to the forgotten hall information object.
* @throws {HoyoAPIError} if the region or UID parameters are missing or failed to be filled.
* @throws {HoyoAPIError} if the given scheduleType parameter is invalid.
* @throws {HoyoAPIError} if failed to retrieve data, please double-check the provided UID.
*/
async forgottenHall(modeType = 1 /* NORMAL */, scheduleType = 1 /* CURRENT */) {
var _a;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
if (Object.values(ForgottenHallScheduleEnum).includes(scheduleType) === false) {
throw new HoyoAPIError("The given scheduleType parameter is invalid !");
}
this.request.setQueryParams({
server: this.region,
role_id: this.uid,
schedule_type: scheduleType,
lang: this.lang,
need_all: "true"
}).setDs();
const apiEndpoints = [
HSR_RECORD_FORGOTTEN_HALL_API,
HSR_RECORD_PURE_FICTION_API,
HSR_RECORD_APOCALYPSE_PHANTOM_API,
HSR_RECORD_ANOMALY_ARBITRATION_API
];
const {
response: res,
body,
params,
headers
} = await this.request.send(apiEndpoints[modeType - 1]);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
return res.data;
}
};
// src/client/hsr/diary/diary.interface.ts
var currentMonth = (/* @__PURE__ */ new Date()).getMonth();
var oneMonthAgo = /* @__PURE__ */ new Date();
oneMonthAgo.setMonth(currentMonth - 1);
var twoMonthAgo = /* @__PURE__ */ new Date();
twoMonthAgo.setMonth(currentMonth - 2);
var HSRDiaryMonthEnum = ((HSRDiaryMonthEnum2) => {
HSRDiaryMonthEnum2[HSRDiaryMonthEnum2["CURRENT"] = currentMonth + 1] = "CURRENT";
HSRDiaryMonthEnum2[HSRDiaryMonthEnum2["ONE_MONTH_AGO"] = oneMonthAgo.getMonth() + 1] = "ONE_MONTH_AGO";
HSRDiaryMonthEnum2[HSRDiaryMonthEnum2["TWO_MONTH_AGO"] = twoMonthAgo.getMonth() + 1] = "TWO_MONTH_AGO";
return HSRDiaryMonthEnum2;
})(HSRDiaryMonthEnum || {});
var HSRDiaryEnum = /* @__PURE__ */ ((HSRDiaryEnum3) => {
HSRDiaryEnum3[HSRDiaryEnum3["PRIMOGEMS"] = 1] = "PRIMOGEMS";
HSRDiaryEnum3[HSRDiaryEnum3["MORA"] = 2] = "MORA";
return HSRDiaryEnum3;
})(HSRDiaryEnum || {});
// src/client/hsr/diary/diary.ts
var HSRDiaryModule = class {
/**
* Constructs a DiaryModule instance
*
* @param request - An instance of the Request class to make HTTP requests
* @param lang - A LanguageEnum value for the language of the user
* @param region - A string value for the region of the user
* @param uid - A number value for the UID of the user
*/
constructor(request, lang, region, uid) {
this.request = request;
this.lang = lang;
this.region = region;
this.uid = uid;
}
/**
* Returns the diary information of a given month for a user
*
* @param month - A DiaryMonthEnum value for the month of the diary information requested. Default is CURRENT.
* @returns A promise that resolves to an IHSRDiaryInfo object
* @throws {@link HoyoAPIError} when the uid or region parameter is missing or invalid
* @remarks
* This method sends a request to the Honkai Star Rail 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.
*/
async list(month = HSRDiaryMonthEnum.CURRENT) {
var _a;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
if (Object.values(HSRDiaryMonthEnum).includes(month) === false) {
throw new HoyoAPIError("The given month parameter is invalid !");
}
this.request.setQueryParams({
region: this.region,
uid: this.uid,
month,
lang: this.lang
}).setDs();
const {
response: res,
params,
body,
headers
} = await this.request.send(HSR_DIARY_LIST_API);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
return res.data;
}
/**
* Returns the diary details of a given type and month for a user
*
* @param type - A HSRDiaryEnum value for the type of diary details requested
* @param month - A DiaryMonthEnum value for the month of the diary details requested. Default is CURRENT.
* @returns A promise that resolves to an IHSRDiaryDetail object
* @throws {@link 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 Honkai Star Rail 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.
*/
async detail(type, month = HSRDiaryMonthEnum.CURRENT) {
var _a, _b;
if (!this.region || !this.uid) {
throw new HoyoAPIError("UID parameter is missing or failed to be filled");
}
if (Object.values(HSRDiaryMonthEnum).includes(month) === false) {
throw new HoyoAPIError("The given month parameter is invalid !");
}
if (Object.values(HSRDiaryEnum).includes(type) === false) {
throw new HoyoAPIError("The given type parameter is invalid !");
}
const responses = {};
let page = 1;
let next = true;
do {
this.request.setQueryParams({
region: this.region,
uid: this.uid,
month,
type,
current_page: page,
page_size: 100,
lang: this.lang
}).setDs();
const {
response: res,
params,
body,
headers
} = await this.request.send(HSR_DIARY_DETAIL_API);
if (res.retcode !== 0) {
throw new HoyoAPIError(
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,
{
response: res,
request: {
body,
headers,
params
}
}
);
}
const data = res.data;
responses.uid = data.uid;
responses.region = data.region;
responses.optional_month = data.optional_month;
responses.nickname = data.nickname;
responses.data_month = data.data_month;
responses.current_page = data.current_page;
responses.list = [...(_b = responses.list) != null ? _b : [], ...data.list];
if (data.list.length < 1) {
next = false;
}
page++;
} while (next);
responses.list.sort((a, b) => {
const keyA = new Date(a.time);
const keyB = new Date(b.time);
if (keyA < keyB)
return -1;
if (keyA > keyB)
return 1;
return 0;
});
return responses;
}
};
// src/client/hsr/hsr.ts
var HonkaiStarRail = class _HonkaiStarRail {
/**
* Create a new instance of HonkaiStarRail.
*
* @constructor
* @param {IHsrOptions} options - The options for the HonkaiStarRail instance.
*/
constructor(options) {
/**
* The Daily module for the Honkai Star Rail game.
*
*/
__publicField(this, "daily");
/**
* The Redeem module for the Honkai Star Rail game.
*
*/
__publicField(this, "redeem");
/**
* The `HSRDiaryModule` object provides an interface to interact with the user diary feature in Honkai Star Rail.
*
*/
__publicField(this, "diary");
/**
* The `HSRRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
__publicField(this, "record");
/**
* The `MimoModule` object provides an interface to interact with the Mimo travel event for HSR.
*/
__publicField(this, "mimo");
/**
* The `WikiModule` object provides an interface to search the Hoyolab HSR wiki.
*/
__publicField(this, "wiki");
/**
* The cookie used for authentication.
*
*/
__publicField(this, "cookie");
/**
* The request object used to make HTTP requests.
*
*/
__publicField(this, "request");
/**
* HoyYolab account object
*
*/
__publicField(this, "_account", null);
/**
* The UID of the Honkai Star Rail account.
*
*/
__publicField(this, "uid");
/**
* The region of the Honkai Star Rail account.
*
*/
__publicField(this, "region");
/**
* The language of the Honkai Star Rail account.
*
*/
__publicField(this, "lang");
var _a;
const cookie = typeof options.cookie === "string" ? Cookie.parseCookieString(options.cookie) : options.cookie;
this.cookie = cookie;
if (!options.lang) {
options.lang = Language.parseLang(cookie.mi18nLang);
}
options.lang = Language.parseLang(options.lang);
this.request = new HTTPRequest(Cookie.parseCookie(this.cookie));
this.request.setReferer(DEFAULT_REFERER);
this.request.setLang(options.lang);
this.uid = (_a = options.uid) != null ? _a : null;
this.region = this.uid !== null ? getHsrRegion(this.uid) : null;
this.lang = options.lang;
this.daily = new DailyModule(
this.request,
this.lang,
"hkrpg_global" /* HONKAI_STAR_RAIL */,
this.region
);
this.redeem = new RedeemModule(
this.request,
this.lang,
"hkrpg_global" /* HONKAI_STAR_RAIL */,
this.region,
this.uid
);
this.record = new HSRRecordModule(
this.request,
this.lang,
this.region,
this.uid
);
this.diary = new HSRDiaryModule(
this.request,
this.lang,
this.region,
this.uid
);
this.mimo = new MimoModule(this.request, this.lang, 6);
this.wiki = new WikiModule(this.request, this.lang, "hsr");
}
/**
* Create 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.
*
* @param {IHsrOptions} options - The options for the HonkaiStarRail instance.
* @returns {Promise<HonkaiStarRail>} - A promise that resolves with a new HonkaiStarRail instance.
*
* @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.
*
* @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.
*/
static async create(options) {
let game = null;
if (typeof options.uid === "undefined") {
const hoyolab = new Hoyolab({
cookie: options.cookie
});
game = await hoyolab.gameAccount("hkrpg_global" /* HONKAI_STAR_RAIL */);
options.uid = parseInt(game.game_uid);
options.region = getHsrRegion(parseInt(game.game_uid));
}
const hsr = new _HonkaiStarRail(options);
hsr.account = game;
return hsr;
}
/**
* Setter for the account property. Prevents from changing the value once set
* @param game The game object to set as the account.
*/
set account(game) {
if (this.account === null && game !== null) {
this._account = game;
}
}
/**
* Getter for the account property.
* @returns {IGame | null} The current value of the account property.
*/
get account() {
return this._account;
}
/**
* Retrieves daily information.
*
* @alias {@link DailyModule.info | DailyModule.info }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.info() } instead
*/
dailyInfo() {
return this.daily.info();
}
/**
*
* @alias {@link DailyModule.rewards | DailyModule.rewards }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.rewards() } instead
*/
dailyRewards() {
return this.daily.rewards();
}
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @alias {@link DailyModule.reward | DailyModule.reward }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.reward() } instead
*/
dailyReward(day = null) {
return this.daily.reward(day);
}
/**
* Claim current reward
*
* @alias {@link DailyModule.claim | DailyModule.claim }
* @deprecated Use through { @link HonkaiStarRail.daily | HonkaiStarRail.daily.claim() } instead
*/
dailyClaim() {
return this.daily.claim();
}
/**
* Returns the diary information of a given month for a user
*
* @param month
* @alias {@link HonkaiStarRail.diary | HSR.diary.list()}
* @deprecated Use through {@link HonkaiStarRail.diary | HSR.diary.list()} instead
*/
async diaryList(month = HSRDiaryMonthEnum.CURRENT) {
return this.diary.list(month);
}
/**
* Returns the diary details of a given type and month for a user
*
* @param type HSRDiaryEnum
* @param month DiaryMonthEnum
* @alias {@link HonkaiStarRail.diary | HSR.diary.detail()}
* @deprecated Use through {@link HonkaiStarRail.diary | HSR.diary.detail()} instead
*/
async diaryDetail(type, month = HSRDiaryMonthEnum.CURRENT) {
return this.diary.detail(type, month);
}
/**
* Redeem Code
*
* @param code string
* @alias {@link RedeemModule.claim | RedeemModule.claim }
* @deprecated Use through { @link HonkaiStarRail.redeem | HonkaiStarRail.redeem.claim() } instead
*/
redeemCode(code) {
return this.redeem.claim(code);
}
};
export {
MimoModule,
WikiModule,
HsrRegion,
getHsrRegion,
ForgottenHallScheduleEnum,
ForgottenHallModeEnum,
HSRRecordModule,
HSRDiaryMonthEnum,
HSRDiaryEnum,
HSRDiaryModule,
HonkaiStarRail
};