diff --git a/package-lock.json b/package-lock.json index 0197613..de25935 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "csso": "^5.0.5", "eslint": "^9.24.0", "express": "^4.21.2", - "express-rate-limit": "^7.5.0", "express-session": "^1.18.1", "glob": "^11.0.1", "globals": "^16.0.0", @@ -1817,21 +1816,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/express-rate-limit": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.0.tgz", - "integrity": "sha512-eB5zbQh5h+VenMPM3fh+nw1YExi5nMr6HUCR62ELSP11huvxm/Uir1H1QEyTkk5QX6A58pX6NmaTMceKZ0Eodg==", - "license": "MIT", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/express-rate-limit" - }, - "peerDependencies": { - "express": "^4.11 || 5 || ^5.0.0-beta.1" - } - }, "node_modules/express-session": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz", diff --git a/package.json b/package.json index 8842825..13a7c08 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "csso": "^5.0.5", "eslint": "^9.24.0", "express": "^4.21.2", - "express-rate-limit": "^7.5.0", "express-session": "^1.18.1", "glob": "^11.0.1", "globals": "^16.0.0", diff --git a/src/js/index.d.ts b/src/js/index.d.ts index 619c464..9ddefde 100644 --- a/src/js/index.d.ts +++ b/src/js/index.d.ts @@ -1,123 +1,181 @@ declare enum platforms { - All = "all", - Activision = "acti", - Battlenet = "battle", - PSN = "psn", - Steam = "steam", - Uno = "uno", - XBOX = "xbl", - ios = "ios", - NULL = "_" + All = 'all', + Activision = 'acti', + Battlenet = 'battle', + PSN = 'psn', + Steam = 'steam', + Uno = 'uno', + XBOX = 'xbl', + ios = 'ios', + NULL = '_', } declare enum games { - ModernWarfare = "mw", - ModernWarfare2 = "mw2", - Vanguard = "vg", - ColdWar = "cw", - NULL = "_" + ModernWarfare = 'mw', + ModernWarfare2 = 'mw2', + Vanguard = 'vg', + ColdWar = 'cw', + NULL = '_', } declare enum friendActions { - Invite = "invite", - Uninvite = "uninvite", - Remove = "remove", - Block = "block", - Unblock = "unblock" + Invite = 'invite', + Uninvite = 'uninvite', + Remove = 'remove', + Block = 'block', + Unblock = 'unblock', } declare const enableDebugMode: () => boolean; declare const disableDebugMode: () => boolean; declare const login: (ssoToken: string) => boolean; -declare const telescopeLogin: (username: string, password: string) => Promise; +declare const telescopeLogin: ( + username: string, + password: string +) => Promise; declare class WZ { - fullData: (gamertag: string, platform: platforms) => Promise; - combatHistory: (gamertag: string, platform: platforms) => Promise; - combatHistoryWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - breakdown: (gamertag: string, platform: platforms) => Promise; - breakdownWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - matchInfo: (matchId: string, platform: platforms) => Promise; - cleanGameMode: (mode: string) => Promise; + fullData: (gamertag: string, platform: platforms) => Promise; + combatHistory: (gamertag: string, platform: platforms) => Promise; + combatHistoryWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + breakdown: (gamertag: string, platform: platforms) => Promise; + breakdownWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + matchInfo: (matchId: string, platform: platforms) => Promise; + cleanGameMode: (mode: string) => Promise; } declare class MW { - fullData: (gamertag: string, platform: platforms) => Promise; - combatHistory: (gamertag: string, platform: platforms) => Promise; - combatHistoryWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - breakdown: (gamertag: string, platform: platforms) => Promise; - breakdownWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - matchInfo: (matchId: string, platform: platforms) => Promise; - matchHeatMap: (matchId: string, platform: platforms) => Promise; - seasonloot: (gamertag: string, platform: platforms) => Promise; - bpProg: (gamertag: string, platform: platforms) => Promise; - bundleInfo: (gamertag: string, platform: platforms) => Promise; - mapList: (platform: platforms) => Promise; - communityMapDataForMapMode: (mapId: string, gamemode: string, platform: platforms) => Promise; + fullData: (gamertag: string, platform: platforms) => Promise; + combatHistory: (gamertag: string, platform: platforms) => Promise; + combatHistoryWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + breakdown: (gamertag: string, platform: platforms) => Promise; + breakdownWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + matchInfo: (matchId: string, platform: platforms) => Promise; + matchHeatMap: (matchId: string, platform: platforms) => Promise; + seasonloot: (gamertag: string, platform: platforms) => Promise; + bpProg: (gamertag: string, platform: platforms) => Promise; + bundleInfo: (gamertag: string, platform: platforms) => Promise; + mapList: (platform: platforms) => Promise; + communityMapDataForMapMode: ( + mapId: string, + gamemode: string, + platform: platforms + ) => Promise; } declare class MW2 { - fullData: (unoId: string) => Promise; - matches: (unoId: string) => Promise; - matchInfo: (unoId: string, matchId: string) => Promise; + fullData: (unoId: string) => Promise; + matches: (unoId: string) => Promise; + matchInfo: (unoId: string, matchId: string) => Promise; } declare class WZ2 { - fullData: (unoId: string) => Promise; - matches: (unoId: string) => Promise; - matchInfo: (unoId: string, matchId: string) => Promise; + fullData: (unoId: string) => Promise; + matches: (unoId: string) => Promise; + matchInfo: (unoId: string, matchId: string) => Promise; } declare class MW3 { - fullData: (unoId: string) => Promise; - matches: (unoId: string) => Promise; - matchInfo: (unoId: string, matchId: string) => Promise; + fullData: (unoId: string) => Promise; + matches: (unoId: string) => Promise; + matchInfo: (unoId: string, matchId: string) => Promise; } declare class WZM { - fullData: (unoId: string) => Promise; - matches: (unoId: string) => Promise; - matchInfo: (unoId: string, matchId: string) => Promise; + fullData: (unoId: string) => Promise; + matches: (unoId: string) => Promise; + matchInfo: (unoId: string, matchId: string) => Promise; } declare class CW { - fullData: (gamertag: string, platform: platforms) => Promise; - combatHistory: (gamertag: string, platform: platforms) => Promise; - combatHistoryWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - breakdown: (gamertag: string, platform: platforms) => Promise; - breakdownWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - seasonloot: (gamertag: string, platform: platforms) => Promise; - bpProg: (gamertag: string, platform: platforms) => Promise; - bundleInfo: (gamertag: string, platform: platforms) => Promise; - mapList: (platform: platforms) => Promise; - matchInfo: (matchId: string, platform: platforms) => Promise; - matchHeatMap: (matchId: string, platform: platforms) => Promise; + fullData: (gamertag: string, platform: platforms) => Promise; + combatHistory: (gamertag: string, platform: platforms) => Promise; + combatHistoryWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + breakdown: (gamertag: string, platform: platforms) => Promise; + breakdownWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + seasonloot: (gamertag: string, platform: platforms) => Promise; + bpProg: (gamertag: string, platform: platforms) => Promise; + bundleInfo: (gamertag: string, platform: platforms) => Promise; + mapList: (platform: platforms) => Promise; + matchInfo: (matchId: string, platform: platforms) => Promise; + matchHeatMap: (matchId: string, platform: platforms) => Promise; } declare class VG { - fullData: (gamertag: string, platform: platforms) => Promise; - combatHistory: (gamertag: string, platform: platforms) => Promise; - combatHistoryWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - breakdown: (gamertag: string, platform: platforms) => Promise; - breakdownWithDate: (gamertag: string, startTime: number, endTime: number, platform: platforms) => Promise; - seasonloot: (gamertag: string, platform: platforms) => Promise; - bpProg: (gamertag: string, platform: platforms) => Promise; - bundleInfo: (gamertag: string, platform: platforms) => Promise; - mapList: (platform: platforms) => Promise; - matchInfo: (matchId: string, platform: platforms) => Promise; - matchHeatMap: (matchId: string, platform: platforms) => Promise; + fullData: (gamertag: string, platform: platforms) => Promise; + combatHistory: (gamertag: string, platform: platforms) => Promise; + combatHistoryWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + breakdown: (gamertag: string, platform: platforms) => Promise; + breakdownWithDate: ( + gamertag: string, + startTime: number, + endTime: number, + platform: platforms + ) => Promise; + seasonloot: (gamertag: string, platform: platforms) => Promise; + bpProg: (gamertag: string, platform: platforms) => Promise; + bundleInfo: (gamertag: string, platform: platforms) => Promise; + mapList: (platform: platforms) => Promise; + matchInfo: (matchId: string, platform: platforms) => Promise; + matchHeatMap: (matchId: string, platform: platforms) => Promise; } declare class SHOP { - purchasableItems: (gameId: string) => Promise; - bundleInformation: (title: string, bundleId: string) => Promise; - battlePassLoot: (title: games, season: number, platform: platforms) => Promise; + purchasableItems: (gameId: string) => Promise; + bundleInformation: (title: string, bundleId: string) => Promise; + battlePassLoot: ( + title: games, + season: number, + platform: platforms + ) => Promise; } declare class USER { - friendFeed: (gamertag: string, platform: platforms) => Promise; - eventFeed: () => Promise; - loggedInIdentities: () => Promise; - userInfo: () => Promise; - codPoints: (gamertag: string, platform: platforms) => Promise; - connectedAccounts: (gamertag: string, platform: platforms) => Promise; - settings: (gamertag: string, platform: platforms) => Promise; - friendAction: (gamertag: string, platform: platforms, action: friendActions) => Promise; + friendFeed: (gamertag: string, platform: platforms) => Promise; + eventFeed: () => Promise; + loggedInIdentities: () => Promise; + userInfo: () => Promise; + codPoints: (gamertag: string, platform: platforms) => Promise; + connectedAccounts: ( + gamertag: string, + platform: platforms + ) => Promise; + settings: (gamertag: string, platform: platforms) => Promise; + friendAction: ( + gamertag: string, + platform: platforms, + action: friendActions + ) => Promise; } declare class DB { - accolades: () => Promise; - allCDNData: () => Promise; + accolades: () => Promise; + allCDNData: () => Promise; } declare class ALT { - search: (gamertag: string, platform: platforms) => Promise; - cleanWeapon: (weapon: string) => Promise; + search: (gamertag: string, platform: platforms) => Promise; + cleanWeapon: (weapon: string) => Promise; } declare const Warzone: WZ; declare const ModernWarfare: MW; @@ -131,4 +189,23 @@ declare const Store: SHOP; declare const Me: USER; declare const CDN: DB; declare const Misc: ALT; -export { CDN, ColdWar, disableDebugMode, enableDebugMode, friendActions, login, Me, Misc, ModernWarfare, ModernWarfare2, ModernWarfare3, platforms, Store, telescopeLogin, Vanguard, Warzone, Warzone2, WarzoneMobile, }; +export { + CDN, + ColdWar, + disableDebugMode, + enableDebugMode, + friendActions, + login, + Me, + Misc, + ModernWarfare, + ModernWarfare2, + ModernWarfare3, + platforms, + Store, + telescopeLogin, + Vanguard, + Warzone, + Warzone2, + WarzoneMobile, +}; diff --git a/src/js/index.js b/src/js/index.js index bffc553..d498bda 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,35 +1,59 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WarzoneMobile = exports.Warzone2 = exports.Warzone = exports.Vanguard = exports.telescopeLogin = exports.Store = exports.platforms = exports.ModernWarfare3 = exports.ModernWarfare2 = exports.ModernWarfare = exports.Misc = exports.Me = exports.login = exports.friendActions = exports.enableDebugMode = exports.disableDebugMode = exports.ColdWar = exports.CDN = void 0; -const tslib_1 = require("tslib"); -const undici_1 = require("undici"); -const game_modes_json_1 = tslib_1.__importDefault(require("../data/game-modes.json")); -const weapon_ids_json_1 = tslib_1.__importDefault(require("../data/weapon-ids.json")); -const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'; +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.WarzoneMobile = + exports.Warzone2 = + exports.Warzone = + exports.Vanguard = + exports.telescopeLogin = + exports.Store = + exports.platforms = + exports.ModernWarfare3 = + exports.ModernWarfare2 = + exports.ModernWarfare = + exports.Misc = + exports.Me = + exports.login = + exports.friendActions = + exports.enableDebugMode = + exports.disableDebugMode = + exports.ColdWar = + exports.CDN = + void 0; +const tslib_1 = require('tslib'); +const undici_1 = require('undici'); +const game_modes_json_1 = tslib_1.__importDefault( + require('../data/game-modes.json') +); +const weapon_ids_json_1 = tslib_1.__importDefault( + require('../data/weapon-ids.json') +); +const userAgent = + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'; let baseCookie = 'new_SiteId=cod;ACT_SSO_LOCALE=en_US;country=US;'; let baseSsoToken = ''; let debugMode = false; let baseHeaders = { - 'content-type': 'application/json', - cookie: baseCookie, - 'user-agent': userAgent, + 'content-type': 'application/json', + cookie: baseCookie, + 'user-agent': userAgent, }; let baseTelescopeHeaders = { - accept: 'application/json, text/plain, */*', - 'accept-language': 'en-GB,en;q=0.9,en-US;q=0.8,fr;q=0.7,nl;q=0.6,et;q=0.5', - 'cache-control': 'no-cache', - pragma: 'no-cache', - 'sec-ch-ua': '"Chromium";v="118", "Microsoft Edge";v="118", "Not=A?Brand";v="99"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'sec-fetch-dest': 'empty', - 'sec-fetch-mode': 'cors', - 'sec-fetch-site': 'same-site', + accept: 'application/json, text/plain, */*', + 'accept-language': 'en-GB,en;q=0.9,en-US;q=0.8,fr;q=0.7,nl;q=0.6,et;q=0.5', + 'cache-control': 'no-cache', + pragma: 'no-cache', + 'sec-ch-ua': + '"Chromium";v="118", "Microsoft Edge";v="118", "Not=A?Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"Windows"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'same-site', }; let basePostHeaders = { - 'content-type': 'text/plain', - cookie: baseCookie, - 'user-agent': userAgent, + 'content-type': 'text/plain', + cookie: baseCookie, + 'user-agent': userAgent, }; let baseUrl = 'https://profile.callofduty.com'; let baseUrlTrunc = 'https://www.callofduty.com'; @@ -39,951 +63,1441 @@ let apiTelescopePath = '/api/ts-api'; let loggedIn = false; var platforms; (function (platforms) { - platforms["All"] = "all"; - platforms["Activision"] = "acti"; - platforms["Battlenet"] = "battle"; - platforms["PSN"] = "psn"; - platforms["Steam"] = "steam"; - platforms["Uno"] = "uno"; - platforms["XBOX"] = "xbl"; - platforms["ios"] = "ios"; - platforms["NULL"] = "_"; + platforms['All'] = 'all'; + platforms['Activision'] = 'acti'; + platforms['Battlenet'] = 'battle'; + platforms['PSN'] = 'psn'; + platforms['Steam'] = 'steam'; + platforms['Uno'] = 'uno'; + platforms['XBOX'] = 'xbl'; + platforms['ios'] = 'ios'; + platforms['NULL'] = '_'; })(platforms || (exports.platforms = platforms = {})); var games; (function (games) { - games["ModernWarfare"] = "mw"; - games["ModernWarfare2"] = "mw2"; - games["Vanguard"] = "vg"; - games["ColdWar"] = "cw"; - games["NULL"] = "_"; + games['ModernWarfare'] = 'mw'; + games['ModernWarfare2'] = 'mw2'; + games['Vanguard'] = 'vg'; + games['ColdWar'] = 'cw'; + games['NULL'] = '_'; })(games || (games = {})); var telescopeGames; (function (telescopeGames) { - telescopeGames["ModernWarfare2"] = "mw2"; - telescopeGames["Warzone2"] = "wz2"; - telescopeGames["ModernWarfare3"] = "jup"; - telescopeGames["Mobile"] = "mgl"; + telescopeGames['ModernWarfare2'] = 'mw2'; + telescopeGames['Warzone2'] = 'wz2'; + telescopeGames['ModernWarfare3'] = 'jup'; + telescopeGames['Mobile'] = 'mgl'; })(telescopeGames || (telescopeGames = {})); var modes; (function (modes) { - modes["Multiplayer"] = "mp"; - modes["Warzone"] = "wz"; - modes["Warzone2"] = "wz2"; - modes["NULL"] = "_"; + modes['Multiplayer'] = 'mp'; + modes['Warzone'] = 'wz'; + modes['Warzone2'] = 'wz2'; + modes['NULL'] = '_'; })(modes || (modes = {})); var telescopeModes; (function (telescopeModes) { - telescopeModes["Multiplayer"] = "mp"; - telescopeModes["Outbreak"] = "ob"; + telescopeModes['Multiplayer'] = 'mp'; + telescopeModes['Outbreak'] = 'ob'; })(telescopeModes || (telescopeModes = {})); var friendActions; (function (friendActions) { - friendActions["Invite"] = "invite"; - friendActions["Uninvite"] = "uninvite"; - friendActions["Remove"] = "remove"; - friendActions["Block"] = "block"; - friendActions["Unblock"] = "unblock"; + friendActions['Invite'] = 'invite'; + friendActions['Uninvite'] = 'uninvite'; + friendActions['Remove'] = 'remove'; + friendActions['Block'] = 'block'; + friendActions['Unblock'] = 'unblock'; })(friendActions || (exports.friendActions = friendActions = {})); var generics; (function (generics) { - generics["STEAM_UNSUPPORTED"] = "Steam platform not supported by this game. Try `battle` instead."; - generics["UNO_NO_NUMERICAL_ID"] = "You must use a numerical ID when using the platform 'uno'.\nIf using an Activision ID, please use the platform 'acti'."; + generics['STEAM_UNSUPPORTED'] = + 'Steam platform not supported by this game. Try `battle` instead.'; + generics['UNO_NO_NUMERICAL_ID'] = + "You must use a numerical ID when using the platform 'uno'.\nIf using an Activision ID, please use the platform 'acti'."; })(generics || (generics = {})); let telescopeUnoToken = ''; const enableDebugMode = () => (debugMode = true); exports.enableDebugMode = enableDebugMode; const disableDebugMode = () => (debugMode = false); exports.disableDebugMode = disableDebugMode; -const sendTelescopeRequest = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { +const sendTelescopeRequest = (url) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In!'); - let requestUrl = `${baseTelescopeUrl}${apiTelescopePath}${url}`; - if (debugMode) - console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); - baseTelescopeHeaders.authorization = `Bearer ${telescopeUnoToken}`; - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - headers: baseTelescopeHeaders, - }); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - let response = yield body.json(); - return response; + if (!loggedIn) throw new Error('Not Logged In!'); + let requestUrl = `${baseTelescopeUrl}${apiTelescopePath}${url}`; + if (debugMode) console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); + baseTelescopeHeaders.authorization = `Bearer ${telescopeUnoToken}`; + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + headers: baseTelescopeHeaders, + }); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + let response = yield body.json(); + return response; + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); -const sendRequest = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + }); +const sendRequest = (url) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In.'); - let requestUrl = `${baseUrl}${apiPath}${url}`; - if (debugMode) - console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); - if (debugMode) - console.time('Round Trip'); - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - headers: baseHeaders, - }); - if (debugMode) - console.timeEnd('Round Trip'); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - let response = yield body.json(); - if (debugMode) - console.log(`[DEBUG]`, `Body Size: ${JSON.stringify(response).length} bytes.`); - return response; + if (!loggedIn) throw new Error('Not Logged In.'); + let requestUrl = `${baseUrl}${apiPath}${url}`; + if (debugMode) console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); + if (debugMode) console.time('Round Trip'); + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + headers: baseHeaders, + }); + if (debugMode) console.timeEnd('Round Trip'); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + let response = yield body.json(); + if (debugMode) + console.log( + `[DEBUG]`, + `Body Size: ${JSON.stringify(response).length} bytes.` + ); + return response; + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); -const sendRequestCDN = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + }); +const sendRequestCDN = (url) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In.'); - let requestUrl = `${baseUrl}${url}`; - if (debugMode) - console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); - if (debugMode) - console.time('Round Trip'); - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - headers: baseHeaders, - }); - if (debugMode) - console.timeEnd('Round Trip'); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - let response = yield body.json(); - if (debugMode) - console.log(`[DEBUG]`, `Body Size: ${JSON.stringify(response).length} bytes.`); - return response; + if (!loggedIn) throw new Error('Not Logged In.'); + let requestUrl = `${baseUrl}${url}`; + if (debugMode) console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); + if (debugMode) console.time('Round Trip'); + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + headers: baseHeaders, + }); + if (debugMode) console.timeEnd('Round Trip'); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + let response = yield body.json(); + if (debugMode) + console.log( + `[DEBUG]`, + `Body Size: ${JSON.stringify(response).length} bytes.` + ); + return response; + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); -const sendRequestCustom = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + }); +const sendRequestCustom = (url) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In.'); - let requestUrl = `${baseUrlTrunc}${apiPath}${url}`; - if (debugMode) - console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); - if (debugMode) - console.time('Round Trip'); - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - headers: baseHeaders, - }); - if (debugMode) - console.timeEnd('Round Trip'); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - let response = yield body.json(); - if (debugMode) - console.log(`[DEBUG]`, `Body Size: ${JSON.stringify(response).length} bytes.`); - return response; + if (!loggedIn) throw new Error('Not Logged In.'); + let requestUrl = `${baseUrlTrunc}${apiPath}${url}`; + if (debugMode) console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); + if (debugMode) console.time('Round Trip'); + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + headers: baseHeaders, + }); + if (debugMode) console.timeEnd('Round Trip'); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + let response = yield body.json(); + if (debugMode) + console.log( + `[DEBUG]`, + `Body Size: ${JSON.stringify(response).length} bytes.` + ); + return response; + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); -const sendRequestUserInfo = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + }); +const sendRequestUserInfo = (url) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In.'); - let requestUrl = `${baseUrl}${url}`; - if (debugMode) - console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); - if (debugMode) - console.time('Round Trip'); - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - headers: baseHeaders, - }); - if (debugMode) - console.timeEnd('Round Trip'); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - // Get the response as text first - let responseText = yield body.text(); - // Check if this is a JSONP response (contains function wrapper) - if (responseText.startsWith('userInfo(') && responseText.endsWith(');')) { - // Extract the JSON data from between the parentheses - const jsonData = responseText.replace(/^userInfo\(|\);$/g, ''); - return JSON.parse(jsonData); - } - else { - // Regular JSON response - return JSON.parse(responseText); - } + if (!loggedIn) throw new Error('Not Logged In.'); + let requestUrl = `${baseUrl}${url}`; + if (debugMode) console.log(`[DEBUG]`, `Request Uri: ${requestUrl}`); + if (debugMode) console.time('Round Trip'); + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + headers: baseHeaders, + }); + if (debugMode) console.timeEnd('Round Trip'); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + // Get the response as text first + let responseText = yield body.text(); + // Check if this is a JSONP response (contains function wrapper) + if (responseText.startsWith('userInfo(') && responseText.endsWith(');')) { + // Extract the JSON data from between the parentheses + const jsonData = responseText.replace(/^userInfo\(|\);$/g, ''); + return JSON.parse(jsonData); + } else { + // Regular JSON response + return JSON.parse(responseText); + } + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); -const sendPostRequest = (url, data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + }); +const sendPostRequest = (url, data) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { - if (!loggedIn) - throw new Error('Not Logged In.'); - let requestUrl = `${baseUrl}${apiPath}${url}`; - const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { - method: 'POST', - headers: basePostHeaders, - body: data, - }); - if (statusCode >= 500) - throw new Error(`Received status code: '${statusCode}'. Route may be down or not exist.`); - let response = yield body.json(); - return response; + if (!loggedIn) throw new Error('Not Logged In.'); + let requestUrl = `${baseUrl}${apiPath}${url}`; + const { body, statusCode } = yield (0, undici_1.request)(requestUrl, { + method: 'POST', + headers: basePostHeaders, + body: data, + }); + if (statusCode >= 500) + throw new Error( + `Received status code: '${statusCode}'. Route may be down or not exist.` + ); + let response = yield body.json(); + return response; + } catch (exception) { + throw exception; } - catch (exception) { - throw exception; - } -}); + }); const cleanClientName = (gamertag) => { - return encodeURIComponent(gamertag); + return encodeURIComponent(gamertag); }; const login = (ssoToken) => { - if (!ssoToken || ssoToken.trim().length <= 0) - return false; - let fakeXSRF = '68e8b62e-1d9d-4ce1-b93f-cbe5ff31a041'; - baseHeaders['X-XSRF-TOKEN'] = fakeXSRF; - baseHeaders['X-CSRF-TOKEN'] = fakeXSRF; - baseHeaders['Atvi-Auth'] = ssoToken; - baseHeaders['ACT_SSO_COOKIE'] = ssoToken; - baseHeaders['atkn'] = ssoToken; - baseHeaders['cookie'] = - `${baseCookie}ACT_SSO_COOKIE=${ssoToken};XSRF-TOKEN=${fakeXSRF};API_CSRF_TOKEN=${fakeXSRF};ACT_SSO_EVENT="LOGIN_SUCCESS:1644346543228";ACT_SSO_COOKIE_EXPIRY=1645556143194;comid=cod;ssoDevId=63025d09c69f47dfa2b8d5520b5b73e4;tfa_enrollment_seen=true;gtm.custom.bot.flag=human;`; - baseSsoToken = ssoToken; - basePostHeaders['X-XSRF-TOKEN'] = fakeXSRF; - basePostHeaders['X-CSRF-TOKEN'] = fakeXSRF; - basePostHeaders['Atvi-Auth'] = ssoToken; - basePostHeaders['ACT_SSO_COOKIE'] = ssoToken; - basePostHeaders['atkn'] = ssoToken; - basePostHeaders['cookie'] = - `${baseCookie}ACT_SSO_COOKIE=${ssoToken};XSRF-TOKEN=${fakeXSRF};API_CSRF_TOKEN=${fakeXSRF};ACT_SSO_EVENT="LOGIN_SUCCESS:1644346543228";ACT_SSO_COOKIE_EXPIRY=1645556143194;comid=cod;ssoDevId=63025d09c69f47dfa2b8d5520b5b73e4;tfa_enrollment_seen=true;gtm.custom.bot.flag=human;`; - loggedIn = true; - return loggedIn; + if (!ssoToken || ssoToken.trim().length <= 0) return false; + let fakeXSRF = '68e8b62e-1d9d-4ce1-b93f-cbe5ff31a041'; + baseHeaders['X-XSRF-TOKEN'] = fakeXSRF; + baseHeaders['X-CSRF-TOKEN'] = fakeXSRF; + baseHeaders['Atvi-Auth'] = ssoToken; + baseHeaders['ACT_SSO_COOKIE'] = ssoToken; + baseHeaders['atkn'] = ssoToken; + baseHeaders['cookie'] = + `${baseCookie}ACT_SSO_COOKIE=${ssoToken};XSRF-TOKEN=${fakeXSRF};API_CSRF_TOKEN=${fakeXSRF};ACT_SSO_EVENT="LOGIN_SUCCESS:1644346543228";ACT_SSO_COOKIE_EXPIRY=1645556143194;comid=cod;ssoDevId=63025d09c69f47dfa2b8d5520b5b73e4;tfa_enrollment_seen=true;gtm.custom.bot.flag=human;`; + baseSsoToken = ssoToken; + basePostHeaders['X-XSRF-TOKEN'] = fakeXSRF; + basePostHeaders['X-CSRF-TOKEN'] = fakeXSRF; + basePostHeaders['Atvi-Auth'] = ssoToken; + basePostHeaders['ACT_SSO_COOKIE'] = ssoToken; + basePostHeaders['atkn'] = ssoToken; + basePostHeaders['cookie'] = + `${baseCookie}ACT_SSO_COOKIE=${ssoToken};XSRF-TOKEN=${fakeXSRF};API_CSRF_TOKEN=${fakeXSRF};ACT_SSO_EVENT="LOGIN_SUCCESS:1644346543228";ACT_SSO_COOKIE_EXPIRY=1645556143194;comid=cod;ssoDevId=63025d09c69f47dfa2b8d5520b5b73e4;tfa_enrollment_seen=true;gtm.custom.bot.flag=human;`; + loggedIn = true; + return loggedIn; }; exports.login = login; -const telescope_login_endpoint = 'https://wzm-ios-loginservice.prod.demonware.net/v1/login/uno/?titleID=7100&client=shg-cod-jup-bnet'; -const telescopeLogin = (username, password) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { - if (!username || !password) - return false; - const { body, statusCode } = yield (0, undici_1.request)(telescope_login_endpoint, { +const telescope_login_endpoint = + 'https://wzm-ios-loginservice.prod.demonware.net/v1/login/uno/?titleID=7100&client=shg-cod-jup-bnet'; +const telescopeLogin = (username, password) => + tslib_1.__awaiter(void 0, void 0, void 0, function* () { + if (!username || !password) return false; + const { body, statusCode } = yield (0, undici_1.request)( + telescope_login_endpoint, + { method: 'POST', headers: baseHeaders, body: JSON.stringify({ - platform: 'ios', - hardwareType: 'ios', - auth: { - email: username, - password: password, - }, - version: 1492, + platform: 'ios', + hardwareType: 'ios', + auth: { + email: username, + password: password, + }, + version: 1492, }), - }); + } + ); if (statusCode === 200) { - let response = (yield body.json()); - let unoToken = response.umbrella.accessToken; - telescopeUnoToken = unoToken; - } - else if (statusCode === 403) { - let errorResponse = (yield body.json()); - console.error('Error Logging In:', errorResponse.error.msg); + let response = yield body.json(); + let unoToken = response.umbrella.accessToken; + telescopeUnoToken = unoToken; + } else if (statusCode === 403) { + let errorResponse = yield body.json(); + console.error('Error Logging In:', errorResponse.error.msg); } loggedIn = statusCode == 200; return loggedIn; -}); + }); exports.telescopeLogin = telescopeLogin; const handleLookupType = (platform) => { - return platform === platforms.Uno ? 'id' : 'gamer'; + return platform === platforms.Uno ? 'id' : 'gamer'; }; const checkForValidPlatform = (platform, gamertag) => { - if (!Object.values(platforms).includes(platform)) - throw new Error(`Platform '${platform}' is not valid.\nTry one of the following:\n${JSON.stringify(Object.values(platforms), null, 2)}`); - if (gamertag && isNaN(Number(gamertag)) && platform === platforms.Uno) - throw new Error(generics.UNO_NO_NUMERICAL_ID); + if (!Object.values(platforms).includes(platform)) + throw new Error( + `Platform '${platform}' is not valid.\nTry one of the following:\n${JSON.stringify(Object.values(platforms), null, 2)}` + ); + if (gamertag && isNaN(Number(gamertag)) && platform === platforms.Uno) + throw new Error(generics.UNO_NO_NUMERICAL_ID); }; const mapGamertagToPlatform = (gamertag, platform, steamSupport = false) => { - checkForValidPlatform(platform, gamertag); - const lookupType = handleLookupType(platform); - if (!steamSupport && platform === platforms.Steam) - throw new Error(generics.STEAM_UNSUPPORTED); - if (platform == platforms.Battlenet || - platform == platforms.Activision || - platform == platforms.Uno) - if (gamertag && gamertag.length > 0) - gamertag = cleanClientName(gamertag); - if (platform === platforms.Uno || platform === platforms.Activision) - platform = platforms.Uno; - return { gamertag, _platform: platform, lookupType }; + checkForValidPlatform(platform, gamertag); + const lookupType = handleLookupType(platform); + if (!steamSupport && platform === platforms.Steam) + throw new Error(generics.STEAM_UNSUPPORTED); + if ( + platform == platforms.Battlenet || + platform == platforms.Activision || + platform == platforms.Uno + ) + if (gamertag && gamertag.length > 0) gamertag = cleanClientName(gamertag); + if (platform === platforms.Uno || platform === platforms.Activision) + platform = platforms.Uno; + return { gamertag, _platform: platform, lookupType }; }; class Endpoints { - constructor(game, gamertag, platform, mode, lookupType) { - this.fullData = () => `/stats/cod/v1/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/profile/type/${this.mode}`; - this.combatHistory = () => `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/0/end/0/details`; - this.combatHistoryWithDate = (startTime, endTime) => `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/${startTime}/end/${endTime}/details`; - this.breakdown = () => `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/0/end/0`; - this.breakdownWithDate = (startTime, endTime) => `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/${startTime}/end/${endTime}`; - this.matchInfo = (matchId) => `/crm/cod/v2/title/${this.game}/platform/${this.platform}/fullMatch/wz/${matchId}/en`; - this.matchHeatMap = (matchId) => `/ce/v1/title/${this.game}/platform/${this.platform}/match/${matchId}/matchMapEvents`; - this.seasonLoot = () => `/loot/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/status/en`; - this.bpProg = () => `/loot/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/status/en`; - this.bundleInfo = () => `/inventory/v1/title/${this.game}/platform/${this.platform}/purchasable/${this.lookupType}/${this.gamertag}/en`; - this.mapList = () => `/ce/v1/title/${this.game}/platform/${this.platform}/gameType/${this.mode}/communityMapData/availability`; - this.purchasableItems = (gameId) => `/inventory/v1/title/${gameId}/platform/psn/purchasable/public/en`; - this.bundleInformation = (gameId, bundleId) => `/inventory/v1/title/${gameId}/bundle/${bundleId}/en`; - this.battlePassLoot = (season) => `/loot/title/${this.game}/platform/${this.platform}/list/loot_season_${season}/en`; - this.friendFeed = () => `/userfeed/v1/friendFeed/platform/${this.platform}/${this.lookupType}/${this.gamertag}/friendFeedEvents/en`; - this.eventFeed = () => `/userfeed/v1/friendFeed/rendered/en/${baseSsoToken}`; - this.loggedInIdentities = () => `/crm/cod/v2/identities/${baseSsoToken}`; - this.codPoints = () => `/inventory/v1/title/mw/platform/${this.platform}/${this.lookupType}/${this.gamertag}/currency`; - this.connectedAccounts = () => `/crm/cod/v2/accounts/platform/${this.platform}/${this.lookupType}/${this.gamertag}`; - this.settings = () => `/preferences/v1/platform/${this.platform}/${this.lookupType}/${this.gamertag}/list`; - this.friendAction = (action) => `/codfriends/v1/${action}/${this.platform}/${this.lookupType}/${this.gamertag}`; - this.search = () => `/crm/cod/v2/platform/${this.platform}/username/${this.gamertag}/search`; - this.communityMapDataForMapMode = (mapId, gamemode) => `/ce/v1/title/${this.game}/platform/${this.platform}/gameType/${this.mode}/map/${mapId}/mode/${gamemode}/communityMapData`; - this.userInfo = () => `/cod/userInfo/${baseSsoToken}`; - this.accolades = () => `/cdn/app/configs/prod/statnames/mapping.json`; - this.allCDNData = () => `/content/atvi/callofduty/mycod/web/en/data/json/iq-content-xweb.js`; - this.game = game; - this.gamertag = gamertag; - this.platform = platform; - this.lookupType = lookupType; - this.mode = mode; - } + constructor(game, gamertag, platform, mode, lookupType) { + this.fullData = () => + `/stats/cod/v1/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/profile/type/${this.mode}`; + this.combatHistory = () => + `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/0/end/0/details`; + this.combatHistoryWithDate = (startTime, endTime) => + `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/${startTime}/end/${endTime}/details`; + this.breakdown = () => + `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/0/end/0`; + this.breakdownWithDate = (startTime, endTime) => + `/crm/cod/v2/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/matches/${this.mode}/start/${startTime}/end/${endTime}`; + this.matchInfo = (matchId) => + `/crm/cod/v2/title/${this.game}/platform/${this.platform}/fullMatch/wz/${matchId}/en`; + this.matchHeatMap = (matchId) => + `/ce/v1/title/${this.game}/platform/${this.platform}/match/${matchId}/matchMapEvents`; + this.seasonLoot = () => + `/loot/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/status/en`; + this.bpProg = () => + `/loot/title/${this.game}/platform/${this.platform}/${this.lookupType}/${this.gamertag}/status/en`; + this.bundleInfo = () => + `/inventory/v1/title/${this.game}/platform/${this.platform}/purchasable/${this.lookupType}/${this.gamertag}/en`; + this.mapList = () => + `/ce/v1/title/${this.game}/platform/${this.platform}/gameType/${this.mode}/communityMapData/availability`; + this.purchasableItems = (gameId) => + `/inventory/v1/title/${gameId}/platform/psn/purchasable/public/en`; + this.bundleInformation = (gameId, bundleId) => + `/inventory/v1/title/${gameId}/bundle/${bundleId}/en`; + this.battlePassLoot = (season) => + `/loot/title/${this.game}/platform/${this.platform}/list/loot_season_${season}/en`; + this.friendFeed = () => + `/userfeed/v1/friendFeed/platform/${this.platform}/${this.lookupType}/${this.gamertag}/friendFeedEvents/en`; + this.eventFeed = () => + `/userfeed/v1/friendFeed/rendered/en/${baseSsoToken}`; + this.loggedInIdentities = () => `/crm/cod/v2/identities/${baseSsoToken}`; + this.codPoints = () => + `/inventory/v1/title/mw/platform/${this.platform}/${this.lookupType}/${this.gamertag}/currency`; + this.connectedAccounts = () => + `/crm/cod/v2/accounts/platform/${this.platform}/${this.lookupType}/${this.gamertag}`; + this.settings = () => + `/preferences/v1/platform/${this.platform}/${this.lookupType}/${this.gamertag}/list`; + this.friendAction = (action) => + `/codfriends/v1/${action}/${this.platform}/${this.lookupType}/${this.gamertag}`; + this.search = () => + `/crm/cod/v2/platform/${this.platform}/username/${this.gamertag}/search`; + this.communityMapDataForMapMode = (mapId, gamemode) => + `/ce/v1/title/${this.game}/platform/${this.platform}/gameType/${this.mode}/map/${mapId}/mode/${gamemode}/communityMapData`; + this.userInfo = () => `/cod/userInfo/${baseSsoToken}`; + this.accolades = () => `/cdn/app/configs/prod/statnames/mapping.json`; + this.allCDNData = () => + `/content/atvi/callofduty/mycod/web/en/data/json/iq-content-xweb.js`; + this.game = game; + this.gamertag = gamertag; + this.platform = platform; + this.lookupType = lookupType; + this.mode = mode; + } } class TelescopeEndpoints { - constructor(game, unoId, mode) { - this.lifeTime = () => `/cr/v1/title/${this.game}/lifetime?language=english&unoId=${this.unoId}`; - this.matches = () => `/cr/v1/title/${this.game}/matches?language=english&unoId=${this.unoId}`; - this.match = (matchId) => `/cr/v1/title/${this.game}/match/${matchId}?language=english&unoId=${this.unoId}`; - this.game = game; - this.unoId = unoId; - this.mode = mode; - } + constructor(game, unoId, mode) { + this.lifeTime = () => + `/cr/v1/title/${this.game}/lifetime?language=english&unoId=${this.unoId}`; + this.matches = () => + `/cr/v1/title/${this.game}/matches?language=english&unoId=${this.unoId}`; + this.match = (matchId) => + `/cr/v1/title/${this.game}/match/${matchId}?language=english&unoId=${this.unoId}`; + this.game = game; + this.unoId = unoId; + this.mode = mode; + } } class WZ { - constructor() { - this.fullData = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.fullData()); - }); - this.combatHistory = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.combatHistory()); - }); - this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.combatHistoryWithDate(startTime, endTime)); - }); - this.breakdown = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.breakdown()); - }); - this.breakdownWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.breakdownWithDate(startTime, endTime)); - }); - this.matchInfo = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Warzone, lookupType); - return yield sendRequest(endpoint.matchInfo(matchId)); - }); - this.cleanGameMode = (mode) => tslib_1.__awaiter(this, void 0, void 0, function* () { - //@ts-ignore - const foundMode = game_modes_json_1.default['modes'][mode]; - if (!foundMode) - return mode; - return foundMode; - }); - } + constructor() { + this.fullData = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest(endpoint.fullData()); + }); + this.combatHistory = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest(endpoint.combatHistory()); + }); + this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest( + endpoint.combatHistoryWithDate(startTime, endTime) + ); + }); + this.breakdown = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest(endpoint.breakdown()); + }); + this.breakdownWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest( + endpoint.breakdownWithDate(startTime, endTime) + ); + }); + this.matchInfo = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Warzone, + lookupType + ); + return yield sendRequest(endpoint.matchInfo(matchId)); + }); + this.cleanGameMode = (mode) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + //@ts-ignore + const foundMode = game_modes_json_1.default['modes'][mode]; + if (!foundMode) return mode; + return foundMode; + }); + } } class MW { - constructor() { - this.fullData = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.fullData()); - }); - this.combatHistory = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistory()); - }); - this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistoryWithDate(startTime, endTime)); - }); - this.breakdown = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdown()); - }); - this.breakdownWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdownWithDate(startTime, endTime)); - }); - this.matchInfo = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchInfo(matchId)); - }); - this.matchHeatMap = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchHeatMap(matchId)); - }); - this.seasonloot = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.seasonLoot()); - }); - this.bpProg = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bpProg()); - }); - this.bundleInfo = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bundleInfo()); - }); - this.mapList = (platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.mapList()); - }); - this.communityMapDataForMapMode = (mapId, gamemode, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ModernWarfare, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequestCustom(endpoint.communityMapDataForMapMode(mapId, gamemode)); - }); - } + constructor() { + this.fullData = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.fullData()); + }); + this.combatHistory = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.combatHistory()); + }); + this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.combatHistoryWithDate(startTime, endTime) + ); + }); + this.breakdown = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.breakdown()); + }); + this.breakdownWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.breakdownWithDate(startTime, endTime) + ); + }); + this.matchInfo = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchInfo(matchId)); + }); + this.matchHeatMap = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchHeatMap(matchId)); + }); + this.seasonloot = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.seasonLoot()); + }); + this.bpProg = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bpProg()); + }); + this.bundleInfo = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bundleInfo()); + }); + this.mapList = (platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.mapList()); + }); + this.communityMapDataForMapMode = (mapId, gamemode, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ModernWarfare, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequestCustom( + endpoint.communityMapDataForMapMode(mapId, gamemode) + ); + }); + } } class MW2 { - constructor() { - this.fullData = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.lifeTime()); - }); - this.matches = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.matches()); - }); - this.matchInfo = (unoId, matchId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.match(matchId)); - }); - } + constructor() { + this.fullData = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.lifeTime()); + }); + this.matches = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.matches()); + }); + this.matchInfo = (unoId, matchId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.match(matchId)); + }); + } } class WZ2 { - constructor() { - this.fullData = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Warzone2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.lifeTime()); - }); - this.matches = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Warzone2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.matches()); - }); - this.matchInfo = (unoId, matchId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Warzone2, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.match(matchId)); - }); - } + constructor() { + this.fullData = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Warzone2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.lifeTime()); + }); + this.matches = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Warzone2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.matches()); + }); + this.matchInfo = (unoId, matchId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Warzone2, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.match(matchId)); + }); + } } class MW3 { - constructor() { - this.fullData = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare3, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.lifeTime()); - }); - this.matches = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare3, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.matches()); - }); - this.matchInfo = (unoId, matchId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.ModernWarfare3, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.match(matchId)); - }); - } + constructor() { + this.fullData = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare3, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.lifeTime()); + }); + this.matches = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare3, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.matches()); + }); + this.matchInfo = (unoId, matchId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.ModernWarfare3, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.match(matchId)); + }); + } } class WZM { - constructor() { - this.fullData = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Mobile, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.lifeTime()); - }); - this.matches = (unoId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Mobile, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.matches()); - }); - this.matchInfo = (unoId, matchId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); - const endpoint = new TelescopeEndpoints(telescopeGames.Mobile, gamertag, telescopeModes.Multiplayer); - return yield sendTelescopeRequest(endpoint.match(matchId)); - }); - } + constructor() { + this.fullData = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Mobile, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.lifeTime()); + }); + this.matches = (unoId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Mobile, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.matches()); + }); + this.matchInfo = (unoId, matchId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var { gamertag } = mapGamertagToPlatform(unoId, platforms.Uno, true); + const endpoint = new TelescopeEndpoints( + telescopeGames.Mobile, + gamertag, + telescopeModes.Multiplayer + ); + return yield sendTelescopeRequest(endpoint.match(matchId)); + }); + } } class CW { - constructor() { - this.fullData = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.fullData()); - }); - this.combatHistory = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistory()); - }); - this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistoryWithDate(startTime, endTime)); - }); - this.breakdown = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdown()); - }); - this.breakdownWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdownWithDate(startTime, endTime)); - }); - this.seasonloot = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.seasonLoot()); - }); - this.bpProg = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bpProg()); - }); - this.bundleInfo = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bundleInfo()); - }); - this.mapList = (platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.mapList()); - }); - this.matchInfo = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchInfo(matchId)); - }); - this.matchHeatMap = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.ColdWar, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchHeatMap(matchId)); - }); - } + constructor() { + this.fullData = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.fullData()); + }); + this.combatHistory = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.combatHistory()); + }); + this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.combatHistoryWithDate(startTime, endTime) + ); + }); + this.breakdown = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.breakdown()); + }); + this.breakdownWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.breakdownWithDate(startTime, endTime) + ); + }); + this.seasonloot = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.seasonLoot()); + }); + this.bpProg = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bpProg()); + }); + this.bundleInfo = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bundleInfo()); + }); + this.mapList = (platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.mapList()); + }); + this.matchInfo = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchInfo(matchId)); + }); + this.matchHeatMap = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.ColdWar, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchHeatMap(matchId)); + }); + } } class VG { - constructor() { - this.fullData = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.fullData()); - }); - this.combatHistory = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistory()); - }); - this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.combatHistoryWithDate(startTime, endTime)); - }); - this.breakdown = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdown()); - }); - this.breakdownWithDate = (gamertag, startTime, endTime, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.breakdownWithDate(startTime, endTime)); - }); - this.seasonloot = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.seasonLoot()); - }); - this.bpProg = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bpProg()); - }); - this.bundleInfo = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.bundleInfo()); - }); - this.mapList = (platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.mapList()); - }); - this.matchInfo = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchInfo(matchId)); - }); - this.matchHeatMap = (matchId, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(games.Vanguard, gamertag, platform, modes.Multiplayer, lookupType); - return yield sendRequest(endpoint.matchHeatMap(matchId)); - }); - } + constructor() { + this.fullData = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.fullData()); + }); + this.combatHistory = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.combatHistory()); + }); + this.combatHistoryWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.combatHistoryWithDate(startTime, endTime) + ); + }); + this.breakdown = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.breakdown()); + }); + this.breakdownWithDate = (gamertag, startTime, endTime, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest( + endpoint.breakdownWithDate(startTime, endTime) + ); + }); + this.seasonloot = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.seasonLoot()); + }); + this.bpProg = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bpProg()); + }); + this.bundleInfo = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.bundleInfo()); + }); + this.mapList = (platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.mapList()); + }); + this.matchInfo = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchInfo(matchId)); + }); + this.matchHeatMap = (matchId, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + games.Vanguard, + gamertag, + platform, + modes.Multiplayer, + lookupType + ); + return yield sendRequest(endpoint.matchHeatMap(matchId)); + }); + } } class SHOP { - constructor() { - this.purchasableItems = (gameId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequest(endpoint.purchasableItems(gameId)); - }); - this.bundleInformation = (title, bundleId) => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequest(endpoint.bundleInformation(title, bundleId)); - }); - this.battlePassLoot = (title, season, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform('', platform)); - const endpoint = new Endpoints(title, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.battlePassLoot(season)); - }); - } + constructor() { + this.purchasableItems = (gameId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequest(endpoint.purchasableItems(gameId)); + }); + this.bundleInformation = (title, bundleId) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequest(endpoint.bundleInformation(title, bundleId)); + }); + this.battlePassLoot = (title, season, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform('', platform)); + const endpoint = new Endpoints( + title, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.battlePassLoot(season)); + }); + } } class USER { - constructor() { - this.friendFeed = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.friendFeed()); - }); - this.eventFeed = () => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequest(endpoint.eventFeed()); - }); - this.loggedInIdentities = () => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequest(endpoint.loggedInIdentities()); - }); - this.userInfo = () => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequestUserInfo(endpoint.userInfo()); - }); - this.codPoints = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.codPoints()); - }); - this.connectedAccounts = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.connectedAccounts()); - }); - this.settings = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.settings()); - }); - this.friendAction = (gamertag, platform, action) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendPostRequest(endpoint.friendAction(action), '{}'); - }); - } + constructor() { + this.friendFeed = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.friendFeed()); + }); + this.eventFeed = () => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequest(endpoint.eventFeed()); + }); + this.loggedInIdentities = () => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequest(endpoint.loggedInIdentities()); + }); + this.userInfo = () => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequestUserInfo(endpoint.userInfo()); + }); + this.codPoints = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.codPoints()); + }); + this.connectedAccounts = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.connectedAccounts()); + }); + this.settings = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.settings()); + }); + this.friendAction = (gamertag, platform, action) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendPostRequest(endpoint.friendAction(action), '{}'); + }); + } } class DB { - constructor() { - this.accolades = () => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequestCDN(endpoint.accolades()); - }); - this.allCDNData = () => tslib_1.__awaiter(this, void 0, void 0, function* () { - const endpoint = new Endpoints(games.NULL, '', platforms.NULL, modes.NULL, ''); - return yield sendRequestCDN(endpoint.allCDNData()); - }); - } + constructor() { + this.accolades = () => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequestCDN(endpoint.accolades()); + }); + this.allCDNData = () => + tslib_1.__awaiter(this, void 0, void 0, function* () { + const endpoint = new Endpoints( + games.NULL, + '', + platforms.NULL, + modes.NULL, + '' + ); + return yield sendRequestCDN(endpoint.allCDNData()); + }); + } } class ALT { - constructor() { - this.search = (gamertag, platform) => tslib_1.__awaiter(this, void 0, void 0, function* () { - var gamertag, platform, lookupType; - ({ - gamertag, - _platform: platform, - lookupType - } = mapGamertagToPlatform(gamertag, platform, true)); - const endpoint = new Endpoints(games.NULL, gamertag, platform, modes.NULL, lookupType); - return yield sendRequest(endpoint.search()); - }); - this.cleanWeapon = (weapon) => tslib_1.__awaiter(this, void 0, void 0, function* () { - //@ts-ignore - const foundWeapon = weapon_ids_json_1.default['All Weapons'][weapon]; - if (!foundWeapon) - return weapon; - return foundWeapon; - }); - } + constructor() { + this.search = (gamertag, platform) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + var gamertag, platform, lookupType; + ({ + gamertag, + _platform: platform, + lookupType, + } = mapGamertagToPlatform(gamertag, platform, true)); + const endpoint = new Endpoints( + games.NULL, + gamertag, + platform, + modes.NULL, + lookupType + ); + return yield sendRequest(endpoint.search()); + }); + this.cleanWeapon = (weapon) => + tslib_1.__awaiter(this, void 0, void 0, function* () { + //@ts-ignore + const foundWeapon = weapon_ids_json_1.default['All Weapons'][weapon]; + if (!foundWeapon) return weapon; + return foundWeapon; + }); + } } const Warzone = new WZ(); exports.Warzone = Warzone; diff --git a/tsconfig.json b/tsconfig.json index 528c638..978a178 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,11 +12,8 @@ "sourceMap": true, "declaration": true, "skipLibCheck": true, - "typeRoots": [ - "./@types", - "./node_modules/@types" - ] + "typeRoots": ["./@types", "./node_modules/@types"] }, "include": ["src/**/*"], "exclude": ["node_modules"] -} \ No newline at end of file +}