functional lib

This commit is contained in:
Braydon 2024-04-14 14:03:02 -04:00
parent 9f0d85cf5b
commit 1968f835fd
3 changed files with 40 additions and 48 deletions

Binary file not shown.

@ -1,40 +1,37 @@
{
"name": "restfulmc",
"version": "1.0.0",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
"keywords": [
"java",
"minecraft",
"json",
"rest-api",
"restful",
"bedrock",
"springboot"
],
"homepage": "https://github.com/Rainnny7/RESTfulMC",
"repository": {
"type": "git",
"url": "git+https://github.com/Rainnny7/RESTfulMC.git"
},
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "bun run build.mjs",
"prepublishOnly": "bun run build"
},
"files": [
"dist"
],
"devDependencies": {
"@types/bun": "latest",
"bun-plugin-dts": "^0.2.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"axios": "^1.6.8"
}
"name": "restfulmc",
"version": "1.0.4",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
"keywords": [
"java",
"minecraft",
"json",
"rest-api",
"restful",
"bedrock",
"springboot"
],
"homepage": "https://github.com/Rainnny7/RESTfulMC",
"repository": {
"type": "git",
"url": "git+https://github.com/Rainnny7/RESTfulMC.git"
},
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "bun run build.mjs",
"prepublishOnly": "bun run build"
},
"files": [
"dist"
],
"devDependencies": {
"@types/bun": "latest",
"bun-plugin-dts": "^0.2.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}

@ -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
});
};