CI additions and tests

This commit is contained in:
Nicholas Keller
2026-01-11 05:19:44 +00:00
parent d661e5b04c
commit ffb8eb5ed1
7 changed files with 260 additions and 79 deletions
+41 -30
View File
@@ -1,35 +1,46 @@
import fetch from 'node-fetch';
const BASE = 'https://mcprofile.io/api/v1';
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();
}
}
getPlayerByUsername: async (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 (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();
}
}
getPlayerByUsername: async (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 (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 (fuid) => {
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}
export default { java, bedrock };