Skip to content

Commit 0cf52fc

Browse files
committed
feat: add player search endpoint
1 parent 9a935ef commit 0cf52fc

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hive-tools-wrapper",
3-
"version": "5.3.0",
3+
"version": "5.5.0",
44
"description": "Type-safe wrapper for the Hive Bedrock API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
AllTimeStatsProcessors,
1515
MonthlyStatsProcessors
1616
} from "./games/processors";
17-
import { Player } from "./player/data";
17+
import { Player, PlayerSearchResult } from "./player/data";
1818
import { GameMap } from "./map/data";
1919

2020
const cachedResponses: {
@@ -360,9 +360,16 @@ export async function getGameMetainfo(
360360
return await fetchData(`/game/meta/${game}`, controller, init);
361361
}
362362

363+
export async function searchPlayer(
364+
partial: string,
365+
controller?: AbortController,
366+
init?: RequestInit
367+
): Promise<PlayerSearchResult[]> {
368+
return await fetchData(`/player/search/${partial}`, controller, init);
369+
}
370+
363371
export * from "./games/data";
364372
export * from "./games/info";
365373
export * from "./games/processors";
366374
export * from "./map/data";
367375
export * from "./player/data";
368-

src/player/data.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,9 @@ export type Player = {
8383
pets: string[];
8484
mounts: string[];
8585
};
86+
87+
export type PlayerSearchResult = {
88+
UUID: string;
89+
username: string;
90+
username_cc: string;
91+
};

0 commit comments

Comments
 (0)