#api #valorant #http-client #riot #history #credentials #manager

valorant_api

A library for interacting with the ingame Valorant-API

34 releases

0.3.3 Nov 6, 2024
0.2.11 Sep 1, 2024
0.2.9 Jul 19, 2024
0.0.4 Mar 10, 2024
0.0.0 Jul 12, 2023

#1578 in Network programming

Download history 151/week @ 2024-08-14 29/week @ 2024-08-21 143/week @ 2024-08-28 22/week @ 2024-09-04 37/week @ 2024-09-11 35/week @ 2024-09-18 74/week @ 2024-09-25 237/week @ 2024-10-02 185/week @ 2024-10-09 3/week @ 2024-10-16 121/week @ 2024-11-06 4/week @ 2024-11-13 3/week @ 2024-11-20

128 downloads per month

MIT license

81KB
2K SLoC

Valorant API

This crate is a wrapper for the In-Game Valorant API.

Usage

1. Authenticate

To use this crate, you need to authenticate with your Riot Games account. Currently, the only way to do this is by using a username and password (no 2FA).

use valorant_api::utils::credentials_manager::CredentialsManager;
use valorant_api::utils::network::http_client::SimpleHttpClient;

#[tokio::main]
async fn main() {
    let http_client = SimpleHttpClient::new();
    let mut credentials_manager = valorant_api::utils::credentials_manager::CredentialsManager::new();
    let result = credentials_manager
        .authenticate(&http_client, "username", "password")
        .await;
    match result {
        Ok(_) => println!("Authenticated"),
        Err(_) => println!("Error while authenticating"),
    }
}

2. Use the API

use valorant_api::enums::region::Region;
use uuid::Uuid;
use std::collections::HashMap;

let puuid = Uuid::parse_str("ee89b4d9-13d0-5832-8dd7-eb5d8806d918").expect("Invalid UUID");
let region = Region::EU;
let queries = HashMap::new();
let result = valorant_api::get_competitve_updates_v1(credentials_manager, &http_client, region, &puuid, queries).await;
println!("Result: {:#?}", result);

Endpoints

Competitive Updates V1

Function: get_competitive_updates_v1

Result Type: CompetitiveUpdatesV1

Match Details V1

Function: get_match_details_v1

Result Type: MatchDetailsV1

Match History V1

Function: get_match_history_v1

Result Type: MatchHistoryV1

MMRV1

Function: get_mmr_details_v1

Result Type: MMRDetailsV1

Leaderboard V1

Function: get_leaderboard_v1

Result Type: LeaderboardV1

Content V3

Function: get_content_v3

Result Type: ContentV3

Store Offers V1

Function: get_store_offers_v1

Result Type: StoreOffersV1

Store Front V2

Function: get_store_front_v2

Result Type: StoreFrontV2

Get the match history of a player

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the player
  • puuid - The puuid of the player
  • query_args - The query arguments

Example

let puuid = Uuid::parse_str("ee89b4d9-13d0-5832-8dd7-eb5d8806d918").expect("Invalid UUID");
let region = Region::EU;
let queries = HashMap::new();
let result = valorant_api::get_match_history_v1(credentials_manager, &http_client, region, &puuid, queries).await;
println!("Result: {:#?}", result);

Get the match details of a match

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the match
  • match_id - The match id of the match

Example

let match_id = Uuid::parse_str("3100c02b-17d2-4adb-97b5-e45dee67d292").expect("Invalid UUID");
let region = Region::EU;
let result = valorant_api::get_match_details_v1(credentials_manager, &http_client, region, &match_id).await;
println!("Result: {:#?}", result);

Get the mmr of a player

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the player
  • puuid - The puuid of the player

Example

let puuid = Uuid::parse_str("ee89b4d9-13d0-5832-8dd7-eb5d8806d918").expect("Invalid UUID");
let region = Region::EU;
let result = valorant_api::get_mmr_details_v1(credentials_manager, &http_client, region, &puuid).await;
println!("Result: {:#?}", result);

Get the competitve updates of a player

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the player
  • puuid - The puuid of the player
  • query_args - The query arguments

Example

let puuid = Uuid::parse_str("ee89b4d9-13d0-5832-8dd7-eb5d8806d918").expect("Invalid UUID");
let region = Region::EU;
let queries = HashMap::new();
let result = valorant_api::get_competitve_updates_v1(credentials_manager, &http_client, region, &puuid, queries).await;
println!("Result: {:#?}", result);

Get the content of the game

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the player

Example

let region = Region::EU;
let result = valorant_api::get_content_v1(credentials_manager, &http_client, region).await;
println!("Result: {:#?}", result);

Get the leaderboard of a region

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the leaderboard
  • season - The season of the leaderboard
  • query_args - The query arguments

Errors

RequestError - If the request failed

Example

let season = Uuid::parse_str("34093c29-4306-43de-452f-3f944bde22be").expect("Invalid UUID");
let region = Region::EU;
let queries = HashMap::new();
let result = valorant_api::get_leaderboard_v1(credentials_manager, &http_client, region, &season, queries).await;
println!("Result: {:#?}", result);

Get the store offers of a region

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the leaderboard

Errors

RequestError - If the request failed

Example

let season = Uuid::parse_str("34093c29-4306-43de-452f-3f944bde22be").expect("Invalid UUID");
let region = Region::EU;
let result = valorant_api::get_store_offers_v1(credentials_manager, &http_client, region).await;
println!("Result: {:#?}", result);

Get the store front of a player

Arguments

  • credentials_manager - The credentials manager
  • region - The region of the leaderboard
  • puuid - The puuid of the player

Errors

RequestError - If the request failed

Example

let puuid = Uuid::parse_str("34093c29-4306-43de-452f-3f944bde22be").expect("Invalid UUID");
let region = Region::EU;
let result = valorant_api::get_store_front_v1(credentials_manager, &http_client, region, puuid).await;
println!("Result: {:#?}", result);

Get the account aliases of a player. This can be used to search for an account by game name and/or tag_line and get their puuid.

Arguments

  • credentials_manager - The credentials manager
  • http_client - The http client
  • cluster - The cluster of the player
  • game_name - The game name of the player
  • tag_line - The tag line of the player

Errors

RequestError - If the request failed

Example

let result = valorant_api::get_account_aliases(credentials_manager, &http_client, "eu", None, None).await;
println!("Result: {:#?}", result);

Get all active valorant esports leagues.

Arguments

  • credentials_manager - The credentials manager
  • http_client - The http client
  • locale - The locale in which the leagues should be returned

Errors

RequestError - If the request failed

Example

let result = valorant_api::get_esports_leagues(&credential_manager, &http_client, EsportsLocales::US).await;
println!("Result: {:#?}", result);

Get the schedule for all professional valorant games.

Arguments

  • credentials_manager - The credentials manager
  • http_client - The http client
  • locale - The locale in which the schedules should be returned

Errors

RequestError - If the request failed

Example

let result = valorant_api::get_esports_schedule(&credential_manager, &http_client, EsportsLocales::US).await;
println!("Result: {:#?}", result);

Get the vod data for each game.

Arguments

  • credentials_manager - The credentials manager
  • http_client - The http client
  • locale - The locale in which the vod data should be returned

Errors

RequestError - If the request failed

Example

let result = valorant_api::get_esports_vods(&credential_manager, &http_client, EsportsLocales::US).await;
println!("Result: {:#?}", result);

Dependencies

~5–17MB
~219K SLoC