diff --git a/Lib/.gitignore b/Lib/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/Lib/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Lib/README.md b/Lib/README.md new file mode 100644 index 0000000..90c0f16 --- /dev/null +++ b/Lib/README.md @@ -0,0 +1 @@ +# Lib \ No newline at end of file diff --git a/Lib/build.mjs b/Lib/build.mjs new file mode 100644 index 0000000..9f65438 --- /dev/null +++ b/Lib/build.mjs @@ -0,0 +1,8 @@ +import dts from "bun-plugin-dts"; + +await Bun.build({ + entrypoints: ["./src/index.ts"], + outdir: "./dist", + minify: true, + plugins: [dts()], +}); diff --git a/Lib/bun.lockb b/Lib/bun.lockb new file mode 100644 index 0000000..a235c21 Binary files /dev/null and b/Lib/bun.lockb differ diff --git a/Lib/dist/index.d.ts b/Lib/dist/index.d.ts new file mode 100644 index 0000000..e2ecb49 --- /dev/null +++ b/Lib/dist/index.d.ts @@ -0,0 +1,46 @@ +// Generated by dts-bundle-generator v9.3.1 + +export type Player = { + /** + * The unique id of this player. + */ + uniqueId: string; + /** + * The username of this player. + */ + username: string; + /** + * The skin of this player. + */ + skin: Skin; +}; +/** + * A skin for a {@link Player}. + */ +export type Skin = { + /** + * The texture URL of this skin. + */ + url: string; + /** + * The model of this skin. + */ + model: Model; + /** + * Is this skin legacy? + */ + legacy: boolean; +}; +/** + * Possible models for a skin. + */ +export type Model = "default" | "slim"; +/** + * Get a player by their username or UUID. + * + * @param query the query to search for the player by + * @returns the promised player + */ +export declare const getPlayer: (query: string) => Promise; + +export {}; diff --git a/Lib/dist/index.js b/Lib/dist/index.js new file mode 100644 index 0000000..05d2ac6 --- /dev/null +++ b/Lib/dist/index.js @@ -0,0 +1 @@ +var d=(a)=>{return new Promise((p,b)=>{p({uniqueId:"fc1d5fe7-f29b-430d-80bb-3b093a638b0f",username:"Rainnny",skin:{url:"",model:"default",legacy:!1}})})};export{d as getPlayer}; diff --git a/Lib/package.json b/Lib/package.json new file mode 100644 index 0000000..958252f --- /dev/null +++ b/Lib/package.json @@ -0,0 +1,40 @@ +{ + "name": "restfulmc", + "version": "1.0.0", + "author": "Braydon (Rainnny) ", + "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" + } +} diff --git a/Lib/src/index.d.ts b/Lib/src/index.d.ts new file mode 100644 index 0000000..dd0d3c1 --- /dev/null +++ b/Lib/src/index.d.ts @@ -0,0 +1 @@ +export * from "./types/player"; diff --git a/Lib/src/index.ts b/Lib/src/index.ts new file mode 100644 index 0000000..d0ed23a --- /dev/null +++ b/Lib/src/index.ts @@ -0,0 +1 @@ +export * from "./lib/restfulmc"; diff --git a/Lib/src/lib/restfulmc.ts b/Lib/src/lib/restfulmc.ts new file mode 100644 index 0000000..0527ba6 --- /dev/null +++ b/Lib/src/lib/restfulmc.ts @@ -0,0 +1,21 @@ +import type { Player } from "../types/player"; + +/** + * Get a player by their username or UUID. + * + * @param query the query to search for the player by + * @returns the promised player + */ +export const getPlayer = (query: string): Promise => { + return new Promise((resolve, reject) => { + resolve({ + uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f", + username: "Rainnny", + skin: { + url: "", + model: "default", + legacy: false, + }, + }); + }); +}; diff --git a/Lib/src/types/player.d.ts b/Lib/src/types/player.d.ts new file mode 100644 index 0000000..87c4153 --- /dev/null +++ b/Lib/src/types/player.d.ts @@ -0,0 +1,41 @@ +export type Player = { + /** + * The unique id of this player. + */ + uniqueId: string; + + /** + * The username of this player. + */ + username: string; + + /** + * The skin of this player. + */ + skin: Skin; +} + +/** + * A skin for a {@link Player}. + */ +type Skin = { + /** + * The texture URL of this skin. + */ + url: string; + + /** + * The model of this skin. + */ + model: Model; + + /** + * Is this skin legacy? + */ + legacy: boolean; +} + +/** + * Possible models for a skin. + */ +type Model = "default" | "slim"; diff --git a/Lib/tsconfig.json b/Lib/tsconfig.json new file mode 100644 index 0000000..90f2f8f --- /dev/null +++ b/Lib/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "esnext", + "strict": true, + "esModuleInterop": true, + "moduleResolution": "node", + "skipLibCheck": true, + "noUnusedLocals": true, + "noImplicitAny": true, + "allowJs": true, + "noEmit": true, + "outDir": "dist", + "resolveJsonModule": true + } +}