hive-bedrock-api 2.1.4 → 2.1.6
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/helpers/toPoint.js +2 -0
- package/lib/methods/getAllTimeLeaderboard.d.ts +1 -1
- package/lib/methods/getAllTimeStatistics.d.ts +2 -2
- package/lib/methods/getGlobalStatistics.d.ts +1 -1
- package/lib/methods/getMaps.d.ts +1 -1
- package/lib/methods/getMetadata.d.ts +1 -1
- package/lib/methods/getMonthlyStatistics.d.ts +2 -2
- package/lib/methods/getMonthlyStatistics.js +12 -6
- package/lib/methods/getPlayerInfomation.d.ts +1 -1
- package/lib/methods/getSeasonStatistics.d.ts +1 -1
- package/package.json +1 -1
package/lib/helpers/toPoint.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Game } from "hive-bedrock-data";
|
|
2
2
|
import { APIResponse, Options } from "../types/types";
|
|
3
3
|
import { AllTimeProcessedLeaderboard } from "../types/output";
|
|
4
|
-
export default function getAllTimeLeaderboard<G extends Game>(game_id: G, options?: Options): Promise<APIResponse<AllTimeProcessedLeaderboard<G>>>;
|
|
4
|
+
export default function getAllTimeLeaderboard<G extends Game>(game_id: G, options?: Partial<Options>): Promise<APIResponse<AllTimeProcessedLeaderboard<G>>>;
|
|
@@ -5,6 +5,6 @@ import { Processed_Player_Statistics } from "../processors/player";
|
|
|
5
5
|
type AllGameStatisticsPlayer = AllTimeProcessedStatistics & {
|
|
6
6
|
player: Processed_Player_Statistics;
|
|
7
7
|
};
|
|
8
|
-
export default function getAllTimeStatistics(identifier: string, options?: Options): Promise<APIResponse<AllGameStatisticsPlayer>>;
|
|
9
|
-
export default function getAllTimeStatistics<G extends Game>(identifier: string, game_id: G, options?: Options): Promise<APIResponse<AllTimeProcessedStatistics[G]>>;
|
|
8
|
+
export default function getAllTimeStatistics(identifier: string, options?: Partial<Options>): Promise<APIResponse<AllGameStatisticsPlayer>>;
|
|
9
|
+
export default function getAllTimeStatistics<G extends Game>(identifier: string, game_id: G, options?: Partial<Options>): Promise<APIResponse<AllTimeProcessedStatistics[G]>>;
|
|
10
10
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GlobalStatisticsMetadata } from "hive-bedrock-data";
|
|
2
2
|
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
export default function getGlobalStatistics(options?: Options): Promise<APIResponse<GlobalStatisticsMetadata>>;
|
|
3
|
+
export default function getGlobalStatistics(options?: Partial<Options>): Promise<APIResponse<GlobalStatisticsMetadata>>;
|
package/lib/methods/getMaps.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Game, MapMetadata } from "hive-bedrock-data";
|
|
2
2
|
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
export default function getMaps<G extends Game>(game_id: G, options?: Options): Promise<APIResponse<MapMetadata[]>>;
|
|
3
|
+
export default function getMaps<G extends Game>(game_id: G, options?: Partial<Options>): Promise<APIResponse<MapMetadata[]>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Game, GameMetadata } from "hive-bedrock-data";
|
|
2
2
|
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
export default function getMetdata<G extends Game>(game_id: G, options?: Options): Promise<APIResponse<GameMetadata>>;
|
|
3
|
+
export default function getMetdata<G extends Game>(game_id: G, options?: Partial<Options>): Promise<APIResponse<GameMetadata>>;
|
|
@@ -5,6 +5,6 @@ interface MonthlyOptions extends Options {
|
|
|
5
5
|
month: number;
|
|
6
6
|
year: number;
|
|
7
7
|
}
|
|
8
|
-
export default function getMonthlyStatistics(identifier: string, options?: MonthlyOptions): Promise<APIResponse<MonthlyProcessedStatistics>>;
|
|
9
|
-
export default function getMonthlyStatistics<G extends Game>(identifier: string, game_id: G, options?: MonthlyOptions): Promise<APIResponse<MonthlyProcessedStatistics[G]>>;
|
|
8
|
+
export default function getMonthlyStatistics(identifier: string, options?: Partial<MonthlyOptions>): Promise<APIResponse<MonthlyProcessedStatistics>>;
|
|
9
|
+
export default function getMonthlyStatistics<G extends Game>(identifier: string, game_id: G, options?: Partial<MonthlyOptions>): Promise<APIResponse<MonthlyProcessedStatistics[G]>>;
|
|
10
10
|
export {};
|
|
@@ -74,9 +74,8 @@ var processors_1 = require("../processors");
|
|
|
74
74
|
function getMonthlyStatistics(identifier, game_or_options, options) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
76
|
var game_id, method_options, current_date, endpoint, response, response_data_1, processed_data_1, response_data, processed_data;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
switch (_c.label) {
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
80
79
|
case 0:
|
|
81
80
|
game_id = "all";
|
|
82
81
|
method_options = game_or_options;
|
|
@@ -94,17 +93,24 @@ function getMonthlyStatistics(identifier, game_or_options, options) {
|
|
|
94
93
|
data: null,
|
|
95
94
|
}];
|
|
96
95
|
current_date = new Date();
|
|
97
|
-
endpoint = "/game/monthly/player/".concat(game_id, "/").concat(identifier, "/").concat((
|
|
96
|
+
endpoint = "/game/monthly/player/".concat(game_id, "/").concat(identifier, "/").concat(typeof (method_options === null || method_options === void 0 ? void 0 : method_options.year) === "number"
|
|
97
|
+
? method_options === null || method_options === void 0 ? void 0 : method_options.year
|
|
98
|
+
: current_date.getFullYear(), "/").concat(typeof (method_options === null || method_options === void 0 ? void 0 : method_options.month) === "number"
|
|
99
|
+
? method_options === null || method_options === void 0 ? void 0 : method_options.month
|
|
100
|
+
: current_date.getMonth() + 1);
|
|
101
|
+
console.log(endpoint);
|
|
98
102
|
return [4 /*yield*/, (0, fetchEndpoint_1.default)(endpoint, method_options === null || method_options === void 0 ? void 0 : method_options.init)];
|
|
99
103
|
case 1:
|
|
100
|
-
response =
|
|
104
|
+
response = _a.sent();
|
|
101
105
|
if (response.error)
|
|
102
106
|
return [2 /*return*/, response];
|
|
103
107
|
if (game_id === "all") {
|
|
104
108
|
response_data_1 = Object.entries(response.data);
|
|
105
109
|
processed_data_1 = Object.fromEntries(response_data_1.map(function (_a) {
|
|
106
110
|
var _b = __read(_a, 2), id = _b[0], statistics = _b[1];
|
|
107
|
-
if (!statistics ||
|
|
111
|
+
if (!statistics ||
|
|
112
|
+
!(0, isGame_1.default)(id) ||
|
|
113
|
+
Array.isArray(statistics))
|
|
108
114
|
return [id, null];
|
|
109
115
|
var e = processors_1.MonthlyProcessors[hive_bedrock_data_1.Game.ParkourWorlds];
|
|
110
116
|
return [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { APIResponse, Options } from "../types/types";
|
|
2
2
|
import { Processed_Player_Statistics } from "../processors/player";
|
|
3
|
-
export default function getPlayerInfomation(identifier: string, options?: Options): Promise<APIResponse<Processed_Player_Statistics>>;
|
|
3
|
+
export default function getPlayerInfomation(identifier: string, options?: Partial<Options>): Promise<APIResponse<Processed_Player_Statistics>>;
|
|
@@ -6,5 +6,5 @@ interface SeasonOptions extends Options {
|
|
|
6
6
|
month: number;
|
|
7
7
|
year: number;
|
|
8
8
|
}
|
|
9
|
-
export default function getSeasonStatistics<G extends Game>(identifier: string, game_id: G, options?: SeasonOptions): Promise<APIResponse<MonthlyProcessedStatistics[G]>>;
|
|
9
|
+
export default function getSeasonStatistics<G extends Game>(identifier: string, game_id: G, options?: Partial<SeasonOptions>): Promise<APIResponse<MonthlyProcessedStatistics[G]>>;
|
|
10
10
|
export {};
|