mcutils-js-api 2.0.17 → 2.0.18
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 +15 -3
- package/dist/index.js +21 -4
- package/dist/types/cape/cape.d.ts +5 -0
- package/dist/types/cape/cape.js +1 -0
- package/dist/types/player/player.d.ts +1 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -132,12 +132,24 @@ export declare class McUtilsAPI {
|
|
|
132
132
|
error?: ErrorResponse;
|
|
133
133
|
}>;
|
|
134
134
|
/**
|
|
135
|
-
* Fetch a cape texture image
|
|
135
|
+
* Fetch a cape texture image.
|
|
136
136
|
*
|
|
137
|
-
* @param
|
|
137
|
+
* @param query player UUID/username or 64-char cape texture id
|
|
138
138
|
* @returns the cape PNG image or the error (if one occurred)
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
fetchCapeTexture(query: string): Promise<{
|
|
141
|
+
image?: ArrayBuffer;
|
|
142
|
+
error?: ErrorResponse;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Fetch a rendered cape part (e.g. front).
|
|
146
|
+
*
|
|
147
|
+
* @param query player UUID/username or 64-char cape texture id
|
|
148
|
+
* @param type cape part (e.g. front) – see CapeRendererType
|
|
149
|
+
* @param size image height (default 768)
|
|
150
|
+
* @returns the cape part PNG image or the error (if one occurred)
|
|
151
|
+
*/
|
|
152
|
+
fetchCapePart(query: string, type: string, size?: number): Promise<{
|
|
141
153
|
image?: ArrayBuffer;
|
|
142
154
|
error?: ErrorResponse;
|
|
143
155
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -195,13 +195,30 @@ export class McUtilsAPI {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
|
-
* Fetch a cape texture image
|
|
198
|
+
* Fetch a cape texture image.
|
|
199
199
|
*
|
|
200
|
-
* @param
|
|
200
|
+
* @param query player UUID/username or 64-char cape texture id
|
|
201
201
|
* @returns the cape PNG image or the error (if one occurred)
|
|
202
202
|
*/
|
|
203
|
-
async
|
|
204
|
-
const response = await fetch(`${this.endpoint}/cape/${
|
|
203
|
+
async fetchCapeTexture(query) {
|
|
204
|
+
const response = await fetch(`${this.endpoint}/cape/${query}/texture.png`);
|
|
205
|
+
if (response.ok) {
|
|
206
|
+
return { image: await response.arrayBuffer() };
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
error: (await response.json()),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Fetch a rendered cape part (e.g. front).
|
|
214
|
+
*
|
|
215
|
+
* @param query player UUID/username or 64-char cape texture id
|
|
216
|
+
* @param type cape part (e.g. front) – see CapeRendererType
|
|
217
|
+
* @param size image height (default 768)
|
|
218
|
+
* @returns the cape part PNG image or the error (if one occurred)
|
|
219
|
+
*/
|
|
220
|
+
async fetchCapePart(query, type, size = 768) {
|
|
221
|
+
const response = await fetch(`${this.endpoint}/cape/${query}/${type}.png${this.buildParams({ size: String(size) })}`);
|
|
205
222
|
if (response.ok) {
|
|
206
223
|
return { image: await response.arrayBuffer() };
|
|
207
224
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Cape } from "../cape/cape";
|
|
1
2
|
export type SkinModel = "DEFAULT" | "SLIM";
|
|
2
3
|
export type SkinPart = "HEAD" | "FULLBODY_FRONT" | "FULLBODY_BACK" | "FACE" | "BODY";
|
|
3
4
|
export type SkinParts = Record<SkinPart, string>;
|
|
@@ -7,9 +8,6 @@ export type Skin = {
|
|
|
7
8
|
textureUrl: string;
|
|
8
9
|
parts: SkinParts;
|
|
9
10
|
};
|
|
10
|
-
export type Cape = {
|
|
11
|
-
textureUrl: string;
|
|
12
|
-
};
|
|
13
11
|
export type ProfileProperty = {
|
|
14
12
|
name: string;
|
|
15
13
|
value: string;
|