Socket
Socket
Sign inDemoInstall

@vermaysha/hoyolab-api

Package Overview
Dependencies
13
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.1 to 2.2.2

10

dist/Base.js

@@ -1,2 +0,5 @@

import { Cookie, Request } from './Utils';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Base = void 0;
const Utils_1 = require("./Utils");
/**

@@ -8,3 +11,3 @@ * This is the main class which contains built-in properties and methods.

*/
export class Base {
class Base {
/**

@@ -31,4 +34,5 @@ * The cookie that will be used for each request

}
this.request = new Request(Cookie.parseToString(options.cookie));
this.request = new Utils_1.Request(Utils_1.Cookie.parseToString(options.cookie));
}
}
exports.Base = Base;

@@ -1,2 +0,5 @@

export var DiaryMonth;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiaryMonth = void 0;
var DiaryMonth;
(function (DiaryMonth) {

@@ -6,2 +9,2 @@ DiaryMonth[DiaryMonth["CURRENT"] = 3] = "CURRENT";

DiaryMonth[DiaryMonth["TWO_MONTH_AGO"] = 1] = "TWO_MONTH_AGO";
})(DiaryMonth || (DiaryMonth = {}));
})(DiaryMonth = exports.DiaryMonth || (exports.DiaryMonth = {}));

@@ -1,5 +0,8 @@

export var DiaryType;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiaryType = void 0;
var DiaryType;
(function (DiaryType) {
DiaryType[DiaryType["PRIMOGEMS"] = 1] = "PRIMOGEMS";
DiaryType[DiaryType["MORA"] = 2] = "MORA";
})(DiaryType || (DiaryType = {}));
})(DiaryType = exports.DiaryType || (exports.DiaryType = {}));

@@ -1,2 +0,5 @@

export var Games;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Games = void 0;
var Games;
(function (Games) {

@@ -6,2 +9,2 @@ Games["ALL"] = "";

Games["GENSHIN"] = "hk4e_global";
})(Games || (Games = {}));
})(Games = exports.Games || (exports.Games = {}));

@@ -1,4 +0,7 @@

export * from './DiaryMonth';
export * from './DiaryType';
export * from './ScheduleType';
export * from './Games';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DiaryMonth"), exports);
tslib_1.__exportStar(require("./DiaryType"), exports);
tslib_1.__exportStar(require("./ScheduleType"), exports);
tslib_1.__exportStar(require("./Games"), exports);

@@ -1,5 +0,8 @@

export var ScheduleType;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScheduleType = void 0;
var ScheduleType;
(function (ScheduleType) {
ScheduleType[ScheduleType["CURRENT"] = 1] = "CURRENT";
ScheduleType[ScheduleType["PREVIOUS"] = 2] = "PREVIOUS";
})(ScheduleType || (ScheduleType = {}));
})(ScheduleType = exports.ScheduleType || (exports.ScheduleType = {}));

@@ -1,5 +0,8 @@

import { HoyoError } from './HoyoError';
import { Base } from './Base';
import { GenshinRoutes, HoyolabRoutes, ServerRegion } from './Utils';
import { DiaryMonth, DiaryType, ScheduleType } from './Enum';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Genshin = void 0;
const HoyoError_1 = require("./HoyoError");
const Base_1 = require("./Base");
const Utils_1 = require("./Utils");
const Enum_1 = require("./Enum");
/**

@@ -10,3 +13,3 @@ * Get data from Hoyolab API

*/
export class Genshin extends Base {
class Genshin extends Base_1.Base {
/**

@@ -29,3 +32,3 @@ * Genshin Impact UID

this.uid = options.uid;
this.region = ServerRegion.determineRegion(options.uid);
this.region = Utils_1.ServerRegion.determineRegion(options.uid);
}

@@ -38,3 +41,3 @@ async getAccountInfo() {

});
const response = await this.request.send(GenshinRoutes.accountInfo);
const response = await this.request.send(Utils_1.GenshinRoutes.accountInfo);
return response.data;

@@ -48,3 +51,3 @@ }

async getDailyInfo() {
const response = await this.request.send(GenshinRoutes.dailyInfo);
const response = await this.request.send(Utils_1.GenshinRoutes.dailyInfo);
return response.data;

@@ -58,3 +61,3 @@ }

async getDailyRewards() {
const response = await this.request.send(GenshinRoutes.dailyRewards);
const response = await this.request.send(Utils_1.GenshinRoutes.dailyRewards);
return response.data;

@@ -84,3 +87,3 @@ }

/* c8 ignore next 2 */
throw new HoyoError('The selected day was not found !');
throw new HoyoError_1.HoyoError('The selected day was not found !');
}

@@ -93,3 +96,3 @@ /**

async claimDaily() {
const response = await this.request.send(GenshinRoutes.dailyClaim, 'post');
const response = await this.request.send(Utils_1.GenshinRoutes.dailyClaim, 'post');
const info = await this.getDailyInfo();

@@ -135,3 +138,3 @@ const reward = await this.getDailyReward();

});
const response = await this.request.send(GenshinRoutes.characters, 'post');
const response = await this.request.send(Utils_1.GenshinRoutes.characters, 'post');
return response.data;

@@ -152,3 +155,3 @@ }

});
const response = await this.request.send(GenshinRoutes.charactersInfo, 'post');
const response = await this.request.send(Utils_1.GenshinRoutes.charactersInfo, 'post');
return response.data;

@@ -168,3 +171,3 @@ }

this.request.withDS();
const response = await this.request.send(GenshinRoutes.dailyNotes);
const response = await this.request.send(Utils_1.GenshinRoutes.dailyNotes);
return response.data;

@@ -179,6 +182,6 @@ }

*/
async getDiaryInfo(month = DiaryMonth.CURRENT) {
async getDiaryInfo(month = Enum_1.DiaryMonth.CURRENT) {
/* c8 ignore start */
if (Object.values(DiaryMonth).includes(month) === false) {
throw new HoyoError('The given month parameter is invalid !');
if (Object.values(Enum_1.DiaryMonth).includes(month) === false) {
throw new HoyoError_1.HoyoError('The given month parameter is invalid !');
}

@@ -192,3 +195,3 @@ /* c8 ignore stop */

this.request.withDS();
const response = await this.request.send(GenshinRoutes.diaryInfo);
const response = await this.request.send(Utils_1.GenshinRoutes.diaryInfo);
return response.data;

@@ -204,9 +207,9 @@ }

*/
async getDiaryDetail(type, month = DiaryMonth.CURRENT) {
async getDiaryDetail(type, month = Enum_1.DiaryMonth.CURRENT) {
/* c8 ignore start */
if (Object.values(DiaryMonth).includes(month) === false) {
throw new HoyoError('The given month parameter is invalid !');
if (Object.values(Enum_1.DiaryMonth).includes(month) === false) {
throw new HoyoError_1.HoyoError('The given month parameter is invalid !');
}
if (Object.values(DiaryType).includes(type) === false) {
throw new HoyoError('The given type parameter is invalid !');
if (Object.values(Enum_1.DiaryType).includes(type) === false) {
throw new HoyoError_1.HoyoError('The given type parameter is invalid !');
}

@@ -226,3 +229,3 @@ /* c8 ignore stop */

this.request.withDS();
const response = await this.request.send(GenshinRoutes.diaryDetail);
const response = await this.request.send(Utils_1.GenshinRoutes.diaryDetail);
responses.push(response.data);

@@ -265,6 +268,6 @@ page++;

*/
async getSpiralAbyss(scheduleType = ScheduleType.CURRENT) {
async getSpiralAbyss(scheduleType = Enum_1.ScheduleType.CURRENT) {
/* c8 ignore start */
if (Object.values(ScheduleType).includes(scheduleType) === false) {
throw new HoyoError('The given scheduleType parameter is invalid !');
if (Object.values(Enum_1.ScheduleType).includes(scheduleType) === false) {
throw new HoyoError_1.HoyoError('The given scheduleType parameter is invalid !');
}

@@ -278,3 +281,3 @@ /* c8 ignore stop */

this.request.withDS();
const response = await this.request.send(GenshinRoutes.spiralAbyss);
const response = await this.request.send(Utils_1.GenshinRoutes.spiralAbyss);
return response.data;

@@ -291,5 +294,6 @@ }

});
const response = await this.request.send(HoyolabRoutes.redeem);
const response = await this.request.send(Utils_1.HoyolabRoutes.redeem);
return response;
}
}
exports.Genshin = Genshin;

@@ -0,1 +1,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HoyoError = void 0;
/**

@@ -5,3 +8,3 @@ *

* */
export class HoyoError extends Error {
class HoyoError extends Error {
/**

@@ -27,1 +30,2 @@ * Return message from current request

}
exports.HoyoError = HoyoError;

@@ -1,5 +0,8 @@

import { HoyoError } from './HoyoError';
import { Base } from './Base';
import { HoyolabRoutes } from './Utils';
import { Games } from './Enum';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hoyolab = void 0;
const HoyoError_1 = require("./HoyoError");
const Base_1 = require("./Base");
const Utils_1 = require("./Utils");
const Enum_1 = require("./Enum");
/**

@@ -10,3 +13,3 @@ * Get data from Hoyolab API

*/
export class Hoyolab extends Base {
class Hoyolab extends Base_1.Base {
/**

@@ -18,8 +21,8 @@ * Displays a list of game accounts from mihoyo that are registered on user accounts

*/
async getGames(games = Games.ALL) {
async getGames(games = Enum_1.Games.ALL) {
/* c8 ignore start */
if (Object.values(Games).includes(games) === false) {
throw new HoyoError('The given games parameter is invalid !');
if (Object.values(Enum_1.Games).includes(games) === false) {
throw new HoyoError_1.HoyoError('The given games parameter is invalid !');
}
if (games !== Games.ALL) {
if (games !== Enum_1.Games.ALL) {
this.request.setParams({

@@ -30,3 +33,3 @@ region: games,

/* c8 ignore stop */
const response = await this.request.send(HoyolabRoutes.gamesList);
const response = await this.request.send(Utils_1.HoyolabRoutes.gamesList);
return response.data;

@@ -42,3 +45,3 @@ }

if (!this.cookie.accountId) {
throw new HoyoError('getRecords() function requires cookie.accountId to be filled !');
throw new HoyoError_1.HoyoError('getRecords() function requires cookie.accountId to be filled !');
}

@@ -49,5 +52,6 @@ this.request.setParams({

this.request.withDS();
const response = await this.request.send(HoyolabRoutes.recordsList);
const response = await this.request.send(Utils_1.HoyolabRoutes.recordsList);
return response.data;
}
}
exports.Hoyolab = Hoyolab;

@@ -1,7 +0,11 @@

export * from './HoyoError';
export * as Interface from './Interfaces';
export * as Utils from './Utils';
export * as Types from './Types';
export * as Enum from './Enum';
export * from './Hoyolab';
export * from './Genshin';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Enum = exports.Types = exports.Utils = exports.Interface = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./HoyoError"), exports);
exports.Interface = tslib_1.__importStar(require("./Interfaces"));
exports.Utils = tslib_1.__importStar(require("./Utils"));
exports.Types = tslib_1.__importStar(require("./Types"));
exports.Enum = tslib_1.__importStar(require("./Enum"));
tslib_1.__exportStar(require("./Hoyolab"), exports);
tslib_1.__exportStar(require("./Genshin"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,4 @@

export * from './Cookie';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Cookie"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,4 @@

export * from './AccountResponse';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./AccountResponse"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,2 +0,5 @@

export * from './CharacterInfoResponse';
export * from './CharacterResponse';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./CharacterInfoResponse"), exports);
tslib_1.__exportStar(require("./CharacterResponse"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,6 +0,9 @@

export * from './DailyInfoResponse';
export * from './AwardItem';
export * from './DailyRewardsResponse';
export * from './DailyRewardResponse';
export * from './DailyClaimResponse';
export * from './DailyNotesResponse';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DailyInfoResponse"), exports);
tslib_1.__exportStar(require("./AwardItem"), exports);
tslib_1.__exportStar(require("./DailyRewardsResponse"), exports);
tslib_1.__exportStar(require("./DailyRewardResponse"), exports);
tslib_1.__exportStar(require("./DailyClaimResponse"), exports);
tslib_1.__exportStar(require("./DailyNotesResponse"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,3 +0,6 @@

export * from './DiaryInfoResponse';
export * from './DiaryDetailResponse';
export * from './IDiary';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DiaryInfoResponse"), exports);
tslib_1.__exportStar(require("./DiaryDetailResponse"), exports);
tslib_1.__exportStar(require("./IDiary"), exports);

@@ -1,6 +0,9 @@

export * from './Daily';
export * from './Character';
export * from './Diary';
export * from './SpiralAbyss';
export * from './Redeem';
export * from './Account';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Daily"), exports);
tslib_1.__exportStar(require("./Character"), exports);
tslib_1.__exportStar(require("./Diary"), exports);
tslib_1.__exportStar(require("./SpiralAbyss"), exports);
tslib_1.__exportStar(require("./Redeem"), exports);
tslib_1.__exportStar(require("./Account"), exports);

@@ -1,1 +0,4 @@

export * from './RedeemResponse';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./RedeemResponse"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,4 @@

export * from './SpiralAbyssResponse';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./SpiralAbyssResponse"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,5 +0,8 @@

export * from './Options';
export * from './Request';
export * from './Hoyolab';
export * from './Genshin';
export * from './Cookie';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Options"), exports);
tslib_1.__exportStar(require("./Request"), exports);
tslib_1.__exportStar(require("./Hoyolab"), exports);
tslib_1.__exportStar(require("./Genshin"), exports);
tslib_1.__exportStar(require("./Cookie"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,2 +0,5 @@

export * from './NumericRange';
export * from './Region';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./NumericRange"), exports);
tslib_1.__exportStar(require("./Region"), exports);

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,4 +0,7 @@

import { HoyoError } from '../HoyoError';
import { camel2Snake } from './String';
export class Cookie {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cookie = void 0;
const HoyoError_1 = require("../HoyoError");
const String_1 = require("./String");
class Cookie {
/**

@@ -13,3 +16,3 @@ * Parse document.cookie string to acceptable object

if (cookies === null) {
throw new HoyoError('The given cookieString paramter is invalid');
throw new HoyoError_1.HoyoError('The given cookieString paramter is invalid');
}

@@ -46,3 +49,3 @@ const cookie = {

if (cookie.ltoken === '' || cookie.ltuid === '') {
throw new HoyoError('The given cookieString parameter is not Hoyolab Cookie !');
throw new HoyoError_1.HoyoError('The given cookieString parameter is not Hoyolab Cookie !');
}

@@ -67,3 +70,3 @@ if (cookie.ltuid !== '' && !cookie.accountId) {

if (['cookieToken', 'accountId'].includes(key)) {
key = camel2Snake(key);
key = (0, String_1.camel2Snake)(key);
}

@@ -76,1 +79,2 @@ cookies.push(`${key}=${value}`);

}
exports.Cookie = Cookie;

@@ -1,2 +0,6 @@

import md5 from 'md5';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DynamicSecurity = void 0;
const tslib_1 = require("tslib");
const md5_1 = tslib_1.__importDefault(require("md5"));
/**

@@ -10,3 +14,3 @@ * Generate Digital Signature/Dynamic Security.

*/
export class DynamicSecurity {
class DynamicSecurity {
/**

@@ -27,3 +31,3 @@ * Cypher Salt

}
const h = md5(`salt=${this.SALT}&t=${t}&r=${r}`, {
const h = (0, md5_1.default)(`salt=${this.SALT}&t=${t}&r=${r}`, {
encoding: 'string',

@@ -34,1 +38,2 @@ });

}
exports.DynamicSecurity = DynamicSecurity;

@@ -1,9 +0,13 @@

export * from './DynamicSecurity';
export * from './Request';
export * from './Routes';
export * from './ServerRegion';
export * from './Cookie';
export * from './String';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DynamicSecurity"), exports);
tslib_1.__exportStar(require("./Request"), exports);
tslib_1.__exportStar(require("./Routes"), exports);
tslib_1.__exportStar(require("./ServerRegion"), exports);
tslib_1.__exportStar(require("./Cookie"), exports);
tslib_1.__exportStar(require("./String"), exports);
/* c8 ignore start */
export function delay(second) {
function delay(second) {
return new Promise((resolve) => {

@@ -13,2 +17,3 @@ setTimeout(resolve, second * 1000);

}
exports.delay = delay;
/* c8 ignore stop */

@@ -1,4 +0,8 @@

import { HoyoError } from './../HoyoError';
import axios from 'axios';
import { Utils } from '..';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Request = void 0;
const tslib_1 = require("tslib");
const HoyoError_1 = require("./../HoyoError");
const axios_1 = tslib_1.__importDefault(require("axios"));
const __1 = require("..");
/**

@@ -12,3 +16,3 @@ * Request Class for making request to HoYoLab API.

*/
export class Request {
class Request {
/**

@@ -78,3 +82,3 @@ * Headers List

if (status) {
this.headers['DS'] = Utils.DynamicSecurity.generate();
this.headers['DS'] = __1.Utils.DynamicSecurity.generate();
}

@@ -108,11 +112,11 @@ else {

}
const response = await axios(config);
const response = await (0, axios_1.default)(config);
/* c8 ignore start */
const maxRetries = 60;
if (response.status === 429 && _retries <= maxRetries) {
await Utils.delay(0.5);
await __1.Utils.delay(0.5);
return this.send(url, method, _retries++);
}
if (response.data.retcode === -2016 && _retries <= maxRetries) {
await Utils.delay(0.5);
await __1.Utils.delay(0.5);
return this.send(url, method, _retries++);

@@ -122,7 +126,7 @@ }

if (response.data?.retcode === -100) {
throw new HoyoError('Unable to authenticate user, make sure the cookie provided is correct!', response.data);
throw new HoyoError_1.HoyoError('Unable to authenticate user, make sure the cookie provided is correct!', response.data);
}
const allowedRetCode = [0, -5003, -2020, -2017];
if (allowedRetCode.includes(response.data?.retcode) === false) {
throw new HoyoError(`Failed to retrive data: [${response.data?.retcode}] - ${response.data?.message}`, response?.data);
throw new HoyoError_1.HoyoError(`Failed to retrive data: [${response.data?.retcode}] - ${response.data?.message}`, response?.data);
}

@@ -135,1 +139,2 @@ // Reset Body & Params for next request

}
exports.Request = Request;

@@ -1,2 +0,5 @@

export class BaseURL {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenshinRoutes = exports.HoyolabRoutes = exports.BaseURL = void 0;
class BaseURL {
static webStaticUrl = 'https://webstatic-sea.hoyolab.com/';

@@ -9,2 +12,3 @@ static accountUrl = 'https://api-account-os.hoyolab.com/account/auth/api';

}
exports.BaseURL = BaseURL;
/**

@@ -17,3 +21,3 @@ * Game Routes

*/
export class HoyolabRoutes {
class HoyolabRoutes {
static gamesList = BaseURL.takumiUrl + '/binding/api/getUserGameRolesByCookie';

@@ -23,3 +27,4 @@ static recordsList = BaseURL.bbsUrl + '/game_record/card/wapi/getGameRecordCard';

}
export class GenshinRoutes {
exports.HoyolabRoutes = HoyolabRoutes;
class GenshinRoutes {
static dailyInfo = BaseURL.sgHke4Url + '/event/sol/info?act_id=e202102251931481&lang=en-us';

@@ -36,1 +41,2 @@ static dailyRewards = BaseURL.sgHke4Url + '/event/sol/home?act_id=e202102251931481&lang=en-us';

}
exports.GenshinRoutes = GenshinRoutes;

@@ -1,3 +0,6 @@

import { HoyoError } from '../HoyoError';
export class ServerRegion {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerRegion = void 0;
const HoyoError_1 = require("../HoyoError");
class ServerRegion {
static determineRegion(uid) {

@@ -15,5 +18,6 @@ const server_region = Number(uid.toString().trim().slice(0, 1));

default:
throw new HoyoError(`Given UID ${uid} is invalid !`);
throw new HoyoError_1.HoyoError(`Given UID ${uid} is invalid !`);
}
}
}
exports.ServerRegion = ServerRegion;

@@ -0,1 +1,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.camel2Snake = void 0;
/**

@@ -6,3 +9,3 @@ * Transform camel case to snake case

*/
export function camel2Snake(text) {
function camel2Snake(text) {
return text

@@ -14,1 +17,2 @@ .replace(/([A-Z])/g, ' $1')

}
exports.camel2Snake = camel2Snake;
{
"name": "@vermaysha/hoyolab-api",
"version": "2.2.1",
"version": "2.2.2",
"description": "Its unofficial HoYoLab API Wrapper for getting hoyoverse some in-game data, including Genshin Impact, Honkai Impact 3rd.",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",

@@ -58,2 +57,3 @@ "scripts": {

"ts-jest": "^29.0.5",
"tslib": "^2.5.0",
"tsx": "^3.12.3",

@@ -60,0 +60,0 @@ "typedoc": "^0.23.26",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc