mowojang 0.2.1 → 0.3.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/README.md +9 -9
- package/dist/package.json +4 -4
- package/dist/src/axiosInstance.d.ts +1 -1
- package/dist/src/axiosInstance.js +1 -1
- package/dist/src/client.d.ts +17 -9
- package/dist/src/client.js +16 -8
- package/dist/src/index.d.ts +2 -2
- package/dist/src/utils.d.ts +11 -2
- package/dist/src/utils.js +8 -0
- package/dist/src/validators.d.ts +11 -0
- package/dist/src/validators.js +11 -0
- package/package.json +4 -4
- package/.prettierignore +0 -5
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -6
- package/docs/custom-caching.md +0 -44
- package/types/index.d.ts +0 -3
- package/types/misc.d.ts +0 -28
- package/types/player.d.ts +0 -20
- package/types/structures.d.ts +0 -27
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mowojang-js
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
> [!IMPORTANT]
|
|
8
|
-
> This is
|
|
8
|
+
> This is a third party wrapper for the [Mowojang-API](https://mowojang.matdoes.dev/)!
|
|
9
9
|
|
|
10
10
|
## ✨ Quick Start
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ const username = await Mowojang.getUsername("14727fae-fbdc-4aff-848c-d2713eb9939
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
> [!TIP]
|
|
22
|
-
> If you plan on using this in a long-running process with
|
|
22
|
+
> If you plan on using this in a long-running process with heavy usage check out this guide on how to setup custom caching to prevent memory leaks.
|
|
23
23
|
> Guide: [Custom-Caching](docs/custom-caching.md)
|
|
24
24
|
|
|
25
25
|
## 🔧 Functions / Supported Endpoints
|
|
@@ -28,12 +28,12 @@ const username = await Mowojang.getUsername("14727fae-fbdc-4aff-848c-d2713eb9939
|
|
|
28
28
|
- `getProfile()`: Retrieve full Player Data by UUID or Username
|
|
29
29
|
- `getSessions()`: Retrieve Player Session Data of multiple Players by UUID or Username
|
|
30
30
|
- `getSession()`: Retrieve Player Session Data by UUID or Username
|
|
31
|
-
- `getUUID()`: Converts Username to UUID
|
|
32
|
-
- `getUsername()`: Converts UUID to Username
|
|
31
|
+
- `getUUID()`: Converts a Player's Username to UUID
|
|
32
|
+
- `getUsername()`: Converts a Player's UUID to Username
|
|
33
33
|
- `getSkin()`: Returns the Skin the specified Player is currently wearing
|
|
34
|
-
- `getSkinBuffer()`: Skin
|
|
35
|
-
- `getCape()`: Returns the Cape the specified Player
|
|
36
|
-
- `getCapeBuffer()`: Cape
|
|
34
|
+
- `getSkinBuffer()`: Returns Skin Image fetched via getSkin() as a Buffer
|
|
35
|
+
- `getCape()`: Returns the Cape the specified Player has currently selected
|
|
36
|
+
- `getCapeBuffer()`: Returns Cape Image fetched via getCape() as a Buffer
|
|
37
37
|
|
|
38
38
|
All above Functions accept an second Argument containing an optional config.
|
|
39
39
|
Cache options can also be passed there via the cache key. All available cache options can be found [here](https://axios-cache-interceptor.js.org/config/request-specifics#cache).
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A simple JavaScript and TypeScript compatible
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/pixelicc/mowojang-
|
|
16
|
+
"url": "https://github.com/pixelicc/mowojang-js.git"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"Minecraft",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"axios-cache-interceptor": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^20.14.
|
|
34
|
+
"@types/node": "^20.14.9",
|
|
35
35
|
"typescript": "^5.5.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AxiosCacheInstance } from "axios-cache-interceptor";
|
|
2
2
|
import { AxiosOptions } from "../types/index.js";
|
|
3
|
-
declare const _default: (options
|
|
3
|
+
declare const _default: (options?: AxiosOptions) => AxiosCacheInstance;
|
|
4
4
|
export default _default;
|
|
@@ -6,7 +6,7 @@ export default (options) => {
|
|
|
6
6
|
timeout: options?.timeout ?? 5000,
|
|
7
7
|
maxRedirects: 0,
|
|
8
8
|
headers: {
|
|
9
|
-
"User-Agent": `axios/${axios.VERSION} mowojang/${PackageJSON.version} (https://
|
|
9
|
+
"User-Agent": `axios/${axios.VERSION} mowojang/${PackageJSON.version} (https://www.npmjs.com/package/mowojang)`,
|
|
10
10
|
Accept: "application/json",
|
|
11
11
|
},
|
|
12
12
|
}), {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,48 +1,56 @@
|
|
|
1
1
|
import { Player, Username, UUID, ClientOptions, MowojangCape, MowojangProfile, MowojangRequestConfig, MowojangResponse, MowojangSession, MowojangSkin } from "../types/index.js";
|
|
2
2
|
export default class Client {
|
|
3
3
|
private axios;
|
|
4
|
-
constructor(clientOptions
|
|
4
|
+
constructor(clientOptions?: ClientOptions);
|
|
5
5
|
/**
|
|
6
|
-
* Returns an Array of Player Profiles
|
|
6
|
+
* Returns an Array of Player Profiles consisting of their Usernames and UUIDs
|
|
7
7
|
*
|
|
8
8
|
* Players considered "INVALID" are excluded from the results
|
|
9
9
|
*/
|
|
10
10
|
getProfiles(players: Player[], config?: MowojangRequestConfig): MowojangResponse<MowojangProfile[], undefined>;
|
|
11
11
|
/**
|
|
12
|
-
* Returns a Player Profile
|
|
12
|
+
* Returns a Player's Profile consisting of their Username and UUID
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
getProfile(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangProfile, "INVALID_PLAYER">;
|
|
16
|
+
/**
|
|
17
|
+
* A Simple Wrapper to Retrieve Only the UUID of a Player's Profile
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
16
20
|
getUUID(username: Username, config?: MowojangRequestConfig): Promise<null | Username>;
|
|
21
|
+
/**
|
|
22
|
+
* A Simple Wrapper to Retrieve Only the Username of a Player's Profile
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
17
25
|
getUsername(UUID: UUID, config?: MowojangRequestConfig): Promise<null | UUID>;
|
|
18
26
|
/**
|
|
19
|
-
* Returns an Array of Player Sessions
|
|
27
|
+
* Returns an Array of Player Sessions consisting of their Usernames, UUIDs, Skins and Capes
|
|
20
28
|
*
|
|
21
29
|
* Players considered "INVALID" are excluded from the results
|
|
22
30
|
*/
|
|
23
31
|
getSessions(players: Player[], config?: MowojangRequestConfig): MowojangResponse<MowojangSession[], "INVALID_PLAYER">;
|
|
24
32
|
/**
|
|
25
|
-
* Returns a Player
|
|
33
|
+
* Returns a Player's Sessions consisting of their Username, UUID, Skin and Cape
|
|
26
34
|
*
|
|
27
35
|
*/
|
|
28
36
|
getSession(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangSession, "INVALID_PLAYER">;
|
|
29
37
|
/**
|
|
30
|
-
* Simple Wrapper to
|
|
38
|
+
* A Simple Wrapper to Retrieve Only the Skin from a Player's Session
|
|
31
39
|
*
|
|
32
40
|
*/
|
|
33
41
|
getSkin(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangSkin>;
|
|
34
42
|
/**
|
|
35
|
-
* Simple Wrapper to
|
|
43
|
+
* A Simple Wrapper to Retrieve Only the Player's Skin from their Session Data Loaded into a Buffer
|
|
36
44
|
*
|
|
37
45
|
*/
|
|
38
46
|
getSkinBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
|
39
47
|
/**
|
|
40
|
-
* Simple Wrapper to
|
|
48
|
+
* A Simple Wrapper to Retrieve Only the Cape Data from a Player's Session
|
|
41
49
|
*
|
|
42
50
|
*/
|
|
43
51
|
getCape(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangCape>;
|
|
44
52
|
/**
|
|
45
|
-
* Simple Wrapper to
|
|
53
|
+
* A Simple Wrapper to Retrieve Only the Player's Cape from their Session Data Loaded into a Buffer
|
|
46
54
|
*
|
|
47
55
|
*/
|
|
48
56
|
getCapeBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
package/dist/src/client.js
CHANGED
|
@@ -8,7 +8,7 @@ export default class Client {
|
|
|
8
8
|
this.axios = axiosInstance(clientOptions);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Returns an Array of Player Profiles
|
|
11
|
+
* Returns an Array of Player Profiles consisting of their Usernames and UUIDs
|
|
12
12
|
*
|
|
13
13
|
* Players considered "INVALID" are excluded from the results
|
|
14
14
|
*/
|
|
@@ -41,7 +41,7 @@ export default class Client {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Returns a Player Profile
|
|
44
|
+
* Returns a Player's Profile consisting of their Username and UUID
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
47
|
async getProfile(player, config) {
|
|
@@ -54,6 +54,10 @@ export default class Client {
|
|
|
54
54
|
return { data: null, error: "INVALID_PLAYER" };
|
|
55
55
|
return { data: profiles.data[0], error: null };
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A Simple Wrapper to Retrieve Only the UUID of a Player's Profile
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
57
61
|
async getUUID(username, config) {
|
|
58
62
|
if (!validateUsername(username))
|
|
59
63
|
return null;
|
|
@@ -62,6 +66,10 @@ export default class Client {
|
|
|
62
66
|
return null;
|
|
63
67
|
return profile.data.UUID;
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* A Simple Wrapper to Retrieve Only the Username of a Player's Profile
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
65
73
|
async getUsername(UUID, config) {
|
|
66
74
|
if (!validateUUID(UUID))
|
|
67
75
|
return null;
|
|
@@ -71,7 +79,7 @@ export default class Client {
|
|
|
71
79
|
return profile.data.username;
|
|
72
80
|
}
|
|
73
81
|
/**
|
|
74
|
-
* Returns an Array of Player Sessions
|
|
82
|
+
* Returns an Array of Player Sessions consisting of their Usernames, UUIDs, Skins and Capes
|
|
75
83
|
*
|
|
76
84
|
* Players considered "INVALID" are excluded from the results
|
|
77
85
|
*/
|
|
@@ -102,7 +110,7 @@ export default class Client {
|
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
/**
|
|
105
|
-
* Returns a Player
|
|
113
|
+
* Returns a Player's Sessions consisting of their Username, UUID, Skin and Cape
|
|
106
114
|
*
|
|
107
115
|
*/
|
|
108
116
|
async getSession(player, config) {
|
|
@@ -156,7 +164,7 @@ export default class Client {
|
|
|
156
164
|
});
|
|
157
165
|
}
|
|
158
166
|
/**
|
|
159
|
-
* Simple Wrapper to
|
|
167
|
+
* A Simple Wrapper to Retrieve Only the Skin from a Player's Session
|
|
160
168
|
*
|
|
161
169
|
*/
|
|
162
170
|
async getSkin(player, config) {
|
|
@@ -166,7 +174,7 @@ export default class Client {
|
|
|
166
174
|
return session.data.skin;
|
|
167
175
|
}
|
|
168
176
|
/**
|
|
169
|
-
* Simple Wrapper to
|
|
177
|
+
* A Simple Wrapper to Retrieve Only the Player's Skin from their Session Data Loaded into a Buffer
|
|
170
178
|
*
|
|
171
179
|
*/
|
|
172
180
|
async getSkinBuffer(player, config) {
|
|
@@ -180,7 +188,7 @@ export default class Client {
|
|
|
180
188
|
return Buffer.from(fetchResponse.data, "base64");
|
|
181
189
|
}
|
|
182
190
|
/**
|
|
183
|
-
* Simple Wrapper to
|
|
191
|
+
* A Simple Wrapper to Retrieve Only the Cape Data from a Player's Session
|
|
184
192
|
*
|
|
185
193
|
*/
|
|
186
194
|
async getCape(player, config) {
|
|
@@ -190,7 +198,7 @@ export default class Client {
|
|
|
190
198
|
return session.data.cape;
|
|
191
199
|
}
|
|
192
200
|
/**
|
|
193
|
-
* Simple Wrapper to
|
|
201
|
+
* A Simple Wrapper to Retrieve Only the Player's Cape from their Session Data Loaded into a Buffer
|
|
194
202
|
*
|
|
195
203
|
*/
|
|
196
204
|
async getCapeBuffer(player, config) {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare const validate: {
|
|
|
7
7
|
username: (username: string) => boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const utils: {
|
|
10
|
-
dashUUID: (UUID:
|
|
11
|
-
undashUUID: (UUID:
|
|
10
|
+
dashUUID: (UUID: import("../types/player.js").UUID) => import("../types/player.js").UUID;
|
|
11
|
+
undashUUID: (UUID: import("../types/player.js").UUID) => import("../types/player.js").UUID;
|
|
12
12
|
};
|
|
13
13
|
export declare const cache: {
|
|
14
14
|
buildStorage: typeof buildStorage;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { UUID } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Removes dashes from a UUID string
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare const undashUUID: (UUID: UUID) => UUID;
|
|
7
|
+
/**
|
|
8
|
+
* Adds dashes to a UUID string if not already dashed
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const dashUUID: (UUID: UUID) => UUID;
|
package/dist/src/utils.js
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes dashes from a UUID string
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
1
5
|
export const undashUUID = (UUID) => UUID.replace(/-/g, "").toLowerCase();
|
|
6
|
+
/**
|
|
7
|
+
* Adds dashes to a UUID string if not already dashed
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
2
10
|
export const dashUUID = (UUID) => undashUUID(UUID).replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
|
package/dist/src/validators.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Player } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates a UUIDv4 string
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
2
6
|
export declare const validateUUID: (UUID: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Validates a Minecraft Username
|
|
9
|
+
*/
|
|
3
10
|
export declare const validateUsername: (username: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Validates a Minecraft Player by either validating their Username or supplied UUID
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
4
15
|
export declare const validatePlayer: (player: Player) => boolean;
|
|
5
16
|
export declare const validateArray: <T>(array: T[], validatorFunction: (item: T, ...params: any[]) => boolean, ...params: any[]) => boolean;
|
package/dist/src/validators.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { undashUUID } from "./utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates a UUIDv4 string
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
2
6
|
export const validateUUID = (UUID) => {
|
|
3
7
|
if (typeof UUID !== "string")
|
|
4
8
|
return false;
|
|
@@ -7,11 +11,18 @@ export const validateUUID = (UUID) => {
|
|
|
7
11
|
return false;
|
|
8
12
|
return /[0-9a-f]{12}4[0-9a-f]{19}/.test(UUID);
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Validates a Minecraft Username
|
|
16
|
+
*/
|
|
10
17
|
export const validateUsername = (username) => {
|
|
11
18
|
if (typeof username !== "string")
|
|
12
19
|
return false;
|
|
13
20
|
return /^[a-zA-Z0-9_]{1,16}$/.test(username);
|
|
14
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Validates a Minecraft Player by either validating their Username or supplied UUID
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
15
26
|
export const validatePlayer = (player) => validateUUID(player) || validateUsername(player);
|
|
16
27
|
export const validateArray = (array, validatorFunction, ...params) => {
|
|
17
28
|
if (!Array.isArray(array))
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A simple JavaScript and TypeScript compatible
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/pixelicc/mowojang-
|
|
10
|
+
"url": "https://github.com/pixelicc/mowojang-js.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"Minecraft",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"axios-cache-interceptor": "^1.5.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^20.14.
|
|
28
|
+
"@types/node": "^20.14.9",
|
|
29
29
|
"typescript": "^5.5.2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
package/docs/custom-caching.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# 💾 Custom Caching / Storage
|
|
2
|
-
|
|
3
|
-
As the `Mowojang` library just uses the `axios-cache-interceptor` library internally you can also follow their docs on the two exported builders accessable via the cache export: `buildMemoryStorage()` and `buildStorage()`
|
|
4
|
-
|
|
5
|
-
Docs: https://axios-cache-interceptor.js.org/guide/storages
|
|
6
|
-
|
|
7
|
-
## Custom Memory Storage
|
|
8
|
-
|
|
9
|
-
```TS
|
|
10
|
-
import { Client, cache } from "mowojang"
|
|
11
|
-
|
|
12
|
-
const Mowojang = new Client({
|
|
13
|
-
cache: {
|
|
14
|
-
storage: cache.buildMemoryStorage(
|
|
15
|
-
false, // Doesn't clone data
|
|
16
|
-
60 * 60 * 1000, // Cleans cache-leftovers every hour
|
|
17
|
-
false // Doesn't set a max entry limit
|
|
18
|
-
/**
|
|
19
|
-
* More detailed documentation:
|
|
20
|
-
*
|
|
21
|
-
* https://axios-cache-interceptor.js.org/guide/storages#memory-storage
|
|
22
|
-
*/
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Custom Storage
|
|
29
|
-
|
|
30
|
-
```TS
|
|
31
|
-
import { Client, cache } from "mowojang"
|
|
32
|
-
|
|
33
|
-
const Mowojang = new Client({
|
|
34
|
-
cache: {
|
|
35
|
-
storage: cache.buildStorage({
|
|
36
|
-
/**
|
|
37
|
-
* More detailed documentation:
|
|
38
|
-
*
|
|
39
|
-
* https://axios-cache-interceptor.js.org/guide/storages#buildstorage
|
|
40
|
-
*/
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
```
|
package/types/index.d.ts
DELETED
package/types/misc.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CacheOptions, CacheRequestConfig } from "axios-cache-interceptor";
|
|
2
|
-
|
|
3
|
-
export type ClientOptions = {
|
|
4
|
-
timeout?: number;
|
|
5
|
-
cache?: CacheOptions;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type AxiosOptions = {
|
|
9
|
-
timeout?: number;
|
|
10
|
-
cache?: CacheOptions;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type MowojangRequestConfig = {
|
|
14
|
-
cache?: CacheRequestConfig<any, any>["cache"];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type MowojangError = "INVALID_PLAYER";
|
|
18
|
-
|
|
19
|
-
export type MowojangResponse<D, E extends MowojangError | undefined> = Promise<
|
|
20
|
-
| {
|
|
21
|
-
data: D;
|
|
22
|
-
error: null;
|
|
23
|
-
}
|
|
24
|
-
| {
|
|
25
|
-
data: null;
|
|
26
|
-
error: E extends undefined ? "UNKOWN_ERROR" | "INVALID_INPUT" : E | "UNKOWN_ERROR" | "INVALID_INPUT";
|
|
27
|
-
}
|
|
28
|
-
>;
|
package/types/player.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minecraft Username or UUIDv4 (both undashed and dashed will be accepted)
|
|
3
|
-
*
|
|
4
|
-
* @example "Technoblade" or "b876ec32-e396-476b-a115-8438d83c67d4"
|
|
5
|
-
*/
|
|
6
|
-
export type Player = string | UUID;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Minecraft Username
|
|
10
|
-
*
|
|
11
|
-
* @example "Pixelic"
|
|
12
|
-
*/
|
|
13
|
-
export type Username = string;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Minecraft UUIDv4 (both undashed and dashed will be accepted)
|
|
17
|
-
*
|
|
18
|
-
* @example b876ec32e396476ba1158438d83c67d4
|
|
19
|
-
*/
|
|
20
|
-
export type UUID = string;
|
package/types/structures.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UUID, Username } from "./index.js";
|
|
2
|
-
|
|
3
|
-
export type MowojangProfile = {
|
|
4
|
-
UUID: UUID;
|
|
5
|
-
username: Username;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type MowojangSession = {
|
|
9
|
-
UUID: UUID;
|
|
10
|
-
username: Username;
|
|
11
|
-
skin: MowojangSkin;
|
|
12
|
-
cape: MowojangCape;
|
|
13
|
-
actions: ("FORCED_NAME_CHANGE" | "USING_BANNED_SKIN")[];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type MowojangSkin = null | {
|
|
17
|
-
url: string;
|
|
18
|
-
hash: string;
|
|
19
|
-
metadata: {
|
|
20
|
-
slim: boolean;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type MowojangCape = null | {
|
|
25
|
-
url: string;
|
|
26
|
-
hash: string;
|
|
27
|
-
};
|