Files
ultimate-ban-tracker/frontend/dist-electron/services/steam.js
Nils Pukropp 64fe49e58e
Some checks failed
Build and Release / build (push) Has been cancelled
init
2026-02-21 01:48:48 +01:00

48 lines
1.7 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveVanityURL = exports.getPlayerBans = exports.getPlayerSummaries = void 0;
const axios_1 = __importDefault(require("axios"));
const BASE_URL = 'https://api.steampowered.com';
const getPlayerSummaries = async (apiKey, steamIds) => {
if (!apiKey)
throw new Error('STEAM_API_KEY is not defined');
const response = await axios_1.default.get(`${BASE_URL}/ISteamUser/GetPlayerSummaries/v2/`, {
params: {
key: apiKey,
steamids: steamIds.join(',')
}
});
return response.data.response.players;
};
exports.getPlayerSummaries = getPlayerSummaries;
const getPlayerBans = async (apiKey, steamIds) => {
if (!apiKey)
throw new Error('STEAM_API_KEY is not defined');
const response = await axios_1.default.get(`${BASE_URL}/ISteamUser/GetPlayerBans/v1/`, {
params: {
key: apiKey,
steamids: steamIds.join(',')
}
});
return response.data.players;
};
exports.getPlayerBans = getPlayerBans;
const resolveVanityURL = async (apiKey, vanityUrl) => {
if (!apiKey)
throw new Error('STEAM_API_KEY is not defined');
const response = await axios_1.default.get(`${BASE_URL}/ISteamUser/ResolveVanityURL/v1/`, {
params: {
key: apiKey,
vanityurl: vanityUrl
}
});
if (response.data.response.success === 1) {
return response.data.response.steamid;
}
return null;
};
exports.resolveVanityURL = resolveVanityURL;