UNPKG

valorant-api-types

Version:

A collection of documented endpoints and return types for the unofficial Valorant API

120 lines 5.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.presenceEndpoint = exports.valorantPresenceSchema = exports.leagueOfLegendsPresenceSchema = void 0; const zod_1 = require("zod"); const commonTypes_1 = require("../../commonTypes"); const iso_base64_1 = require("iso-base64"); exports.leagueOfLegendsPresenceSchema = zod_1.z.object({ bannerIdSelected: zod_1.z.string(), challengeCrystalSelected: zod_1.z.string(), challengeTitleSelected: commonTypes_1.weakUUIDSchema, challengeTokensSelected: zod_1.z.string().transform(val => val.split(',').map(v => parseInt(v))), championId: zod_1.z.string(), companionId: zod_1.z.string(), damageSkinId: zod_1.z.string(), gameId: zod_1.z.string(), gameMode: zod_1.z.string(), gameQueueType: zod_1.z.string(), gameStatus: zod_1.z.string(), iconOverride: zod_1.z.string(), isObservable: zod_1.z.string(), level: zod_1.z.string(), mapId: zod_1.z.string(), mapSkinId: zod_1.z.string(), masteryScore: zod_1.z.string(), profileIcon: zod_1.z.string(), pty: zod_1.z.string(), puuid: zod_1.z.string(), queueId: zod_1.z.string(), rankedLeagueDivision: zod_1.z.string(), rankedLeagueQueue: zod_1.z.string(), rankedLeagueTier: zod_1.z.string(), rankedLosses: zod_1.z.string(), rankedPrevSeasonDivision: zod_1.z.string(), rankedPrevSeasonTier: zod_1.z.string(), rankedSplitRewardLevel: zod_1.z.string(), rankedWins: zod_1.z.string(), regalia: zod_1.z.string(), skinVariant: zod_1.z.string(), skinname: zod_1.z.string(), timeStamp: zod_1.z.string() }); exports.valorantPresenceSchema = zod_1.z.object({ isValid: zod_1.z.boolean(), sessionLoopState: zod_1.z.string(), partyOwnerSessionLoopState: zod_1.z.string(), customGameName: zod_1.z.string(), customGameTeam: zod_1.z.string(), partyOwnerMatchMap: commonTypes_1.mapIDSchema, partyOwnerMatchCurrentTeam: zod_1.z.string(), partyOwnerMatchScoreAllyTeam: zod_1.z.number(), partyOwnerMatchScoreEnemyTeam: zod_1.z.number(), partyOwnerProvisioningFlow: zod_1.z.string(), matchMap: commonTypes_1.mapIDSchema, partyId: commonTypes_1.partyIDSchema, isPartyOwner: zod_1.z.boolean(), partyState: zod_1.z.string(), partyAccessibility: zod_1.z.enum(['OPEN', 'CLOSED']), maxPartySize: zod_1.z.number(), queueId: commonTypes_1.queueIDSchema, partyLFM: zod_1.z.boolean(), partyClientVersion: zod_1.z.string(), partySize: zod_1.z.number(), tournamentId: zod_1.z.string(), rosterId: zod_1.z.string(), partyVersion: commonTypes_1.millisSchema, queueEntryTime: zod_1.z.string(), playerCardId: commonTypes_1.cardIDSchema, playerTitleId: commonTypes_1.titleIDSchema, preferredLevelBorderId: commonTypes_1.preferredLevelBorderIDSchema, accountLevel: zod_1.z.number(), competitiveTier: zod_1.z.number(), leaderboardPosition: zod_1.z.number(), isIdle: zod_1.z.boolean() }); exports.presenceEndpoint = { name: 'Presence', description: 'Get a list of online friends and their activity\n ' + '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.', category: 'Local Endpoints', type: 'local', suffix: 'chat/v4/presences', riotRequirements: { localAuth: true }, responses: { '200': zod_1.z.object({ presences: zod_1.z.array(zod_1.z.object({ actor: zod_1.z.unknown().nullable(), basic: zod_1.z.string(), details: zod_1.z.unknown().nullable(), game_name: zod_1.z.string(), game_tag: zod_1.z.string(), location: zod_1.z.unknown().nullable(), msg: zod_1.z.unknown().nullable(), name: zod_1.z.string(), patchline: zod_1.z.unknown().nullable(), pid: zod_1.z.string(), platform: zod_1.z.unknown().nullable(), private: zod_1.z.string().nullable().transform((val) => { if (val === null) return null; try { return exports.leagueOfLegendsPresenceSchema.parse(JSON.parse(val)); } catch (ignored) { } return exports.valorantPresenceSchema.parse(JSON.parse((0, iso_base64_1.atob)(val))); }), privateJwt: zod_1.z.unknown().nullable(), product: zod_1.z.enum(['valorant', 'league_of_legends']), puuid: commonTypes_1.playerUUIDSchema, region: zod_1.z.string(), resource: zod_1.z.string(), state: zod_1.z.enum(['mobile', 'dnd', 'away', 'chat']), summary: zod_1.z.string(), time: commonTypes_1.millisSchema })) }) } }; //# sourceMappingURL=Presence.js.map