Skip to content

Commit

Permalink
feat: add player search endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
NeutronicMC committed Oct 27, 2024
1 parent 9a935ef commit 0cf52fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hive-tools-wrapper",
"version": "5.3.0",
"version": "5.5.0",
"description": "Type-safe wrapper for the Hive Bedrock API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
AllTimeStatsProcessors,
MonthlyStatsProcessors
} from "./games/processors";
import { Player } from "./player/data";
import { Player, PlayerSearchResult } from "./player/data";
import { GameMap } from "./map/data";

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

export async function searchPlayer(
partial: string,
controller?: AbortController,
init?: RequestInit
): Promise<PlayerSearchResult[]> {
return await fetchData(`/player/search/${partial}`, controller, init);
}

export * from "./games/data";
export * from "./games/info";
export * from "./games/processors";
export * from "./map/data";
export * from "./player/data";

6 changes: 6 additions & 0 deletions src/player/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,9 @@ export type Player = {
pets: string[];
mounts: string[];
};

export type PlayerSearchResult = {
UUID: string;
username: string;
username_cc: string;
};

0 comments on commit 0cf52fc

Please sign in to comment.