tanishqmanuja / valorant-api-client

πŸ’’ VAPIC is a type safe implementation of an API Client for VALORANT.
MIT License
24 stars 6 forks source link
api riot typescript valorant

Logo

VAPIC //VALORANT API CLIENT

NPM Version NPM Downloads GitHub Actions Workflow Status GitHub License

VAPIC is a type safe implementation of an api client for VALORANT. It includes functional wrapper to call all community known endpoints provided by valorant-api-types.

πŸ“¦ Installation

Install @tqman/valorant-api-client with npm, pnpm or yarn

npm i @tqman/valorant-api-client@latest
pnpm add @tqman/valorant-api-client@latest
yarn add @tqman/valorant-api-client@latest

⚑ Showcase Features

πŸš€ API Clients

πŸ“ƒ Usage/Examples

🟠 Local Authentication

import { createValorantApiClient } from "@tqman/valorant-api-client";
import { presets } from "@tqman/valorant-api-client/presets";

const vapic = await createValorantApiClient(presets.local);

const puuid = vapic.remote.puuid;
console.log("PUUID", puuid);

const { data: accountAlias } = await vapic.local.getAccountAlias();
console.log("Account Alias", accountAlias);

const { data: compUpdates } = await vapic.remote.getCompetitiveUpdates({
  data: {
    puuid,
  },
});
console.log("Comp Updates", compUpdates);

[!NOTE] VALORANT should be running for lockfile and logfile to be generated.

🟣 Remote Authentication

import { createValorantApiClient } from "@tqman/valorant-api-client";
import { presets } from "@tqman/valorant-api-client/presets";

const RIOT_USERNAME = "YOUR_USERNAME";
const RIOT_PASSWORD = "YOUR_PASSWORD";

const vapic = await createValorantApiClient(
  presets.remote.with({
    username: RIOT_USERNAME,
    password: RIOT_PASSWORD,
  }),
);

const puuid = vapic.remote.puuid;
console.log("PUUID", puuid);

const { data: compUpdates } = await vapic.remote.getCompetitiveUpdates({
  data: {
    puuid,
  },
});
console.log("Comp Updates", compUpdates);

❀️‍πŸ”₯ Infinite Thanks

🌿 Show your Support

Give a ⭐️ if this project helped you! \ It will give me motivation for working towards this project.

βš–οΈ Disclaimer

THIS PROJECT IS NOT ASSOCIATED OR ENDORSED BY RIOT GAMES. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. Whilst effort has been made to abide by Riot's API rules; you acknowledge that use of this software is done so at your own risk.