5 releases

0.0.4 Mar 10, 2024
0.0.3 Jan 24, 2024
0.0.2 Jan 21, 2024
0.0.1 Jan 20, 2024
0.0.0 Jul 12, 2023

#55 in #account

Download history 34/week @ 2024-01-19 1/week @ 2024-01-26 3/week @ 2024-02-23 3/week @ 2024-03-01 156/week @ 2024-03-08 25/week @ 2024-03-15 2/week @ 2024-03-22 20/week @ 2024-03-29 1/week @ 2024-04-05

51 downloads per month

MIT license

105KB
2.5K 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: CompetitveUpdatesV1

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
  • 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, None, None).await;
println!("Result: {:#?}", result);

Dependencies

~16–31MB
~547K SLoC