hive-bedrock-api 3.0.0-alpha.25 → 3.0.0-alpha.26
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/lib/index.d.ts +6 -2
- package/lib/index.js +20 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -48,9 +48,9 @@ export default class HiveAPI {
|
|
|
48
48
|
month?: number;
|
|
49
49
|
year?: number;
|
|
50
50
|
}): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, false>[G]>>;
|
|
51
|
-
getStatistics<G extends Game>(identifier: string, timeframe: Timeframe.Seasonal, options
|
|
51
|
+
getStatistics<G extends Game>(identifier: string, timeframe: Timeframe.Seasonal, options: {
|
|
52
52
|
game: G;
|
|
53
|
-
season
|
|
53
|
+
season: number;
|
|
54
54
|
}): Promise<MethodResponse<ProcessedMonthlyGamesResponse>>;
|
|
55
55
|
private _getStatisticsAllTime;
|
|
56
56
|
private _getStatisticsMonthly;
|
|
@@ -76,8 +76,12 @@ export default class HiveAPI {
|
|
|
76
76
|
month?: number;
|
|
77
77
|
year?: number;
|
|
78
78
|
}): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, true>[G][] | null>>;
|
|
79
|
+
getLeaderboard<G extends Game>(timeframe: Timeframe.Seasonal, game: G, options: {
|
|
80
|
+
season: number;
|
|
81
|
+
}): Promise<MethodResponse<ProcessedGame<Timeframe.Seasonal, true>[G][] | null>>;
|
|
79
82
|
private _getLeaderboardAllTime;
|
|
80
83
|
private _getLeaderboardMonthly;
|
|
84
|
+
private _getLeaderboardSeasonal;
|
|
81
85
|
/**
|
|
82
86
|
* `/game/season/{game}/{season}` Gets seasonal statistics for a game
|
|
83
87
|
* @param game The game to get the statistics for
|
package/lib/index.js
CHANGED
|
@@ -299,6 +299,8 @@ var HiveAPI = /** @class */ (function () {
|
|
|
299
299
|
return __generator(this, function (_a) {
|
|
300
300
|
if (timeframe === hive_bedrock_data_1.Timeframe.Monthly)
|
|
301
301
|
return [2 /*return*/, this._getLeaderboardMonthly(game, (options === null || options === void 0 ? void 0 : options.month) || new Date().getMonth() + 1, (options === null || options === void 0 ? void 0 : options.year) || new Date().getFullYear())];
|
|
302
|
+
if (timeframe === hive_bedrock_data_1.Timeframe.Seasonal)
|
|
303
|
+
return [2 /*return*/, this._getLeaderboardSeasonal(game, (options === null || options === void 0 ? void 0 : options.season) || 1)];
|
|
302
304
|
return [2 /*return*/, this._getLeaderboardAllTime(game)];
|
|
303
305
|
});
|
|
304
306
|
});
|
|
@@ -337,6 +339,24 @@ var HiveAPI = /** @class */ (function () {
|
|
|
337
339
|
});
|
|
338
340
|
});
|
|
339
341
|
};
|
|
342
|
+
// /game/season/{game}/season
|
|
343
|
+
HiveAPI.prototype._getLeaderboardSeasonal = function (game_2) {
|
|
344
|
+
return __awaiter(this, arguments, void 0, function (game, season) {
|
|
345
|
+
var _a, response, error, meta, data;
|
|
346
|
+
if (season === void 0) { season = 1; }
|
|
347
|
+
return __generator(this, function (_b) {
|
|
348
|
+
switch (_b.label) {
|
|
349
|
+
case 0: return [4 /*yield*/, this._fetchAPI("/game/season/".concat(game, "/").concat(season))];
|
|
350
|
+
case 1:
|
|
351
|
+
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
352
|
+
if (error)
|
|
353
|
+
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
354
|
+
data = response.map(function (res) { return (0, game_1.default)(game, hive_bedrock_data_1.Timeframe.Seasonal, true, res); });
|
|
355
|
+
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
};
|
|
340
360
|
/**
|
|
341
361
|
* `/game/season/{game}/{season}` Gets seasonal statistics for a game
|
|
342
362
|
* @param game The game to get the statistics for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-bedrock-api",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.26",
|
|
4
4
|
"description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Cubeedge Studios",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"hive-bedrock-data": "^2.0.0-alpha.
|
|
14
|
+
"hive-bedrock-data": "^2.0.0-alpha.15"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc"
|