mowojang 0.2.0 → 0.2.2

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 CHANGED
@@ -33,7 +33,7 @@ const username = await Mowojang.getUsername("14727fae-fbdc-4aff-848c-d2713eb9939
33
33
  - `getSkin()`: Returns the Skin the specified Player is currently wearing
34
34
  - `getSkinBuffer()`: Skin-Data fetched via getSkin() as a Buffer
35
35
  - `getCape()`: Returns the Cape the specified Player is currently wearing
36
- - `getCapeBuffer()`: Skin-Data fetched via getCape() as a Buffer
36
+ - `getCapeBuffer()`: Cape-Data 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,6 +1,6 @@
1
1
  {
2
2
  "name": "mowojang",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A simple JavaScript and TypeScript compatible API Wrapper for the Mowojang-API.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "axios-cache-interceptor": "^1.5.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^20.14.7",
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: AxiosOptions) => AxiosCacheInstance;
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://github.com/pixelicc/mowojang-api-wrapper)`,
9
+ "User-Agent": `axios/${axios.VERSION} mowojang/${PackageJSON.version} (https://www.npmjs.com/package/mowojang)`,
10
10
  Accept: "application/json",
11
11
  },
12
12
  }), {
@@ -1,7 +1,7 @@
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: ClientOptions);
4
+ constructor(clientOptions?: ClientOptions);
5
5
  /**
6
6
  * Returns an Array of Player Profiles
7
7
  *
@@ -13,7 +13,15 @@ export default class Client {
13
13
  *
14
14
  */
15
15
  getProfile(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangProfile, "INVALID_PLAYER">;
16
+ /**
17
+ * Simple Wrapper to only retrieve the UUID from the Player's Profile Data
18
+ *
19
+ */
16
20
  getUUID(username: Username, config?: MowojangRequestConfig): Promise<null | Username>;
21
+ /**
22
+ * Simple Wrapper to only retrieve the Username from the Player's Profile Data
23
+ *
24
+ */
17
25
  getUsername(UUID: UUID, config?: MowojangRequestConfig): Promise<null | UUID>;
18
26
  /**
19
27
  * Returns an Array of Player Sessions
@@ -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
+ * Simple Wrapper to only retrieve the UUID from the Player's Profile Data
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
+ * Simple Wrapper to only retrieve the Username from the Player's Profile Data
71
+ *
72
+ */
65
73
  async getUsername(UUID, config) {
66
74
  if (!validateUUID(UUID))
67
75
  return null;
@@ -3,12 +3,12 @@ import { buildStorage, buildMemoryStorage } from "axios-cache-interceptor";
3
3
  export declare const Client: typeof client;
4
4
  export declare const validate: {
5
5
  player: (player: import("../types/player.js").Player) => boolean;
6
- uuid: (UUID: string) => boolean;
6
+ UUID: (UUID: string) => boolean;
7
7
  username: (username: string) => boolean;
8
8
  };
9
9
  export declare const utils: {
10
- dashUUID: (UUID: string) => string;
11
- undashUUID: (UUID: string) => string;
10
+ dashUUID: (UUID: string) => import("../types/player.js").UUID;
11
+ undashUUID: (UUID: string) => import("../types/player.js").UUID;
12
12
  };
13
13
  export declare const cache: {
14
14
  buildStorage: typeof buildStorage;
package/dist/src/index.js CHANGED
@@ -5,7 +5,7 @@ import { buildStorage, buildMemoryStorage } from "axios-cache-interceptor";
5
5
  export const Client = client;
6
6
  export const validate = {
7
7
  player: validatePlayer,
8
- uuid: validateUUID,
8
+ UUID: validateUUID,
9
9
  username: validateUsername,
10
10
  };
11
11
  export const utils = {
@@ -1,2 +1,3 @@
1
- export declare const undashUUID: (UUID: string) => string;
2
- export declare const dashUUID: (UUID: string) => string;
1
+ import { UUID } from "../types/index.js";
2
+ export declare const undashUUID: (UUID: string) => UUID;
3
+ export declare const dashUUID: (UUID: string) => UUID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mowojang",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A simple JavaScript and TypeScript compatible API Wrapper for the Mowojang-API.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "axios-cache-interceptor": "^1.5.3"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/node": "^20.14.7",
28
+ "@types/node": "^20.14.9",
29
29
  "typescript": "^5.5.2"
30
30
  },
31
31
  "scripts": {