v1.0.1
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
package-lock.json
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
export interface JavaUser {
|
||||
username: string,
|
||||
uuid: string,
|
||||
skin: string,
|
||||
cape: string,
|
||||
linked: boolean,
|
||||
bedrock_gamertag?: string,
|
||||
bedrock_xuid?: number,
|
||||
bedrock_fuid?: string
|
||||
}
|
||||
|
||||
export interface BedrockUser {
|
||||
gamertag: string,
|
||||
xuid: string,
|
||||
floodgateuid: string,
|
||||
icon: string,
|
||||
gamescore: string,
|
||||
accounttier: string,
|
||||
textureid: string,
|
||||
skin: string,
|
||||
linked: boolean,
|
||||
java_uuid?: string,
|
||||
java_name?: string
|
||||
}
|
||||
|
||||
export const java: {
|
||||
getPlayerByUsername(username: string): Promise<JavaUser>;
|
||||
getPlayerByUUID(uuid: string): Promise<JavaUser>;
|
||||
};
|
||||
|
||||
export const bedrock: {
|
||||
getPlayerByUsername(gamertag: string): Promise<BedrockUser>;
|
||||
getPlayerByXUID(xuid: string): Promise<BedrockUser>;
|
||||
getPlayerByFUID(fuid: string): Promise<BedrockUser>;
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import fetch from 'node-fetch';
|
||||
const BASE = 'https://mcprofile.io/api/v1';
|
||||
|
||||
export const java = {
|
||||
getPlayerByUsername: async function(username) {
|
||||
const response = await fetch(`${BASE}/java/username/${encodeURIComponent(username)}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch profile');
|
||||
return response.json();
|
||||
},
|
||||
getPlayerByUUID: async function(uuid) {
|
||||
const response = await fetch(`${BASE}/java/uuid/${encodeURIComponent(uuid)}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch profile');
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
export const bedrock = {
|
||||
getPlayerByUsername: async function(gamertag) {
|
||||
const response = await fetch(`${BASE}/bedrock/gamertag/${encodeURIComponent(gamertag)}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch profile');
|
||||
return response.json();
|
||||
},
|
||||
getPlayerByXUID: async function(xuid) {
|
||||
const response = await fetch(`${BASE}/bedrock/xuid/${encodeURIComponent(xuid)}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch profile');
|
||||
return response.json();
|
||||
},
|
||||
getPlayerByFUID: async function(xuid) {
|
||||
const response = await fetch(`${BASE}/bedrock/fuid/${encodeURIComponent(fuid)}`);
|
||||
if (!response.ok) throw new Error('Failed to fetch profile');
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
export default {java, bedrock}
|
||||
+7
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mcprofile",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Connect to mcprofile.io",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -18,5 +18,10 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/profilelag/mcprofile/issues"
|
||||
},
|
||||
"homepage": "https://github.com/profilelag/mcprofile#readme"
|
||||
"homepage": "https://github.com/profilelag/mcprofile#readme",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"node-fetch": "^3.3.2"
|
||||
},
|
||||
"types": "index.d.ts"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user