mcutils-js-api 2.0.37 → 2.0.39

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 CHANGED
@@ -10,6 +10,7 @@ import { CachedPlayerName } from "./types/cache/cached-player-name";
10
10
  import { StatisticsResponse } from "./types/response/statistics-response";
11
11
  import { Skin } from "./types/player/skin/skin";
12
12
  import { Page } from "./types/pagination/pagination";
13
+ import { PlayerSearchEntry } from "./types/player/player-search-entry";
13
14
  export declare class McUtilsAPI {
14
15
  private readonly endpoint;
15
16
  private readonly fetchOptions?;
@@ -205,5 +206,15 @@ export declare class McUtilsAPI {
205
206
  skins?: Page<Skin>;
206
207
  error?: ErrorResponse;
207
208
  }>;
209
+ /**
210
+ * Search for players by username.
211
+ *
212
+ * @param query the query to search for (eg: aetheria)
213
+ * @returns the player search entry or the error (if one occurred)
214
+ */
215
+ searchPlayers(query: string): Promise<{
216
+ entry?: PlayerSearchEntry;
217
+ error?: ErrorResponse;
218
+ }>;
208
219
  }
209
220
  export default McUtilsAPI;
package/dist/index.js CHANGED
@@ -207,5 +207,15 @@ export class McUtilsAPI {
207
207
  const { data, error } = await this.request(`/skins${this.buildParams({ page: String(page) })}`);
208
208
  return error ? { error } : { skins: data };
209
209
  }
210
+ /**
211
+ * Search for players by username.
212
+ *
213
+ * @param query the query to search for (eg: aetheria)
214
+ * @returns the player search entry or the error (if one occurred)
215
+ */
216
+ async searchPlayers(query) {
217
+ const { data, error } = await this.request(`/players/search${this.buildParams({ query: query })}`);
218
+ return error ? { error } : { entry: data };
219
+ }
210
220
  }
211
221
  export default McUtilsAPI;
@@ -0,0 +1,6 @@
1
+ import { Skin } from "./skin/skin";
2
+ export type PlayerSearchEntry = {
3
+ uuid: string;
4
+ username: string;
5
+ skin: Skin;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcutils-js-api",
3
- "version": "2.0.37",
3
+ "version": "2.0.39",
4
4
  "module": "dist/index.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",