functional lib
This commit is contained in:
BIN
Lib/bun.lockb
BIN
Lib/bun.lockb
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "restfulmc",
|
"name": "restfulmc",
|
||||||
"version": "1.0.0",
|
"version": "1.0.4",
|
||||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||||
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
|
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -33,8 +33,5 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"axios": "^1.6.8"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import type { Player } from "../types/player";
|
import type { Player } from "../types/player";
|
||||||
|
|
||||||
|
const ENDPOINT = "https://mc.rainnny.club"; // The API endpoint to use
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player by their username or UUID.
|
* Get a player by their username or UUID.
|
||||||
*
|
*
|
||||||
@ -7,15 +9,8 @@ import type { Player } from "../types/player";
|
|||||||
* @returns the promised player
|
* @returns the promised player
|
||||||
*/
|
*/
|
||||||
export const getPlayer = (query: string): Promise<Player> => {
|
export const getPlayer = (query: string): Promise<Player> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
resolve({
|
const response: Response = await fetch(`${ENDPOINT}/player/${query}`); // Request the player
|
||||||
uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f",
|
resolve((await response.json()) as Player); // Resolve the player
|
||||||
username: "Rainnny",
|
|
||||||
skin: {
|
|
||||||
url: "",
|
|
||||||
model: "default",
|
|
||||||
legacy: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user