1.0.5 • Published 1 year ago
@ivanoliverfabra/valorant-api v1.0.5
ValorantAPI
ValorantAPI is a wrapper library for the unofficial Valorant API. It provides easy-to-use methods to interact with various endpoints of the Valorant API.
Installation
npm install @ivanoliverfabra/valorant-apipnpm add @ivanoliverfabra/valorant-apiyarn add @ivanoliverfabra/valorant-apibun add @ivanoliverfabra/valorant-apiUsage
Initialization
import ValorantAPI from "@ivanoliverfabra/valorant-api";
const api = new ValorantAPI({ apiKey: "HDEV-..." });
const api = new ValorantAPI(); // If you set the environment variable HDEV_API_KEYAvailable Methods
Game Data
fetchGameDatagenerateCrosshairImage
Account Data
getAccountDataV1getAccountDataV2
Leaderboard
getLeaderboardV1getLeaderboardV3
Match Details
getMatchDetailsV2getMatchDetailsV4
Match History
getMatchHistoryV3getMatchHistoryV4
MMR Data
getMMRDataV2getMMRDataV3
MMR History
getMMRHistoryV1
Premier
getPremierConferencesgetPremierLeaderboardgetPremierSeasonsV1getPremierTeamDetailsV1getPremierTeamHistoryV1searchPremierTeamsV1
Queue Status
getQueueStatus
Region Status
getRegionStatusV1
Stored Matches
getStoredMatchesV1
Store
getStoreFeaturedV1getStoreFeaturedV2getStoreOffersV1getStoreOffersV2
Upcoming Matches
getUpcomingMatches
Valorant Version
getValorantVersionV1
Example
import ValorantAPI from "@ivanoliverfabra/valorant-api";
const apiKey = "HDEV-..."; // Optional if you set the environment variable HDEV_API_KEY
const api = new ValorantAPI({ apiKey });
const data = await api.accounts.v1.byName("fabra", "olivr"); // With Name and Tag
const data = await api.accounts.v1.byPuuid(
"79bed427-e691-573d-9bc1-046d8f817de8"
); // With PUUIDimport { getAccountDataV1 } from "@ivanoliverfabra/valorant-api";
import { getAccountDataV1 } from "@ivanoliverfabra/valorant-api/test"; // Recieve mock data
const apiKey = "HDEV-..."; // Optional if you set the environment variable HDEV_API_KEY
const data = await getAccountDataV1("fabra", "olivr", apiKey); // With Name and Tag
const data = await getAccountDataV1(
"79bed427-e691-573d-9bc1-046d8f817de8",
apiKey
); // With PUUIDGet API Key
Environment Variables
HDEV_API_KEY=YOUR_API_KEYIf you set the environment variable HDEV_API_KEY to your API key, you can use the library without passing the API key as a parameter to the functions.