valo-api-wrapper
Version:
Type-safe client and wrapper for the Valorant API
1,311 lines (1,292 loc) • 2.08 MB
text/typescript
import * as axios from 'axios';
import { AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
import { CookieJar } from 'tough-cookie';
import * as zod from 'zod';
import { z } from 'zod';
import { IfAny, Merge, EmptyObject, Simplify, SetOptional, UnionToIntersection } from 'type-fest';
declare const valorantEndpointSchema: z.ZodEffects<z.ZodObject<{
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
type: z.ZodEnum<["auth", "local", "pd", "glz", "shared"]>;
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "DELETE"]>>;
url: z.ZodString;
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
requirements: z.ZodDefault<z.ZodArray<z.ZodEnum<["ACCESS_TOKEN", "ENTITLEMENTS_TOKEN", "CLIENT_VERSION", "CLIENT_PLATFORM", "LOCAL_AUTH"]>, "many">>;
body: z.ZodOptional<z.ZodType<z.ZodType<any, z.ZodTypeDef, any>, z.ZodTypeDef, z.ZodType<any, z.ZodTypeDef, any>>>;
query: z.ZodOptional<z.ZodType<z.ZodType<any, z.ZodTypeDef, any>, z.ZodTypeDef, z.ZodType<any, z.ZodTypeDef, any>>>;
responses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<z.ZodType<any, z.ZodTypeDef, any>, z.ZodTypeDef, z.ZodType<any, z.ZodTypeDef, any>>>>;
}, "strip", z.ZodTypeAny, {
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
requirements: ("ACCESS_TOKEN" | "ENTITLEMENTS_TOKEN" | "CLIENT_VERSION" | "CLIENT_PLATFORM" | "LOCAL_AUTH")[];
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, {
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
url: string;
description?: string | undefined;
method?: "PUT" | "GET" | "DELETE" | "POST" | undefined;
headers?: Record<string, string> | undefined;
requirements?: ("ACCESS_TOKEN" | "ENTITLEMENTS_TOKEN" | "CLIENT_VERSION" | "CLIENT_PLATFORM" | "LOCAL_AUTH")[] | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}>, {
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, {
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
url: string;
description?: string | undefined;
method?: "PUT" | "GET" | "DELETE" | "POST" | undefined;
headers?: Record<string, string> | undefined;
requirements?: ("ACCESS_TOKEN" | "ENTITLEMENTS_TOKEN" | "CLIENT_VERSION" | "CLIENT_PLATFORM" | "LOCAL_AUTH")[] | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}>;
type ValorantEndpoint = z.output<typeof valorantEndpointSchema>;
declare const _default$1a: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Auth Cookies";
readonly description: "Prepare cookies for auth request";
readonly type: "auth";
readonly method: "POST";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
client_id: z.ZodLiteral<"play-valorant-web-prod">;
nonce: z.ZodLiteral<"1">;
redirect_uri: z.ZodLiteral<"https://playvalorant.com/opt_in">;
response_type: z.ZodLiteral<"token id_token">;
scope: z.ZodLiteral<"account openid">;
}, "strip", z.ZodTypeAny, {
client_id: "play-valorant-web-prod";
nonce: "1";
redirect_uri: "https://playvalorant.com/opt_in";
response_type: "token id_token";
scope: "account openid";
}, {
client_id: "play-valorant-web-prod";
nonce: "1";
redirect_uri: "https://playvalorant.com/opt_in";
response_type: "token id_token";
scope: "account openid";
}>;
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Auth Cookies";
readonly description: "Prepare cookies for auth request";
readonly type: "auth";
readonly method: "POST";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
client_id: z.ZodLiteral<"play-valorant-web-prod">;
nonce: z.ZodLiteral<"1">;
redirect_uri: z.ZodLiteral<"https://playvalorant.com/opt_in">;
response_type: z.ZodLiteral<"token id_token">;
scope: z.ZodLiteral<"account openid">;
}, "strip", z.ZodTypeAny, {
client_id: "play-valorant-web-prod";
nonce: "1";
redirect_uri: "https://playvalorant.com/opt_in";
response_type: "token id_token";
scope: "account openid";
}, {
client_id: "play-valorant-web-prod";
nonce: "1";
redirect_uri: "https://playvalorant.com/opt_in";
response_type: "token id_token";
scope: "account openid";
}>;
};
};
type IsPathParameter<Part extends string> = Part extends `:${infer Parameter}` ? Parameter : never;
type GetPathParameter<Path extends string> = Path extends `${infer A}/${infer B}` ? IsPathParameter<A> | GetPathParameter<B> : IsPathParameter<Path>;
type ResolvePath<Path extends string> = Simplify<{
[Param in GetPathParameter<Path> as Param extends `${string}?` ? never : Param]: string;
} & {
[Param in GetPathParameter<Path> as Param extends `${infer OptionalParam}?` ? OptionalParam : never]?: string;
}>;
type ResolveParams<Url extends string, Resolved = ResolvePath<Url>> = Resolved extends {
puuid: any;
} ? SetOptional<Resolved, "puuid"> : Resolved;
type ResolveValue<Object, Key extends string, FallbackType = any> = Object extends {
[key in Key]: infer Value;
} ? Value : FallbackType;
type ResolveData<Params, Body, Data = Merge<Params, IfAny<Body, EmptyObject, Body>>> = Data extends EmptyObject ? any : Data;
type ValorantAxiosRequestConfig<T = any, K extends string = IfAny<T, never, "data">> = AxiosRequestConfig<T> & {
[key in K]: T;
};
type Params$1a = ResolveParams<(typeof _default$1a)["~type"]["url"]>;
type Body$1a = z.infer<ResolveValue<(typeof _default$1a)["~type"], "body">>;
type Data$1a = ResolveData<Params$1a, Body$1a>;
type Response$1a = z.infer<ResolveValue<(typeof _default$1a)["~type"], "responses">["200"]>;
interface AuthCookiesRequestConfig extends ValorantAxiosRequestConfig<Data$1a> {
}
declare class AuthCookiesEndpoint {
/**
* Prepare cookies for auth request
*
* @EndpointType auth
*/
postAuthCookies<T = Response$1a>(this: AuthApiClient, config: AuthCookiesRequestConfig): Promise<AxiosResponse<T>>;
}
declare const AuthRequestResponseSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"success">;
success: z.ZodObject<{
login_token: z.ZodString;
redirect_url: z.ZodString;
is_console_link_session: z.ZodBoolean;
auth_method: z.ZodLiteral<"riot_identity">;
puuid: z.ZodString;
}, "strip", z.ZodTypeAny, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}>;
country: z.ZodString;
platform: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"multifactor">;
multifactor: z.ZodObject<{
method: z.ZodLiteral<"email">;
methods: z.ZodArray<z.ZodLiteral<"email">, "many">;
email: z.ZodString;
mode: z.ZodLiteral<"auth">;
auth_method: z.ZodLiteral<"riot_identity">;
}, "strip", z.ZodTypeAny, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}>;
country: z.ZodString;
platform: z.ZodString;
error: z.ZodOptional<z.ZodLiteral<"invalid_code">>;
}, "strip", z.ZodTypeAny, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}>]>;
declare const _default$19: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Auth Request";
readonly description: string;
readonly type: "auth";
readonly method: "PUT";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
type: z.ZodLiteral<"auth">;
language: z.ZodLiteral<"en_US">;
remember: z.ZodBoolean;
riot_identity: z.ZodObject<{
captcha: z.ZodString;
username: z.ZodString;
password: z.ZodString;
}, "strip", z.ZodTypeAny, {
password: string;
username: string;
captcha: string;
}, {
password: string;
username: string;
captcha: string;
}>;
}, "strip", z.ZodTypeAny, {
type: "auth";
riot_identity: {
password: string;
username: string;
captcha: string;
};
language: "en_US";
remember: boolean;
}, {
type: "auth";
riot_identity: {
password: string;
username: string;
captcha: string;
};
language: "en_US";
remember: boolean;
}>;
readonly responses: {
readonly "200": z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"success">;
success: z.ZodObject<{
login_token: z.ZodString;
redirect_url: z.ZodString;
is_console_link_session: z.ZodBoolean;
auth_method: z.ZodLiteral<"riot_identity">;
puuid: z.ZodString;
}, "strip", z.ZodTypeAny, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}>;
country: z.ZodString;
platform: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"multifactor">;
multifactor: z.ZodObject<{
method: z.ZodLiteral<"email">;
methods: z.ZodArray<z.ZodLiteral<"email">, "many">;
email: z.ZodString;
mode: z.ZodLiteral<"auth">;
auth_method: z.ZodLiteral<"riot_identity">;
}, "strip", z.ZodTypeAny, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}>;
country: z.ZodString;
platform: z.ZodString;
error: z.ZodOptional<z.ZodLiteral<"invalid_code">>;
}, "strip", z.ZodTypeAny, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}>]>;
};
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Auth Request";
readonly description: string;
readonly type: "auth";
readonly method: "PUT";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
type: z.ZodLiteral<"auth">;
language: z.ZodLiteral<"en_US">;
remember: z.ZodBoolean;
riot_identity: z.ZodObject<{
captcha: z.ZodString;
username: z.ZodString;
password: z.ZodString;
}, "strip", z.ZodTypeAny, {
password: string;
username: string;
captcha: string;
}, {
password: string;
username: string;
captcha: string;
}>;
}, "strip", z.ZodTypeAny, {
type: "auth";
riot_identity: {
password: string;
username: string;
captcha: string;
};
language: "en_US";
remember: boolean;
}, {
type: "auth";
riot_identity: {
password: string;
username: string;
captcha: string;
};
language: "en_US";
remember: boolean;
}>;
readonly responses: {
readonly "200": z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"success">;
success: z.ZodObject<{
login_token: z.ZodString;
redirect_url: z.ZodString;
is_console_link_session: z.ZodBoolean;
auth_method: z.ZodLiteral<"riot_identity">;
puuid: z.ZodString;
}, "strip", z.ZodTypeAny, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}, {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
}>;
country: z.ZodString;
platform: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}, {
type: "success";
success: {
login_token: string;
redirect_url: string;
is_console_link_session: boolean;
auth_method: "riot_identity";
puuid: string;
};
country: string;
platform: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"multifactor">;
multifactor: z.ZodObject<{
method: z.ZodLiteral<"email">;
methods: z.ZodArray<z.ZodLiteral<"email">, "many">;
email: z.ZodString;
mode: z.ZodLiteral<"auth">;
auth_method: z.ZodLiteral<"riot_identity">;
}, "strip", z.ZodTypeAny, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}, {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
}>;
country: z.ZodString;
platform: z.ZodString;
error: z.ZodOptional<z.ZodLiteral<"invalid_code">>;
}, "strip", z.ZodTypeAny, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}, {
type: "multifactor";
country: string;
platform: string;
multifactor: {
method: "email";
email: string;
auth_method: "riot_identity";
methods: "email"[];
mode: "auth";
};
error?: "invalid_code" | undefined;
}>]>;
};
};
};
type Params$19 = ResolveParams<(typeof _default$19)["~type"]["url"]>;
type Body$19 = z.infer<ResolveValue<(typeof _default$19)["~type"], "body">>;
type Data$19 = ResolveData<Params$19, Body$19>;
type Response$19 = z.infer<ResolveValue<(typeof _default$19)["~type"], "responses">["200"]>;
interface AuthRequestRequestConfig extends ValorantAxiosRequestConfig<Data$19> {
}
declare 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<T = Response$19>(this: AuthApiClient, config: AuthRequestRequestConfig): Promise<AxiosResponse<T>>;
}
declare const _default$18: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: zod.ZodType<any, zod.ZodTypeDef, any> | undefined;
query?: zod.ZodType<any, zod.ZodTypeDef, any> | undefined;
responses?: Record<string, zod.ZodType<any, zod.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Cookie Reauth";
readonly description: string;
readonly type: "auth";
readonly method: "PUT";
readonly 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";
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Cookie Reauth";
readonly description: string;
readonly type: "auth";
readonly method: "PUT";
readonly 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";
};
};
type Params$18 = ResolveParams<(typeof _default$18)["~type"]["url"]>;
type Body$18 = z.infer<ResolveValue<(typeof _default$18)["~type"], "body">>;
type Data$18 = ResolveData<Params$18, Body$18>;
type Response$18 = z.infer<ResolveValue<(typeof _default$18)["~type"], "responses">["200"]>;
interface CookieReauthRequestConfig extends ValorantAxiosRequestConfig<Data$18> {
}
declare 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<T = Response$18>(this: AuthApiClient, config?: CookieReauthRequestConfig): Promise<AxiosResponse<T>>;
}
declare const _default$17: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Entitlements Token";
readonly description: "Get entitlement for remote requests with a token";
readonly type: "auth";
readonly method: "POST";
readonly url: "https://entitlements.auth.riotgames.com/api/token/v1";
readonly requirements: ["ACCESS_TOKEN"];
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly responses: {
readonly "200": z.ZodObject<{
entitlements_token: z.ZodString;
}, "strip", z.ZodTypeAny, {
entitlements_token: string;
}, {
entitlements_token: string;
}>;
};
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Entitlements Token";
readonly description: "Get entitlement for remote requests with a token";
readonly type: "auth";
readonly method: "POST";
readonly url: "https://entitlements.auth.riotgames.com/api/token/v1";
readonly requirements: ["ACCESS_TOKEN"];
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly responses: {
readonly "200": z.ZodObject<{
entitlements_token: z.ZodString;
}, "strip", z.ZodTypeAny, {
entitlements_token: string;
}, {
entitlements_token: string;
}>;
};
};
};
type Params$17 = ResolveParams<(typeof _default$17)["~type"]["url"]>;
type Body$17 = z.infer<ResolveValue<(typeof _default$17)["~type"], "body">>;
type Data$17 = ResolveData<Params$17, Body$17>;
type Response$17 = z.infer<ResolveValue<(typeof _default$17)["~type"], "responses">["200"]>;
interface EntitlementsTokenRequestConfig$1 extends ValorantAxiosRequestConfig<Data$17> {
}
declare class EntitlementsTokenEndpoint$1 {
/**
* Get entitlement for remote requests with a token
*
* @EndpointType auth
*/
postEntitlementsToken<T = Response$17>(this: AuthApiClient, config?: EntitlementsTokenRequestConfig$1): Promise<AxiosResponse<T>>;
}
declare const _default$16: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "MultiFactor Authentication";
readonly description: "Submits a multi-factor authentication code for login";
readonly type: "auth";
readonly method: "PUT";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
type: z.ZodLiteral<"multifactor">;
multifactor: z.ZodObject<{
otp: z.ZodString;
rememberDevice: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
otp: string;
rememberDevice: boolean;
}, {
otp: string;
rememberDevice: boolean;
}>;
}, "strip", z.ZodTypeAny, {
type: "multifactor";
multifactor: {
otp: string;
rememberDevice: boolean;
};
}, {
type: "multifactor";
multifactor: {
otp: string;
rememberDevice: boolean;
};
}>;
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "MultiFactor Authentication";
readonly description: "Submits a multi-factor authentication code for login";
readonly type: "auth";
readonly method: "PUT";
readonly url: "https://auth.riotgames.com/api/v1/authorization";
readonly headers: {
readonly "Content-Type": "application/json";
};
readonly body: z.ZodObject<{
type: z.ZodLiteral<"multifactor">;
multifactor: z.ZodObject<{
otp: z.ZodString;
rememberDevice: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
otp: string;
rememberDevice: boolean;
}, {
otp: string;
rememberDevice: boolean;
}>;
}, "strip", z.ZodTypeAny, {
type: "multifactor";
multifactor: {
otp: string;
rememberDevice: boolean;
};
}, {
type: "multifactor";
multifactor: {
otp: string;
rememberDevice: boolean;
};
}>;
};
};
type Params$16 = ResolveParams<(typeof _default$16)["~type"]["url"]>;
type Body$16 = z.infer<ResolveValue<(typeof _default$16)["~type"], "body">>;
type Data$16 = ResolveData<Params$16, Body$16>;
type Response$16 = z.infer<ResolveValue<(typeof _default$16)["~type"], "responses">["200"]>;
interface MultiFactorAuthenticationRequestConfig extends ValorantAxiosRequestConfig<Data$16> {
}
declare class MultiFactorAuthenticationEndpoint {
/**
* Submits a multi-factor authentication code for login
*
* @EndpointType auth
*/
putMultiFactorAuthentication<T = Response$16>(this: AuthApiClient, config: MultiFactorAuthenticationRequestConfig): Promise<AxiosResponse<T>>;
}
declare const PasTokenResponseSchema: z.ZodString;
declare const _default$15: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "PAS Token";
readonly description: "Get a PAS token using the auth token. The PAS token is a JWT that contains the affinity for the XMPP server.";
readonly type: "auth";
readonly url: "https://riot-geo.pas.si.riotgames.com/pas/v1/service/chat";
readonly requirements: ["ACCESS_TOKEN"];
readonly responses: {
readonly "200": z.ZodString;
};
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "PAS Token";
readonly description: "Get a PAS token using the auth token. The PAS token is a JWT that contains the affinity for the XMPP server.";
readonly type: "auth";
readonly url: "https://riot-geo.pas.si.riotgames.com/pas/v1/service/chat";
readonly requirements: ["ACCESS_TOKEN"];
readonly responses: {
readonly "200": z.ZodString;
};
};
};
type Params$15 = ResolveParams<(typeof _default$15)["~type"]["url"]>;
type Body$15 = z.infer<ResolveValue<(typeof _default$15)["~type"], "body">>;
type Data$15 = ResolveData<Params$15, Body$15>;
type Response$15 = z.infer<ResolveValue<(typeof _default$15)["~type"], "responses">["200"]>;
interface PasTokenRequestConfig extends ValorantAxiosRequestConfig<Data$15> {
}
declare 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<T = Response$15>(this: AuthApiClient, config?: PasTokenRequestConfig): Promise<AxiosResponse<T>>;
}
declare const PlayerInfoResponseSchema: z.ZodObject<{
country: z.ZodString;
sub: z.ZodString;
email_verified: z.ZodBoolean;
player_plocale: z.ZodNullable<z.ZodUnknown>;
country_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, Date, number>>;
pw: z.ZodObject<{
cng_at: z.ZodEffects<z.ZodNumber, Date, number>;
reset: z.ZodBoolean;
must_reset: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
cng_at: Date;
reset: boolean;
must_reset: boolean;
}, {
cng_at: number;
reset: boolean;
must_reset: boolean;
}>;
phone_number_verified: z.ZodBoolean;
account_verified: z.ZodBoolean;
ppid: z.ZodNullable<z.ZodUnknown>;
federated_identity_providers: z.ZodArray<z.ZodString, "many">;
player_locale: z.ZodNullable<z.ZodString>;
acct: z.ZodObject<{
type: z.ZodNumber;
state: z.ZodString;
adm: z.ZodBoolean;
game_name: z.ZodString;
tag_line: z.ZodString;
created_at: z.ZodEffects<z.ZodNumber, Date, number>;
}, "strip", z.ZodTypeAny, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
}, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
}>;
age: z.ZodNumber;
jti: z.ZodString;
affinity: z.ZodRecord<z.ZodString, z.ZodString>;
}, "strip", z.ZodTypeAny, {
sub: string;
country: string;
email_verified: boolean;
country_at: Date | null;
pw: {
cng_at: Date;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}, {
sub: string;
country: string;
email_verified: boolean;
country_at: number | null;
pw: {
cng_at: number;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}>;
declare const _default$14: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Player Info";
readonly description: "Get the PUUID and other info from a token";
readonly type: "auth";
readonly url: "https://auth.riotgames.com/userinfo";
readonly requirements: ["ACCESS_TOKEN"];
readonly responses: {
readonly "200": z.ZodObject<{
country: z.ZodString;
sub: z.ZodString;
email_verified: z.ZodBoolean;
player_plocale: z.ZodNullable<z.ZodUnknown>;
country_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, Date, number>>;
pw: z.ZodObject<{
cng_at: z.ZodEffects<z.ZodNumber, Date, number>;
reset: z.ZodBoolean;
must_reset: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
cng_at: Date;
reset: boolean;
must_reset: boolean;
}, {
cng_at: number;
reset: boolean;
must_reset: boolean;
}>;
phone_number_verified: z.ZodBoolean;
account_verified: z.ZodBoolean;
ppid: z.ZodNullable<z.ZodUnknown>;
federated_identity_providers: z.ZodArray<z.ZodString, "many">;
player_locale: z.ZodNullable<z.ZodString>;
acct: z.ZodObject<{
type: z.ZodNumber;
state: z.ZodString;
adm: z.ZodBoolean;
game_name: z.ZodString;
tag_line: z.ZodString;
created_at: z.ZodEffects<z.ZodNumber, Date, number>;
}, "strip", z.ZodTypeAny, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
}, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
}>;
age: z.ZodNumber;
jti: z.ZodString;
affinity: z.ZodRecord<z.ZodString, z.ZodString>;
}, "strip", z.ZodTypeAny, {
sub: string;
country: string;
email_verified: boolean;
country_at: Date | null;
pw: {
cng_at: Date;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}, {
sub: string;
country: string;
email_verified: boolean;
country_at: number | null;
pw: {
cng_at: number;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}>;
};
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Player Info";
readonly description: "Get the PUUID and other info from a token";
readonly type: "auth";
readonly url: "https://auth.riotgames.com/userinfo";
readonly requirements: ["ACCESS_TOKEN"];
readonly responses: {
readonly "200": z.ZodObject<{
country: z.ZodString;
sub: z.ZodString;
email_verified: z.ZodBoolean;
player_plocale: z.ZodNullable<z.ZodUnknown>;
country_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, Date, number>>;
pw: z.ZodObject<{
cng_at: z.ZodEffects<z.ZodNumber, Date, number>;
reset: z.ZodBoolean;
must_reset: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
cng_at: Date;
reset: boolean;
must_reset: boolean;
}, {
cng_at: number;
reset: boolean;
must_reset: boolean;
}>;
phone_number_verified: z.ZodBoolean;
account_verified: z.ZodBoolean;
ppid: z.ZodNullable<z.ZodUnknown>;
federated_identity_providers: z.ZodArray<z.ZodString, "many">;
player_locale: z.ZodNullable<z.ZodString>;
acct: z.ZodObject<{
type: z.ZodNumber;
state: z.ZodString;
adm: z.ZodBoolean;
game_name: z.ZodString;
tag_line: z.ZodString;
created_at: z.ZodEffects<z.ZodNumber, Date, number>;
}, "strip", z.ZodTypeAny, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
}, {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
}>;
age: z.ZodNumber;
jti: z.ZodString;
affinity: z.ZodRecord<z.ZodString, z.ZodString>;
}, "strip", z.ZodTypeAny, {
sub: string;
country: string;
email_verified: boolean;
country_at: Date | null;
pw: {
cng_at: Date;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: Date;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}, {
sub: string;
country: string;
email_verified: boolean;
country_at: number | null;
pw: {
cng_at: number;
reset: boolean;
must_reset: boolean;
};
phone_number_verified: boolean;
account_verified: boolean;
federated_identity_providers: string[];
player_locale: string | null;
acct: {
type: number;
state: string;
adm: boolean;
game_name: string;
tag_line: string;
created_at: number;
};
age: number;
jti: string;
affinity: Record<string, string>;
player_plocale?: unknown;
ppid?: unknown;
}>;
};
};
};
type Params$14 = ResolveParams<(typeof _default$14)["~type"]["url"]>;
type Body$14 = z.infer<ResolveValue<(typeof _default$14)["~type"], "body">>;
type Data$14 = ResolveData<Params$14, Body$14>;
type Response$14 = z.infer<ResolveValue<(typeof _default$14)["~type"], "responses">["200"]>;
interface PlayerInfoRequestConfig extends ValorantAxiosRequestConfig<Data$14> {
}
declare class PlayerInfoEndpoint {
/**
* Get the PUUID and other info from a token
*
* @EndpointType auth
*/
getPlayerInfo<T = Response$14>(this: AuthApiClient, config?: PlayerInfoRequestConfig): Promise<AxiosResponse<T>>;
}
declare const RiotClientConfigResponseSchema: z.ZodIntersection<z.ZodObject<{
"chat.affinities": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.affinity_domains": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.port": z.ZodNumber;
}, "strip", z.ZodTypeAny, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
declare const _default$13: Omit<{
requirements: string[];
type: "auth" | "local" | "pd" | "glz" | "shared";
name: string;
method: "PUT" | "GET" | "DELETE" | "POST";
url: string;
description?: string | undefined;
headers?: Record<string, string> | undefined;
body?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
query?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
responses?: Record<string, z.ZodType<any, z.ZodTypeDef, any>> | undefined;
}, "type" | "name" | "url"> & Pick<{
readonly name: "Riot Client Config";
readonly description: "Gets the config file used by the Riot Client. This includes a ton of info, most of it undocumented.";
readonly type: "auth";
readonly url: "https://clientconfig.rpg.riotgames.com/api/v1/config/player?app=Riot%20Client";
readonly requirements: ["ACCESS_TOKEN", "ENTITLEMENTS_TOKEN"];
readonly responses: {
readonly "200": z.ZodIntersection<z.ZodObject<{
"chat.affinities": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.affinity_domains": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.port": z.ZodNumber;
}, "strip", z.ZodTypeAny, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
};
}, "type" | "name" | "url"> & {
"~type": {
readonly name: "Riot Client Config";
readonly description: "Gets the config file used by the Riot Client. This includes a ton of info, most of it undocumented.";
readonly type: "auth";
readonly url: "https://clientconfig.rpg.riotgames.com/api/v1/config/player?app=Riot%20Client";
readonly requirements: ["ACCESS_TOKEN", "ENTITLEMENTS_TOKEN"];
readonly responses: {
readonly "200": z.ZodIntersection<z.ZodObject<{
"chat.affinities": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.affinity_domains": z.ZodRecord<z.ZodString, z.ZodString>;
"chat.port": z.ZodNumber;
}, "strip", z.ZodTypeAny, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}, {
"chat.affinities": Record<string, string>;
"chat.affinity_domains": Record<string, string>;
"chat.port": number;
}>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
};
};
};
type Params$13 = ResolveParams<(typeof _default$13)["~type"]["url"]>;
type Body$13 = z.infer<ResolveValue<(typeof _default$13)["~type"], "body">>;
type Data$13 = ResolveData<Params$13, Body$13>;
type Response$13 = z.infer<ResolveValue<(typeof _default$13)["~type"], "responses">["200"]>;
interface RiotClientConfigRequestConfig extends ValorantAxiosRequestConfig<Data$13> {
}
declare class RiotClientConfigEndpoint {
/**
* Gets the config file used by the Riot Client. This includes a ton of info, most of it undocumented.
*
* @EndpointType auth
*/
getRiotClientConfig<T = Response$13>(this: AuthApiClient, config?: RiotClientConfigRequestConfig): Promise<AxiosResponse<T>>;
}
declare const RiotGeoResponseSchema: z.ZodObject<{
token: z.ZodString;
affinities: z.ZodObject<{
pbe: z.ZodString;
live: z.ZodString;
}, "strip", z.ZodTypeAny, {
pbe: string;
live: string;
}, {
pbe: string;
live: string;
}>;
}, "strip", z.ZodTypeAny, {
token: string;
affinities: {
pbe: string;
live: st