#r6stats #rainbow-six #r6

r6stats_client

Client for the r6stats API

8 releases

0.2.3 Nov 3, 2020
0.2.2 Nov 1, 2020
0.2.1 Oct 29, 2020
0.1.3 Oct 29, 2020

MIT license

51KB
1.5K SLoC

r6stats Client

This crate provides a client for the r6stats API. It supports the /stats and the /leaderboard endpoint.

Usage

Add the following to your Cargo.toml:

[dependencies]
r6stats_client = "0.2"

Basic example:

#[tokio::main]
async fn main() {
    // You need an API key to access the endpoints of r6stats.
    //
    // If you don't have one, you can request one from their support.
    let token = "<API KEY HERE>";
    let client = Client::new(token).unwrap();

    let leaderboard = client
        .leaderboard()
        .get(Platform::Pc, Some(Region::Emea))
        .await
        .unwrap();

    println!("{:#?}", leaderboard);
}

More examples can be found in the examples directory.


lib.rs:

r6stats Client

This crate provides a client for the r6stats API. It supports the /stats and the /leaderboard endpoint.

Example

use r6stats_client::{Client, Platform, Region};
use std::env;

#[tokio::main]
async fn main() {
    // You need an API key to access the endpoints of r6stats.
    //
    // If you don't have one, you can request one from their support.
    let token = "<API KEY HERE>";
    # let token = std::env::var("R6STATS_TOKEN").unwrap();
    let client = Client::new(token).unwrap();

    let leaderboard = client
        .leaderboard()
        .get(Platform::Pc, Some(Region::Emea))
        .await
        .unwrap();

    println!("{:#?}", leaderboard);
}

More examples can be found in the examples directory.

Features

  • ratelimiting (default): Enables pre-ratelimiting before sending requests to prevent HTTP-429 Errors. Note: Ratelimits are enforced by the server either way.
  • threadsafe: Makes Client threadsafe (Send + Sync)

Dependencies

~8–12MB
~242K SLoC