This commit is contained in:
47
frontend/dist-electron/services/steam.js
Normal file
47
frontend/dist-electron/services/steam.js
Normal file
@@ -0,0 +1,47 @@
|
||||
"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;
|
||||
Reference in New Issue
Block a user