valorant-assets-api

API Wrapper for valorant-api.com

6 releases

0.1.5 May 25, 2024
0.1.4 Feb 20, 2024
0.1.3 Jan 29, 2024

#205 in HTTP client

36 downloads per month

MIT license

94KB
2K SLoC

Rust bindings for the Valorant Assets API

This crate provides Rust bindings for the Valorant Assets API.

Installation

Install this crate with cargo add valorant-assets-api or add it to your Cargo.toml.

Usage

use valorant_assets_api::agents::{get_agent, get_agents};
use valorant_assets_api::models::language::Language;

#[tokio::main]
async fn main() {
    // Create a reqwest::Client, which is used to send HTTP requests.
    let client = reqwest::Client::new();

    // Get a list of agents from the Valorant API. (language is optional)
    let agents = get_agents(&client, Some(Language::DeDe), None)
        .await
        .expect("Failed to get agents");

    println!(
        "Agents: {:?}",
        agents
            .iter()
            .map(|x| x.display_name.clone())
            .collect::<Vec<_>>()
    );

    println!(
        "Single Agent: {:#?}",
        agents.first()
    );
}

Dependencies

~5–16MB
~220K SLoC