UNPKG

valorant-api-types

Version:

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

217 lines 11.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.matchDetailsEndpoint = void 0; const commonTypes_1 = require("../../commonTypes"); const zod_1 = require("zod"); const newPlayerExperienceTimingSchema = zod_1.z.object({ idleTimeMillis: zod_1.z.literal(0), objectiveCompleteTimeMillis: zod_1.z.literal(0) }); const teamOrPlayerSchema = zod_1.z.enum(['Blue', 'Red']).or(commonTypes_1.playerUUIDSchema); const locationSchema = zod_1.z.object({ x: zod_1.z.number(), y: zod_1.z.number() }); const playerLocationSchema = zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema, viewRadians: zod_1.z.number(), location: locationSchema }); const economySchema = zod_1.z.object({ loadoutValue: zod_1.z.number(), weapon: commonTypes_1.itemIDSchema.or(zod_1.z.literal('')), armor: commonTypes_1.armorIDSchema.or(zod_1.z.literal('')), remaining: zod_1.z.number(), spent: zod_1.z.number() }); const killSchema = zod_1.z.object({ gameTime: zod_1.z.number().describe('Time in milliseconds since the start of the game'), roundTime: zod_1.z.number().describe('Time in milliseconds since the start of the round'), killer: commonTypes_1.playerUUIDSchema, victim: commonTypes_1.playerUUIDSchema, victimLocation: locationSchema, assistants: zod_1.z.array(commonTypes_1.playerUUIDSchema), playerLocations: zod_1.z.array(playerLocationSchema), finishingDamage: zod_1.z.object({ damageType: zod_1.z.enum(['Weapon', 'Bomb', 'Ability', 'Fall', 'Melee', 'Invalid', '']), damageItem: commonTypes_1.itemIDSchema .or(zod_1.z.enum(['Ultimate', 'Ability1', 'Ability2', 'GrenadeAbility', 'Primary'])) .or(zod_1.z.literal('')) .describe('Item ID of the weapon used to kill the player. Empty string if the player was killed by the spike, fall damage, or melee.'), isSecondaryFireMode: zod_1.z.boolean() }) }); exports.matchDetailsEndpoint = { name: 'Match Details', description: 'Get the details of a match after it ends', queryName: 'MatchDetails_FetchMatchDetails', category: 'PVP Endpoints', type: 'pd', suffix: 'match-details/v1/matches/{matchID}', variables: new Map([ ['matchID', commonTypes_1.matchIDSchema] ]), riotRequirements: { token: true, entitlement: true, clientVersion: true, clientPlatform: true }, responses: { '200': zod_1.z.object({ matchInfo: zod_1.z.object({ matchId: commonTypes_1.matchIDSchema, mapId: commonTypes_1.mapIDSchema, gamePodId: zod_1.z.string(), gameLoopZone: zod_1.z.string(), gameServerAddress: zod_1.z.string(), gameVersion: zod_1.z.string(), gameLengthMillis: zod_1.z.number().nullable(), gameStartMillis: zod_1.z.number(), provisioningFlowID: zod_1.z.enum(['Matchmaking', 'CustomGame']), isCompleted: zod_1.z.boolean(), customGameName: zod_1.z.string(), forcePostProcessing: zod_1.z.boolean(), queueID: commonTypes_1.queueIDSchema, gameMode: commonTypes_1.gameModeSchema, isRanked: zod_1.z.boolean(), isMatchSampled: zod_1.z.boolean(), seasonId: commonTypes_1.seasonIDSchema, completionState: zod_1.z.enum(['Surrendered', 'Completed', 'VoteDraw', '']), platformType: commonTypes_1.platformSchema.shape.platformType, premierMatchInfo: zod_1.z.object({}), partyRRPenalties: zod_1.z.record(commonTypes_1.partyIDSchema, zod_1.z.number()).optional(), shouldMatchDisablePenalties: zod_1.z.boolean(), }), players: zod_1.z.array(zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema, gameName: zod_1.z.string(), tagLine: zod_1.z.string(), platformInfo: commonTypes_1.platformSchema, teamId: teamOrPlayerSchema, partyId: commonTypes_1.partyIDSchema, characterId: commonTypes_1.characterIDSchema, stats: zod_1.z.object({ score: zod_1.z.number(), roundsPlayed: zod_1.z.number(), kills: zod_1.z.number(), deaths: zod_1.z.number(), assists: zod_1.z.number(), playtimeMillis: zod_1.z.number(), abilityCasts: zod_1.z.object({ grenadeCasts: zod_1.z.number(), ability1Casts: zod_1.z.number(), ability2Casts: zod_1.z.number(), ultimateCasts: zod_1.z.number() }).nullable().optional() }).nullable(), roundDamage: zod_1.z.array(zod_1.z.object({ round: zod_1.z.number(), receiver: commonTypes_1.playerUUIDSchema, damage: zod_1.z.number() })).nullable(), competitiveTier: zod_1.z.number(), isObserver: zod_1.z.boolean(), playerCard: commonTypes_1.cardIDSchema, playerTitle: commonTypes_1.titleIDSchema, preferredLevelBorder: commonTypes_1.preferredLevelBorderIDSchema.optional(), accountLevel: zod_1.z.number(), sessionPlaytimeMinutes: zod_1.z.number().nullable().optional(), xpModifications: zod_1.z.array(zod_1.z.object({ Value: zod_1.z.number().describe('XP multiplier'), ID: commonTypes_1.xpModificationIDSchema })).optional(), behaviorFactors: zod_1.z.object({ afkRounds: zod_1.z.number(), collisions: zod_1.z.number().optional().describe('Float value of unknown significance. Possibly used to quantify how much the player was in the way of their teammates?'), commsRatingRecovery: zod_1.z.number(), damageParticipationOutgoing: zod_1.z.number(), friendlyFireIncoming: zod_1.z.number().optional(), friendlyFireOutgoing: zod_1.z.number().optional(), mouseMovement: zod_1.z.number().optional(), stayedInSpawnRounds: zod_1.z.number().optional() }).optional(), newPlayerExperienceDetails: zod_1.z.object({ basicMovement: newPlayerExperienceTimingSchema, basicGunSkill: newPlayerExperienceTimingSchema, adaptiveBots: zod_1.z.object({ adaptiveBotAverageDurationMillisAllAttempts: zod_1.z.literal(0), adaptiveBotAverageDurationMillisFirstAttempt: zod_1.z.literal(0), killDetailsFirstAttempt: zod_1.z.null() }).merge(newPlayerExperienceTimingSchema), ability: newPlayerExperienceTimingSchema, bombPlant: newPlayerExperienceTimingSchema, defendBombSite: zod_1.z.object({ success: zod_1.z.literal(false) }).merge(newPlayerExperienceTimingSchema), settingStatus: zod_1.z.object({ isMouseSensitivityDefault: zod_1.z.boolean(), isCrosshairDefault: zod_1.z.boolean(), }), versionString: zod_1.z.literal('') }).optional() })), bots: zod_1.z.array(zod_1.z.unknown()), coaches: zod_1.z.array(zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema, teamId: zod_1.z.enum(['Blue', 'Red']) })), teams: zod_1.z.array(zod_1.z.object({ teamId: teamOrPlayerSchema, won: zod_1.z.boolean(), roundsPlayed: zod_1.z.number(), roundsWon: zod_1.z.number(), numPoints: zod_1.z.number() })).nullable(), roundResults: zod_1.z.array(zod_1.z.object({ roundNum: zod_1.z.number(), roundResult: zod_1.z.enum(['Eliminated', 'Bomb detonated', 'Bomb defused', 'Surrendered', 'Round timer expired']), roundCeremony: zod_1.z.enum(['CeremonyDefault', 'CeremonyTeamAce', 'CeremonyFlawless', 'CeremonyCloser', 'CeremonyClutch', 'CeremonyThrifty', 'CeremonyAce', '']), winningTeam: teamOrPlayerSchema, bombPlanter: commonTypes_1.playerUUIDSchema.optional(), bombDefuser: teamOrPlayerSchema.optional(), plantRoundTime: zod_1.z.number().optional().describe('Time in milliseconds since the start of the round when the bomb was planted. 0 if not planted'), plantPlayerLocations: zod_1.z.array(playerLocationSchema).nullable(), plantLocation: locationSchema, plantSite: zod_1.z.enum(['A', 'B', 'C', '']), defuseRoundTime: zod_1.z.number().optional().describe('Time in milliseconds since the start of the round when the bomb was defused. 0 if not defused'), defusePlayerLocations: zod_1.z.array(playerLocationSchema).nullable(), defuseLocation: locationSchema, playerStats: zod_1.z.array(zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema, kills: zod_1.z.array(killSchema), damage: zod_1.z.array(zod_1.z.object({ receiver: commonTypes_1.playerUUIDSchema, damage: zod_1.z.number(), legshots: zod_1.z.number(), bodyshots: zod_1.z.number(), headshots: zod_1.z.number() })), score: zod_1.z.number(), economy: economySchema, ability: zod_1.z.object({ grenadeEffects: zod_1.z.null(), ability1Effects: zod_1.z.null(), ability2Effects: zod_1.z.null(), ultimateEffects: zod_1.z.null() }), wasAfk: zod_1.z.boolean(), wasPenalized: zod_1.z.boolean(), stayedInSpawn: zod_1.z.boolean() })), roundResultCode: zod_1.z.enum(['Elimination', 'Detonate', 'Defuse', 'Surrendered', '']).describe('Empty string if the timer expired'), playerEconomies: zod_1.z.array(zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema }).merge(economySchema)).nullable(), playerScores: zod_1.z.array(zod_1.z.object({ subject: commonTypes_1.playerUUIDSchema, score: zod_1.z.number() })).nullable() })).nullable(), kills: zod_1.z.array(killSchema.merge(zod_1.z.object({ round: zod_1.z.number() }))).nullable(), }) } }; //# sourceMappingURL=MatchDetails.js.map