mcutils-js-api 2.0.27 → 2.0.29
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/index.d.ts +13 -3
- package/dist/index.js +14 -0
- package/dist/types/player/player.d.ts +0 -2
- package/dist/types/response/statistics-response.d.ts +5 -0
- package/package.json +1 -1
- package/dist/types/cache/cached-player.d.ts +0 -3
- package/dist/types/player/profile-property.d.ts +0 -5
- package/dist/types/player/profile-property.js +0 -1
- /package/dist/types/{cache/cached-player.js → response/statistics-response.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import type { ErrorResponse } from "./types/response/error-response";
|
|
|
2
2
|
import type { IpLookup } from "./types/response/ip-lookup-response";
|
|
3
3
|
import type { BedrockServer } from "./types/server/impl/bedrock-server";
|
|
4
4
|
import type { JavaServer } from "./types/server/impl/java-server";
|
|
5
|
-
import type { CachedPlayer } from "./types/cache/cached-player";
|
|
6
|
-
import type { CachedPlayerName } from "./types/cache/cached-player-name";
|
|
7
5
|
import type { ServerPlatform } from "./types/server/server";
|
|
8
6
|
import type { Cape } from "./types/player/cape/cape";
|
|
9
7
|
import { ServerRegistryEntry } from "./types/server-registry/server-registry-entry";
|
|
8
|
+
import { Player } from "./types/player/player";
|
|
9
|
+
import { CachedPlayerName } from "./types/cache/cached-player-name";
|
|
10
|
+
import { StatisticsResponse } from "./types/response/statistics-response";
|
|
10
11
|
export declare class McUtilsAPI {
|
|
11
12
|
private readonly endpoint;
|
|
12
13
|
constructor(endpoint?: string);
|
|
@@ -75,7 +76,7 @@ export declare class McUtilsAPI {
|
|
|
75
76
|
* @returns the player or the error (if one occurred)
|
|
76
77
|
*/
|
|
77
78
|
fetchPlayer(id: string): Promise<{
|
|
78
|
-
player?:
|
|
79
|
+
player?: Player;
|
|
79
80
|
error?: ErrorResponse;
|
|
80
81
|
}>;
|
|
81
82
|
/**
|
|
@@ -174,5 +175,14 @@ export declare class McUtilsAPI {
|
|
|
174
175
|
entries?: ServerRegistryEntry[];
|
|
175
176
|
error?: ErrorResponse;
|
|
176
177
|
}>;
|
|
178
|
+
/**
|
|
179
|
+
* Fetch the statistics of the API.
|
|
180
|
+
*
|
|
181
|
+
* @returns the statistics or the error (if one occurred)
|
|
182
|
+
*/
|
|
183
|
+
fetchStatistics(): Promise<{
|
|
184
|
+
statistics?: StatisticsResponse;
|
|
185
|
+
error?: ErrorResponse;
|
|
186
|
+
}>;
|
|
177
187
|
}
|
|
178
188
|
export default McUtilsAPI;
|
package/dist/index.js
CHANGED
|
@@ -255,5 +255,19 @@ export class McUtilsAPI {
|
|
|
255
255
|
error: (await response.json()),
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Fetch the statistics of the API.
|
|
260
|
+
*
|
|
261
|
+
* @returns the statistics or the error (if one occurred)
|
|
262
|
+
*/
|
|
263
|
+
async fetchStatistics() {
|
|
264
|
+
const response = await fetch(`${this.endpoint}/statistics`);
|
|
265
|
+
if (response.ok) {
|
|
266
|
+
return { statistics: (await response.json()) };
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
error: (await response.json()),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
258
272
|
}
|
|
259
273
|
export default McUtilsAPI;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Cape } from "./cape/cape";
|
|
2
|
-
import { ProfileProperty } from "./profile-property";
|
|
3
2
|
import { Skin } from "./skin/skin";
|
|
4
3
|
export type Player = {
|
|
5
4
|
uniqueId: string;
|
|
@@ -8,5 +7,4 @@ export type Player = {
|
|
|
8
7
|
skin: Skin;
|
|
9
8
|
cape?: Cape;
|
|
10
9
|
optifineCape?: Cape;
|
|
11
|
-
rawProperties?: ProfileProperty[];
|
|
12
10
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|