@ejercito-fam/habbo-api 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +63 -38
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +47 -2
- package/dist/esm/index.d.ts +47 -2
- package/dist/esm/index.js +62 -37
- package/dist/esm/index.js.map +1 -1
- package/package.json +55 -55
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var safeFetch = require('@skyra/safe-fetch');
|
|
4
|
-
var common_js = require('common.js');
|
|
5
4
|
|
|
6
5
|
var __defProp = Object.defineProperty;
|
|
7
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -45,9 +44,17 @@ var BaseAPI = class {
|
|
|
45
44
|
formatURL(route) {
|
|
46
45
|
return new URL(route, this.baseURL);
|
|
47
46
|
}
|
|
48
|
-
|
|
47
|
+
fetchGet(url, options) {
|
|
49
48
|
return safeFetch.safeFetch(url, { headers: { "Content-Type": "application/json" }, signal: this.#getSignalOrDefault(options) });
|
|
50
49
|
}
|
|
50
|
+
fetchPost(url, body, options) {
|
|
51
|
+
return safeFetch.safeFetch(url, {
|
|
52
|
+
method: "POST",
|
|
53
|
+
headers: { "Content-Type": "application/json" },
|
|
54
|
+
body: JSON.stringify(body),
|
|
55
|
+
signal: this.#getSignalOrDefault(options)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
51
58
|
#getSignalOrDefault(options) {
|
|
52
59
|
if (typeof options === "object" && options !== null) {
|
|
53
60
|
if (typeof options.signal === "number") return AbortSignal.timeout(options.signal);
|
|
@@ -70,7 +77,7 @@ var AchievementsAPI = class extends BaseAPI {
|
|
|
70
77
|
*/
|
|
71
78
|
getAll(options) {
|
|
72
79
|
const url = this.formatURL("/api/public/achievements");
|
|
73
|
-
return safeFetch.Json(this.
|
|
80
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
74
81
|
}
|
|
75
82
|
/**
|
|
76
83
|
* Get the achievements from a specified user ID
|
|
@@ -80,7 +87,7 @@ var AchievementsAPI = class extends BaseAPI {
|
|
|
80
87
|
*/
|
|
81
88
|
getByUserId(id, options) {
|
|
82
89
|
const url = this.formatURL(`/api/public/achievements/${id}`);
|
|
83
|
-
return safeFetch.Json(this.
|
|
90
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
84
91
|
}
|
|
85
92
|
/**
|
|
86
93
|
* Get the image URL for an achievement
|
|
@@ -99,6 +106,14 @@ var AchievementDataState = /* @__PURE__ */ ((AchievementDataState2) => {
|
|
|
99
106
|
AchievementDataState2["OffSeason"] = "OFF_SEASON";
|
|
100
107
|
return AchievementDataState2;
|
|
101
108
|
})(AchievementDataState || {});
|
|
109
|
+
|
|
110
|
+
// src/common.ts
|
|
111
|
+
function isNullish(value) {
|
|
112
|
+
return value == null;
|
|
113
|
+
}
|
|
114
|
+
__name(isNullish, "isNullish");
|
|
115
|
+
|
|
116
|
+
// src/routes/groups.ts
|
|
102
117
|
var GroupsAPI = class extends BaseAPI {
|
|
103
118
|
static {
|
|
104
119
|
__name(this, "GroupsAPI");
|
|
@@ -111,7 +126,7 @@ var GroupsAPI = class extends BaseAPI {
|
|
|
111
126
|
*/
|
|
112
127
|
getByUniqueId(id, options) {
|
|
113
128
|
const url = this.formatURL(`/api/public/groups/${id}`);
|
|
114
|
-
return safeFetch.Json(this.
|
|
129
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
115
130
|
}
|
|
116
131
|
/**
|
|
117
132
|
* Get the members from a group given its identifier
|
|
@@ -121,10 +136,10 @@ var GroupsAPI = class extends BaseAPI {
|
|
|
121
136
|
*/
|
|
122
137
|
getGroupMembers(id, options) {
|
|
123
138
|
const url = this.formatURL(`/api/public/groups/${id}/members`);
|
|
124
|
-
if (!
|
|
139
|
+
if (!isNullish(options?.pageIndex)) {
|
|
125
140
|
url.searchParams.append("pageIndex", options.pageIndex.toString());
|
|
126
141
|
}
|
|
127
|
-
return safeFetch.Json(this.
|
|
142
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
128
143
|
}
|
|
129
144
|
/**
|
|
130
145
|
* Get the image URL for a badge
|
|
@@ -154,7 +169,7 @@ var ListsAPI = class extends BaseAPI {
|
|
|
154
169
|
*/
|
|
155
170
|
async getHotLooks(options) {
|
|
156
171
|
const url = this.formatURL("/api/public/lists/hotlooks");
|
|
157
|
-
const data = await this.
|
|
172
|
+
const data = await this.fetchGet(url, options);
|
|
158
173
|
return data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();
|
|
159
174
|
}
|
|
160
175
|
#parseHotLooksXML(data) {
|
|
@@ -176,22 +191,40 @@ var MarketplaceAPI = class extends BaseAPI {
|
|
|
176
191
|
/**
|
|
177
192
|
* Get the marketplace stats for a room item
|
|
178
193
|
*
|
|
194
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
195
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
196
|
+
* provide stats for up to 25 items per type in a single request.
|
|
197
|
+
*
|
|
179
198
|
* @param roomItemName - The name of the room item
|
|
180
199
|
* @param options - The options for the API call
|
|
181
200
|
*/
|
|
182
201
|
getRoomItemStats(roomItemName, options) {
|
|
183
202
|
const url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);
|
|
184
|
-
return safeFetch.Json(this.
|
|
203
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
185
204
|
}
|
|
186
205
|
/**
|
|
187
206
|
* Get the marketplace stats for a wall item
|
|
188
207
|
*
|
|
208
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
209
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
210
|
+
* provide stats for up to 25 items per type in a single request.
|
|
211
|
+
*
|
|
189
212
|
* @param wallItemName - The name of the wall item
|
|
190
213
|
* @param options - The options for the API call
|
|
191
214
|
*/
|
|
192
215
|
getWallItemStats(wallItemName, options) {
|
|
193
216
|
const url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);
|
|
194
|
-
return safeFetch.Json(this.
|
|
217
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get the marketplace stats for up to 25 room and wall items at once
|
|
221
|
+
*
|
|
222
|
+
* @param data - The data for the stats request
|
|
223
|
+
* @param options - The options for the API call
|
|
224
|
+
*/
|
|
225
|
+
getStats(data, options) {
|
|
226
|
+
const url = this.formatURL("/api/public/marketplace/stats");
|
|
227
|
+
return safeFetch.Json(this.fetchPost(url, data, options));
|
|
195
228
|
}
|
|
196
229
|
};
|
|
197
230
|
|
|
@@ -208,7 +241,7 @@ var PingAPI = class extends BaseAPI {
|
|
|
208
241
|
async get(options) {
|
|
209
242
|
const url = this.formatURL("/api/public/ping");
|
|
210
243
|
const now = performance.now();
|
|
211
|
-
return (await this.
|
|
244
|
+
return (await this.fetchGet(url, options)).match({
|
|
212
245
|
ok: /* @__PURE__ */ __name(() => performance.now() - now, "ok"),
|
|
213
246
|
err: /* @__PURE__ */ __name(() => null, "err")
|
|
214
247
|
});
|
|
@@ -226,17 +259,9 @@ var RoomsAPI = class extends BaseAPI {
|
|
|
226
259
|
*/
|
|
227
260
|
async getById(roomId, options) {
|
|
228
261
|
const url = this.formatURL(`/api/public/rooms/${roomId}`);
|
|
229
|
-
return safeFetch.Json(this.
|
|
262
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
230
263
|
}
|
|
231
264
|
};
|
|
232
|
-
|
|
233
|
-
// src/common.ts
|
|
234
|
-
function isNullish2(value) {
|
|
235
|
-
return value == null;
|
|
236
|
-
}
|
|
237
|
-
__name(isNullish2, "isNullish");
|
|
238
|
-
|
|
239
|
-
// src/routes/users.ts
|
|
240
265
|
var UsersAPI = class extends BaseAPI {
|
|
241
266
|
static {
|
|
242
267
|
__name(this, "UsersAPI");
|
|
@@ -250,7 +275,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
250
275
|
getByUsername(username, options) {
|
|
251
276
|
const url = this.formatURL("/api/public/users");
|
|
252
277
|
url.searchParams.set("name", username);
|
|
253
|
-
return safeFetch.Json(this.
|
|
278
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
254
279
|
}
|
|
255
280
|
/**
|
|
256
281
|
* Get a user by its ID
|
|
@@ -260,7 +285,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
260
285
|
*/
|
|
261
286
|
getByUniqueId(uniqueId, options) {
|
|
262
287
|
const url = this.formatURL(`/api/public/users/${uniqueId}`);
|
|
263
|
-
return safeFetch.Json(this.
|
|
288
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
264
289
|
}
|
|
265
290
|
/**
|
|
266
291
|
* Get a user's friends
|
|
@@ -270,7 +295,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
270
295
|
*/
|
|
271
296
|
getUserFriends(uniqueId, options) {
|
|
272
297
|
const url = this.formatURL(`/api/public/users/${uniqueId}/friends`);
|
|
273
|
-
return safeFetch.Json(this.
|
|
298
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
274
299
|
}
|
|
275
300
|
/**
|
|
276
301
|
* Get a user's groups
|
|
@@ -280,7 +305,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
280
305
|
*/
|
|
281
306
|
getUserGroups(uniqueId, options) {
|
|
282
307
|
const url = this.formatURL(`/api/public/users/${uniqueId}/groups`);
|
|
283
|
-
return safeFetch.Json(this.
|
|
308
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
284
309
|
}
|
|
285
310
|
/**
|
|
286
311
|
* Get a user's rooms
|
|
@@ -290,7 +315,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
290
315
|
*/
|
|
291
316
|
getUserRooms(uniqueId, options) {
|
|
292
317
|
const url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);
|
|
293
|
-
return safeFetch.Json(this.
|
|
318
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
294
319
|
}
|
|
295
320
|
/**
|
|
296
321
|
* Get a user's badges
|
|
@@ -300,7 +325,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
300
325
|
*/
|
|
301
326
|
getUserBadges(uniqueId, options) {
|
|
302
327
|
const url = this.formatURL(`/api/public/users/${uniqueId}/badges`);
|
|
303
|
-
return safeFetch.Json(this.
|
|
328
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
304
329
|
}
|
|
305
330
|
/**
|
|
306
331
|
* Get a user's profile
|
|
@@ -310,7 +335,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
310
335
|
*/
|
|
311
336
|
getUserProfile(uniqueId, options) {
|
|
312
337
|
const url = this.formatURL(`/api/public/users/${uniqueId}/profile`);
|
|
313
|
-
return safeFetch.Json(this.
|
|
338
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
314
339
|
}
|
|
315
340
|
/**
|
|
316
341
|
* Get a user's photos
|
|
@@ -320,7 +345,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
320
345
|
*/
|
|
321
346
|
getUserPhotos(uniqueId, options) {
|
|
322
347
|
const url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);
|
|
323
|
-
return safeFetch.Json(this.
|
|
348
|
+
return safeFetch.Json(this.fetchGet(url, options));
|
|
324
349
|
}
|
|
325
350
|
/**
|
|
326
351
|
* Get a user's figure
|
|
@@ -329,26 +354,26 @@ var UsersAPI = class extends BaseAPI {
|
|
|
329
354
|
*/
|
|
330
355
|
getUserFigureImageURL(options) {
|
|
331
356
|
const url = this.formatURL("/habbo-imaging/avatarimage");
|
|
332
|
-
if ("figure" in options && !
|
|
357
|
+
if ("figure" in options && !isNullish(options.figure)) {
|
|
333
358
|
url.searchParams.append("figure", options.figure);
|
|
334
|
-
if (!
|
|
335
|
-
} else if ("user" in options && !
|
|
359
|
+
if (!isNullish(options.gender)) url.searchParams.append("gender", HabboFigureGender[options.gender]);
|
|
360
|
+
} else if ("user" in options && !isNullish(options.user)) {
|
|
336
361
|
url.searchParams.append("user", options.user);
|
|
337
362
|
} else {
|
|
338
363
|
throw new Error("You must define `figure` or `user` in the options");
|
|
339
364
|
}
|
|
340
|
-
if (!
|
|
365
|
+
if (!isNullish(options.action)) {
|
|
341
366
|
const habboAction = HabboFigureAction[options.action];
|
|
342
367
|
url.searchParams.append(
|
|
343
368
|
"action",
|
|
344
|
-
|
|
369
|
+
isNullish(options.hand) ? habboAction : `${habboAction}=${HabboFigureHand[options.hand]}`
|
|
345
370
|
);
|
|
346
371
|
}
|
|
347
|
-
if (!
|
|
348
|
-
if (!
|
|
349
|
-
if (!
|
|
350
|
-
if (!
|
|
351
|
-
if (!
|
|
372
|
+
if (!isNullish(options.direction)) url.searchParams.append("direction", HabboFigureDirection[options.direction]);
|
|
373
|
+
if (!isNullish(options.headDirection)) url.searchParams.append("head_direction", HabboFigureDirection[options.headDirection]);
|
|
374
|
+
if (!isNullish(options.gesture)) url.searchParams.append("gesture", HabboFigureGesture[options.gesture]);
|
|
375
|
+
if (!isNullish(options.size)) url.searchParams.append("size", HabboFigureSize[options.size]);
|
|
376
|
+
if (!isNullish(options.headOnly)) url.searchParams.append("headonly", options.headOnly ? "1" : "0");
|
|
352
377
|
return url;
|
|
353
378
|
}
|
|
354
379
|
};
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/routes/base.ts","../../src/routes/achievements.ts","../../src/routes/groups.ts","../../src/routes/lists.ts","../../src/routes/marketplace.ts","../../src/routes/ping.ts","../../src/routes/rooms.ts","../../src/common.ts","../../src/routes/users.ts","../../src/habbo.ts"],"names":["HotelDomainTLD","safeFetch","Json","AchievementDataState","isNullish","HabboGroupType"],"mappings":";;;;;;;;;AAAY,IAAA,cAAA,qBAAAA,eAAL,KAAA;AACN,EAAAA,gBAAA,WAAY,CAAA,GAAA,SA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AAe,GAAA,IAAI,eAAgB,CAAA,OAAA,EAAS,OAAO,CAAA;AACxD,IAAA,IAAA,CAAK,MAAS,GAAA,IAAI,SAAU,CAAA,OAAA,EAAS,OAAO,CAAA;AAC5C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,WAAc,GAAA,IAAI,cAAe,CAAA,OAAA,EAAS,OAAO,CAAA;AACtD,IAAA,IAAA,CAAK,IAAO,GAAA,IAAI,OAAQ,CAAA,OAAA,EAAS,OAAO,CAAA;AACxC,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAAA;AAE5C","file":"index.cjs","sourcesContent":["export enum HotelDomainTLD {\n\tBrazilian = '.com.br',\n\tDanish = '.dk',\n\tDutch = '.nl',\n\tFinnish = '.fi',\n\tFrench = '.fr',\n\tGerman = '.de',\n\tInternational = '.com',\n\tItalian = '.it',\n\tSpanish = '.es',\n\tTurkish = '.com.tr'\n}\n\nexport const HotelDomainURL = {\n\tBrazilian: `https://www.habbo${HotelDomainTLD.Brazilian}`,\n\tDanish: `https://www.habbo${HotelDomainTLD.Danish}`,\n\tDutch: `https://www.habbo${HotelDomainTLD.Dutch}`,\n\tFinnish: `https://www.habbo${HotelDomainTLD.Finnish}`,\n\tFrench: `https://www.habbo${HotelDomainTLD.French}`,\n\tGerman: `https://www.habbo${HotelDomainTLD.German}`,\n\tInternational: `https://www.habbo${HotelDomainTLD.International}`,\n\tItalian: `https://www.habbo${HotelDomainTLD.Italian}`,\n\tSpanish: `https://www.habbo${HotelDomainTLD.Spanish}`,\n\tTurkish: `https://www.habbo${HotelDomainTLD.Turkish}`\n} as const;\n","import { safeFetch, type FetchResult } from '@skyra/safe-fetch';\n\nexport abstract class BaseAPI {\n\tprotected readonly baseURL: string;\n\tprotected readonly timeout: number | null;\n\n\tpublic constructor(baseURL: string, timeout?: number | null | undefined) {\n\t\tthis.baseURL = baseURL;\n\t\tthis.timeout = timeout ?? null;\n\t}\n\n\tprotected formatURL(route: string): URL {\n\t\treturn new URL(route, this.baseURL);\n\t}\n\n\tprotected fetch(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, { headers: { 'Content-Type': 'application/json' }, signal: this.#getSignalOrDefault(options) });\n\t}\n\n\t#getSignalOrDefault(options?: APIOptions): AbortSignal | null {\n\t\tif (typeof options === 'object' && options !== null) {\n\t\t\tif (typeof options.signal === 'number') return AbortSignal.timeout(options.signal);\n\t\t\tif (typeof options.signal === 'object' && options.signal !== null) return options.signal;\n\t\t}\n\n\t\tif (typeof this.timeout === 'number') return AbortSignal.timeout(this.timeout);\n\t\treturn null;\n\t}\n}\n\nexport interface APIOptions {\n\tsignal?: AbortSignal | number | null | undefined;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboUserId } from './users.js';\n\nexport class AchievementsAPI extends BaseAPI {\n\t/**\n\t * Get all achievements\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic getAll(options?: APIOptions): Promise<FetchResult<Achievement[]>> {\n\t\tconst url = this.formatURL('/api/public/achievements');\n\t\treturn Json<Achievement[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the achievements from a specified user ID\n\t *\n\t * @param id - The ID of the user\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUserId(id: HabboUserId, options?: APIOptions): Promise<FetchResult<UserAchievement[]>> {\n\t\tconst url = this.formatURL(`/api/public/achievements/${id}`);\n\t\treturn Json<UserAchievement[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for an achievement\n\t *\n\t * @param achievementName - The name of the achievement, retrieved from {@linkcode AchievementData.name}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getImageURL(achievementName: string): URL {\n\t\treturn new URL(`https://images.habbo.com/c_images/album1584/${achievementName}.png`);\n\t}\n}\n\nexport interface Achievement {\n\tachievement: AchievementData;\n\tlevelRequirements: AchievementRequirements;\n}\n\nexport interface UserAchievement {\n\tachievement: AchievementData;\n\tlevel: number;\n\tscore: number;\n}\n\nexport interface AchievementData {\n\tid: number;\n\tname: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}`;\n\tstate: AchievementDataState;\n\tcategory: string;\n}\n\nexport enum AchievementDataState {\n\tEnabled = 'ENABLED',\n\tArchived = 'ARCHIVED',\n\tOffSeason = 'OFF_SEASON'\n}\n\nexport interface AchievementRequirements {\n\tlevel: number;\n\trequiredScore: number;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from 'common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboRoomUniqueId } from './rooms.js';\n\nexport class GroupsAPI extends BaseAPI {\n\t/**\n\t * Get the data for a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(id: HabboGroupId, options?: APIOptions): Promise<FetchResult<HabboGroup>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}`);\n\t\treturn Json<HabboGroup>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the members from a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getGroupMembers(id: HabboGroupId, options?: GetGroupMembersOptions): Promise<FetchResult<HabboGroupMember[]>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}/members`);\n\t\tif (!isNullish(options?.pageIndex)) {\n\t\t\turl.searchParams.append('pageIndex', options.pageIndex.toString());\n\t\t}\n\n\t\treturn Json<HabboGroupMember[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for a badge\n\t *\n\t * @param badgeCode - The badge's code, retrieved from {@linkcode HabboGroup.badgeCode}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getGroupBadgeImageURL(badgeCode: string): URL {\n\t\treturn this.formatURL(`/habbo-imaging/badge/${badgeCode}`);\n\t}\n}\n\n/**\n * The options for {@linkcode GroupsAPI.getGroupMembers}.\n */\nexport interface GetGroupMembersOptions extends APIOptions {\n\t/**\n\t * The page index to look for, each page containing up to 1000 entries.\n\t */\n\tpageIndex?: number | null | undefined;\n}\n\nexport type HabboGroupId = `g-hh${string}-${string};`;\n\n/**\n * Represents a Habbo group.\n */\nexport interface HabboGroup {\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: HabboGroupId;\n\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\n\t/**\n\t * The ID of the room associated with the group, or null if no room is associated.\n\t */\n\troomId: HabboRoomUniqueId;\n\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n}\n\n/**\n * Enum representing the type of a Habbo group.\n */\nexport enum HabboGroupType {\n\t/**\n\t * A normal group (public).\n\t */\n\tNORMAL = 'NORMAL',\n\n\t/**\n\t * A favourite (exclusive) group.\n\t */\n\tFAVOURITE = 'EXCLUSIVE',\n\n\t/**\n\t * A private (closed) group.\n\t */\n\tPRIVATE = 'CLOSED'\n}\n\n/**\n * Represents a member of a Habbo group.\n */\nexport interface HabboGroupMember {\n\t/**\n\t * Indicates whether the member is online.\n\t */\n\tonline: boolean;\n\n\t/**\n\t * The gender of the member.\n\t */\n\tgender: 'm' | 'f';\n\n\t/**\n\t * The motto of the member.\n\t */\n\tmotto: string;\n\n\t/**\n\t * The figure of the member in the Habbo world.\n\t */\n\thabboFigure: string;\n\n\t/**\n\t * The date since the member joined the group.\n\t */\n\tmemberSince: string;\n\n\t/**\n\t * The unique identifier of the member.\n\t */\n\tuniqueId: string;\n\n\t/**\n\t * The name of the member.\n\t */\n\tname: string;\n\n\t/**\n\t * Indicates whether the member is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n","import { type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class ListsAPI extends BaseAPI {\n\t/**\n\t * Get the hot looks from the hotel\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async getHotLooks(options: APIOptions): Promise<FetchResult<HabboHotLookList>> {\n\t\tconst url = this.formatURL('/api/public/lists/hotlooks');\n\t\tconst data = await this.fetch(url, options);\n\t\treturn data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();\n\t}\n\n\t#parseHotLooksXML(data: string): HabboHotLookList {\n\t\tconst urlResult = /url=\"(.*)\"/.exec(data);\n\t\tif (urlResult === null) throw new SyntaxError('Could not read hot looks');\n\n\t\tconst url = urlResult[1];\n\t\tconst entries = [] as HabboHotLookListItem[];\n\t\tfor (const result of data.matchAll(/gender=\"(\\w)\" figure=\"(.+)\" hash=\"(.+)\"/g)) {\n\t\t\tentries.push({ gender: result[1] as 'f' | 'm', figure: result[2], hash: result[3] });\n\t\t}\n\n\t\tif (entries.length === 0) throw new SyntaxError('Could not read hot looks');\n\n\t\treturn { url, entries };\n\t}\n}\n\nexport interface HabboHotLookList {\n\turl: string;\n\tentries: HabboHotLookListItem[];\n}\n\nexport interface HabboHotLookListItem {\n\tgender: 'f' | 'm';\n\tfigure: string;\n\thash: string;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class MarketplaceAPI extends BaseAPI {\n\t/**\n\t * Get the marketplace stats for a room item\n\t *\n\t * @param roomItemName - The name of the room item\n\t * @param options - The options for the API call\n\t */\n\tpublic getRoomItemStats(roomItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for a wall item\n\t *\n\t * @param wallItemName - The name of the wall item\n\t * @param options - The options for the API call\n\t */\n\tpublic getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetch(url, options));\n\t}\n}\n\nexport interface MarketplaceStats {\n\thistory: MarketplaceStatsHistory[];\n\tstatsDate: `${bigint}-${bigint}-${bigint}`;\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsHistory {\n\tdayOffset: `${bigint}`;\n\taveragePrice: `${bigint}`;\n\ttotalSoldItems: `${bigint}`;\n\ttotalCreditSum: `${bigint}`;\n\ttotalOpenOffers: `${bigint}`;\n}\n","import { type APIOptions, BaseAPI } from './base.js';\n\nexport class PingAPI extends BaseAPI {\n\t/**\n\t * Pings Habbo, returning the measured time using {@linkcode performance.now()}\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async get(options?: APIOptions): Promise<number | null> {\n\t\tconst url = this.formatURL('/api/public/ping');\n\t\tconst now = performance.now();\n\t\treturn (await this.fetch(url, options)).match({\n\t\t\tok: () => performance.now() - now,\n\t\t\terr: () => null\n\t\t});\n\t}\n}\n","import { type FetchResult, Json } from '@skyra/safe-fetch';\nimport { type APIOptions, BaseAPI } from './base.js';\n\nexport class RoomsAPI extends BaseAPI {\n\t/**\n\t * Get a room by its ID\n\t *\n\t * @param roomId - The ID of the room\n\t * @param options - The options for the API call\n\t */\n\tpublic async getById(roomId: number, options?: APIOptions): Promise<FetchResult<HabboRoom>> {\n\t\tconst url = this.formatURL(`/api/public/rooms/${roomId}`);\n\t\treturn Json<HabboRoom>(this.fetch(url, options));\n\t}\n}\n\nexport interface HabboRoom {\n\tid: number;\n\tname: string;\n\tdescription: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}T${string}`;\n\thabboGroupId: string;\n\ttags: string[];\n\tmaximumVisitors: number;\n\tshowOwnerName: boolean;\n\townerName: string;\n\townerUniqueId: string;\n\tcategories: string[];\n\tthumbnailUrl: string;\n\timageUrl: string;\n\trating: number;\n\tuniqueId: HabboRoomUniqueId;\n}\n\nexport type HabboRoomUniqueId = `r-hh${string}-${string}`;\n","export function isNullish(value: unknown): value is null | undefined {\n\treturn value == null;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport { HabboGroupType } from './groups.js';\n\nexport class UsersAPI extends BaseAPI {\n\t/**\n\t * Get a user by its username\n\t *\n\t * @param username - The username to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUsername(username: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL('/api/public/users');\n\t\turl.searchParams.set('name', username);\n\t\treturn Json<HabboUser>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user by its ID\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}`);\n\t\treturn Json<HabboUser>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's friends\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserFriends(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserFriend[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/friends`);\n\t\treturn Json<HabboUserFriend[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's groups\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserGroups(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserGroup[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/groups`);\n\t\treturn Json<HabboUserGroup[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's rooms\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserRooms(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserRoom[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);\n\t\treturn Json<HabboUserRoom[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's badges\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserBadges(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserBadge[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/badges`);\n\t\treturn Json<HabboUserBadge[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's profile\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserProfile(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserProfile>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/profile`);\n\t\treturn Json<HabboUserProfile>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's photos\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserPhotos(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserPhotos[]>> {\n\t\tconst url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);\n\t\treturn Json<HabboUserPhotos[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's figure\n\t *\n\t * @param options - The options for the image\n\t */\n\tpublic getUserFigureImageURL(options: HabboFigureName | HabboFigureStatic): URL {\n\t\tconst url = this.formatURL('/habbo-imaging/avatarimage');\n\n\t\tif ('figure' in options && !isNullish(options.figure)) {\n\t\t\turl.searchParams.append('figure', options.figure);\n\t\t\tif (!isNullish(options.gender)) url.searchParams.append('gender', HabboFigureGender[options.gender]);\n\t\t} else if ('user' in options && !isNullish(options.user)) {\n\t\t\turl.searchParams.append('user', options.user);\n\t\t} else {\n\t\t\tthrow new Error('You must define `figure` or `user` in the options');\n\t\t}\n\n\t\tif (!isNullish(options.action)) {\n\t\t\tconst habboAction = HabboFigureAction[options.action];\n\t\t\turl.searchParams.append(\n\t\t\t\t'action',\n\t\t\t\tisNullish(options.hand) //\n\t\t\t\t\t? habboAction\n\t\t\t\t\t: `${habboAction}=${HabboFigureHand[options.hand]}`\n\t\t\t);\n\t\t}\n\t\tif (!isNullish(options.direction)) url.searchParams.append('direction', HabboFigureDirection[options.direction]);\n\t\tif (!isNullish(options.headDirection)) url.searchParams.append('head_direction', HabboFigureDirection[options.headDirection]);\n\t\tif (!isNullish(options.gesture)) url.searchParams.append('gesture', HabboFigureGesture[options.gesture]);\n\t\tif (!isNullish(options.size)) url.searchParams.append('size', HabboFigureSize[options.size]);\n\t\tif (!isNullish(options.headOnly)) url.searchParams.append('headonly', options.headOnly ? '1' : '0');\n\n\t\treturn url;\n\t}\n}\n\nexport type HabboUserId = `hh${string}-${string}`;\n\n/**\n * Represents a Habbo user.\n */\nexport interface HabboUser {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: HabboUserId;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n}\n\n/**\n * Represents a room owned by a Habbo user.\n */\nexport interface HabboUserRoom {\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tid: number;\n\t/**\n\t * The name of the room.\n\t */\n\tname: string;\n\t/**\n\t * The description of the room.\n\t */\n\tdescription: string;\n\t/**\n\t * The creation time of the room.\n\t */\n\tcreationTime: string;\n\t/**\n\t * The unique identifier of the Habbo group associated with the room.\n\t */\n\thabboGroupId: string;\n\t/**\n\t * The tags associated with the room.\n\t */\n\ttags: string[];\n\t/**\n\t * The maximum number of visitors allowed in the room.\n\t */\n\tmaximumVisitors: number;\n\t/**\n\t * Indicates whether the owner's name is shown.\n\t */\n\tshowOwnerName: boolean;\n\t/**\n\t * The name of the room owner.\n\t */\n\townerName: string;\n\t/**\n\t * The unique identifier of the room owner.\n\t */\n\townerUniqueId: string;\n\t/**\n\t * The categories associated with the room.\n\t */\n\tcategories: string[];\n\t/**\n\t * The URL of the room's thumbnail image.\n\t */\n\tthumbnailUrl: string;\n\t/**\n\t * The URL of the room's image.\n\t */\n\timageUrl: string;\n\t/**\n\t * The rating of the room.\n\t */\n\trating: number;\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tuniqueId: string;\n}\n\n/**\n * Represents a group associated with a Habbo user.\n */\nexport interface HabboUserGroup {\n\t/**\n\t * Indicates whether the group is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: string;\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\t/**\n\t * The unique identifier of the room associated with the group.\n\t */\n\troomId: string;\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n\t/**\n\t * The primary color of the group.\n\t */\n\tprimaryColour: string;\n\t/**\n\t * The secondary color of the group.\n\t */\n\tsecondaryColour: string;\n\t/**\n\t * Indicates whether the user is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n\n/**\n * Represents a badge owned by a Habbo user.\n */\nexport interface HabboUserBadge {\n\t/**\n\t * The code of the badge.\n\t */\n\tcode: string;\n\t/**\n\t * The name of the badge.\n\t */\n\tname: string;\n\t/**\n\t * The description of the badge.\n\t */\n\tdescription: string;\n}\n\n/**\n * Represents a selected badge of a Habbo user.\n */\nexport interface HabboUserSelectedBadge extends HabboUserBadge {\n\t/**\n\t * The index of the badge.\n\t */\n\tbadgeIndex: number;\n}\n\n/**\n * Represents a friend of a Habbo user.\n */\nexport interface HabboUserFriend {\n\t/**\n\t * The unique identifier of the friend.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the friend.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the friend.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the friend.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the friend is online.\n\t */\n\tonline: boolean;\n}\n\n/**\n * Represents the profile of a Habbo user.\n */\nexport interface HabboUserProfile {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n\t/**\n\t * The groups the user is a member of.\n\t */\n\tgroups: HabboUserGroup[];\n\t/**\n\t * The badges owned by the user.\n\t */\n\tbadges: HabboUserBadge[];\n\t/**\n\t * The friends of the user.\n\t */\n\tfriends: HabboUserFriend[];\n\t/**\n\t * The rooms owned by the user.\n\t */\n\trooms: HabboUserRoom[];\n}\n\n/**\n * Represents photos associated with a Habbo user.\n */\nexport interface HabboUserPhotos {\n\t/**\n\t * The unique identifier of the room where the photo was taken.\n\t */\n\troom_id: number;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_id: number;\n\t/**\n\t * The name of the photo creator.\n\t */\n\tcreator_name: string;\n\t/**\n\t * The time when the photo was taken.\n\t */\n\ttime: number;\n\t/**\n\t * The version of the photo.\n\t */\n\tversion: number;\n\t/**\n\t * The URL of the photo.\n\t */\n\turl: string;\n\t/**\n\t * The type of the photo.\n\t */\n\ttype: string;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_uniqueId: string;\n\t/**\n\t * The tags associated with the photo.\n\t */\n\ttags: string[];\n\t/**\n\t * The URL of the photo preview.\n\t */\n\tpreviewUrl: string;\n\t/**\n\t * The unique identifier of the photo.\n\t */\n\tid: string;\n\t/**\n\t * The likes associated with the photo.\n\t */\n\tlikes: string[];\n}\n\nexport interface HabboFigureName extends HabboFigureBase {\n\t/**\n\t * The Habbo username.\n\t */\n\tuser: string;\n}\n\nexport interface HabboFigureStatic extends HabboFigureBase {\n\t/**\n\t * The Habbo figure to use.\n\t */\n\tfigure: string;\n\t/**\n\t * The Habbo's gender.\n\t */\n\tgender?: keyof typeof HabboFigureGender | undefined | null;\n}\n\nexport interface HabboFigureBase {\n\t/**\n\t * The action the user should perform.\n\t */\n\taction?: keyof typeof HabboFigureAction | undefined | null;\n\t/**\n\t * The hand item, will override {@linkcode HabboFigureBase.action} to `'crr'`.\n\t */\n\thand?: keyof typeof HabboFigureHand | undefined | null;\n\t/**\n\t * The Habbo's direction.\n\t */\n\tdirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The Habbo's head direction.\n\t */\n\theadDirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The gesture, if any.\n\t */\n\tgesture?: keyof typeof HabboFigureGesture | undefined | null;\n\t/**\n\t * The size of the character.\n\t */\n\tsize?: keyof typeof HabboFigureSize | undefined | null;\n\t/**\n\t * Whether or not to render only the head.\n\t */\n\theadOnly?: boolean | undefined | null;\n}\n\nexport const HabboFigureAction = {\n\t// Main Actions\n\tlay: 'lay',\n\tsit: 'sit',\n\trespect: 'respect',\n\twalk: 'wlk',\n\twave: 'wav',\n\tcarry: 'crr',\n\tdrink: 'drk',\n\tsign: 'sig',\n\tblow: 'blw',\n\tlaugh: 'laugh'\n} as const;\n\nexport const HabboFigureHand = {\n\tnothing: '0',\n\tcarrot: '2',\n\tcoffee: '6',\n\tcocktail: '667',\n\thabbo_cola: '5',\n\tice_cream: '3',\n\tjapanese_tea: '42',\n\tlove_potion: '9',\n\tradioactive: '44',\n\ttomato: '43',\n\twater: '1'\n} as const;\n\nexport const HabboFigureGesture = {\n\tnothing: 'nrm',\n\thappy: 'sml',\n\tsad: 'sad',\n\tangry: 'agr',\n\tsurprised: 'srp',\n\tsleeping: 'eyb',\n\tspeaking: 'spk'\n} as const;\n\nexport const HabboFigureSize = { small: 's', normal: 'm', large: 'l' } as const;\nexport const HabboFigureDirection = { nw: '0', w: '1', sw: '2', s: '3', se: '4', e: '5', ne: '6', n: '7' } as const;\nexport const HabboFigureGender = { male: 'M', female: 'F' } as const;\n\nexport const HabboFigureGestureKeys = Object.keys(HabboFigureGesture) as (keyof typeof HabboFigureGesture)[];\nexport const HabboFigureActionKeys = Object.keys(HabboFigureAction) as (keyof typeof HabboFigureAction)[];\nexport const HabboFigureHandKeys = Object.keys(HabboFigureHand) as (keyof typeof HabboFigureHand)[];\nexport const HabboFigureSizeKeys = Object.keys(HabboFigureSize) as (keyof typeof HabboFigureSize)[];\nexport const HabboFigureDirectionKeys = Object.keys(HabboFigureDirection) as (keyof typeof HabboFigureDirection)[];\nexport const HabboFigureGenderKeys = Object.keys(HabboFigureGender) as (keyof typeof HabboFigureGender)[];\n","import { HotelDomainURL } from './constants.js';\nimport { AchievementsAPI } from './routes/achievements.js';\nimport { GroupsAPI } from './routes/groups.js';\nimport { ListsAPI } from './routes/lists.js';\nimport { MarketplaceAPI } from './routes/marketplace.js';\nimport { PingAPI } from './routes/ping.js';\nimport { RoomsAPI } from './routes/rooms.js';\nimport { UsersAPI } from './routes/users.js';\n\nexport class Habbo {\n\tpublic readonly achievements: AchievementsAPI;\n\tpublic readonly groups: GroupsAPI;\n\tpublic readonly lists: ListsAPI;\n\tpublic readonly marketplace: MarketplaceAPI;\n\tpublic readonly ping: PingAPI;\n\tpublic readonly rooms: RoomsAPI;\n\tpublic readonly users: UsersAPI;\n\n\tpublic constructor(options?: HabboOptions) {\n\t\tconst baseURL = options?.baseURL ?? HotelDomainURL.International;\n\t\tconst timeout = options?.timeout ?? null;\n\n\t\tthis.achievements = new AchievementsAPI(baseURL, timeout);\n\t\tthis.groups = new GroupsAPI(baseURL, timeout);\n\t\tthis.lists = new ListsAPI(baseURL, timeout);\n\t\tthis.marketplace = new MarketplaceAPI(baseURL, timeout);\n\t\tthis.ping = new PingAPI(baseURL, timeout);\n\t\tthis.rooms = new RoomsAPI(baseURL, timeout);\n\t\tthis.users = new UsersAPI(baseURL, timeout);\n\t}\n}\n\nexport interface HabboOptions {\n\tbaseURL?: string | null | undefined;\n\ttimeout?: number | null | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/routes/base.ts","../../src/routes/achievements.ts","../../src/common.ts","../../src/routes/groups.ts","../../src/routes/lists.ts","../../src/routes/marketplace.ts","../../src/routes/ping.ts","../../src/routes/rooms.ts","../../src/routes/users.ts","../../src/habbo.ts"],"names":["HotelDomainTLD","safeFetch","Json","AchievementDataState","HabboGroupType"],"mappings":";;;;;;;;AAAY,IAAA,cAAA,qBAAAA,eAAL,KAAA;AACN,EAAAA,gBAAA,WAAY,CAAA,GAAA,SAAA;AACZ,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,OAAQ,CAAA,GAAA,KAAA;AACR,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,eAAgB,CAAA,GAAA,MAAA;AAChB,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,SAAU,CAAA,GAAA,SAAA;AAVC,EAAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAaL,IAAM,cAAiB,GAAA;AAAA,EAC7B,SAAA,EAAW,oBAAoB,SAAwB,iBAAA,CAAA;AAAA,EACvD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,EACjD,KAAA,EAAO,oBAAoB,KAAoB,aAAA,CAAA;AAAA,EAC/C,OAAA,EAAS,oBAAoB,KAAsB,eAAA,CAAA;AAAA,EACnD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,EACjD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,EACjD,aAAA,EAAe,oBAAoB,MAA4B,qBAAA,CAAA;AAAA,EAC/D,OAAA,EAAS,oBAAoB,KAAsB,eAAA,CAAA;AAAA,EACnD,OAAA,EAAS,oBAAoB,KA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IAAO,GAAA,IAAI,OAAQ,CAAA,OAAA,EAAS,OAAO,CAAA;AACxC,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAAA;AAE5C","file":"index.cjs","sourcesContent":["export enum HotelDomainTLD {\n\tBrazilian = '.com.br',\n\tDanish = '.dk',\n\tDutch = '.nl',\n\tFinnish = '.fi',\n\tFrench = '.fr',\n\tGerman = '.de',\n\tInternational = '.com',\n\tItalian = '.it',\n\tSpanish = '.es',\n\tTurkish = '.com.tr'\n}\n\nexport const HotelDomainURL = {\n\tBrazilian: `https://www.habbo${HotelDomainTLD.Brazilian}`,\n\tDanish: `https://www.habbo${HotelDomainTLD.Danish}`,\n\tDutch: `https://www.habbo${HotelDomainTLD.Dutch}`,\n\tFinnish: `https://www.habbo${HotelDomainTLD.Finnish}`,\n\tFrench: `https://www.habbo${HotelDomainTLD.French}`,\n\tGerman: `https://www.habbo${HotelDomainTLD.German}`,\n\tInternational: `https://www.habbo${HotelDomainTLD.International}`,\n\tItalian: `https://www.habbo${HotelDomainTLD.Italian}`,\n\tSpanish: `https://www.habbo${HotelDomainTLD.Spanish}`,\n\tTurkish: `https://www.habbo${HotelDomainTLD.Turkish}`\n} as const;\n","import { safeFetch, type FetchResult } from '@skyra/safe-fetch';\n\nexport abstract class BaseAPI {\n\tprotected readonly baseURL: string;\n\tprotected readonly timeout: number | null;\n\n\tpublic constructor(baseURL: string, timeout?: number | null | undefined) {\n\t\tthis.baseURL = baseURL;\n\t\tthis.timeout = timeout ?? null;\n\t}\n\n\tprotected formatURL(route: string): URL {\n\t\treturn new URL(route, this.baseURL);\n\t}\n\n\tprotected fetchGet(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, { headers: { 'Content-Type': 'application/json' }, signal: this.#getSignalOrDefault(options) });\n\t}\n\n\tprotected fetchPost(url: string | URL, body: object, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify(body),\n\t\t\tsignal: this.#getSignalOrDefault(options)\n\t\t});\n\t}\n\n\t#getSignalOrDefault(options?: APIOptions): AbortSignal | null {\n\t\tif (typeof options === 'object' && options !== null) {\n\t\t\tif (typeof options.signal === 'number') return AbortSignal.timeout(options.signal);\n\t\t\tif (typeof options.signal === 'object' && options.signal !== null) return options.signal;\n\t\t}\n\n\t\tif (typeof this.timeout === 'number') return AbortSignal.timeout(this.timeout);\n\t\treturn null;\n\t}\n}\n\nexport interface APIOptions {\n\tsignal?: AbortSignal | number | null | undefined;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboUserId } from './users.js';\n\nexport class AchievementsAPI extends BaseAPI {\n\t/**\n\t * Get all achievements\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic getAll(options?: APIOptions): Promise<FetchResult<Achievement[]>> {\n\t\tconst url = this.formatURL('/api/public/achievements');\n\t\treturn Json<Achievement[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the achievements from a specified user ID\n\t *\n\t * @param id - The ID of the user\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUserId(id: HabboUserId, options?: APIOptions): Promise<FetchResult<UserAchievement[]>> {\n\t\tconst url = this.formatURL(`/api/public/achievements/${id}`);\n\t\treturn Json<UserAchievement[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for an achievement\n\t *\n\t * @param achievementName - The name of the achievement, retrieved from {@linkcode AchievementData.name}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getImageURL(achievementName: string): URL {\n\t\treturn new URL(`https://images.habbo.com/c_images/album1584/${achievementName}.png`);\n\t}\n}\n\nexport interface Achievement {\n\tachievement: AchievementData;\n\tlevelRequirements: AchievementRequirements;\n}\n\nexport interface UserAchievement {\n\tachievement: AchievementData;\n\tlevel: number;\n\tscore: number;\n}\n\nexport interface AchievementData {\n\tid: number;\n\tname: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}`;\n\tstate: AchievementDataState;\n\tcategory: string;\n}\n\nexport enum AchievementDataState {\n\tEnabled = 'ENABLED',\n\tArchived = 'ARCHIVED',\n\tOffSeason = 'OFF_SEASON'\n}\n\nexport interface AchievementRequirements {\n\tlevel: number;\n\trequiredScore: number;\n}\n","export function isNullish(value: unknown): value is null | undefined {\n\treturn value == null;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboRoomUniqueId } from './rooms.js';\n\nexport class GroupsAPI extends BaseAPI {\n\t/**\n\t * Get the data for a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(id: HabboGroupId, options?: APIOptions): Promise<FetchResult<HabboGroup>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}`);\n\t\treturn Json<HabboGroup>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the members from a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getGroupMembers(id: HabboGroupId, options?: GetGroupMembersOptions): Promise<FetchResult<HabboGroupMember[]>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}/members`);\n\t\tif (!isNullish(options?.pageIndex)) {\n\t\t\turl.searchParams.append('pageIndex', options.pageIndex.toString());\n\t\t}\n\n\t\treturn Json<HabboGroupMember[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for a badge\n\t *\n\t * @param badgeCode - The badge's code, retrieved from {@linkcode HabboGroup.badgeCode}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getGroupBadgeImageURL(badgeCode: string): URL {\n\t\treturn this.formatURL(`/habbo-imaging/badge/${badgeCode}`);\n\t}\n}\n\n/**\n * The options for {@linkcode GroupsAPI.getGroupMembers}.\n */\nexport interface GetGroupMembersOptions extends APIOptions {\n\t/**\n\t * The page index to look for, each page containing up to 1000 entries.\n\t */\n\tpageIndex?: number | null | undefined;\n}\n\nexport type HabboGroupId = `g-hh${string}-${string};`;\n\n/**\n * Represents a Habbo group.\n */\nexport interface HabboGroup {\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: HabboGroupId;\n\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\n\t/**\n\t * The ID of the room associated with the group, or null if no room is associated.\n\t */\n\troomId: HabboRoomUniqueId;\n\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n}\n\n/**\n * Enum representing the type of a Habbo group.\n */\nexport enum HabboGroupType {\n\t/**\n\t * A normal group (public).\n\t */\n\tNORMAL = 'NORMAL',\n\n\t/**\n\t * A favourite (exclusive) group.\n\t */\n\tFAVOURITE = 'EXCLUSIVE',\n\n\t/**\n\t * A private (closed) group.\n\t */\n\tPRIVATE = 'CLOSED'\n}\n\n/**\n * Represents a member of a Habbo group.\n */\nexport interface HabboGroupMember {\n\t/**\n\t * Indicates whether the member is online.\n\t */\n\tonline: boolean;\n\n\t/**\n\t * The gender of the member.\n\t */\n\tgender: 'm' | 'f';\n\n\t/**\n\t * The motto of the member.\n\t */\n\tmotto: string;\n\n\t/**\n\t * The figure of the member in the Habbo world.\n\t */\n\thabboFigure: string;\n\n\t/**\n\t * The date since the member joined the group.\n\t */\n\tmemberSince: string;\n\n\t/**\n\t * The unique identifier of the member.\n\t */\n\tuniqueId: string;\n\n\t/**\n\t * The name of the member.\n\t */\n\tname: string;\n\n\t/**\n\t * Indicates whether the member is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n","import { type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class ListsAPI extends BaseAPI {\n\t/**\n\t * Get the hot looks from the hotel\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async getHotLooks(options: APIOptions): Promise<FetchResult<HabboHotLookList>> {\n\t\tconst url = this.formatURL('/api/public/lists/hotlooks');\n\t\tconst data = await this.fetchGet(url, options);\n\t\treturn data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();\n\t}\n\n\t#parseHotLooksXML(data: string): HabboHotLookList {\n\t\tconst urlResult = /url=\"(.*)\"/.exec(data);\n\t\tif (urlResult === null) throw new SyntaxError('Could not read hot looks');\n\n\t\tconst url = urlResult[1];\n\t\tconst entries = [] as HabboHotLookListItem[];\n\t\tfor (const result of data.matchAll(/gender=\"(\\w)\" figure=\"(.+)\" hash=\"(.+)\"/g)) {\n\t\t\tentries.push({ gender: result[1] as 'f' | 'm', figure: result[2], hash: result[3] });\n\t\t}\n\n\t\tif (entries.length === 0) throw new SyntaxError('Could not read hot looks');\n\n\t\treturn { url, entries };\n\t}\n}\n\nexport interface HabboHotLookList {\n\turl: string;\n\tentries: HabboHotLookListItem[];\n}\n\nexport interface HabboHotLookListItem {\n\tgender: 'f' | 'm';\n\tfigure: string;\n\thash: string;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class MarketplaceAPI extends BaseAPI {\n\t/**\n\t * Get the marketplace stats for a room item\n\t *\n\t * @deprecated This endpoint has been removed from the official API in favour\n\t * of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can\n\t * provide stats for up to 25 items per type in a single request.\n\t *\n\t * @param roomItemName - The name of the room item\n\t * @param options - The options for the API call\n\t */\n\tpublic getRoomItemStats(roomItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for a wall item\n\t *\n\t * @deprecated This endpoint has been removed from the official API in favour\n\t * of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can\n\t * provide stats for up to 25 items per type in a single request.\n\t *\n\t * @param wallItemName - The name of the wall item\n\t * @param options - The options for the API call\n\t */\n\tpublic getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for up to 25 room and wall items at once\n\t *\n\t * @param data - The data for the stats request\n\t * @param options - The options for the API call\n\t */\n\tpublic getStats(data: MarketplaceGetStats, options?: APIOptions) {\n\t\tconst url = this.formatURL('/api/public/marketplace/stats');\n\t\treturn Json<MarketplaceStats[]>(this.fetchPost(url, data, options));\n\t}\n}\n\nexport interface MarketplaceStats {\n\thistory: MarketplaceStatsHistory[];\n\tstatsDate: `${bigint}-${bigint}-${bigint}`;\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsHistory {\n\tdayOffset: `${bigint}`;\n\taveragePrice: `${bigint}`;\n\ttotalSoldItems: `${bigint}`;\n\ttotalCreditSum: `${bigint}`;\n\ttotalOpenOffers: `${bigint}`;\n}\n\nexport interface MarketplaceGetStats {\n\troomItems: string[];\n\twallItems: string[];\n}\n\nexport interface MarketplaceStatsResult {\n\tstatus: string;\n\troomItemData: MarketplaceStatsResultEntry[];\n\twallItemData: MarketplaceStatsResultEntry[];\n}\n\nexport interface MarketplaceStatsResultEntry {\n\titem: string;\n\textraData: null;\n\tstatsDate: Date;\n\thistory: MarketplaceStatsResultEntryHistory[];\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\tcurrentOpenOffers: number;\n\tcurrentPrice: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsResultEntryHistory {\n\tdayOffset: string;\n\taveragePrice: string;\n\ttotalSoldItems: string;\n\ttotalCreditSum: string;\n\ttotalOpenOffers: string;\n}\n","import { type APIOptions, BaseAPI } from './base.js';\n\nexport class PingAPI extends BaseAPI {\n\t/**\n\t * Pings Habbo, returning the measured time using {@linkcode performance.now()}\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async get(options?: APIOptions): Promise<number | null> {\n\t\tconst url = this.formatURL('/api/public/ping');\n\t\tconst now = performance.now();\n\t\treturn (await this.fetchGet(url, options)).match({\n\t\t\tok: () => performance.now() - now,\n\t\t\terr: () => null\n\t\t});\n\t}\n}\n","import { type FetchResult, Json } from '@skyra/safe-fetch';\nimport { type APIOptions, BaseAPI } from './base.js';\n\nexport class RoomsAPI extends BaseAPI {\n\t/**\n\t * Get a room by its ID\n\t *\n\t * @param roomId - The ID of the room\n\t * @param options - The options for the API call\n\t */\n\tpublic async getById(roomId: number, options?: APIOptions): Promise<FetchResult<HabboRoom>> {\n\t\tconst url = this.formatURL(`/api/public/rooms/${roomId}`);\n\t\treturn Json<HabboRoom>(this.fetchGet(url, options));\n\t}\n}\n\nexport interface HabboRoom {\n\tid: number;\n\tname: string;\n\tdescription: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}T${string}`;\n\thabboGroupId: string;\n\ttags: string[];\n\tmaximumVisitors: number;\n\tshowOwnerName: boolean;\n\townerName: string;\n\townerUniqueId: string;\n\tcategories: string[];\n\tthumbnailUrl: string;\n\timageUrl: string;\n\trating: number;\n\tuniqueId: HabboRoomUniqueId;\n}\n\nexport type HabboRoomUniqueId = `r-hh${string}-${string}`;\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport { HabboGroupType } from './groups.js';\n\nexport class UsersAPI extends BaseAPI {\n\t/**\n\t * Get a user by its username\n\t *\n\t * @param username - The username to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUsername(username: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL('/api/public/users');\n\t\turl.searchParams.set('name', username);\n\t\treturn Json<HabboUser>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user by its ID\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}`);\n\t\treturn Json<HabboUser>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's friends\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserFriends(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserFriend[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/friends`);\n\t\treturn Json<HabboUserFriend[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's groups\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserGroups(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserGroup[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/groups`);\n\t\treturn Json<HabboUserGroup[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's rooms\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserRooms(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserRoom[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);\n\t\treturn Json<HabboUserRoom[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's badges\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserBadges(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserBadge[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/badges`);\n\t\treturn Json<HabboUserBadge[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's profile\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserProfile(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserProfile>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/profile`);\n\t\treturn Json<HabboUserProfile>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's photos\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserPhotos(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserPhotos[]>> {\n\t\tconst url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);\n\t\treturn Json<HabboUserPhotos[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's figure\n\t *\n\t * @param options - The options for the image\n\t */\n\tpublic getUserFigureImageURL(options: HabboFigureName | HabboFigureStatic): URL {\n\t\tconst url = this.formatURL('/habbo-imaging/avatarimage');\n\n\t\tif ('figure' in options && !isNullish(options.figure)) {\n\t\t\turl.searchParams.append('figure', options.figure);\n\t\t\tif (!isNullish(options.gender)) url.searchParams.append('gender', HabboFigureGender[options.gender]);\n\t\t} else if ('user' in options && !isNullish(options.user)) {\n\t\t\turl.searchParams.append('user', options.user);\n\t\t} else {\n\t\t\tthrow new Error('You must define `figure` or `user` in the options');\n\t\t}\n\n\t\tif (!isNullish(options.action)) {\n\t\t\tconst habboAction = HabboFigureAction[options.action];\n\t\t\turl.searchParams.append(\n\t\t\t\t'action',\n\t\t\t\tisNullish(options.hand) //\n\t\t\t\t\t? habboAction\n\t\t\t\t\t: `${habboAction}=${HabboFigureHand[options.hand]}`\n\t\t\t);\n\t\t}\n\t\tif (!isNullish(options.direction)) url.searchParams.append('direction', HabboFigureDirection[options.direction]);\n\t\tif (!isNullish(options.headDirection)) url.searchParams.append('head_direction', HabboFigureDirection[options.headDirection]);\n\t\tif (!isNullish(options.gesture)) url.searchParams.append('gesture', HabboFigureGesture[options.gesture]);\n\t\tif (!isNullish(options.size)) url.searchParams.append('size', HabboFigureSize[options.size]);\n\t\tif (!isNullish(options.headOnly)) url.searchParams.append('headonly', options.headOnly ? '1' : '0');\n\n\t\treturn url;\n\t}\n}\n\nexport type HabboUserId = `hh${string}-${string}`;\n\n/**\n * Represents a Habbo user.\n */\nexport interface HabboUser {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: HabboUserId;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n}\n\n/**\n * Represents a room owned by a Habbo user.\n */\nexport interface HabboUserRoom {\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tid: number;\n\t/**\n\t * The name of the room.\n\t */\n\tname: string;\n\t/**\n\t * The description of the room.\n\t */\n\tdescription: string;\n\t/**\n\t * The creation time of the room.\n\t */\n\tcreationTime: string;\n\t/**\n\t * The unique identifier of the Habbo group associated with the room.\n\t */\n\thabboGroupId: string;\n\t/**\n\t * The tags associated with the room.\n\t */\n\ttags: string[];\n\t/**\n\t * The maximum number of visitors allowed in the room.\n\t */\n\tmaximumVisitors: number;\n\t/**\n\t * Indicates whether the owner's name is shown.\n\t */\n\tshowOwnerName: boolean;\n\t/**\n\t * The name of the room owner.\n\t */\n\townerName: string;\n\t/**\n\t * The unique identifier of the room owner.\n\t */\n\townerUniqueId: string;\n\t/**\n\t * The categories associated with the room.\n\t */\n\tcategories: string[];\n\t/**\n\t * The URL of the room's thumbnail image.\n\t */\n\tthumbnailUrl: string;\n\t/**\n\t * The URL of the room's image.\n\t */\n\timageUrl: string;\n\t/**\n\t * The rating of the room.\n\t */\n\trating: number;\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tuniqueId: string;\n}\n\n/**\n * Represents a group associated with a Habbo user.\n */\nexport interface HabboUserGroup {\n\t/**\n\t * Indicates whether the group is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: string;\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\t/**\n\t * The unique identifier of the room associated with the group.\n\t */\n\troomId: string;\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n\t/**\n\t * The primary color of the group.\n\t */\n\tprimaryColour: string;\n\t/**\n\t * The secondary color of the group.\n\t */\n\tsecondaryColour: string;\n\t/**\n\t * Indicates whether the user is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n\n/**\n * Represents a badge owned by a Habbo user.\n */\nexport interface HabboUserBadge {\n\t/**\n\t * The code of the badge.\n\t */\n\tcode: string;\n\t/**\n\t * The name of the badge.\n\t */\n\tname: string;\n\t/**\n\t * The description of the badge.\n\t */\n\tdescription: string;\n}\n\n/**\n * Represents a selected badge of a Habbo user.\n */\nexport interface HabboUserSelectedBadge extends HabboUserBadge {\n\t/**\n\t * The index of the badge.\n\t */\n\tbadgeIndex: number;\n}\n\n/**\n * Represents a friend of a Habbo user.\n */\nexport interface HabboUserFriend {\n\t/**\n\t * The unique identifier of the friend.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the friend.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the friend.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the friend.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the friend is online.\n\t */\n\tonline: boolean;\n}\n\n/**\n * Represents the profile of a Habbo user.\n */\nexport interface HabboUserProfile {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n\t/**\n\t * The groups the user is a member of.\n\t */\n\tgroups: HabboUserGroup[];\n\t/**\n\t * The badges owned by the user.\n\t */\n\tbadges: HabboUserBadge[];\n\t/**\n\t * The friends of the user.\n\t */\n\tfriends: HabboUserFriend[];\n\t/**\n\t * The rooms owned by the user.\n\t */\n\trooms: HabboUserRoom[];\n}\n\n/**\n * Represents photos associated with a Habbo user.\n */\nexport interface HabboUserPhotos {\n\t/**\n\t * The unique identifier of the room where the photo was taken.\n\t */\n\troom_id: number;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_id: number;\n\t/**\n\t * The name of the photo creator.\n\t */\n\tcreator_name: string;\n\t/**\n\t * The time when the photo was taken.\n\t */\n\ttime: number;\n\t/**\n\t * The version of the photo.\n\t */\n\tversion: number;\n\t/**\n\t * The URL of the photo.\n\t */\n\turl: string;\n\t/**\n\t * The type of the photo.\n\t */\n\ttype: string;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_uniqueId: string;\n\t/**\n\t * The tags associated with the photo.\n\t */\n\ttags: string[];\n\t/**\n\t * The URL of the photo preview.\n\t */\n\tpreviewUrl: string;\n\t/**\n\t * The unique identifier of the photo.\n\t */\n\tid: string;\n\t/**\n\t * The likes associated with the photo.\n\t */\n\tlikes: string[];\n}\n\nexport interface HabboFigureName extends HabboFigureBase {\n\t/**\n\t * The Habbo username.\n\t */\n\tuser: string;\n}\n\nexport interface HabboFigureStatic extends HabboFigureBase {\n\t/**\n\t * The Habbo figure to use.\n\t */\n\tfigure: string;\n\t/**\n\t * The Habbo's gender.\n\t */\n\tgender?: keyof typeof HabboFigureGender | undefined | null;\n}\n\nexport interface HabboFigureBase {\n\t/**\n\t * The action the user should perform.\n\t */\n\taction?: keyof typeof HabboFigureAction | undefined | null;\n\t/**\n\t * The hand item, will override {@linkcode HabboFigureBase.action} to `'crr'`.\n\t */\n\thand?: keyof typeof HabboFigureHand | undefined | null;\n\t/**\n\t * The Habbo's direction.\n\t */\n\tdirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The Habbo's head direction.\n\t */\n\theadDirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The gesture, if any.\n\t */\n\tgesture?: keyof typeof HabboFigureGesture | undefined | null;\n\t/**\n\t * The size of the character.\n\t */\n\tsize?: keyof typeof HabboFigureSize | undefined | null;\n\t/**\n\t * Whether or not to render only the head.\n\t */\n\theadOnly?: boolean | undefined | null;\n}\n\nexport const HabboFigureAction = {\n\t// Main Actions\n\tlay: 'lay',\n\tsit: 'sit',\n\trespect: 'respect',\n\twalk: 'wlk',\n\twave: 'wav',\n\tcarry: 'crr',\n\tdrink: 'drk',\n\tsign: 'sig',\n\tblow: 'blw',\n\tlaugh: 'laugh'\n} as const;\n\nexport const HabboFigureHand = {\n\tnothing: '0',\n\tcarrot: '2',\n\tcoffee: '6',\n\tcocktail: '667',\n\thabbo_cola: '5',\n\tice_cream: '3',\n\tjapanese_tea: '42',\n\tlove_potion: '9',\n\tradioactive: '44',\n\ttomato: '43',\n\twater: '1'\n} as const;\n\nexport const HabboFigureGesture = {\n\tnothing: 'nrm',\n\thappy: 'sml',\n\tsad: 'sad',\n\tangry: 'agr',\n\tsurprised: 'srp',\n\tsleeping: 'eyb',\n\tspeaking: 'spk'\n} as const;\n\nexport const HabboFigureSize = { small: 's', normal: 'm', large: 'l' } as const;\nexport const HabboFigureDirection = { nw: '0', w: '1', sw: '2', s: '3', se: '4', e: '5', ne: '6', n: '7' } as const;\nexport const HabboFigureGender = { male: 'M', female: 'F' } as const;\n\nexport const HabboFigureGestureKeys = Object.keys(HabboFigureGesture) as (keyof typeof HabboFigureGesture)[];\nexport const HabboFigureActionKeys = Object.keys(HabboFigureAction) as (keyof typeof HabboFigureAction)[];\nexport const HabboFigureHandKeys = Object.keys(HabboFigureHand) as (keyof typeof HabboFigureHand)[];\nexport const HabboFigureSizeKeys = Object.keys(HabboFigureSize) as (keyof typeof HabboFigureSize)[];\nexport const HabboFigureDirectionKeys = Object.keys(HabboFigureDirection) as (keyof typeof HabboFigureDirection)[];\nexport const HabboFigureGenderKeys = Object.keys(HabboFigureGender) as (keyof typeof HabboFigureGender)[];\n","import { HotelDomainURL } from './constants.js';\nimport { AchievementsAPI } from './routes/achievements.js';\nimport { GroupsAPI } from './routes/groups.js';\nimport { ListsAPI } from './routes/lists.js';\nimport { MarketplaceAPI } from './routes/marketplace.js';\nimport { PingAPI } from './routes/ping.js';\nimport { RoomsAPI } from './routes/rooms.js';\nimport { UsersAPI } from './routes/users.js';\n\nexport class Habbo {\n\tpublic readonly achievements: AchievementsAPI;\n\tpublic readonly groups: GroupsAPI;\n\tpublic readonly lists: ListsAPI;\n\tpublic readonly marketplace: MarketplaceAPI;\n\tpublic readonly ping: PingAPI;\n\tpublic readonly rooms: RoomsAPI;\n\tpublic readonly users: UsersAPI;\n\n\tpublic constructor(options?: HabboOptions) {\n\t\tconst baseURL = options?.baseURL ?? HotelDomainURL.International;\n\t\tconst timeout = options?.timeout ?? null;\n\n\t\tthis.achievements = new AchievementsAPI(baseURL, timeout);\n\t\tthis.groups = new GroupsAPI(baseURL, timeout);\n\t\tthis.lists = new ListsAPI(baseURL, timeout);\n\t\tthis.marketplace = new MarketplaceAPI(baseURL, timeout);\n\t\tthis.ping = new PingAPI(baseURL, timeout);\n\t\tthis.rooms = new RoomsAPI(baseURL, timeout);\n\t\tthis.users = new UsersAPI(baseURL, timeout);\n\t}\n}\n\nexport interface HabboOptions {\n\tbaseURL?: string | null | undefined;\n\ttimeout?: number | null | undefined;\n}\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -31,7 +31,8 @@ declare abstract class BaseAPI {
|
|
|
31
31
|
protected readonly timeout: number | null;
|
|
32
32
|
constructor(baseURL: string, timeout?: number | null | undefined);
|
|
33
33
|
protected formatURL(route: string): URL;
|
|
34
|
-
protected
|
|
34
|
+
protected fetchGet(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>>;
|
|
35
|
+
protected fetchPost(url: string | URL, body: object, options?: APIOptions): Promise<FetchResult<Response>>;
|
|
35
36
|
}
|
|
36
37
|
interface APIOptions {
|
|
37
38
|
signal?: AbortSignal | number | null | undefined;
|
|
@@ -770,6 +771,10 @@ declare class MarketplaceAPI extends BaseAPI {
|
|
|
770
771
|
/**
|
|
771
772
|
* Get the marketplace stats for a room item
|
|
772
773
|
*
|
|
774
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
775
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
776
|
+
* provide stats for up to 25 items per type in a single request.
|
|
777
|
+
*
|
|
773
778
|
* @param roomItemName - The name of the room item
|
|
774
779
|
* @param options - The options for the API call
|
|
775
780
|
*/
|
|
@@ -777,10 +782,21 @@ declare class MarketplaceAPI extends BaseAPI {
|
|
|
777
782
|
/**
|
|
778
783
|
* Get the marketplace stats for a wall item
|
|
779
784
|
*
|
|
785
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
786
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
787
|
+
* provide stats for up to 25 items per type in a single request.
|
|
788
|
+
*
|
|
780
789
|
* @param wallItemName - The name of the wall item
|
|
781
790
|
* @param options - The options for the API call
|
|
782
791
|
*/
|
|
783
792
|
getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>>;
|
|
793
|
+
/**
|
|
794
|
+
* Get the marketplace stats for up to 25 room and wall items at once
|
|
795
|
+
*
|
|
796
|
+
* @param data - The data for the stats request
|
|
797
|
+
* @param options - The options for the API call
|
|
798
|
+
*/
|
|
799
|
+
getStats(data: MarketplaceGetStats, options?: APIOptions): Promise<FetchResult<MarketplaceStats[]>>;
|
|
784
800
|
}
|
|
785
801
|
interface MarketplaceStats {
|
|
786
802
|
history: MarketplaceStatsHistory[];
|
|
@@ -798,6 +814,35 @@ interface MarketplaceStatsHistory {
|
|
|
798
814
|
totalCreditSum: `${bigint}`;
|
|
799
815
|
totalOpenOffers: `${bigint}`;
|
|
800
816
|
}
|
|
817
|
+
interface MarketplaceGetStats {
|
|
818
|
+
roomItems: string[];
|
|
819
|
+
wallItems: string[];
|
|
820
|
+
}
|
|
821
|
+
interface MarketplaceStatsResult {
|
|
822
|
+
status: string;
|
|
823
|
+
roomItemData: MarketplaceStatsResultEntry[];
|
|
824
|
+
wallItemData: MarketplaceStatsResultEntry[];
|
|
825
|
+
}
|
|
826
|
+
interface MarketplaceStatsResultEntry {
|
|
827
|
+
item: string;
|
|
828
|
+
extraData: null;
|
|
829
|
+
statsDate: Date;
|
|
830
|
+
history: MarketplaceStatsResultEntryHistory[];
|
|
831
|
+
soldItemCount: number;
|
|
832
|
+
creditSum: number;
|
|
833
|
+
averagePrice: number;
|
|
834
|
+
totalOpenOffers: number;
|
|
835
|
+
currentOpenOffers: number;
|
|
836
|
+
currentPrice: number;
|
|
837
|
+
historyLimitInDays: number;
|
|
838
|
+
}
|
|
839
|
+
interface MarketplaceStatsResultEntryHistory {
|
|
840
|
+
dayOffset: string;
|
|
841
|
+
averagePrice: string;
|
|
842
|
+
totalSoldItems: string;
|
|
843
|
+
totalCreditSum: string;
|
|
844
|
+
totalOpenOffers: string;
|
|
845
|
+
}
|
|
801
846
|
|
|
802
847
|
declare class PingAPI extends BaseAPI {
|
|
803
848
|
/**
|
|
@@ -823,4 +868,4 @@ interface HabboOptions {
|
|
|
823
868
|
timeout?: number | null | undefined;
|
|
824
869
|
}
|
|
825
870
|
|
|
826
|
-
export { type Achievement, type AchievementData, AchievementDataState, type AchievementRequirements, AchievementsAPI, type GetGroupMembersOptions, GroupsAPI, Habbo, HabboFigureAction, HabboFigureActionKeys, type HabboFigureBase, HabboFigureDirection, HabboFigureDirectionKeys, HabboFigureGender, HabboFigureGenderKeys, HabboFigureGesture, HabboFigureGestureKeys, HabboFigureHand, HabboFigureHandKeys, type HabboFigureName, HabboFigureSize, HabboFigureSizeKeys, type HabboFigureStatic, type HabboGroup, type HabboGroupId, type HabboGroupMember, HabboGroupType, type HabboHotLookList, type HabboHotLookListItem, type HabboOptions, type HabboRoom, type HabboRoomUniqueId, type HabboUser, type HabboUserBadge, type HabboUserFriend, type HabboUserGroup, type HabboUserId, type HabboUserPhotos, type HabboUserProfile, type HabboUserRoom, type HabboUserSelectedBadge, HotelDomainTLD, HotelDomainURL, ListsAPI, MarketplaceAPI, type MarketplaceStats, type MarketplaceStatsHistory, PingAPI, RoomsAPI, type UserAchievement, UsersAPI };
|
|
871
|
+
export { type Achievement, type AchievementData, AchievementDataState, type AchievementRequirements, AchievementsAPI, type GetGroupMembersOptions, GroupsAPI, Habbo, HabboFigureAction, HabboFigureActionKeys, type HabboFigureBase, HabboFigureDirection, HabboFigureDirectionKeys, HabboFigureGender, HabboFigureGenderKeys, HabboFigureGesture, HabboFigureGestureKeys, HabboFigureHand, HabboFigureHandKeys, type HabboFigureName, HabboFigureSize, HabboFigureSizeKeys, type HabboFigureStatic, type HabboGroup, type HabboGroupId, type HabboGroupMember, HabboGroupType, type HabboHotLookList, type HabboHotLookListItem, type HabboOptions, type HabboRoom, type HabboRoomUniqueId, type HabboUser, type HabboUserBadge, type HabboUserFriend, type HabboUserGroup, type HabboUserId, type HabboUserPhotos, type HabboUserProfile, type HabboUserRoom, type HabboUserSelectedBadge, HotelDomainTLD, HotelDomainURL, ListsAPI, MarketplaceAPI, type MarketplaceGetStats, type MarketplaceStats, type MarketplaceStatsHistory, type MarketplaceStatsResult, type MarketplaceStatsResultEntry, type MarketplaceStatsResultEntryHistory, PingAPI, RoomsAPI, type UserAchievement, UsersAPI };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ declare abstract class BaseAPI {
|
|
|
31
31
|
protected readonly timeout: number | null;
|
|
32
32
|
constructor(baseURL: string, timeout?: number | null | undefined);
|
|
33
33
|
protected formatURL(route: string): URL;
|
|
34
|
-
protected
|
|
34
|
+
protected fetchGet(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>>;
|
|
35
|
+
protected fetchPost(url: string | URL, body: object, options?: APIOptions): Promise<FetchResult<Response>>;
|
|
35
36
|
}
|
|
36
37
|
interface APIOptions {
|
|
37
38
|
signal?: AbortSignal | number | null | undefined;
|
|
@@ -770,6 +771,10 @@ declare class MarketplaceAPI extends BaseAPI {
|
|
|
770
771
|
/**
|
|
771
772
|
* Get the marketplace stats for a room item
|
|
772
773
|
*
|
|
774
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
775
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
776
|
+
* provide stats for up to 25 items per type in a single request.
|
|
777
|
+
*
|
|
773
778
|
* @param roomItemName - The name of the room item
|
|
774
779
|
* @param options - The options for the API call
|
|
775
780
|
*/
|
|
@@ -777,10 +782,21 @@ declare class MarketplaceAPI extends BaseAPI {
|
|
|
777
782
|
/**
|
|
778
783
|
* Get the marketplace stats for a wall item
|
|
779
784
|
*
|
|
785
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
786
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
787
|
+
* provide stats for up to 25 items per type in a single request.
|
|
788
|
+
*
|
|
780
789
|
* @param wallItemName - The name of the wall item
|
|
781
790
|
* @param options - The options for the API call
|
|
782
791
|
*/
|
|
783
792
|
getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>>;
|
|
793
|
+
/**
|
|
794
|
+
* Get the marketplace stats for up to 25 room and wall items at once
|
|
795
|
+
*
|
|
796
|
+
* @param data - The data for the stats request
|
|
797
|
+
* @param options - The options for the API call
|
|
798
|
+
*/
|
|
799
|
+
getStats(data: MarketplaceGetStats, options?: APIOptions): Promise<FetchResult<MarketplaceStats[]>>;
|
|
784
800
|
}
|
|
785
801
|
interface MarketplaceStats {
|
|
786
802
|
history: MarketplaceStatsHistory[];
|
|
@@ -798,6 +814,35 @@ interface MarketplaceStatsHistory {
|
|
|
798
814
|
totalCreditSum: `${bigint}`;
|
|
799
815
|
totalOpenOffers: `${bigint}`;
|
|
800
816
|
}
|
|
817
|
+
interface MarketplaceGetStats {
|
|
818
|
+
roomItems: string[];
|
|
819
|
+
wallItems: string[];
|
|
820
|
+
}
|
|
821
|
+
interface MarketplaceStatsResult {
|
|
822
|
+
status: string;
|
|
823
|
+
roomItemData: MarketplaceStatsResultEntry[];
|
|
824
|
+
wallItemData: MarketplaceStatsResultEntry[];
|
|
825
|
+
}
|
|
826
|
+
interface MarketplaceStatsResultEntry {
|
|
827
|
+
item: string;
|
|
828
|
+
extraData: null;
|
|
829
|
+
statsDate: Date;
|
|
830
|
+
history: MarketplaceStatsResultEntryHistory[];
|
|
831
|
+
soldItemCount: number;
|
|
832
|
+
creditSum: number;
|
|
833
|
+
averagePrice: number;
|
|
834
|
+
totalOpenOffers: number;
|
|
835
|
+
currentOpenOffers: number;
|
|
836
|
+
currentPrice: number;
|
|
837
|
+
historyLimitInDays: number;
|
|
838
|
+
}
|
|
839
|
+
interface MarketplaceStatsResultEntryHistory {
|
|
840
|
+
dayOffset: string;
|
|
841
|
+
averagePrice: string;
|
|
842
|
+
totalSoldItems: string;
|
|
843
|
+
totalCreditSum: string;
|
|
844
|
+
totalOpenOffers: string;
|
|
845
|
+
}
|
|
801
846
|
|
|
802
847
|
declare class PingAPI extends BaseAPI {
|
|
803
848
|
/**
|
|
@@ -823,4 +868,4 @@ interface HabboOptions {
|
|
|
823
868
|
timeout?: number | null | undefined;
|
|
824
869
|
}
|
|
825
870
|
|
|
826
|
-
export { type Achievement, type AchievementData, AchievementDataState, type AchievementRequirements, AchievementsAPI, type GetGroupMembersOptions, GroupsAPI, Habbo, HabboFigureAction, HabboFigureActionKeys, type HabboFigureBase, HabboFigureDirection, HabboFigureDirectionKeys, HabboFigureGender, HabboFigureGenderKeys, HabboFigureGesture, HabboFigureGestureKeys, HabboFigureHand, HabboFigureHandKeys, type HabboFigureName, HabboFigureSize, HabboFigureSizeKeys, type HabboFigureStatic, type HabboGroup, type HabboGroupId, type HabboGroupMember, HabboGroupType, type HabboHotLookList, type HabboHotLookListItem, type HabboOptions, type HabboRoom, type HabboRoomUniqueId, type HabboUser, type HabboUserBadge, type HabboUserFriend, type HabboUserGroup, type HabboUserId, type HabboUserPhotos, type HabboUserProfile, type HabboUserRoom, type HabboUserSelectedBadge, HotelDomainTLD, HotelDomainURL, ListsAPI, MarketplaceAPI, type MarketplaceStats, type MarketplaceStatsHistory, PingAPI, RoomsAPI, type UserAchievement, UsersAPI };
|
|
871
|
+
export { type Achievement, type AchievementData, AchievementDataState, type AchievementRequirements, AchievementsAPI, type GetGroupMembersOptions, GroupsAPI, Habbo, HabboFigureAction, HabboFigureActionKeys, type HabboFigureBase, HabboFigureDirection, HabboFigureDirectionKeys, HabboFigureGender, HabboFigureGenderKeys, HabboFigureGesture, HabboFigureGestureKeys, HabboFigureHand, HabboFigureHandKeys, type HabboFigureName, HabboFigureSize, HabboFigureSizeKeys, type HabboFigureStatic, type HabboGroup, type HabboGroupId, type HabboGroupMember, HabboGroupType, type HabboHotLookList, type HabboHotLookListItem, type HabboOptions, type HabboRoom, type HabboRoomUniqueId, type HabboUser, type HabboUserBadge, type HabboUserFriend, type HabboUserGroup, type HabboUserId, type HabboUserPhotos, type HabboUserProfile, type HabboUserRoom, type HabboUserSelectedBadge, HotelDomainTLD, HotelDomainURL, ListsAPI, MarketplaceAPI, type MarketplaceGetStats, type MarketplaceStats, type MarketplaceStatsHistory, type MarketplaceStatsResult, type MarketplaceStatsResultEntry, type MarketplaceStatsResultEntryHistory, PingAPI, RoomsAPI, type UserAchievement, UsersAPI };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { safeFetch, Json } from '@skyra/safe-fetch';
|
|
2
|
-
import { isNullish } from 'common.js';
|
|
3
2
|
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -43,9 +42,17 @@ var BaseAPI = class {
|
|
|
43
42
|
formatURL(route) {
|
|
44
43
|
return new URL(route, this.baseURL);
|
|
45
44
|
}
|
|
46
|
-
|
|
45
|
+
fetchGet(url, options) {
|
|
47
46
|
return safeFetch(url, { headers: { "Content-Type": "application/json" }, signal: this.#getSignalOrDefault(options) });
|
|
48
47
|
}
|
|
48
|
+
fetchPost(url, body, options) {
|
|
49
|
+
return safeFetch(url, {
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: { "Content-Type": "application/json" },
|
|
52
|
+
body: JSON.stringify(body),
|
|
53
|
+
signal: this.#getSignalOrDefault(options)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
49
56
|
#getSignalOrDefault(options) {
|
|
50
57
|
if (typeof options === "object" && options !== null) {
|
|
51
58
|
if (typeof options.signal === "number") return AbortSignal.timeout(options.signal);
|
|
@@ -68,7 +75,7 @@ var AchievementsAPI = class extends BaseAPI {
|
|
|
68
75
|
*/
|
|
69
76
|
getAll(options) {
|
|
70
77
|
const url = this.formatURL("/api/public/achievements");
|
|
71
|
-
return Json(this.
|
|
78
|
+
return Json(this.fetchGet(url, options));
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* Get the achievements from a specified user ID
|
|
@@ -78,7 +85,7 @@ var AchievementsAPI = class extends BaseAPI {
|
|
|
78
85
|
*/
|
|
79
86
|
getByUserId(id, options) {
|
|
80
87
|
const url = this.formatURL(`/api/public/achievements/${id}`);
|
|
81
|
-
return Json(this.
|
|
88
|
+
return Json(this.fetchGet(url, options));
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
91
|
* Get the image URL for an achievement
|
|
@@ -97,6 +104,14 @@ var AchievementDataState = /* @__PURE__ */ ((AchievementDataState2) => {
|
|
|
97
104
|
AchievementDataState2["OffSeason"] = "OFF_SEASON";
|
|
98
105
|
return AchievementDataState2;
|
|
99
106
|
})(AchievementDataState || {});
|
|
107
|
+
|
|
108
|
+
// src/common.ts
|
|
109
|
+
function isNullish(value) {
|
|
110
|
+
return value == null;
|
|
111
|
+
}
|
|
112
|
+
__name(isNullish, "isNullish");
|
|
113
|
+
|
|
114
|
+
// src/routes/groups.ts
|
|
100
115
|
var GroupsAPI = class extends BaseAPI {
|
|
101
116
|
static {
|
|
102
117
|
__name(this, "GroupsAPI");
|
|
@@ -109,7 +124,7 @@ var GroupsAPI = class extends BaseAPI {
|
|
|
109
124
|
*/
|
|
110
125
|
getByUniqueId(id, options) {
|
|
111
126
|
const url = this.formatURL(`/api/public/groups/${id}`);
|
|
112
|
-
return Json(this.
|
|
127
|
+
return Json(this.fetchGet(url, options));
|
|
113
128
|
}
|
|
114
129
|
/**
|
|
115
130
|
* Get the members from a group given its identifier
|
|
@@ -122,7 +137,7 @@ var GroupsAPI = class extends BaseAPI {
|
|
|
122
137
|
if (!isNullish(options?.pageIndex)) {
|
|
123
138
|
url.searchParams.append("pageIndex", options.pageIndex.toString());
|
|
124
139
|
}
|
|
125
|
-
return Json(this.
|
|
140
|
+
return Json(this.fetchGet(url, options));
|
|
126
141
|
}
|
|
127
142
|
/**
|
|
128
143
|
* Get the image URL for a badge
|
|
@@ -152,7 +167,7 @@ var ListsAPI = class extends BaseAPI {
|
|
|
152
167
|
*/
|
|
153
168
|
async getHotLooks(options) {
|
|
154
169
|
const url = this.formatURL("/api/public/lists/hotlooks");
|
|
155
|
-
const data = await this.
|
|
170
|
+
const data = await this.fetchGet(url, options);
|
|
156
171
|
return data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();
|
|
157
172
|
}
|
|
158
173
|
#parseHotLooksXML(data) {
|
|
@@ -174,22 +189,40 @@ var MarketplaceAPI = class extends BaseAPI {
|
|
|
174
189
|
/**
|
|
175
190
|
* Get the marketplace stats for a room item
|
|
176
191
|
*
|
|
192
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
193
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
194
|
+
* provide stats for up to 25 items per type in a single request.
|
|
195
|
+
*
|
|
177
196
|
* @param roomItemName - The name of the room item
|
|
178
197
|
* @param options - The options for the API call
|
|
179
198
|
*/
|
|
180
199
|
getRoomItemStats(roomItemName, options) {
|
|
181
200
|
const url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);
|
|
182
|
-
return Json(this.
|
|
201
|
+
return Json(this.fetchGet(url, options));
|
|
183
202
|
}
|
|
184
203
|
/**
|
|
185
204
|
* Get the marketplace stats for a wall item
|
|
186
205
|
*
|
|
206
|
+
* @deprecated This endpoint has been removed from the official API in favour
|
|
207
|
+
* of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can
|
|
208
|
+
* provide stats for up to 25 items per type in a single request.
|
|
209
|
+
*
|
|
187
210
|
* @param wallItemName - The name of the wall item
|
|
188
211
|
* @param options - The options for the API call
|
|
189
212
|
*/
|
|
190
213
|
getWallItemStats(wallItemName, options) {
|
|
191
214
|
const url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);
|
|
192
|
-
return Json(this.
|
|
215
|
+
return Json(this.fetchGet(url, options));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get the marketplace stats for up to 25 room and wall items at once
|
|
219
|
+
*
|
|
220
|
+
* @param data - The data for the stats request
|
|
221
|
+
* @param options - The options for the API call
|
|
222
|
+
*/
|
|
223
|
+
getStats(data, options) {
|
|
224
|
+
const url = this.formatURL("/api/public/marketplace/stats");
|
|
225
|
+
return Json(this.fetchPost(url, data, options));
|
|
193
226
|
}
|
|
194
227
|
};
|
|
195
228
|
|
|
@@ -206,7 +239,7 @@ var PingAPI = class extends BaseAPI {
|
|
|
206
239
|
async get(options) {
|
|
207
240
|
const url = this.formatURL("/api/public/ping");
|
|
208
241
|
const now = performance.now();
|
|
209
|
-
return (await this.
|
|
242
|
+
return (await this.fetchGet(url, options)).match({
|
|
210
243
|
ok: /* @__PURE__ */ __name(() => performance.now() - now, "ok"),
|
|
211
244
|
err: /* @__PURE__ */ __name(() => null, "err")
|
|
212
245
|
});
|
|
@@ -224,17 +257,9 @@ var RoomsAPI = class extends BaseAPI {
|
|
|
224
257
|
*/
|
|
225
258
|
async getById(roomId, options) {
|
|
226
259
|
const url = this.formatURL(`/api/public/rooms/${roomId}`);
|
|
227
|
-
return Json(this.
|
|
260
|
+
return Json(this.fetchGet(url, options));
|
|
228
261
|
}
|
|
229
262
|
};
|
|
230
|
-
|
|
231
|
-
// src/common.ts
|
|
232
|
-
function isNullish2(value) {
|
|
233
|
-
return value == null;
|
|
234
|
-
}
|
|
235
|
-
__name(isNullish2, "isNullish");
|
|
236
|
-
|
|
237
|
-
// src/routes/users.ts
|
|
238
263
|
var UsersAPI = class extends BaseAPI {
|
|
239
264
|
static {
|
|
240
265
|
__name(this, "UsersAPI");
|
|
@@ -248,7 +273,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
248
273
|
getByUsername(username, options) {
|
|
249
274
|
const url = this.formatURL("/api/public/users");
|
|
250
275
|
url.searchParams.set("name", username);
|
|
251
|
-
return Json(this.
|
|
276
|
+
return Json(this.fetchGet(url, options));
|
|
252
277
|
}
|
|
253
278
|
/**
|
|
254
279
|
* Get a user by its ID
|
|
@@ -258,7 +283,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
258
283
|
*/
|
|
259
284
|
getByUniqueId(uniqueId, options) {
|
|
260
285
|
const url = this.formatURL(`/api/public/users/${uniqueId}`);
|
|
261
|
-
return Json(this.
|
|
286
|
+
return Json(this.fetchGet(url, options));
|
|
262
287
|
}
|
|
263
288
|
/**
|
|
264
289
|
* Get a user's friends
|
|
@@ -268,7 +293,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
268
293
|
*/
|
|
269
294
|
getUserFriends(uniqueId, options) {
|
|
270
295
|
const url = this.formatURL(`/api/public/users/${uniqueId}/friends`);
|
|
271
|
-
return Json(this.
|
|
296
|
+
return Json(this.fetchGet(url, options));
|
|
272
297
|
}
|
|
273
298
|
/**
|
|
274
299
|
* Get a user's groups
|
|
@@ -278,7 +303,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
278
303
|
*/
|
|
279
304
|
getUserGroups(uniqueId, options) {
|
|
280
305
|
const url = this.formatURL(`/api/public/users/${uniqueId}/groups`);
|
|
281
|
-
return Json(this.
|
|
306
|
+
return Json(this.fetchGet(url, options));
|
|
282
307
|
}
|
|
283
308
|
/**
|
|
284
309
|
* Get a user's rooms
|
|
@@ -288,7 +313,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
288
313
|
*/
|
|
289
314
|
getUserRooms(uniqueId, options) {
|
|
290
315
|
const url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);
|
|
291
|
-
return Json(this.
|
|
316
|
+
return Json(this.fetchGet(url, options));
|
|
292
317
|
}
|
|
293
318
|
/**
|
|
294
319
|
* Get a user's badges
|
|
@@ -298,7 +323,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
298
323
|
*/
|
|
299
324
|
getUserBadges(uniqueId, options) {
|
|
300
325
|
const url = this.formatURL(`/api/public/users/${uniqueId}/badges`);
|
|
301
|
-
return Json(this.
|
|
326
|
+
return Json(this.fetchGet(url, options));
|
|
302
327
|
}
|
|
303
328
|
/**
|
|
304
329
|
* Get a user's profile
|
|
@@ -308,7 +333,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
308
333
|
*/
|
|
309
334
|
getUserProfile(uniqueId, options) {
|
|
310
335
|
const url = this.formatURL(`/api/public/users/${uniqueId}/profile`);
|
|
311
|
-
return Json(this.
|
|
336
|
+
return Json(this.fetchGet(url, options));
|
|
312
337
|
}
|
|
313
338
|
/**
|
|
314
339
|
* Get a user's photos
|
|
@@ -318,7 +343,7 @@ var UsersAPI = class extends BaseAPI {
|
|
|
318
343
|
*/
|
|
319
344
|
getUserPhotos(uniqueId, options) {
|
|
320
345
|
const url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);
|
|
321
|
-
return Json(this.
|
|
346
|
+
return Json(this.fetchGet(url, options));
|
|
322
347
|
}
|
|
323
348
|
/**
|
|
324
349
|
* Get a user's figure
|
|
@@ -327,26 +352,26 @@ var UsersAPI = class extends BaseAPI {
|
|
|
327
352
|
*/
|
|
328
353
|
getUserFigureImageURL(options) {
|
|
329
354
|
const url = this.formatURL("/habbo-imaging/avatarimage");
|
|
330
|
-
if ("figure" in options && !
|
|
355
|
+
if ("figure" in options && !isNullish(options.figure)) {
|
|
331
356
|
url.searchParams.append("figure", options.figure);
|
|
332
|
-
if (!
|
|
333
|
-
} else if ("user" in options && !
|
|
357
|
+
if (!isNullish(options.gender)) url.searchParams.append("gender", HabboFigureGender[options.gender]);
|
|
358
|
+
} else if ("user" in options && !isNullish(options.user)) {
|
|
334
359
|
url.searchParams.append("user", options.user);
|
|
335
360
|
} else {
|
|
336
361
|
throw new Error("You must define `figure` or `user` in the options");
|
|
337
362
|
}
|
|
338
|
-
if (!
|
|
363
|
+
if (!isNullish(options.action)) {
|
|
339
364
|
const habboAction = HabboFigureAction[options.action];
|
|
340
365
|
url.searchParams.append(
|
|
341
366
|
"action",
|
|
342
|
-
|
|
367
|
+
isNullish(options.hand) ? habboAction : `${habboAction}=${HabboFigureHand[options.hand]}`
|
|
343
368
|
);
|
|
344
369
|
}
|
|
345
|
-
if (!
|
|
346
|
-
if (!
|
|
347
|
-
if (!
|
|
348
|
-
if (!
|
|
349
|
-
if (!
|
|
370
|
+
if (!isNullish(options.direction)) url.searchParams.append("direction", HabboFigureDirection[options.direction]);
|
|
371
|
+
if (!isNullish(options.headDirection)) url.searchParams.append("head_direction", HabboFigureDirection[options.headDirection]);
|
|
372
|
+
if (!isNullish(options.gesture)) url.searchParams.append("gesture", HabboFigureGesture[options.gesture]);
|
|
373
|
+
if (!isNullish(options.size)) url.searchParams.append("size", HabboFigureSize[options.size]);
|
|
374
|
+
if (!isNullish(options.headOnly)) url.searchParams.append("headonly", options.headOnly ? "1" : "0");
|
|
350
375
|
return url;
|
|
351
376
|
}
|
|
352
377
|
};
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/routes/base.ts","../../src/routes/achievements.ts","../../src/routes/groups.ts","../../src/routes/lists.ts","../../src/routes/marketplace.ts","../../src/routes/ping.ts","../../src/routes/rooms.ts","../../src/common.ts","../../src/routes/users.ts","../../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AAM,MAAA,OAAA,GAAU,OAAS,EAAA,OAAA,IAAW,cAAe,CAAA,aAAA;AACnD,IAAM,MAAA,OAAA,GAAU,SAAS,OAAW,IAAA,IAAA;AAEpC,IAAA,IAAA,CAAK,YAAe,GAAA,IAAI,eAAgB,CAAA,OAAA,EAAS,OAAO,CAAA;AACxD,IAAA,IAAA,CAAK,MAAS,GAAA,IAAI,SAAU,CAAA,OAAA,EAAS,OAAO,CAAA;AAC5C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,WAAc,GAAA,IAAI,cAAe,CAAA,OAAA,EAAS,OAAO,CAAA;AACtD,IAAA,IAAA,CAAK,IAAO,GAAA,IAAI,OAAQ,CAAA,OAAA,EAAS,OAAO,CAAA;AACxC,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAAA;AAE5C","file":"index.js","sourcesContent":["export enum HotelDomainTLD {\n\tBrazilian = '.com.br',\n\tDanish = '.dk',\n\tDutch = '.nl',\n\tFinnish = '.fi',\n\tFrench = '.fr',\n\tGerman = '.de',\n\tInternational = '.com',\n\tItalian = '.it',\n\tSpanish = '.es',\n\tTurkish = '.com.tr'\n}\n\nexport const HotelDomainURL = {\n\tBrazilian: `https://www.habbo${HotelDomainTLD.Brazilian}`,\n\tDanish: `https://www.habbo${HotelDomainTLD.Danish}`,\n\tDutch: `https://www.habbo${HotelDomainTLD.Dutch}`,\n\tFinnish: `https://www.habbo${HotelDomainTLD.Finnish}`,\n\tFrench: `https://www.habbo${HotelDomainTLD.French}`,\n\tGerman: `https://www.habbo${HotelDomainTLD.German}`,\n\tInternational: `https://www.habbo${HotelDomainTLD.International}`,\n\tItalian: `https://www.habbo${HotelDomainTLD.Italian}`,\n\tSpanish: `https://www.habbo${HotelDomainTLD.Spanish}`,\n\tTurkish: `https://www.habbo${HotelDomainTLD.Turkish}`\n} as const;\n","import { safeFetch, type FetchResult } from '@skyra/safe-fetch';\n\nexport abstract class BaseAPI {\n\tprotected readonly baseURL: string;\n\tprotected readonly timeout: number | null;\n\n\tpublic constructor(baseURL: string, timeout?: number | null | undefined) {\n\t\tthis.baseURL = baseURL;\n\t\tthis.timeout = timeout ?? null;\n\t}\n\n\tprotected formatURL(route: string): URL {\n\t\treturn new URL(route, this.baseURL);\n\t}\n\n\tprotected fetch(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, { headers: { 'Content-Type': 'application/json' }, signal: this.#getSignalOrDefault(options) });\n\t}\n\n\t#getSignalOrDefault(options?: APIOptions): AbortSignal | null {\n\t\tif (typeof options === 'object' && options !== null) {\n\t\t\tif (typeof options.signal === 'number') return AbortSignal.timeout(options.signal);\n\t\t\tif (typeof options.signal === 'object' && options.signal !== null) return options.signal;\n\t\t}\n\n\t\tif (typeof this.timeout === 'number') return AbortSignal.timeout(this.timeout);\n\t\treturn null;\n\t}\n}\n\nexport interface APIOptions {\n\tsignal?: AbortSignal | number | null | undefined;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboUserId } from './users.js';\n\nexport class AchievementsAPI extends BaseAPI {\n\t/**\n\t * Get all achievements\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic getAll(options?: APIOptions): Promise<FetchResult<Achievement[]>> {\n\t\tconst url = this.formatURL('/api/public/achievements');\n\t\treturn Json<Achievement[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the achievements from a specified user ID\n\t *\n\t * @param id - The ID of the user\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUserId(id: HabboUserId, options?: APIOptions): Promise<FetchResult<UserAchievement[]>> {\n\t\tconst url = this.formatURL(`/api/public/achievements/${id}`);\n\t\treturn Json<UserAchievement[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for an achievement\n\t *\n\t * @param achievementName - The name of the achievement, retrieved from {@linkcode AchievementData.name}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getImageURL(achievementName: string): URL {\n\t\treturn new URL(`https://images.habbo.com/c_images/album1584/${achievementName}.png`);\n\t}\n}\n\nexport interface Achievement {\n\tachievement: AchievementData;\n\tlevelRequirements: AchievementRequirements;\n}\n\nexport interface UserAchievement {\n\tachievement: AchievementData;\n\tlevel: number;\n\tscore: number;\n}\n\nexport interface AchievementData {\n\tid: number;\n\tname: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}`;\n\tstate: AchievementDataState;\n\tcategory: string;\n}\n\nexport enum AchievementDataState {\n\tEnabled = 'ENABLED',\n\tArchived = 'ARCHIVED',\n\tOffSeason = 'OFF_SEASON'\n}\n\nexport interface AchievementRequirements {\n\tlevel: number;\n\trequiredScore: number;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from 'common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboRoomUniqueId } from './rooms.js';\n\nexport class GroupsAPI extends BaseAPI {\n\t/**\n\t * Get the data for a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(id: HabboGroupId, options?: APIOptions): Promise<FetchResult<HabboGroup>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}`);\n\t\treturn Json<HabboGroup>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the members from a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getGroupMembers(id: HabboGroupId, options?: GetGroupMembersOptions): Promise<FetchResult<HabboGroupMember[]>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}/members`);\n\t\tif (!isNullish(options?.pageIndex)) {\n\t\t\turl.searchParams.append('pageIndex', options.pageIndex.toString());\n\t\t}\n\n\t\treturn Json<HabboGroupMember[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for a badge\n\t *\n\t * @param badgeCode - The badge's code, retrieved from {@linkcode HabboGroup.badgeCode}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getGroupBadgeImageURL(badgeCode: string): URL {\n\t\treturn this.formatURL(`/habbo-imaging/badge/${badgeCode}`);\n\t}\n}\n\n/**\n * The options for {@linkcode GroupsAPI.getGroupMembers}.\n */\nexport interface GetGroupMembersOptions extends APIOptions {\n\t/**\n\t * The page index to look for, each page containing up to 1000 entries.\n\t */\n\tpageIndex?: number | null | undefined;\n}\n\nexport type HabboGroupId = `g-hh${string}-${string};`;\n\n/**\n * Represents a Habbo group.\n */\nexport interface HabboGroup {\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: HabboGroupId;\n\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\n\t/**\n\t * The ID of the room associated with the group, or null if no room is associated.\n\t */\n\troomId: HabboRoomUniqueId;\n\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n}\n\n/**\n * Enum representing the type of a Habbo group.\n */\nexport enum HabboGroupType {\n\t/**\n\t * A normal group (public).\n\t */\n\tNORMAL = 'NORMAL',\n\n\t/**\n\t * A favourite (exclusive) group.\n\t */\n\tFAVOURITE = 'EXCLUSIVE',\n\n\t/**\n\t * A private (closed) group.\n\t */\n\tPRIVATE = 'CLOSED'\n}\n\n/**\n * Represents a member of a Habbo group.\n */\nexport interface HabboGroupMember {\n\t/**\n\t * Indicates whether the member is online.\n\t */\n\tonline: boolean;\n\n\t/**\n\t * The gender of the member.\n\t */\n\tgender: 'm' | 'f';\n\n\t/**\n\t * The motto of the member.\n\t */\n\tmotto: string;\n\n\t/**\n\t * The figure of the member in the Habbo world.\n\t */\n\thabboFigure: string;\n\n\t/**\n\t * The date since the member joined the group.\n\t */\n\tmemberSince: string;\n\n\t/**\n\t * The unique identifier of the member.\n\t */\n\tuniqueId: string;\n\n\t/**\n\t * The name of the member.\n\t */\n\tname: string;\n\n\t/**\n\t * Indicates whether the member is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n","import { type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class ListsAPI extends BaseAPI {\n\t/**\n\t * Get the hot looks from the hotel\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async getHotLooks(options: APIOptions): Promise<FetchResult<HabboHotLookList>> {\n\t\tconst url = this.formatURL('/api/public/lists/hotlooks');\n\t\tconst data = await this.fetch(url, options);\n\t\treturn data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();\n\t}\n\n\t#parseHotLooksXML(data: string): HabboHotLookList {\n\t\tconst urlResult = /url=\"(.*)\"/.exec(data);\n\t\tif (urlResult === null) throw new SyntaxError('Could not read hot looks');\n\n\t\tconst url = urlResult[1];\n\t\tconst entries = [] as HabboHotLookListItem[];\n\t\tfor (const result of data.matchAll(/gender=\"(\\w)\" figure=\"(.+)\" hash=\"(.+)\"/g)) {\n\t\t\tentries.push({ gender: result[1] as 'f' | 'm', figure: result[2], hash: result[3] });\n\t\t}\n\n\t\tif (entries.length === 0) throw new SyntaxError('Could not read hot looks');\n\n\t\treturn { url, entries };\n\t}\n}\n\nexport interface HabboHotLookList {\n\turl: string;\n\tentries: HabboHotLookListItem[];\n}\n\nexport interface HabboHotLookListItem {\n\tgender: 'f' | 'm';\n\tfigure: string;\n\thash: string;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class MarketplaceAPI extends BaseAPI {\n\t/**\n\t * Get the marketplace stats for a room item\n\t *\n\t * @param roomItemName - The name of the room item\n\t * @param options - The options for the API call\n\t */\n\tpublic getRoomItemStats(roomItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for a wall item\n\t *\n\t * @param wallItemName - The name of the wall item\n\t * @param options - The options for the API call\n\t */\n\tpublic getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetch(url, options));\n\t}\n}\n\nexport interface MarketplaceStats {\n\thistory: MarketplaceStatsHistory[];\n\tstatsDate: `${bigint}-${bigint}-${bigint}`;\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsHistory {\n\tdayOffset: `${bigint}`;\n\taveragePrice: `${bigint}`;\n\ttotalSoldItems: `${bigint}`;\n\ttotalCreditSum: `${bigint}`;\n\ttotalOpenOffers: `${bigint}`;\n}\n","import { type APIOptions, BaseAPI } from './base.js';\n\nexport class PingAPI extends BaseAPI {\n\t/**\n\t * Pings Habbo, returning the measured time using {@linkcode performance.now()}\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async get(options?: APIOptions): Promise<number | null> {\n\t\tconst url = this.formatURL('/api/public/ping');\n\t\tconst now = performance.now();\n\t\treturn (await this.fetch(url, options)).match({\n\t\t\tok: () => performance.now() - now,\n\t\t\terr: () => null\n\t\t});\n\t}\n}\n","import { type FetchResult, Json } from '@skyra/safe-fetch';\nimport { type APIOptions, BaseAPI } from './base.js';\n\nexport class RoomsAPI extends BaseAPI {\n\t/**\n\t * Get a room by its ID\n\t *\n\t * @param roomId - The ID of the room\n\t * @param options - The options for the API call\n\t */\n\tpublic async getById(roomId: number, options?: APIOptions): Promise<FetchResult<HabboRoom>> {\n\t\tconst url = this.formatURL(`/api/public/rooms/${roomId}`);\n\t\treturn Json<HabboRoom>(this.fetch(url, options));\n\t}\n}\n\nexport interface HabboRoom {\n\tid: number;\n\tname: string;\n\tdescription: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}T${string}`;\n\thabboGroupId: string;\n\ttags: string[];\n\tmaximumVisitors: number;\n\tshowOwnerName: boolean;\n\townerName: string;\n\townerUniqueId: string;\n\tcategories: string[];\n\tthumbnailUrl: string;\n\timageUrl: string;\n\trating: number;\n\tuniqueId: HabboRoomUniqueId;\n}\n\nexport type HabboRoomUniqueId = `r-hh${string}-${string}`;\n","export function isNullish(value: unknown): value is null | undefined {\n\treturn value == null;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport { HabboGroupType } from './groups.js';\n\nexport class UsersAPI extends BaseAPI {\n\t/**\n\t * Get a user by its username\n\t *\n\t * @param username - The username to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUsername(username: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL('/api/public/users');\n\t\turl.searchParams.set('name', username);\n\t\treturn Json<HabboUser>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user by its ID\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}`);\n\t\treturn Json<HabboUser>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's friends\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserFriends(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserFriend[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/friends`);\n\t\treturn Json<HabboUserFriend[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's groups\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserGroups(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserGroup[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/groups`);\n\t\treturn Json<HabboUserGroup[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's rooms\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserRooms(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserRoom[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);\n\t\treturn Json<HabboUserRoom[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's badges\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserBadges(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserBadge[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/badges`);\n\t\treturn Json<HabboUserBadge[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's profile\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserProfile(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserProfile>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/profile`);\n\t\treturn Json<HabboUserProfile>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's photos\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserPhotos(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserPhotos[]>> {\n\t\tconst url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);\n\t\treturn Json<HabboUserPhotos[]>(this.fetch(url, options));\n\t}\n\n\t/**\n\t * Get a user's figure\n\t *\n\t * @param options - The options for the image\n\t */\n\tpublic getUserFigureImageURL(options: HabboFigureName | HabboFigureStatic): URL {\n\t\tconst url = this.formatURL('/habbo-imaging/avatarimage');\n\n\t\tif ('figure' in options && !isNullish(options.figure)) {\n\t\t\turl.searchParams.append('figure', options.figure);\n\t\t\tif (!isNullish(options.gender)) url.searchParams.append('gender', HabboFigureGender[options.gender]);\n\t\t} else if ('user' in options && !isNullish(options.user)) {\n\t\t\turl.searchParams.append('user', options.user);\n\t\t} else {\n\t\t\tthrow new Error('You must define `figure` or `user` in the options');\n\t\t}\n\n\t\tif (!isNullish(options.action)) {\n\t\t\tconst habboAction = HabboFigureAction[options.action];\n\t\t\turl.searchParams.append(\n\t\t\t\t'action',\n\t\t\t\tisNullish(options.hand) //\n\t\t\t\t\t? habboAction\n\t\t\t\t\t: `${habboAction}=${HabboFigureHand[options.hand]}`\n\t\t\t);\n\t\t}\n\t\tif (!isNullish(options.direction)) url.searchParams.append('direction', HabboFigureDirection[options.direction]);\n\t\tif (!isNullish(options.headDirection)) url.searchParams.append('head_direction', HabboFigureDirection[options.headDirection]);\n\t\tif (!isNullish(options.gesture)) url.searchParams.append('gesture', HabboFigureGesture[options.gesture]);\n\t\tif (!isNullish(options.size)) url.searchParams.append('size', HabboFigureSize[options.size]);\n\t\tif (!isNullish(options.headOnly)) url.searchParams.append('headonly', options.headOnly ? '1' : '0');\n\n\t\treturn url;\n\t}\n}\n\nexport type HabboUserId = `hh${string}-${string}`;\n\n/**\n * Represents a Habbo user.\n */\nexport interface HabboUser {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: HabboUserId;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n}\n\n/**\n * Represents a room owned by a Habbo user.\n */\nexport interface HabboUserRoom {\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tid: number;\n\t/**\n\t * The name of the room.\n\t */\n\tname: string;\n\t/**\n\t * The description of the room.\n\t */\n\tdescription: string;\n\t/**\n\t * The creation time of the room.\n\t */\n\tcreationTime: string;\n\t/**\n\t * The unique identifier of the Habbo group associated with the room.\n\t */\n\thabboGroupId: string;\n\t/**\n\t * The tags associated with the room.\n\t */\n\ttags: string[];\n\t/**\n\t * The maximum number of visitors allowed in the room.\n\t */\n\tmaximumVisitors: number;\n\t/**\n\t * Indicates whether the owner's name is shown.\n\t */\n\tshowOwnerName: boolean;\n\t/**\n\t * The name of the room owner.\n\t */\n\townerName: string;\n\t/**\n\t * The unique identifier of the room owner.\n\t */\n\townerUniqueId: string;\n\t/**\n\t * The categories associated with the room.\n\t */\n\tcategories: string[];\n\t/**\n\t * The URL of the room's thumbnail image.\n\t */\n\tthumbnailUrl: string;\n\t/**\n\t * The URL of the room's image.\n\t */\n\timageUrl: string;\n\t/**\n\t * The rating of the room.\n\t */\n\trating: number;\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tuniqueId: string;\n}\n\n/**\n * Represents a group associated with a Habbo user.\n */\nexport interface HabboUserGroup {\n\t/**\n\t * Indicates whether the group is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: string;\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\t/**\n\t * The unique identifier of the room associated with the group.\n\t */\n\troomId: string;\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n\t/**\n\t * The primary color of the group.\n\t */\n\tprimaryColour: string;\n\t/**\n\t * The secondary color of the group.\n\t */\n\tsecondaryColour: string;\n\t/**\n\t * Indicates whether the user is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n\n/**\n * Represents a badge owned by a Habbo user.\n */\nexport interface HabboUserBadge {\n\t/**\n\t * The code of the badge.\n\t */\n\tcode: string;\n\t/**\n\t * The name of the badge.\n\t */\n\tname: string;\n\t/**\n\t * The description of the badge.\n\t */\n\tdescription: string;\n}\n\n/**\n * Represents a selected badge of a Habbo user.\n */\nexport interface HabboUserSelectedBadge extends HabboUserBadge {\n\t/**\n\t * The index of the badge.\n\t */\n\tbadgeIndex: number;\n}\n\n/**\n * Represents a friend of a Habbo user.\n */\nexport interface HabboUserFriend {\n\t/**\n\t * The unique identifier of the friend.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the friend.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the friend.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the friend.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the friend is online.\n\t */\n\tonline: boolean;\n}\n\n/**\n * Represents the profile of a Habbo user.\n */\nexport interface HabboUserProfile {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n\t/**\n\t * The groups the user is a member of.\n\t */\n\tgroups: HabboUserGroup[];\n\t/**\n\t * The badges owned by the user.\n\t */\n\tbadges: HabboUserBadge[];\n\t/**\n\t * The friends of the user.\n\t */\n\tfriends: HabboUserFriend[];\n\t/**\n\t * The rooms owned by the user.\n\t */\n\trooms: HabboUserRoom[];\n}\n\n/**\n * Represents photos associated with a Habbo user.\n */\nexport interface HabboUserPhotos {\n\t/**\n\t * The unique identifier of the room where the photo was taken.\n\t */\n\troom_id: number;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_id: number;\n\t/**\n\t * The name of the photo creator.\n\t */\n\tcreator_name: string;\n\t/**\n\t * The time when the photo was taken.\n\t */\n\ttime: number;\n\t/**\n\t * The version of the photo.\n\t */\n\tversion: number;\n\t/**\n\t * The URL of the photo.\n\t */\n\turl: string;\n\t/**\n\t * The type of the photo.\n\t */\n\ttype: string;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_uniqueId: string;\n\t/**\n\t * The tags associated with the photo.\n\t */\n\ttags: string[];\n\t/**\n\t * The URL of the photo preview.\n\t */\n\tpreviewUrl: string;\n\t/**\n\t * The unique identifier of the photo.\n\t */\n\tid: string;\n\t/**\n\t * The likes associated with the photo.\n\t */\n\tlikes: string[];\n}\n\nexport interface HabboFigureName extends HabboFigureBase {\n\t/**\n\t * The Habbo username.\n\t */\n\tuser: string;\n}\n\nexport interface HabboFigureStatic extends HabboFigureBase {\n\t/**\n\t * The Habbo figure to use.\n\t */\n\tfigure: string;\n\t/**\n\t * The Habbo's gender.\n\t */\n\tgender?: keyof typeof HabboFigureGender | undefined | null;\n}\n\nexport interface HabboFigureBase {\n\t/**\n\t * The action the user should perform.\n\t */\n\taction?: keyof typeof HabboFigureAction | undefined | null;\n\t/**\n\t * The hand item, will override {@linkcode HabboFigureBase.action} to `'crr'`.\n\t */\n\thand?: keyof typeof HabboFigureHand | undefined | null;\n\t/**\n\t * The Habbo's direction.\n\t */\n\tdirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The Habbo's head direction.\n\t */\n\theadDirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The gesture, if any.\n\t */\n\tgesture?: keyof typeof HabboFigureGesture | undefined | null;\n\t/**\n\t * The size of the character.\n\t */\n\tsize?: keyof typeof HabboFigureSize | undefined | null;\n\t/**\n\t * Whether or not to render only the head.\n\t */\n\theadOnly?: boolean | undefined | null;\n}\n\nexport const HabboFigureAction = {\n\t// Main Actions\n\tlay: 'lay',\n\tsit: 'sit',\n\trespect: 'respect',\n\twalk: 'wlk',\n\twave: 'wav',\n\tcarry: 'crr',\n\tdrink: 'drk',\n\tsign: 'sig',\n\tblow: 'blw',\n\tlaugh: 'laugh'\n} as const;\n\nexport const HabboFigureHand = {\n\tnothing: '0',\n\tcarrot: '2',\n\tcoffee: '6',\n\tcocktail: '667',\n\thabbo_cola: '5',\n\tice_cream: '3',\n\tjapanese_tea: '42',\n\tlove_potion: '9',\n\tradioactive: '44',\n\ttomato: '43',\n\twater: '1'\n} as const;\n\nexport const HabboFigureGesture = {\n\tnothing: 'nrm',\n\thappy: 'sml',\n\tsad: 'sad',\n\tangry: 'agr',\n\tsurprised: 'srp',\n\tsleeping: 'eyb',\n\tspeaking: 'spk'\n} as const;\n\nexport const HabboFigureSize = { small: 's', normal: 'm', large: 'l' } as const;\nexport const HabboFigureDirection = { nw: '0', w: '1', sw: '2', s: '3', se: '4', e: '5', ne: '6', n: '7' } as const;\nexport const HabboFigureGender = { male: 'M', female: 'F' } as const;\n\nexport const HabboFigureGestureKeys = Object.keys(HabboFigureGesture) as (keyof typeof HabboFigureGesture)[];\nexport const HabboFigureActionKeys = Object.keys(HabboFigureAction) as (keyof typeof HabboFigureAction)[];\nexport const HabboFigureHandKeys = Object.keys(HabboFigureHand) as (keyof typeof HabboFigureHand)[];\nexport const HabboFigureSizeKeys = Object.keys(HabboFigureSize) as (keyof typeof HabboFigureSize)[];\nexport const HabboFigureDirectionKeys = Object.keys(HabboFigureDirection) as (keyof typeof HabboFigureDirection)[];\nexport const HabboFigureGenderKeys = Object.keys(HabboFigureGender) as (keyof typeof HabboFigureGender)[];\n","import { HotelDomainURL } from './constants.js';\nimport { AchievementsAPI } from './routes/achievements.js';\nimport { GroupsAPI } from './routes/groups.js';\nimport { ListsAPI } from './routes/lists.js';\nimport { MarketplaceAPI } from './routes/marketplace.js';\nimport { PingAPI } from './routes/ping.js';\nimport { RoomsAPI } from './routes/rooms.js';\nimport { UsersAPI } from './routes/users.js';\n\nexport class Habbo {\n\tpublic readonly achievements: AchievementsAPI;\n\tpublic readonly groups: GroupsAPI;\n\tpublic readonly lists: ListsAPI;\n\tpublic readonly marketplace: MarketplaceAPI;\n\tpublic readonly ping: PingAPI;\n\tpublic readonly rooms: RoomsAPI;\n\tpublic readonly users: UsersAPI;\n\n\tpublic constructor(options?: HabboOptions) {\n\t\tconst baseURL = options?.baseURL ?? HotelDomainURL.International;\n\t\tconst timeout = options?.timeout ?? null;\n\n\t\tthis.achievements = new AchievementsAPI(baseURL, timeout);\n\t\tthis.groups = new GroupsAPI(baseURL, timeout);\n\t\tthis.lists = new ListsAPI(baseURL, timeout);\n\t\tthis.marketplace = new MarketplaceAPI(baseURL, timeout);\n\t\tthis.ping = new PingAPI(baseURL, timeout);\n\t\tthis.rooms = new RoomsAPI(baseURL, timeout);\n\t\tthis.users = new UsersAPI(baseURL, timeout);\n\t}\n}\n\nexport interface HabboOptions {\n\tbaseURL?: string | null | undefined;\n\ttimeout?: number | null | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/routes/base.ts","../../src/routes/achievements.ts","../../src/common.ts","../../src/routes/groups.ts","../../src/routes/lists.ts","../../src/routes/marketplace.ts","../../src/routes/ping.ts","../../src/routes/rooms.ts","../../src/routes/users.ts","../../src/habbo.ts"],"names":["HotelDomainTLD","AchievementDataState","Json","HabboGroupType"],"mappings":";;;;;;AAAY,IAAA,cAAA,qBAAAA,eAAL,KAAA;AACN,EAAAA,gBAAA,WAAY,CAAA,GAAA,SAAA;AACZ,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,OAAQ,CAAA,GAAA,KAAA;AACR,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,QAAS,CAAA,GAAA,KAAA;AACT,EAAAA,gBAAA,eAAgB,CAAA,GAAA,MAAA;AAChB,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,SAAU,CAAA,GAAA,KAAA;AACV,EAAAA,gBAAA,SAAU,CAAA,GAAA,SAAA;AAVC,EAAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAaL,IAAM,cAAiB,GAAA;AAAA,EAC7B,SAAA,EAAW,oBAAoB,SAAwB,iBAAA,CAAA;AAAA,EACvD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,EACjD,KAAA,EAAO,oBAAoB,KAAoB,aAAA,CAAA;AAAA,EAC/C,OAAA,EAAS,oBAAoB,KAAsB,eAAA,CAAA;AAAA,EACnD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,EACjD,MAAA,EAAQ,oBAAoB,KAAqB,cAAA,CAAA;AAAA,E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AAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,WAAc,GAAA,IAAI,cAAe,CAAA,OAAA,EAAS,OAAO,CAAA;AACtD,IAAA,IAAA,CAAK,IAAO,GAAA,IAAI,OAAQ,CAAA,OAAA,EAAS,OAAO,CAAA;AACxC,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAI,QAAS,CAAA,OAAA,EAAS,OAAO,CAAA;AAAA;AAE5C","file":"index.js","sourcesContent":["export enum HotelDomainTLD {\n\tBrazilian = '.com.br',\n\tDanish = '.dk',\n\tDutch = '.nl',\n\tFinnish = '.fi',\n\tFrench = '.fr',\n\tGerman = '.de',\n\tInternational = '.com',\n\tItalian = '.it',\n\tSpanish = '.es',\n\tTurkish = '.com.tr'\n}\n\nexport const HotelDomainURL = {\n\tBrazilian: `https://www.habbo${HotelDomainTLD.Brazilian}`,\n\tDanish: `https://www.habbo${HotelDomainTLD.Danish}`,\n\tDutch: `https://www.habbo${HotelDomainTLD.Dutch}`,\n\tFinnish: `https://www.habbo${HotelDomainTLD.Finnish}`,\n\tFrench: `https://www.habbo${HotelDomainTLD.French}`,\n\tGerman: `https://www.habbo${HotelDomainTLD.German}`,\n\tInternational: `https://www.habbo${HotelDomainTLD.International}`,\n\tItalian: `https://www.habbo${HotelDomainTLD.Italian}`,\n\tSpanish: `https://www.habbo${HotelDomainTLD.Spanish}`,\n\tTurkish: `https://www.habbo${HotelDomainTLD.Turkish}`\n} as const;\n","import { safeFetch, type FetchResult } from '@skyra/safe-fetch';\n\nexport abstract class BaseAPI {\n\tprotected readonly baseURL: string;\n\tprotected readonly timeout: number | null;\n\n\tpublic constructor(baseURL: string, timeout?: number | null | undefined) {\n\t\tthis.baseURL = baseURL;\n\t\tthis.timeout = timeout ?? null;\n\t}\n\n\tprotected formatURL(route: string): URL {\n\t\treturn new URL(route, this.baseURL);\n\t}\n\n\tprotected fetchGet(url: string | URL, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, { headers: { 'Content-Type': 'application/json' }, signal: this.#getSignalOrDefault(options) });\n\t}\n\n\tprotected fetchPost(url: string | URL, body: object, options?: APIOptions): Promise<FetchResult<Response>> {\n\t\treturn safeFetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify(body),\n\t\t\tsignal: this.#getSignalOrDefault(options)\n\t\t});\n\t}\n\n\t#getSignalOrDefault(options?: APIOptions): AbortSignal | null {\n\t\tif (typeof options === 'object' && options !== null) {\n\t\t\tif (typeof options.signal === 'number') return AbortSignal.timeout(options.signal);\n\t\t\tif (typeof options.signal === 'object' && options.signal !== null) return options.signal;\n\t\t}\n\n\t\tif (typeof this.timeout === 'number') return AbortSignal.timeout(this.timeout);\n\t\treturn null;\n\t}\n}\n\nexport interface APIOptions {\n\tsignal?: AbortSignal | number | null | undefined;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboUserId } from './users.js';\n\nexport class AchievementsAPI extends BaseAPI {\n\t/**\n\t * Get all achievements\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic getAll(options?: APIOptions): Promise<FetchResult<Achievement[]>> {\n\t\tconst url = this.formatURL('/api/public/achievements');\n\t\treturn Json<Achievement[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the achievements from a specified user ID\n\t *\n\t * @param id - The ID of the user\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUserId(id: HabboUserId, options?: APIOptions): Promise<FetchResult<UserAchievement[]>> {\n\t\tconst url = this.formatURL(`/api/public/achievements/${id}`);\n\t\treturn Json<UserAchievement[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for an achievement\n\t *\n\t * @param achievementName - The name of the achievement, retrieved from {@linkcode AchievementData.name}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getImageURL(achievementName: string): URL {\n\t\treturn new URL(`https://images.habbo.com/c_images/album1584/${achievementName}.png`);\n\t}\n}\n\nexport interface Achievement {\n\tachievement: AchievementData;\n\tlevelRequirements: AchievementRequirements;\n}\n\nexport interface UserAchievement {\n\tachievement: AchievementData;\n\tlevel: number;\n\tscore: number;\n}\n\nexport interface AchievementData {\n\tid: number;\n\tname: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}`;\n\tstate: AchievementDataState;\n\tcategory: string;\n}\n\nexport enum AchievementDataState {\n\tEnabled = 'ENABLED',\n\tArchived = 'ARCHIVED',\n\tOffSeason = 'OFF_SEASON'\n}\n\nexport interface AchievementRequirements {\n\tlevel: number;\n\trequiredScore: number;\n}\n","export function isNullish(value: unknown): value is null | undefined {\n\treturn value == null;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport type { HabboRoomUniqueId } from './rooms.js';\n\nexport class GroupsAPI extends BaseAPI {\n\t/**\n\t * Get the data for a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(id: HabboGroupId, options?: APIOptions): Promise<FetchResult<HabboGroup>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}`);\n\t\treturn Json<HabboGroup>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the members from a group given its identifier\n\t *\n\t * @param id - The ID of the group\n\t * @param options - The options for the API call\n\t */\n\tpublic getGroupMembers(id: HabboGroupId, options?: GetGroupMembersOptions): Promise<FetchResult<HabboGroupMember[]>> {\n\t\tconst url = this.formatURL(`/api/public/groups/${id}/members`);\n\t\tif (!isNullish(options?.pageIndex)) {\n\t\t\turl.searchParams.append('pageIndex', options.pageIndex.toString());\n\t\t}\n\n\t\treturn Json<HabboGroupMember[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the image URL for a badge\n\t *\n\t * @param badgeCode - The badge's code, retrieved from {@linkcode HabboGroup.badgeCode}\n\t *\n\t * @unstable This feature is not documented, use at your own risk\n\t */\n\tpublic getGroupBadgeImageURL(badgeCode: string): URL {\n\t\treturn this.formatURL(`/habbo-imaging/badge/${badgeCode}`);\n\t}\n}\n\n/**\n * The options for {@linkcode GroupsAPI.getGroupMembers}.\n */\nexport interface GetGroupMembersOptions extends APIOptions {\n\t/**\n\t * The page index to look for, each page containing up to 1000 entries.\n\t */\n\tpageIndex?: number | null | undefined;\n}\n\nexport type HabboGroupId = `g-hh${string}-${string};`;\n\n/**\n * Represents a Habbo group.\n */\nexport interface HabboGroup {\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: HabboGroupId;\n\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\n\t/**\n\t * The ID of the room associated with the group, or null if no room is associated.\n\t */\n\troomId: HabboRoomUniqueId;\n\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n}\n\n/**\n * Enum representing the type of a Habbo group.\n */\nexport enum HabboGroupType {\n\t/**\n\t * A normal group (public).\n\t */\n\tNORMAL = 'NORMAL',\n\n\t/**\n\t * A favourite (exclusive) group.\n\t */\n\tFAVOURITE = 'EXCLUSIVE',\n\n\t/**\n\t * A private (closed) group.\n\t */\n\tPRIVATE = 'CLOSED'\n}\n\n/**\n * Represents a member of a Habbo group.\n */\nexport interface HabboGroupMember {\n\t/**\n\t * Indicates whether the member is online.\n\t */\n\tonline: boolean;\n\n\t/**\n\t * The gender of the member.\n\t */\n\tgender: 'm' | 'f';\n\n\t/**\n\t * The motto of the member.\n\t */\n\tmotto: string;\n\n\t/**\n\t * The figure of the member in the Habbo world.\n\t */\n\thabboFigure: string;\n\n\t/**\n\t * The date since the member joined the group.\n\t */\n\tmemberSince: string;\n\n\t/**\n\t * The unique identifier of the member.\n\t */\n\tuniqueId: string;\n\n\t/**\n\t * The name of the member.\n\t */\n\tname: string;\n\n\t/**\n\t * Indicates whether the member is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n","import { type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class ListsAPI extends BaseAPI {\n\t/**\n\t * Get the hot looks from the hotel\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async getHotLooks(options: APIOptions): Promise<FetchResult<HabboHotLookList>> {\n\t\tconst url = this.formatURL('/api/public/lists/hotlooks');\n\t\tconst data = await this.fetchGet(url, options);\n\t\treturn data.map(async (result) => this.#parseHotLooksXML(await result.text())).intoPromise();\n\t}\n\n\t#parseHotLooksXML(data: string): HabboHotLookList {\n\t\tconst urlResult = /url=\"(.*)\"/.exec(data);\n\t\tif (urlResult === null) throw new SyntaxError('Could not read hot looks');\n\n\t\tconst url = urlResult[1];\n\t\tconst entries = [] as HabboHotLookListItem[];\n\t\tfor (const result of data.matchAll(/gender=\"(\\w)\" figure=\"(.+)\" hash=\"(.+)\"/g)) {\n\t\t\tentries.push({ gender: result[1] as 'f' | 'm', figure: result[2], hash: result[3] });\n\t\t}\n\n\t\tif (entries.length === 0) throw new SyntaxError('Could not read hot looks');\n\n\t\treturn { url, entries };\n\t}\n}\n\nexport interface HabboHotLookList {\n\turl: string;\n\tentries: HabboHotLookListItem[];\n}\n\nexport interface HabboHotLookListItem {\n\tgender: 'f' | 'm';\n\tfigure: string;\n\thash: string;\n}\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { BaseAPI, type APIOptions } from './base.js';\n\nexport class MarketplaceAPI extends BaseAPI {\n\t/**\n\t * Get the marketplace stats for a room item\n\t *\n\t * @deprecated This endpoint has been removed from the official API in favour\n\t * of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can\n\t * provide stats for up to 25 items per type in a single request.\n\t *\n\t * @param roomItemName - The name of the room item\n\t * @param options - The options for the API call\n\t */\n\tpublic getRoomItemStats(roomItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/roomItem/${roomItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for a wall item\n\t *\n\t * @deprecated This endpoint has been removed from the official API in favour\n\t * of the newer {@linkcode MarketplaceAPI.getStats} endpoint, which can\n\t * provide stats for up to 25 items per type in a single request.\n\t *\n\t * @param wallItemName - The name of the wall item\n\t * @param options - The options for the API call\n\t */\n\tpublic getWallItemStats(wallItemName: string, options?: APIOptions): Promise<FetchResult<MarketplaceStats>> {\n\t\tconst url = this.formatURL(`/api/public/marketplace/stats/wallItem/${wallItemName}`);\n\t\treturn Json<MarketplaceStats>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get the marketplace stats for up to 25 room and wall items at once\n\t *\n\t * @param data - The data for the stats request\n\t * @param options - The options for the API call\n\t */\n\tpublic getStats(data: MarketplaceGetStats, options?: APIOptions) {\n\t\tconst url = this.formatURL('/api/public/marketplace/stats');\n\t\treturn Json<MarketplaceStats[]>(this.fetchPost(url, data, options));\n\t}\n}\n\nexport interface MarketplaceStats {\n\thistory: MarketplaceStatsHistory[];\n\tstatsDate: `${bigint}-${bigint}-${bigint}`;\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsHistory {\n\tdayOffset: `${bigint}`;\n\taveragePrice: `${bigint}`;\n\ttotalSoldItems: `${bigint}`;\n\ttotalCreditSum: `${bigint}`;\n\ttotalOpenOffers: `${bigint}`;\n}\n\nexport interface MarketplaceGetStats {\n\troomItems: string[];\n\twallItems: string[];\n}\n\nexport interface MarketplaceStatsResult {\n\tstatus: string;\n\troomItemData: MarketplaceStatsResultEntry[];\n\twallItemData: MarketplaceStatsResultEntry[];\n}\n\nexport interface MarketplaceStatsResultEntry {\n\titem: string;\n\textraData: null;\n\tstatsDate: Date;\n\thistory: MarketplaceStatsResultEntryHistory[];\n\tsoldItemCount: number;\n\tcreditSum: number;\n\taveragePrice: number;\n\ttotalOpenOffers: number;\n\tcurrentOpenOffers: number;\n\tcurrentPrice: number;\n\thistoryLimitInDays: number;\n}\n\nexport interface MarketplaceStatsResultEntryHistory {\n\tdayOffset: string;\n\taveragePrice: string;\n\ttotalSoldItems: string;\n\ttotalCreditSum: string;\n\ttotalOpenOffers: string;\n}\n","import { type APIOptions, BaseAPI } from './base.js';\n\nexport class PingAPI extends BaseAPI {\n\t/**\n\t * Pings Habbo, returning the measured time using {@linkcode performance.now()}\n\t *\n\t * @param options - The options for the API call\n\t */\n\tpublic async get(options?: APIOptions): Promise<number | null> {\n\t\tconst url = this.formatURL('/api/public/ping');\n\t\tconst now = performance.now();\n\t\treturn (await this.fetchGet(url, options)).match({\n\t\t\tok: () => performance.now() - now,\n\t\t\terr: () => null\n\t\t});\n\t}\n}\n","import { type FetchResult, Json } from '@skyra/safe-fetch';\nimport { type APIOptions, BaseAPI } from './base.js';\n\nexport class RoomsAPI extends BaseAPI {\n\t/**\n\t * Get a room by its ID\n\t *\n\t * @param roomId - The ID of the room\n\t * @param options - The options for the API call\n\t */\n\tpublic async getById(roomId: number, options?: APIOptions): Promise<FetchResult<HabboRoom>> {\n\t\tconst url = this.formatURL(`/api/public/rooms/${roomId}`);\n\t\treturn Json<HabboRoom>(this.fetchGet(url, options));\n\t}\n}\n\nexport interface HabboRoom {\n\tid: number;\n\tname: string;\n\tdescription: string;\n\tcreationTime: `${bigint}-${bigint}-${bigint}T${string}`;\n\thabboGroupId: string;\n\ttags: string[];\n\tmaximumVisitors: number;\n\tshowOwnerName: boolean;\n\townerName: string;\n\townerUniqueId: string;\n\tcategories: string[];\n\tthumbnailUrl: string;\n\timageUrl: string;\n\trating: number;\n\tuniqueId: HabboRoomUniqueId;\n}\n\nexport type HabboRoomUniqueId = `r-hh${string}-${string}`;\n","import { Json, type FetchResult } from '@skyra/safe-fetch';\nimport { isNullish } from '../common.js';\nimport { BaseAPI, type APIOptions } from './base.js';\nimport { HabboGroupType } from './groups.js';\n\nexport class UsersAPI extends BaseAPI {\n\t/**\n\t * Get a user by its username\n\t *\n\t * @param username - The username to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUsername(username: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL('/api/public/users');\n\t\turl.searchParams.set('name', username);\n\t\treturn Json<HabboUser>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user by its ID\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getByUniqueId(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUser>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}`);\n\t\treturn Json<HabboUser>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's friends\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserFriends(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserFriend[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/friends`);\n\t\treturn Json<HabboUserFriend[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's groups\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserGroups(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserGroup[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/groups`);\n\t\treturn Json<HabboUserGroup[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's rooms\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserRooms(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserRoom[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/rooms`);\n\t\treturn Json<HabboUserRoom[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's badges\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserBadges(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserBadge[]>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/badges`);\n\t\treturn Json<HabboUserBadge[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's profile\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserProfile(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserProfile>> {\n\t\tconst url = this.formatURL(`/api/public/users/${uniqueId}/profile`);\n\t\treturn Json<HabboUserProfile>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's photos\n\t *\n\t * @param uniqueId - The ID to search a Habbo user by\n\t * @param options - The options for the API call\n\t */\n\tpublic getUserPhotos(uniqueId: string, options?: APIOptions): Promise<FetchResult<HabboUserPhotos[]>> {\n\t\tconst url = this.formatURL(`/extradata/public/users/${uniqueId}/photos`);\n\t\treturn Json<HabboUserPhotos[]>(this.fetchGet(url, options));\n\t}\n\n\t/**\n\t * Get a user's figure\n\t *\n\t * @param options - The options for the image\n\t */\n\tpublic getUserFigureImageURL(options: HabboFigureName | HabboFigureStatic): URL {\n\t\tconst url = this.formatURL('/habbo-imaging/avatarimage');\n\n\t\tif ('figure' in options && !isNullish(options.figure)) {\n\t\t\turl.searchParams.append('figure', options.figure);\n\t\t\tif (!isNullish(options.gender)) url.searchParams.append('gender', HabboFigureGender[options.gender]);\n\t\t} else if ('user' in options && !isNullish(options.user)) {\n\t\t\turl.searchParams.append('user', options.user);\n\t\t} else {\n\t\t\tthrow new Error('You must define `figure` or `user` in the options');\n\t\t}\n\n\t\tif (!isNullish(options.action)) {\n\t\t\tconst habboAction = HabboFigureAction[options.action];\n\t\t\turl.searchParams.append(\n\t\t\t\t'action',\n\t\t\t\tisNullish(options.hand) //\n\t\t\t\t\t? habboAction\n\t\t\t\t\t: `${habboAction}=${HabboFigureHand[options.hand]}`\n\t\t\t);\n\t\t}\n\t\tif (!isNullish(options.direction)) url.searchParams.append('direction', HabboFigureDirection[options.direction]);\n\t\tif (!isNullish(options.headDirection)) url.searchParams.append('head_direction', HabboFigureDirection[options.headDirection]);\n\t\tif (!isNullish(options.gesture)) url.searchParams.append('gesture', HabboFigureGesture[options.gesture]);\n\t\tif (!isNullish(options.size)) url.searchParams.append('size', HabboFigureSize[options.size]);\n\t\tif (!isNullish(options.headOnly)) url.searchParams.append('headonly', options.headOnly ? '1' : '0');\n\n\t\treturn url;\n\t}\n}\n\nexport type HabboUserId = `hh${string}-${string}`;\n\n/**\n * Represents a Habbo user.\n */\nexport interface HabboUser {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: HabboUserId;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n}\n\n/**\n * Represents a room owned by a Habbo user.\n */\nexport interface HabboUserRoom {\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tid: number;\n\t/**\n\t * The name of the room.\n\t */\n\tname: string;\n\t/**\n\t * The description of the room.\n\t */\n\tdescription: string;\n\t/**\n\t * The creation time of the room.\n\t */\n\tcreationTime: string;\n\t/**\n\t * The unique identifier of the Habbo group associated with the room.\n\t */\n\thabboGroupId: string;\n\t/**\n\t * The tags associated with the room.\n\t */\n\ttags: string[];\n\t/**\n\t * The maximum number of visitors allowed in the room.\n\t */\n\tmaximumVisitors: number;\n\t/**\n\t * Indicates whether the owner's name is shown.\n\t */\n\tshowOwnerName: boolean;\n\t/**\n\t * The name of the room owner.\n\t */\n\townerName: string;\n\t/**\n\t * The unique identifier of the room owner.\n\t */\n\townerUniqueId: string;\n\t/**\n\t * The categories associated with the room.\n\t */\n\tcategories: string[];\n\t/**\n\t * The URL of the room's thumbnail image.\n\t */\n\tthumbnailUrl: string;\n\t/**\n\t * The URL of the room's image.\n\t */\n\timageUrl: string;\n\t/**\n\t * The rating of the room.\n\t */\n\trating: number;\n\t/**\n\t * The unique identifier of the room.\n\t */\n\tuniqueId: string;\n}\n\n/**\n * Represents a group associated with a Habbo user.\n */\nexport interface HabboUserGroup {\n\t/**\n\t * Indicates whether the group is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The unique identifier of the group.\n\t */\n\tid: string;\n\t/**\n\t * The name of the group.\n\t */\n\tname: string;\n\t/**\n\t * The description of the group.\n\t */\n\tdescription: string;\n\t/**\n\t * The type of the group.\n\t */\n\ttype: HabboGroupType;\n\t/**\n\t * The unique identifier of the room associated with the group.\n\t */\n\troomId: string;\n\t/**\n\t * The badge code of the group.\n\t */\n\tbadgeCode: string;\n\t/**\n\t * The primary color of the group.\n\t */\n\tprimaryColour: string;\n\t/**\n\t * The secondary color of the group.\n\t */\n\tsecondaryColour: string;\n\t/**\n\t * Indicates whether the user is an admin of the group.\n\t */\n\tisAdmin: boolean;\n}\n\n/**\n * Represents a badge owned by a Habbo user.\n */\nexport interface HabboUserBadge {\n\t/**\n\t * The code of the badge.\n\t */\n\tcode: string;\n\t/**\n\t * The name of the badge.\n\t */\n\tname: string;\n\t/**\n\t * The description of the badge.\n\t */\n\tdescription: string;\n}\n\n/**\n * Represents a selected badge of a Habbo user.\n */\nexport interface HabboUserSelectedBadge extends HabboUserBadge {\n\t/**\n\t * The index of the badge.\n\t */\n\tbadgeIndex: number;\n}\n\n/**\n * Represents a friend of a Habbo user.\n */\nexport interface HabboUserFriend {\n\t/**\n\t * The unique identifier of the friend.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the friend.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the friend.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the friend.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the friend is online.\n\t */\n\tonline: boolean;\n}\n\n/**\n * Represents the profile of a Habbo user.\n */\nexport interface HabboUserProfile {\n\t/**\n\t * The unique identifier of the user.\n\t */\n\tuniqueId: string;\n\t/**\n\t * The name of the user.\n\t */\n\tname: string;\n\t/**\n\t * The figure string of the user.\n\t */\n\tfigureString: string;\n\t/**\n\t * The motto of the user.\n\t */\n\tmotto: string;\n\t/**\n\t * Indicates whether the user is online.\n\t */\n\tonline: boolean;\n\t/**\n\t * The last access time of the user.\n\t */\n\tlastAccessTime: string;\n\t/**\n\t * The date when the user became a member.\n\t */\n\tmemberSince: string;\n\t/**\n\t * Indicates whether the user's profile is visible.\n\t */\n\tprofileVisible: boolean;\n\t/**\n\t * The current level of the user.\n\t */\n\tcurrentLevel: number;\n\t/**\n\t * The percentage of the current level completed by the user.\n\t */\n\tcurrentLevelCompletePercent: number;\n\t/**\n\t * The total experience points of the user.\n\t */\n\ttotalExperience: number;\n\t/**\n\t * The number of star gems the user has.\n\t */\n\tstarGemCount: number;\n\t/**\n\t * The badges selected by the user.\n\t */\n\tselectedBadges: HabboUserSelectedBadge[];\n\t/**\n\t * The groups the user is a member of.\n\t */\n\tgroups: HabboUserGroup[];\n\t/**\n\t * The badges owned by the user.\n\t */\n\tbadges: HabboUserBadge[];\n\t/**\n\t * The friends of the user.\n\t */\n\tfriends: HabboUserFriend[];\n\t/**\n\t * The rooms owned by the user.\n\t */\n\trooms: HabboUserRoom[];\n}\n\n/**\n * Represents photos associated with a Habbo user.\n */\nexport interface HabboUserPhotos {\n\t/**\n\t * The unique identifier of the room where the photo was taken.\n\t */\n\troom_id: number;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_id: number;\n\t/**\n\t * The name of the photo creator.\n\t */\n\tcreator_name: string;\n\t/**\n\t * The time when the photo was taken.\n\t */\n\ttime: number;\n\t/**\n\t * The version of the photo.\n\t */\n\tversion: number;\n\t/**\n\t * The URL of the photo.\n\t */\n\turl: string;\n\t/**\n\t * The type of the photo.\n\t */\n\ttype: string;\n\t/**\n\t * The unique identifier of the photo creator.\n\t */\n\tcreator_uniqueId: string;\n\t/**\n\t * The tags associated with the photo.\n\t */\n\ttags: string[];\n\t/**\n\t * The URL of the photo preview.\n\t */\n\tpreviewUrl: string;\n\t/**\n\t * The unique identifier of the photo.\n\t */\n\tid: string;\n\t/**\n\t * The likes associated with the photo.\n\t */\n\tlikes: string[];\n}\n\nexport interface HabboFigureName extends HabboFigureBase {\n\t/**\n\t * The Habbo username.\n\t */\n\tuser: string;\n}\n\nexport interface HabboFigureStatic extends HabboFigureBase {\n\t/**\n\t * The Habbo figure to use.\n\t */\n\tfigure: string;\n\t/**\n\t * The Habbo's gender.\n\t */\n\tgender?: keyof typeof HabboFigureGender | undefined | null;\n}\n\nexport interface HabboFigureBase {\n\t/**\n\t * The action the user should perform.\n\t */\n\taction?: keyof typeof HabboFigureAction | undefined | null;\n\t/**\n\t * The hand item, will override {@linkcode HabboFigureBase.action} to `'crr'`.\n\t */\n\thand?: keyof typeof HabboFigureHand | undefined | null;\n\t/**\n\t * The Habbo's direction.\n\t */\n\tdirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The Habbo's head direction.\n\t */\n\theadDirection?: keyof typeof HabboFigureDirection | undefined | null;\n\t/**\n\t * The gesture, if any.\n\t */\n\tgesture?: keyof typeof HabboFigureGesture | undefined | null;\n\t/**\n\t * The size of the character.\n\t */\n\tsize?: keyof typeof HabboFigureSize | undefined | null;\n\t/**\n\t * Whether or not to render only the head.\n\t */\n\theadOnly?: boolean | undefined | null;\n}\n\nexport const HabboFigureAction = {\n\t// Main Actions\n\tlay: 'lay',\n\tsit: 'sit',\n\trespect: 'respect',\n\twalk: 'wlk',\n\twave: 'wav',\n\tcarry: 'crr',\n\tdrink: 'drk',\n\tsign: 'sig',\n\tblow: 'blw',\n\tlaugh: 'laugh'\n} as const;\n\nexport const HabboFigureHand = {\n\tnothing: '0',\n\tcarrot: '2',\n\tcoffee: '6',\n\tcocktail: '667',\n\thabbo_cola: '5',\n\tice_cream: '3',\n\tjapanese_tea: '42',\n\tlove_potion: '9',\n\tradioactive: '44',\n\ttomato: '43',\n\twater: '1'\n} as const;\n\nexport const HabboFigureGesture = {\n\tnothing: 'nrm',\n\thappy: 'sml',\n\tsad: 'sad',\n\tangry: 'agr',\n\tsurprised: 'srp',\n\tsleeping: 'eyb',\n\tspeaking: 'spk'\n} as const;\n\nexport const HabboFigureSize = { small: 's', normal: 'm', large: 'l' } as const;\nexport const HabboFigureDirection = { nw: '0', w: '1', sw: '2', s: '3', se: '4', e: '5', ne: '6', n: '7' } as const;\nexport const HabboFigureGender = { male: 'M', female: 'F' } as const;\n\nexport const HabboFigureGestureKeys = Object.keys(HabboFigureGesture) as (keyof typeof HabboFigureGesture)[];\nexport const HabboFigureActionKeys = Object.keys(HabboFigureAction) as (keyof typeof HabboFigureAction)[];\nexport const HabboFigureHandKeys = Object.keys(HabboFigureHand) as (keyof typeof HabboFigureHand)[];\nexport const HabboFigureSizeKeys = Object.keys(HabboFigureSize) as (keyof typeof HabboFigureSize)[];\nexport const HabboFigureDirectionKeys = Object.keys(HabboFigureDirection) as (keyof typeof HabboFigureDirection)[];\nexport const HabboFigureGenderKeys = Object.keys(HabboFigureGender) as (keyof typeof HabboFigureGender)[];\n","import { HotelDomainURL } from './constants.js';\nimport { AchievementsAPI } from './routes/achievements.js';\nimport { GroupsAPI } from './routes/groups.js';\nimport { ListsAPI } from './routes/lists.js';\nimport { MarketplaceAPI } from './routes/marketplace.js';\nimport { PingAPI } from './routes/ping.js';\nimport { RoomsAPI } from './routes/rooms.js';\nimport { UsersAPI } from './routes/users.js';\n\nexport class Habbo {\n\tpublic readonly achievements: AchievementsAPI;\n\tpublic readonly groups: GroupsAPI;\n\tpublic readonly lists: ListsAPI;\n\tpublic readonly marketplace: MarketplaceAPI;\n\tpublic readonly ping: PingAPI;\n\tpublic readonly rooms: RoomsAPI;\n\tpublic readonly users: UsersAPI;\n\n\tpublic constructor(options?: HabboOptions) {\n\t\tconst baseURL = options?.baseURL ?? HotelDomainURL.International;\n\t\tconst timeout = options?.timeout ?? null;\n\n\t\tthis.achievements = new AchievementsAPI(baseURL, timeout);\n\t\tthis.groups = new GroupsAPI(baseURL, timeout);\n\t\tthis.lists = new ListsAPI(baseURL, timeout);\n\t\tthis.marketplace = new MarketplaceAPI(baseURL, timeout);\n\t\tthis.ping = new PingAPI(baseURL, timeout);\n\t\tthis.rooms = new RoomsAPI(baseURL, timeout);\n\t\tthis.users = new UsersAPI(baseURL, timeout);\n\t}\n}\n\nexport interface HabboOptions {\n\tbaseURL?: string | null | undefined;\n\ttimeout?: number | null | undefined;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
2
|
+
"name": "@ejercito-fam/habbo-api",
|
|
3
|
+
"description": "A typed Habbo API library",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/cjs/index.cjs",
|
|
7
|
+
"module": "dist/esm/index.mjs",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"start": "node ./dist/main.js",
|
|
10
|
+
"build": "tsup",
|
|
11
|
+
"dev": "yarn build && yarn start",
|
|
12
|
+
"prepublishOnly": "yarn build"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/esm/index.d.ts",
|
|
17
|
+
"default": "./dist/esm/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/cjs/index.d.cts",
|
|
21
|
+
"default": "./dist/cjs/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@skyra/safe-fetch": "^1.1.4"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@sapphire/eslint-config": "^5.0.6",
|
|
32
|
+
"@sapphire/prettier-config": "^2.0.0",
|
|
33
|
+
"@sapphire/ts-config": "^5.0.3",
|
|
34
|
+
"@types/node": "^22.19.17",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
36
|
+
"@typescript-eslint/parser": "^8.58.1",
|
|
37
|
+
"eslint": "^9.39.4",
|
|
38
|
+
"eslint-config-prettier": "^10.1.8",
|
|
39
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
40
|
+
"prettier": "^3.8.2",
|
|
41
|
+
"tsup": "^8.5.1",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"prettier": "@sapphire/prettier-config",
|
|
48
|
+
"eslintConfig": {
|
|
49
|
+
"extends": "@sapphire",
|
|
50
|
+
"ignorePatterns": [
|
|
51
|
+
"node_modules/",
|
|
52
|
+
"dist/"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"packageManager": "yarn@4.13.0"
|
|
56
|
+
}
|