valo-api-wrapper
Version:
Type-safe client and wrapper for the Valorant API
1,612 lines (1,548 loc) • 124 kB
JavaScript
'use strict';
const node_https = require('node:https');
const axios = require('axios');
const toughCookie = require('tough-cookie');
const zod = require('zod');
const promises = require('node:fs/promises');
const node_path = require('node:path');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
class HeadersBuilder {
headers = {};
static create() {
return new HeadersBuilder();
}
static remote(options) {
return new HeadersBuilder().accessToken(options.accessToken).entitlementsJWT(options.entitlementsToken).clientVersion(options.clientVersion).clientPlatform(options.platformInfo).userAgent(options.userAgent).build();
}
userAgent(userAgent) {
this.headers["User-Agent"] = userAgent;
return this;
}
rsoUserAgent(clientBuild) {
this.headers["User-Agent"] = `RiotClient/${clientBuild} rso-auth (Windows;10;;Professional, x64)`;
return this;
}
localAuth(username, password) {
this.headers["Authorization"] = `Basic ${generateBasicToken(username, password)}`;
return this;
}
accessToken(accessToken) {
this.headers["Authorization"] = accessToken.startsWith("Bearer") ? accessToken : `Bearer ${accessToken}`;
return this;
}
entitlementsJWT(entitlementsToken) {
this.headers["X-Riot-Entitlements-JWT"] = entitlementsToken;
return this;
}
clientVersion(clientVersion) {
this.headers["X-Riot-ClientVersion"] = clientVersion;
return this;
}
clientPlatform(platformInfo) {
this.headers["X-Riot-ClientPlatform"] = Buffer.from(
JSON.stringify(platformInfo)
).toString("base64");
return this;
}
build() {
return this.headers;
}
}
const generateBasicToken = (username, password) => Buffer.from(`${username}:${password}`).toString("base64");
function applyMixins(derivedCtor, constructors) {
constructors.forEach((baseCtor) => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
Object.defineProperty(
derivedCtor.prototype,
name,
Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
);
});
});
}
function ensureArray(input) {
if (!input) {
return [];
} else if (input instanceof Array) {
return input;
} else {
return [input];
}
}
function applyToughCookieInterceptor(axiosInstance, options) {
const cookieJar = options.jar ?? new toughCookie.CookieJar();
const requestInterceptorId = axiosInstance.interceptors.request.use(
(config) => {
if (config.url) {
const previousCookie = config.headers["Cookie"] ?? "";
config.headers = Object.assign(config.headers, {
Cookie: previousCookie + cookieJar.getCookieStringSync(config.url)
});
}
return config;
}
);
const responseInterceptorId = axiosInstance.interceptors.response.use(
(response) => {
if (response.headers["set-cookie"]) {
const cookies = ensureArray(response.headers["set-cookie"]);
cookies.forEach((cookie) => {
if (response.config.url) {
cookieJar.setCookieSync(cookie, response.config.url);
}
});
}
return response;
}
);
return {
get id() {
return { request: requestInterceptorId, response: responseInterceptorId };
},
eject: () => {
axiosInstance.interceptors.request.eject(requestInterceptorId);
axiosInstance.interceptors.request.eject(responseInterceptorId);
}
};
}
const DEFAULT_CIPHERS = [
"ECDHE-ECDSA-CHACHA20-POLY1305",
"ECDHE-RSA-CHACHA20-POLY1305",
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES256-GCM-SHA384",
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-AES128-SHA",
"ECDHE-RSA-AES128-SHA",
"ECDHE-ECDSA-AES256-SHA",
"ECDHE-RSA-AES256-SHA",
"AES128-GCM-SHA256",
"AES256-GCM-SHA384",
"AES128-SHA",
"AES256-SHA",
"DES-CBC3-SHA",
"TLS_CHACHA20_POLY1305_SHA256",
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384"
];
const DEFAULT_SIGALGS = [
"ecdsa_secp256r1_sha256",
"rsa_pss_rsae_sha256",
"rsa_pkcs1_sha256",
"ecdsa_secp384r1_sha384",
"rsa_pss_rsae_sha384",
"rsa_pkcs1_sha384",
"rsa_pss_rsae_sha512",
"rsa_pkcs1_sha512",
"rsa_pkcs1_sha1"
];
const zc = {
zodschema: zod.z.custom((value) => value instanceof zod.z.ZodType)
};
const valorantEndpointSchema = zod.z.object({
name: zod.z.string(),
description: zod.z.string().optional(),
type: zod.z.enum(["auth", "local", "pd", "glz", "shared"]),
method: zod.z.enum(["GET", "POST", "PUT", "DELETE"]).default("GET"),
url: zod.z.string(),
headers: zod.z.record(zod.z.string()).optional(),
requirements: zod.z.array(
zod.z.enum([
"ACCESS_TOKEN",
"ENTITLEMENTS_TOKEN",
"CLIENT_VERSION",
"CLIENT_PLATFORM",
"LOCAL_AUTH"
])
).default([]),
body: zc.zodschema.optional(),
query: zc.zodschema.optional(),
responses: zod.z.record(zc.zodschema).optional()
}).transform((data) => {
const REMOTE_ENDPOINTS = ["glz", "pd", "shared"];
const REMOTE_REQUIREMENTS = [
"ACCESS_TOKEN",
"ENTITLEMENTS_TOKEN",
"CLIENT_VERSION",
"CLIENT_PLATFORM"
];
const LOCAL_REQUIREMENTS = ["LOCAL_AUTH"];
const requirements = REMOTE_ENDPOINTS.includes(data.type) ? REMOTE_REQUIREMENTS : data.type === "local" ? LOCAL_REQUIREMENTS : [];
return {
...data,
requirements: [.../* @__PURE__ */ new Set([...data.requirements, ...requirements])]
};
});
function defineEndpoint(schema) {
return {
get ["~type"]() {
throw new Error("NOT FOR RUNTIME");
},
...valorantEndpointSchema.parse(schema)
};
}
const Endpoint$1a = defineEndpoint({
name: "Auth Cookies",
description: "Prepare cookies for auth request",
type: "auth",
method: "POST",
url: "https://auth.riotgames.com/api/v1/authorization",
headers: {
"Content-Type": "application/json"
},
body: zod.z.object({
client_id: zod.z.literal("play-valorant-web-prod"),
nonce: zod.z.literal("1"),
redirect_uri: zod.z.literal("https://playvalorant.com/opt_in"),
response_type: zod.z.literal("token id_token"),
scope: zod.z.literal("account openid")
})
});
class AuthCookiesEndpoint {
/**
* Prepare cookies for auth request
*
* @EndpointType auth
*/
postAuthCookies(config) {
return this["~request"](Endpoint$1a, config);
}
}
const AuthRequestResponseSchema = zod.z.discriminatedUnion("type", [
zod.z.object({
type: zod.z.literal("success"),
success: zod.z.object({
login_token: zod.z.string(),
redirect_url: zod.z.string(),
is_console_link_session: zod.z.boolean(),
auth_method: zod.z.literal("riot_identity"),
//TODO find other auth methods (likely to be google/facebook/others)
puuid: zod.z.string()
}),
country: zod.z.string(),
platform: zod.z.string()
}),
zod.z.object({
type: zod.z.literal("multifactor"),
multifactor: zod.z.object({
method: zod.z.literal("email"),
methods: zod.z.array(zod.z.literal("email")),
email: zod.z.string().describe("partially-obscured email address"),
mode: zod.z.literal("auth"),
auth_method: zod.z.literal("riot_identity")
}),
country: zod.z.string(),
platform: zod.z.string(),
error: zod.z.literal("invalid_code").optional().describe(
"The MFA request seems to still give an HTTP response code of 200 for invalid codes but attaches this error property"
)
})
]);
const Endpoint$19 = defineEndpoint({
name: "Auth Request",
description: [
"Perform authorization request to get token",
"",
"Requires cookies from the [POST Auth Cookies] stage. If the user has multi-factor authentication enabled, the response will contain a `type` of `multifactor` and [PUT Multi-Factor Authentication] will need to be used.",
"",
"Note: ",
"Authenticating directly is prone to breakage (captchas and cloudflare anti-bot) and does not support users who use alternative sign-in methods.",
"Consider using [GET Cookie Reauth] or opening a webview to the Riot login page and watching for redirects."
].join("\n"),
type: "auth",
method: "PUT",
url: "https://auth.riotgames.com/api/v1/authorization",
headers: {
"Content-Type": "application/json"
},
body: zod.z.object({
type: zod.z.literal("auth"),
language: zod.z.literal("en_US"),
remember: zod.z.boolean(),
riot_identity: zod.z.object({
captcha: zod.z.string().describe(
"hcaptcha token from the login page (see <https://docs.hcaptcha.com/>)"
),
username: zod.z.string(),
password: zod.z.string()
})
}),
responses: {
"200": AuthRequestResponseSchema
}
});
class AuthRequestEndpoint {
/**
* Perform authorization request to get token
*
* Requires cookies from the [POST Auth Cookies] stage. If the user has multi-factor authentication enabled, the response will contain a `type` of `multifactor` and [PUT Multi-Factor Authentication] will need to be used.
*
* Note:
* Authenticating directly is prone to breakage (captchas and cloudflare anti-bot) and does not support users who use alternative sign-in methods.
* Consider using [GET Cookie Reauth] or opening a webview to the Riot login page and watching for redirects.
*
* @EndpointType auth
*/
putAuthRequest(config) {
return this["~request"](Endpoint$19, config);
}
}
const Endpoint$18 = defineEndpoint({
name: "Cookie Reauth",
description: [
"Get a new token using the cookies from a previous authorization request",
"Use the saved cookies from [PUT Auth Request] (specifically the `ssid` cookie). The auth token and id token can be found from the url this request redirects to.",
"",
"It's recommended to use this endpoint instead of storing the password and sending it again.",
"",
"There are ongoing tests at documented at <https://github.com/techchrism/riot-auth-test> that test for auth lifespan using different cookie strategies.",
"Currently, it appears refreshing with just the `ssid` cookie is only stable for one week and refreshing with all auth cookies is stable for three weeks.",
"",
"On a successful response, the 301 redirect location header will be of the format:\n> ```https://playvalorant.com/opt_in#access_token={access token}&scope=openid&iss=https%3A%2F%2Fauth.riotgames.com&id_token={id token}&token_type=Bearer&session_state={session state}&expires_in=3600```\n",
"On an unsuccessful response, the 301 redirect location header will be of the format:\n> ```https://authenticate.riotgames.com/login?client_id=play-valorant-web-prod&nonce=1&redirect_uri=https%3A%2F%2Fauth.riotgames.com%2Fauthorize%3Fclient_id%3Dplay-valorant-web-prod%26nonce%3D1%26redirect_uri%3Dhttps%253A%252F%252Fplayvalorant.com%252Fopt_in%26response_type%3Dtoken%2520id_token&response_type=token%20id_token&method=riot_identity```\n"
].join(" \n"),
type: "auth",
method: "PUT",
url: "https://auth.riotgames.com/authorize?redirect_uri=https%3A%2F%2Fplayvalorant.com%2Fopt_in&client_id=play-valorant-web-prod&response_type=token%20id_token&nonce=1&scope=account%20openid"
});
class CookieReauthEndpoint {
/**
* Get a new token using the cookies from a previous authorization request
* Use the saved cookies from [PUT Auth Request] (specifically the `ssid` cookie). The auth token and id token can be found from the url this request redirects to.
*
* It's recommended to use this endpoint instead of storing the password and sending it again.
*
* There are ongoing tests at documented at <https://github.com/techchrism/riot-auth-test> that test for auth lifespan using different cookie strategies.
* Currently, it appears refreshing with just the `ssid` cookie is only stable for one week and refreshing with all auth cookies is stable for three weeks.
*
* On a successful response, the 301 redirect location header will be of the format:
* > ```https://playvalorant.com/opt_in#access_token={access token}&scope=openid&iss=https%3A%2F%2Fauth.riotgames.com&id_token={id token}&token_type=Bearer&session_state={session state}&expires_in=3600```
*
* On an unsuccessful response, the 301 redirect location header will be of the format:
* > ```https://authenticate.riotgames.com/login?client_id=play-valorant-web-prod&nonce=1&redirect_uri=https%3A%2F%2Fauth.riotgames.com%2Fauthorize%3Fclient_id%3Dplay-valorant-web-prod%26nonce%3D1%26redirect_uri%3Dhttps%253A%252F%252Fplayvalorant.com%252Fopt_in%26response_type%3Dtoken%2520id_token&response_type=token%20id_token&method=riot_identity```
*
*
* @EndpointType auth
*/
putCookieReauth(config = {}) {
return this["~request"](Endpoint$18, config);
}
}
const EntitlementsTokenResponse = zod.z.object({
entitlements_token: zod.z.string()
});
const Endpoint$17 = defineEndpoint({
name: "Entitlements Token",
description: "Get entitlement for remote requests with a token",
type: "auth",
method: "POST",
url: "https://entitlements.auth.riotgames.com/api/token/v1",
requirements: ["ACCESS_TOKEN"],
headers: {
"Content-Type": "application/json"
},
responses: {
"200": EntitlementsTokenResponse
}
});
let EntitlementsTokenEndpoint$1 = class EntitlementsTokenEndpoint {
/**
* Get entitlement for remote requests with a token
*
* @EndpointType auth
*/
postEntitlementsToken(config = {}) {
return this["~request"](Endpoint$17, config);
}
};
const Endpoint$16 = defineEndpoint({
name: "MultiFactor Authentication",
description: "Submits a multi-factor authentication code for login",
type: "auth",
method: "PUT",
url: "https://auth.riotgames.com/api/v1/authorization",
headers: {
"Content-Type": "application/json"
},
body: zod.z.object({
type: zod.z.literal("multifactor"),
multifactor: zod.z.object({
otp: zod.z.string().describe("The multi-factor authentication code"),
rememberDevice: zod.z.boolean()
})
})
});
class MultiFactorAuthenticationEndpoint {
/**
* Submits a multi-factor authentication code for login
*
* @EndpointType auth
*/
putMultiFactorAuthentication(config) {
return this["~request"](Endpoint$16, config);
}
}
const PasTokenResponseSchema = zod.z.string().describe("The PAS token");
const Endpoint$15 = defineEndpoint({
name: "PAS Token",
description: "Get a PAS token using the auth token. The PAS token is a JWT that contains the affinity for the XMPP server.",
type: "auth",
url: "https://riot-geo.pas.si.riotgames.com/pas/v1/service/chat",
requirements: ["ACCESS_TOKEN"],
responses: {
"200": PasTokenResponseSchema
}
});
class PasTokenEndpoint {
/**
* Get a PAS token using the auth token. The PAS token is a JWT that contains the affinity for the XMPP server.
*
* @EndpointType auth
*/
getPasToken(config = {}) {
return this["~request"](Endpoint$15, config);
}
}
const weakUUIDSchema = zod.z.string().regex(/^([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/i).describe("UUID");
const stringBooleanSchema = zod.z.string().transform((val) => val === "true");
const playerUUIDSchema = weakUUIDSchema.describe("Player UUID");
const matchIDSchema = weakUUIDSchema.describe("Match ID");
const pregameIDSchema = weakUUIDSchema.describe("Pre-Game Match ID");
const currentGameIDSchema = weakUUIDSchema.describe(
"Current Game Match ID"
);
const partyIDSchema = weakUUIDSchema.describe("Party ID");
const gameModeSchema = zod.z.string().describe("Game Mode");
const dateSchema = zod.z.string().datetime().transform((val) => new Date(val)).describe("Date in ISO 8601 format");
const millisSchema = zod.z.number().transform((val) => new Date(val)).describe("Milliseconds since epoch");
const seasonIDSchema = weakUUIDSchema.describe("Season ID");
const queueIDSchema = zod.z.string().describe("Queue ID");
const mapIDSchema = zod.z.string().describe("Map ID");
const characterIDSchema = weakUUIDSchema.describe("Character ID");
const cardIDSchema = weakUUIDSchema.describe("Card ID");
const titleIDSchema = weakUUIDSchema.describe("Title ID");
const preferredLevelBorderIDSchema = weakUUIDSchema.or(zod.z.literal("")).describe("Preferred Level Border ID");
const xpModificationIDSchema = zod.z.string().describe("XP Modification ID");
const itemIDSchema = weakUUIDSchema.describe("Item ID");
const itemTypeIDSchema = weakUUIDSchema.describe("Item Type ID");
const armorIDSchema = weakUUIDSchema.describe("Armor ID");
const currencyIDSchema = weakUUIDSchema.describe("Currency ID");
const platformSchema = zod.z.object({
platformType: zod.z.literal("PC"),
platformOS: zod.z.literal("Windows"),
platformOSVersion: zod.z.string(),
platformChipset: zod.z.literal("Unknown")
});
const partyMembershipSchema = zod.z.array(zod.z.object({ Subject: playerUUIDSchema })).nullable();
const partySchema = zod.z.object({
ID: partyIDSchema,
MUCName: zod.z.string(),
VoiceRoomID: zod.z.string(),
Version: zod.z.number(),
ClientVersion: zod.z.string(),
Members: zod.z.array(
zod.z.object({
Subject: playerUUIDSchema,
CompetitiveTier: zod.z.number(),
PlayerIdentity: zod.z.object({
Subject: playerUUIDSchema,
PlayerCardID: cardIDSchema,
PlayerTitleID: titleIDSchema,
AccountLevel: zod.z.number(),
PreferredLevelBorderID: preferredLevelBorderIDSchema,
Incognito: zod.z.boolean(),
HideAccountLevel: zod.z.boolean()
}),
SeasonalBadgeInfo: zod.z.null(),
IsOwner: zod.z.boolean().optional(),
QueueEligibleRemainingAccountLevels: zod.z.number(),
Pings: zod.z.array(
zod.z.object({
Ping: zod.z.number(),
GamePodID: zod.z.string()
})
),
IsReady: zod.z.boolean(),
IsModerator: zod.z.boolean(),
UseBroadcastHUD: zod.z.boolean(),
PlatformType: platformSchema.shape.platformType
})
),
State: zod.z.string(),
PreviousState: zod.z.string(),
StateTransitionReason: zod.z.string(),
Accessibility: zod.z.union([zod.z.literal("OPEN"), zod.z.literal("CLOSED")]),
CustomGameData: zod.z.object({
Settings: zod.z.object({
Map: mapIDSchema,
Mode: gameModeSchema,
UseBots: zod.z.boolean(),
GamePod: zod.z.string(),
GameRules: zod.z.object({
AllowGameModifiers: stringBooleanSchema.optional(),
IsOvertimeWinByTwo: stringBooleanSchema.optional(),
PlayOutAllRounds: stringBooleanSchema.optional(),
SkipMatchHistory: stringBooleanSchema.optional(),
TournamentMode: stringBooleanSchema.optional()
}).nullable()
}),
Membership: zod.z.object({
teamOne: partyMembershipSchema,
teamTwo: partyMembershipSchema,
teamSpectate: partyMembershipSchema,
teamOneCoaches: partyMembershipSchema,
teamTwoCoaches: partyMembershipSchema
}),
MaxPartySize: zod.z.number(),
AutobalanceEnabled: zod.z.boolean(),
AutobalanceMinPlayers: zod.z.number(),
HasRecoveryData: zod.z.boolean()
}),
MatchmakingData: zod.z.object({
QueueID: queueIDSchema,
PreferredGamePods: zod.z.array(zod.z.string()),
SkillDisparityRRPenalty: zod.z.number()
}),
Invites: zod.z.null(),
Requests: zod.z.array(zod.z.unknown()),
QueueEntryTime: dateSchema,
ErrorNotification: zod.z.object({
ErrorType: zod.z.string(),
ErroredPlayers: partyMembershipSchema
}),
RestrictedSeconds: zod.z.number(),
EligibleQueues: zod.z.array(zod.z.string()),
QueueIneligibilities: zod.z.array(zod.z.string()),
CheatData: zod.z.object({
GamePodOverride: zod.z.string(),
ForcePostGameProcessing: zod.z.boolean()
}),
XPBonuses: zod.z.array(zod.z.unknown()),
InviteCode: zod.z.string().describe("Empty string when there is no invite code")
});
const partyPlayerSchema = zod.z.object({
Subject: playerUUIDSchema,
Version: zod.z.number(),
CurrentPartyID: partyIDSchema,
Invites: zod.z.null(),
Requests: zod.z.array(
zod.z.object({
ID: zod.z.string(),
PartyID: partyIDSchema,
RequestedBySubject: playerUUIDSchema,
Subjects: zod.z.array(playerUUIDSchema),
CreatedAt: dateSchema,
RefreshedAt: dateSchema,
ExpiresIn: zod.z.number()
})
),
PlatformInfo: platformSchema
});
const offerSchema = zod.z.object({
OfferID: zod.z.string(),
IsDirectPurchase: zod.z.boolean(),
StartDate: dateSchema,
Cost: zod.z.record(currencyIDSchema, zod.z.number()),
Rewards: zod.z.array(
zod.z.object({
ItemTypeID: itemTypeIDSchema,
ItemID: itemIDSchema,
Quantity: zod.z.number()
})
)
});
const pregameTeamSchema = zod.z.object({
TeamID: zod.z.enum(["Blue", "Red"]).or(playerUUIDSchema),
Players: zod.z.array(
zod.z.object({
Subject: playerUUIDSchema,
CharacterID: characterIDSchema,
CharacterSelectionState: zod.z.enum(["", "selected", "locked"]),
PregamePlayerState: zod.z.enum(["joined"]),
//TODO find other values
CompetitiveTier: zod.z.number(),
PlayerIdentity: zod.z.object({
Subject: playerUUIDSchema,
PlayerCardID: cardIDSchema,
PlayerTitleID: titleIDSchema,
AccountLevel: zod.z.number(),
PreferredLevelBorderID: preferredLevelBorderIDSchema,
Incognito: zod.z.boolean(),
HideAccountLevel: zod.z.boolean()
}),
SeasonalBadgeInfo: zod.z.object({
SeasonID: seasonIDSchema.or(zod.z.literal("")),
NumberOfWins: zod.z.number(),
WinsByTier: zod.z.null(),
Rank: zod.z.number(),
LeaderboardRank: zod.z.number()
}),
IsCaptain: zod.z.boolean()
})
)
});
const pregameMatchSchema = zod.z.object({
ID: pregameIDSchema,
Version: zod.z.number(),
Teams: zod.z.array(pregameTeamSchema),
AllyTeam: pregameTeamSchema.nullable(),
EnemyTeam: pregameTeamSchema.nullable(),
ObserverSubjects: zod.z.array(zod.z.unknown()),
//TODO verify
MatchCoaches: zod.z.array(zod.z.unknown()),
//TODO verify
EnemyTeamSize: zod.z.number(),
EnemyTeamLockCount: zod.z.number(),
PregameState: zod.z.enum(["character_select_active", "provisioned"]),
//TODO find other values
LastUpdated: dateSchema,
MapID: mapIDSchema,
MapSelectPool: zod.z.array(zod.z.unknown()),
BannedMapIDs: zod.z.array(zod.z.unknown()),
CastedVotes: zod.z.unknown(),
MapSelectSteps: zod.z.array(zod.z.unknown()),
MapSelectStep: zod.z.number(),
Team1: zod.z.enum(["Blue", "Red"]).or(playerUUIDSchema),
GamePodID: zod.z.string(),
Mode: gameModeSchema,
VoiceSessionID: zod.z.string(),
MUCName: zod.z.string(),
TeamMatchToken: zod.z.string().describe("JWT containing match ID and player IDs"),
QueueID: queueIDSchema.or(zod.z.literal("")),
ProvisioningFlowID: zod.z.enum(["Matchmaking", "CustomGame"]),
IsRanked: zod.z.boolean(),
PhaseTimeRemainingNS: zod.z.number(),
StepTimeRemainingNS: zod.z.number(),
altModesFlagADA: zod.z.boolean(),
TournamentMetadata: zod.z.null(),
RosterMetadata: zod.z.null()
});
const contractsResponse = zod.z.object({
Version: zod.z.number(),
Subject: playerUUIDSchema,
Contracts: zod.z.array(
zod.z.object({
ContractDefinitionID: weakUUIDSchema,
ContractProgression: zod.z.object({
TotalProgressionEarned: zod.z.number(),
TotalProgressionEarnedVersion: zod.z.number(),
HighestRewardedLevel: zod.z.record(
zod.z.object({
Amount: zod.z.number(),
Version: zod.z.number()
})
)
}),
ProgressionLevelReached: zod.z.number(),
ProgressionTowardsNextLevel: zod.z.number()
})
),
ProcessedMatches: zod.z.array(
zod.z.object({
ID: matchIDSchema,
StartTime: millisSchema,
XPGrants: zod.z.object({
GamePlayed: zod.z.number(),
GameWon: zod.z.number(),
RoundPlayed: zod.z.number(),
RoundWon: zod.z.number(),
Missions: zod.z.object({}),
Modifier: zod.z.object({
Value: zod.z.number(),
BaseMultiplierValue: zod.z.number(),
Modifiers: zod.z.array(
zod.z.object({
Value: zod.z.number(),
Name: zod.z.enum(["RESTRICTIONS_XP", "PREMIUM_CONTRACT_XP"]),
BaseOnly: zod.z.boolean()
})
)
}),
NumAFKRounds: zod.z.number()
}).nullable(),
RewardGrants: zod.z.object({}).nullable(),
MissionDeltas: zod.z.record(
weakUUIDSchema,
zod.z.object({
ID: weakUUIDSchema,
Objectives: zod.z.record(weakUUIDSchema, zod.z.number()),
ObjectiveDeltas: zod.z.record(
weakUUIDSchema,
zod.z.object({
ID: weakUUIDSchema,
ProgressBefore: zod.z.number(),
ProgressAfter: zod.z.number()
})
)
})
).nullable(),
ContractDeltas: zod.z.record(
weakUUIDSchema,
zod.z.object({
ID: weakUUIDSchema,
TotalXPBefore: zod.z.number(),
TotalXPAfter: zod.z.number()
})
).nullable(),
CouldProgressMissions: zod.z.boolean()
})
),
ActiveSpecialContract: weakUUIDSchema,
Missions: zod.z.array(
zod.z.object({
ID: weakUUIDSchema,
Objectives: zod.z.record(weakUUIDSchema, zod.z.number()),
Complete: zod.z.boolean(),
ExpirationTime: dateSchema
})
),
MissionMetadata: zod.z.object({
NPECompleted: zod.z.boolean(),
WeeklyCheckpoint: dateSchema,
WeeklyRefillTime: dateSchema
})
});
const conversationsSchema = zod.z.object({
conversations: zod.z.array(
zod.z.object({
cid: zod.z.string(),
direct_messages: zod.z.boolean(),
global_readership: zod.z.boolean(),
message_history: zod.z.boolean(),
mid: zod.z.string(),
muted: zod.z.boolean(),
mutedRestriction: zod.z.boolean(),
type: zod.z.enum(["groupchat", "chat"]),
uiState: zod.z.object({
changedSinceHidden: zod.z.boolean(),
hidden: zod.z.boolean()
}),
unread_count: zod.z.number()
})
)
});
const chatMessagesSchema = zod.z.object({
messages: zod.z.array(
zod.z.object({
body: zod.z.string(),
cid: zod.z.string(),
game_name: zod.z.string(),
game_tag: zod.z.string(),
id: zod.z.string(),
mid: zod.z.string(),
name: zod.z.string(),
pid: zod.z.string(),
puuid: playerUUIDSchema,
read: zod.z.boolean(),
region: zod.z.string(),
time: zod.z.string().transform((s) => new Date(Number(s))).describe("Time in milliseconds since epoch"),
type: zod.z.enum(["chat", "groupchat"])
})
)
});
const loadoutsSchema = zod.z.object({
Subject: playerUUIDSchema,
Sprays: zod.z.object({
SpraySelections: zod.z.array(
zod.z.object({
SocketID: weakUUIDSchema,
SprayID: weakUUIDSchema,
LevelID: weakUUIDSchema
})
)
}),
Expressions: zod.z.object({
AESSelections: zod.z.array(
zod.z.object({
SocketID: weakUUIDSchema,
AssetID: weakUUIDSchema,
TypeID: weakUUIDSchema
})
)
}),
Items: zod.z.record(
zod.z.object({
ID: itemIDSchema,
TypeID: itemTypeIDSchema,
Sockets: zod.z.record(
zod.z.object({
ID: weakUUIDSchema,
Item: zod.z.object({
ID: itemIDSchema,
TypeID: itemTypeIDSchema
})
})
)
})
)
});
const PlayerInfoResponseSchema = zod.z.object({
country: zod.z.string(),
sub: playerUUIDSchema,
email_verified: zod.z.boolean(),
player_plocale: zod.z.unknown().nullable(),
country_at: millisSchema.nullable(),
pw: zod.z.object({
cng_at: millisSchema,
reset: zod.z.boolean(),
must_reset: zod.z.boolean()
}),
phone_number_verified: zod.z.boolean(),
account_verified: zod.z.boolean(),
ppid: zod.z.unknown().nullable(),
federated_identity_providers: zod.z.array(zod.z.string()),
player_locale: zod.z.string().nullable(),
acct: zod.z.object({
type: zod.z.number(),
state: zod.z.string(),
adm: zod.z.boolean(),
game_name: zod.z.string(),
tag_line: zod.z.string(),
created_at: millisSchema
}),
age: zod.z.number(),
jti: zod.z.string(),
affinity: zod.z.record(zod.z.string())
});
const Endpoint$14 = defineEndpoint({
name: "Player Info",
description: "Get the PUUID and other info from a token",
type: "auth",
url: "https://auth.riotgames.com/userinfo",
requirements: ["ACCESS_TOKEN"],
responses: {
"200": PlayerInfoResponseSchema
}
});
class PlayerInfoEndpoint {
/**
* Get the PUUID and other info from a token
*
* @EndpointType auth
*/
getPlayerInfo(config = {}) {
return this["~request"](Endpoint$14, config);
}
}
const RiotClientConfigResponseSchema = zod.z.intersection(
zod.z.object({
"chat.affinities": zod.z.record(
zod.z.string().describe("Affinity ID"),
zod.z.string().describe("Chat Server Host")
).describe("Mapping of affinity ID to chat server host"),
"chat.affinity_domains": zod.z.record(
zod.z.string().describe("Affinity ID"),
zod.z.string().describe("Affinity Domain")
).describe("Mapping of affinity ID to affinity domain"),
"chat.port": zod.z.number().describe("Chat server port")
}),
zod.z.record(zod.z.string(), zod.z.unknown())
);
const Endpoint$13 = defineEndpoint({
name: "Riot Client Config",
description: "Gets the config file used by the Riot Client. This includes a ton of info, most of it undocumented.",
type: "auth",
url: "https://clientconfig.rpg.riotgames.com/api/v1/config/player?app=Riot%20Client",
requirements: ["ACCESS_TOKEN", "ENTITLEMENTS_TOKEN"],
responses: {
"200": RiotClientConfigResponseSchema
}
});
class RiotClientConfigEndpoint {
/**
* Gets the config file used by the Riot Client. This includes a ton of info, most of it undocumented.
*
* @EndpointType auth
*/
getRiotClientConfig(config = {}) {
return this["~request"](Endpoint$13, config);
}
}
const RiotGeoResponseSchema = zod.z.object({
token: zod.z.string(),
affinities: zod.z.object({
pbe: zod.z.string(),
live: zod.z.string()
}).describe("The region IDs for PBE and live servers")
});
const Endpoint$12 = defineEndpoint({
name: "Riot Geo",
description: "Get the region for a given ID token and auth token. The ID token and auth token can be obtained from [PUT Cookie Reauth]",
type: "auth",
url: "https://riot-geo.pas.si.riotgames.com/pas/v1/product/valorant",
method: "PUT",
requirements: ["ACCESS_TOKEN"],
body: zod.z.object({
id_token: zod.z.string().describe("The ID token")
}),
responses: {
"200": RiotGeoResponseSchema
}
});
class RiotGeoEndpoint {
/**
* Get the region for a given ID token and auth token. The ID token and auth token can be obtained from [PUT Cookie Reauth]
*
* @EndpointType auth
*/
putRiotGeo(config) {
return this["~request"](Endpoint$12, config);
}
}
class AuthApiEndpoints {
}
applyMixins(AuthApiEndpoints, [
AuthCookiesEndpoint,
AuthRequestEndpoint,
CookieReauthEndpoint,
EntitlementsTokenEndpoint$1,
MultiFactorAuthenticationEndpoint,
PasTokenEndpoint,
PlayerInfoEndpoint,
RiotClientConfigEndpoint,
RiotGeoEndpoint
]);
const authApiClientOptionsSchema = zod.z.object({
clientVersion: zod.z.string(),
rsoUserAgent: zod.z.string(),
ciphers: zod.z.array(zod.z.string()).default(DEFAULT_CIPHERS),
sigalgs: zod.z.array(zod.z.string()).default(DEFAULT_SIGALGS)
});
function createAuthApiClient(options) {
return new AuthApiClient(options);
}
class AuthApiClient {
#axios;
#cookieJar;
#options;
constructor(options) {
this.#options = authApiClientOptionsSchema.parse(options);
this.#axios = axios__default.create({
headers: HeadersBuilder.create().userAgent(this.#options.rsoUserAgent).clientVersion(this.#options.clientVersion).build(),
httpsAgent: new node_https.Agent({
ciphers: this.#options.ciphers.join(":"),
sigalgs: this.#options.sigalgs.join(":"),
honorCipherOrder: true,
minVersion: "TLSv1.2"
}),
withCredentials: true
});
this.#cookieJar = new toughCookie.CookieJar();
applyToughCookieInterceptor(this.#axios, { jar: this.#cookieJar });
}
reinit(options) {
this.#options = authApiClientOptionsSchema.parse(options);
Object.assign(
this.#axios.defaults.headers,
HeadersBuilder.create().clientVersion(this.#options.clientVersion).userAgent(this.#options.rsoUserAgent).build()
);
this.#axios.defaults.withCredentials = true;
this.#axios.defaults.httpsAgent.options.ciphers = this.#options.ciphers.join(":");
this.#axios.defaults.httpsAgent.options.sigalgs = this.#options.sigalgs.join(":");
this.#axios.defaults.httpsAgent.options.honorCipherOrder = true;
this.#axios.defaults.httpsAgent.options.minVersion = "TLSv1.2";
}
get axios() {
return this.#axios;
}
get cookieJar() {
return this.#cookieJar;
}
get options() {
return structuredClone(this.#options);
}
["~request"](endpoint, config) {
return this.axios({
url: endpoint.url,
method: endpoint.method,
headers: endpoint.headers,
...config
});
}
}
applyMixins(AuthApiClient, [AuthApiEndpoints]);
const REMOTE_SERVER_TYPES = ["glz", "pd", "shared"];
function getServerUrl(options) {
switch (options.type) {
case "local":
return `https://127.0.0.1:${options.port}`;
case "pd":
return `https://pd.${options.shard}.a.pvp.net`;
case "glz":
return `https://glz-${options.region ?? options.shard}-1.${options.shard}.a.pvp.net`;
case "shared":
return `https://shared.${options.shard}.a.pvp.net`;
}
}
function getRegionAndShardFromGlzServer(glzServer) {
const regex = /https:\/\/glz-(?<region>.*)-1.(?<shard>.*).a.pvp.net/;
const matches = glzServer.match(regex);
return zod.z.object({
region: zod.z.string(),
shard: zod.z.string()
}).parse(matches?.groups);
}
const AccountAliasResponseSchema = zod.z.object({
active: zod.z.boolean(),
created_datetime: millisSchema,
game_name: zod.z.string(),
summoner: zod.z.boolean(),
tag_line: zod.z.string()
});
const Endpoint$11 = defineEndpoint({
name: "Account Alias",
description: "Gets the player username and tagline",
type: "local",
url: "player-account/aliases/v1/active",
responses: {
"200": AccountAliasResponseSchema
}
});
class AccountAliasEndpoint {
/**
* Gets the player username and tagline
*
* @EndpointType local
*/
getAccountAlias(config = {}) {
return this["~request"](Endpoint$11, config);
}
}
const Endpoint$10 = defineEndpoint({
name: "All Chat Info",
description: "Get information about all active conversations",
type: "local",
url: "chat/v6/conversations",
responses: {
"200": conversationsSchema
}
});
class AllChatInfoEndpoint {
/**
* Get information about all active conversations
*
* @EndpointType local
*/
getAllChatInfo(config = {}) {
return this["~request"](Endpoint$10, config);
}
}
const Endpoint$$ = defineEndpoint({
name: "Chat History",
description: "Get chat history for all conversations or a specific conversation if the cid is provided",
type: "local",
url: "chat/v6/messages",
query: zod.z.object({ cid: zod.z.string().optional() }),
responses: {
"200": chatMessagesSchema
}
});
class ChatHistoryEndpoint {
/**
* Get chat history for all conversations or a specific conversation if the cid is provided
*
* @EndpointType local
*/
getChatHistory(config = {}) {
return this["~request"](Endpoint$$, config);
}
}
const ChatParticipantsResponseSchema = zod.z.object({
participants: zod.z.array(
zod.z.object({
activePlatform: zod.z.null(),
cid: zod.z.string(),
game_name: zod.z.string(),
game_tag: zod.z.string(),
muted: zod.z.boolean(),
name: zod.z.string(),
pid: zod.z.string(),
puuid: playerUUIDSchema,
region: zod.z.string()
})
)
});
const Endpoint$_ = defineEndpoint({
name: "Chat Participants",
description: "Get information about the participants of all active conversations or a specific conversation if a cid is provided",
type: "local",
url: "chat/v5/participants",
query: zod.z.object({ cid: zod.z.string().optional() }),
responses: {
"200": ChatParticipantsResponseSchema
}
});
class ChatParticipantsEndpoint {
/**
* Get information about the participants of all active conversations or a specific conversation if a cid is provided
*
* @EndpointType local
*/
getChatParticipants(config = {}) {
return this["~request"](Endpoint$_, config);
}
}
const ChatSessionResponseSchema = zod.z.object({
federated: zod.z.boolean(),
game_name: zod.z.string(),
game_tag: zod.z.string(),
loaded: zod.z.boolean(),
name: zod.z.string(),
pid: zod.z.string(),
puuid: playerUUIDSchema,
region: zod.z.string(),
resource: zod.z.string(),
state: zod.z.string()
});
const Endpoint$Z = defineEndpoint({
name: "Chat Session",
description: "Get the current session including player name and PUUID",
type: "local",
url: "chat/v1/session",
responses: {
"200": ChatSessionResponseSchema
}
});
class ChatSessionEndpoint {
/**
* Get the current session including player name and PUUID
*
* @EndpointType local
*/
getChatSession(config = {}) {
return this["~request"](Endpoint$Z, config);
}
}
const ChatRegionSchema = zod.z.object({
locale: zod.z.string(),
region: zod.z.string(),
webLanguage: zod.z.string(),
webRegion: zod.z.string()
});
const Endpoint$Y = defineEndpoint({
name: "Client Region",
description: "Gets info about the region and locale from the Riot client",
type: "local",
url: "riotclient/region-locale",
responses: {
"200": ChatRegionSchema
}
});
class ClientRegionEndpoint {
/**
* Gets info about the region and locale from the Riot client
*
* @EndpointType local
*/
getClientRegion(config = {}) {
return this["~request"](Endpoint$Y, config);
}
}
const Endpoint$X = defineEndpoint({
name: "Current Game Chat Info",
description: "Get information about the current game chat",
type: "local",
url: "chat/v6/conversations/ares-coregame",
responses: {
"200": conversationsSchema
}
});
class CurrentGameChatInfoEndpoint {
/**
* Get information about the current game chat
*
* @EndpointType local
*/
getCurrentGameChatInfo(config = {}) {
return this["~request"](Endpoint$X, config);
}
}
const EntitlementsTokenResponseSchema = zod.z.object({
accessToken: zod.z.string().describe("Used as the token in requests"),
entitlements: zod.z.array(zod.z.unknown()),
issuer: zod.z.string(),
subject: playerUUIDSchema,
token: zod.z.string().describe("Used as the entitlement in requests")
});
const Endpoint$W = defineEndpoint({
name: "Entitlements Token",
description: [
"Gets both the token and entitlement for API usage",
"",
"`accessToken` is used as the token and `token` is used as the entitlement."
].join(" \n"),
type: "local",
url: "entitlements/v1/token",
responses: {
"200": EntitlementsTokenResponseSchema
}
});
class EntitlementsTokenEndpoint {
/**
* Gets both the token and entitlement for API usage
*
* `accessToken` is used as the token and `token` is used as the entitlement.
*
* @EndpointType local
*/
getEntitlementsToken(config = {}) {
return this["~request"](Endpoint$W, config);
}
}
const FriendRequestsResponseSchema = zod.z.object({
requests: zod.z.array(
zod.z.object({
game_name: zod.z.string(),
game_tag: zod.z.string(),
name: zod.z.string(),
note: zod.z.string(),
pid: zod.z.string(),
puuid: playerUUIDSchema,
region: zod.z.string(),
subscription: zod.z.enum(["pending_out", "pending_in"])
})
)
});
const Endpoint$V = defineEndpoint({
name: "Friend Requests",
description: "Get a list of friend requests",
type: "local",
url: "chat/v4/friendrequests",
responses: {
"200": FriendRequestsResponseSchema
}
});
class FriendRequestsEndpoint {
/**
* Get a list of friend requests
*
* @EndpointType local
*/
getFriendRequests(config = {}) {
return this["~request"](Endpoint$V, config);
}
}
const FriendsResponseSchema = zod.z.object({
friends: zod.z.array(
zod.z.object({
activePlatform: zod.z.string().nullable(),
displayGroup: zod.z.string(),
game_name: zod.z.string(),
game_tag: zod.z.string(),
group: zod.z.string(),
last_online_ts: millisSchema.nullable(),
name: zod.z.string(),
note: zod.z.string(),
pid: zod.z.string(),
puuid: playerUUIDSchema,
region: zod.z.string()
})
)
});
const Endpoint$U = defineEndpoint({
name: "Friends",
description: "Get a list of friends",
type: "local",
url: "chat/v4/friends",
responses: {
"200": FriendsResponseSchema
}
});
class FriendsEndpoint {
/**
* Get a list of friends
*
* @EndpointType local
*/
getFriends(config = {}) {
return this["~request"](Endpoint$U, config);
}
}
const HelpResponseSchema = zod.z.object({
events: zod.z.record(
zod.z.string().describe("Websocket event name"),
zod.z.string().describe("Websocket event description")
),
functions: zod.z.record(
zod.z.string().describe("Function name"),
zod.z.string().describe("Function description")
),
types: zod.z.record(
zod.z.string().describe("Type name"),
zod.z.string().describe("Type description")
)
});
const Endpoint$T = defineEndpoint({
name: "Help",
description: "Get help for the local client",
type: "local",
url: "help",
responses: {
"200": HelpResponseSchema
}
});
class HelpEndpoint {
/**
* Get help for the local client
*
* @EndpointType local
*/
getHelp(config = {}) {
return this["~request"](Endpoint$T, config);
}
}
const Endpoint$S = defineEndpoint({
name: "Party Chat Info",
description: "Get information about the party chat",
type: "local",
url: "chat/v6/conversations/ares-parties",
responses: {
"200": conversationsSchema
}
});
class PartyChatInfoEndpoint {
/**
* Get information about the party chat
*
* @EndpointType local
*/
getPartyChatInfo(config = {}) {
return this["~request"](Endpoint$S, config);
}
}
const Endpoint$R = defineEndpoint({
name: "Pre-Game Chat Info",
description: "Get information about the pre-game chat",
type: "local",
url: "chat/v6/conversations/ares-pregame",
responses: {
"200": conversationsSchema
}
});
class PreGameChatInfoEndpoint {
/**
* Get information about the pre-game chat
*
* @EndpointType local
*/
getPreGameChatInfo(config = {}) {
return this["~request"](Endpoint$R, config);
}
}
const leagueOfLegendsPresenceSchema = zod.z.object({
bannerIdSelected: zod.z.string(),
challengeCrystalSelected: zod.z.string(),
challengeTitleSelected: weakUUIDSchema,
challengeTokensSelected: zod.z.string().transform((val) => val.split(",").map((v) => parseInt(v))),
championId: zod.z.string(),
companionId: zod.z.string(),
damageSkinId: zod.z.string(),
gameId: zod.z.string(),
gameMode: zod.z.string(),
gameQueueType: zod.z.string(),
gameStatus: zod.z.string(),
iconOverride: zod.z.string(),
isObservable: zod.z.string(),
level: zod.z.string(),
mapId: zod.z.string(),
mapSkinId: zod.z.string(),
masteryScore: zod.z.string(),
profileIcon: zod.z.string(),
pty: zod.z.string(),
puuid: zod.z.string(),
queueId: zod.z.string(),
rankedLeagueDivision: zod.z.string(),
rankedLeagueQueue: zod.z.string(),
rankedLeagueTier: zod.z.string(),
rankedLosses: zod.z.string(),
rankedPrevSeasonDivision: zod.z.string(),
rankedPrevSeasonTier: zod.z.string(),
rankedSplitRewardLevel: zod.z.string(),
rankedWins: zod.z.string(),
regalia: zod.z.string(),
skinVariant: zod.z.string(),
skinname: zod.z.string(),
timeStamp: zod.z.string()
});
const valorantPresenceSchema = zod.z.object({
isValid: zod.z.boolean(),
sessionLoopState: zod.z.string(),
partyOwnerSessionLoopState: zod.z.string(),
customGameName: zod.z.string(),
customGameTeam: zod.z.string(),
partyOwnerMatchMap: mapIDSchema,
partyOwnerMatchCurrentTeam: zod.z.string(),
partyOwnerMatchScoreAllyTeam: zod.z.number(),
partyOwnerMatchScoreEnemyTeam: zod.z.number(),
partyOwnerProvisioningFlow: zod.z.string(),
matchMap: mapIDSchema,
partyId: partyIDSchema,
isPartyOwner: zod.z.boolean(),
partyState: zod.z.string(),
partyAccessibility: zod.z.enum(["OPEN", "CLOSED"]),
maxPartySize: zod.z.number(),
queueId: queueIDSchema,
partyLFM: zod.z.boolean(),
partyClientVersion: zod.z.string(),
partySize: zod.z.number(),
tournamentId: zod.z.string(),
rosterId: zod.z.string(),
partyVersion: millisSchema,
queueEntryTime: zod.z.string(),
playerCardId: cardIDSchema,
playerTitleId: titleIDSchema,
preferredLevelBorderId: preferredLevelBorderIDSchema,
accountLevel: zod.z.number(),
competitiveTier: zod.z.number(),
leaderboardPosition: zod.z.number(),
isIdle: zod.z.boolean()
});
const PresenceResponseSchema = zod.z.object({
presences: zod.z.array(
zod.z.object({
actor: zod.z.unknown().nullable(),
basic: zod.z.string(),
details: zod.z.unknown().nullable(),
game_name: zod.z.string(),
game_tag: zod.z.string(),
location: zod.z.unknown().nullable(),
msg: zod.z.unknown().nullable(),
name: zod.z.string(),
patchline: zod.z.unknown().nullable(),
pid: zod.z.string(),
platform: zod.z.unknown().nullable(),
private: zod.z.string().nullable().transform((val) => {
if (val === null) return null;
try {
return leagueOfLegendsPresenceSchema.parse(JSON.parse(val));
} catch (ignored) {
}
return valorantPresenceSchema.parse(JSON.parse(atob(val)));
}),
privateJwt: zod.z.unknown().nullable(),
product: zod.z.enum(["valorant", "league_of_legends"]),
puuid: playerUUIDSchema,
region: zod.z.string(),
resource: zod.z.string(),
state: zod.z.enum(["mobile", "dnd", "away", "chat"]),
summary: zod.z.string(),
time: millisSchema
})
)
});
const Endpoint$Q = defineEndpoint({
name: "Presence",
description: [
"Get a list of online friends and their activity",
"If the player is playing Valorant, `private` is a base64-encoded JSON string that contains useful information such as party and in-progress game score."
].join(" \n"),
type: "local",
url: "chat/v4/presences",
responses: {
"200": PresenceResponseSchema
}
});
class PresenceEndpoint {
/**
* Get a list of online friends and their activity
* If the player is playing Valorant, `private` is a base64-encoded JSON string that contains useful information such as party and in-progress game score.
*
* @EndpointType local
*/
getPresence(config = {}) {
return this["~request"](Endpoint$Q, config);
}
}
const Endpoint$P = defineEndpoint({
name: "Remove Friend Request",
description: "Removes an outgoing friend request",
type: "local",
method: "DELETE",
url: "chat/v4/friendrequests",
body: zod.z.object({
puuid: playerUUIDSchema
}),
responses: {
"204": zod.z.undefined()
}
});
class RemoveFriendRequestEndpoint {
/**
* Removes an outgoing friend request
*
* @EndpointType local
*/
deleteRemoveFriendRequest(config) {
return this["~request"](Endpoint$P, config);
}
}
const userInfoSchema = zod.z.object({
acct: zod.z.object({
adm: zod.z.boolean(),
created_at: millisSchema,
game_name: zod.z.string(),
state: zod.z.string(),
tag_line: zod.z.string(),
type: zod.z.number()
}),
ban: zod.z.object({
code: zod.z.unknown().nullable().optional(),
desc: zod.z.string().optional(),
exp: zod.z.unknown().nullable().optional(),
restrictions: zod.z.array(zod.z.unknown())
}),
country: zod.z.string(),
country_at: millisSchema,
email_verified: zod.z.boolean(),
jti: zod.z.string(),
lol: zod.z.unknown().nullable(),
lol_region: zod.z.array(zod.z.unknown()),
original_account_id: zod.z.unknown().nullable(),
original_platform_id: zod.z.unknown().nullable(),
phone_number_verified: zod.z.boolean(),
player_locale: zod.z.string(),
player_plocale: zod.z.unknown().nullable(),
ppid: zod.z.unknown().nullable(),
preferred_username: zod.z.string(),
pvpnet_account_id: zod.z.unknown().nullable(),
pw: zod.z.object({
cng_at: millisSchema,
must_reset: zod.z.boolean(),
reset: zod.z.boolean()
}).describe("Password info"),
sub: playerUUIDSchema,
username: zod.z.string()
});
const Endpoint$O = defineEndpoint({
name: "RSO User Info",
description: "Get RSO user info",
type: "local",
url: "rso-auth/v1/authorization/userinfo",
responses: {
"200": zod.z.object({
userInfo: zod.z.string().transform((str) => userInfoSchema.parse(JSON.parse(str)))
})
}
});
class RsoUserInfoEndpoint {
/**
* Get RSO user info
*
* @EndpointType local
*/
getRsoUserInfo(config = {}) {
return this["~request"](Endpoint$O, config);
}
}
const Endpoint$N = defineEndpoint({
name: "Send Chat Message",
description: "Send a message to the specified group",
type: "local",
url: "chat/v6/messages",
method: "POST",
body: zod.z.object({
cid: zod.z.string().describe("The conversation ID of the group to send the message to"),
message: zod.z.string(),
type: zod.z.enum(["groupchat", "chat", "system"]).describe(
"Use `chat` for whispers, `groupchat` for group messages, and `system` f