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",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.4",
|
||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
|
||||
"keywords": [
|
||||
@ -33,8 +33,5 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
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.
|
||||
*
|
||||
@ -7,15 +9,8 @@ import type { Player } from "../types/player";
|
||||
* @returns the promised player
|
||||
*/
|
||||
export const getPlayer = (query: string): Promise<Player> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f",
|
||||
username: "Rainnny",
|
||||
skin: {
|
||||
url: "",
|
||||
model: "default",
|
||||
legacy: false,
|
||||
},
|
||||
});
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const response: Response = await fetch(`${ENDPOINT}/player/${query}`); // Request the player
|
||||
resolve((await response.json()) as Player); // Resolve the player
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user