insomnia-plugin-valorant
Version:
Adds template tags to Insomnia with Valorant data
25 lines • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentGameMatchId = void 0;
const node_fetch_1 = __importDefault(require("node-fetch"));
async function getCurrentGameMatchId(shard, region, puuid, clientVersion, clientPlatform, accessToken, entitlement) {
const response = await (0, node_fetch_1.default)(`https://glz-${region}-1.${shard}.a.pvp.net/core-game/v1/players/${puuid}`, {
headers: {
'Authorization': 'Bearer ' + accessToken,
'X-Riot-Entitlements-JWT': entitlement,
'X-Riot-ClientVersion': clientVersion,
'X-Riot-ClientPlatform': clientPlatform,
'User-Agent': ''
},
});
if (response.status === 404)
throw new Error('Player is not in an active match (after the agent select screen)');
if (!response.ok)
throw new Error(`Failed to get current game match ID: ${response.status} ${response.statusText} - ${await response.text()}`);
return (await response.json())['MatchID'];
}
exports.getCurrentGameMatchId = getCurrentGameMatchId;
//# sourceMappingURL=get-current-game-match-id.js.map