Function valorant_api::get_leaderboard_v1

source ·
pub async fn get_leaderboard_v1<T: HttpClient>(
    credentials_manager: &CredentialsManager,
    http_client: &T,
    region: Region,
    season: &Uuid,
    query_args: HashMap<LeaderboardQueryArg, String>
) -> Result<LeaderboardV1, RequestError>
Expand description

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);
Examples found in repository?
examples/leaderboard.rs (lines 18-24)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async fn main() {
    let http_client = get_http_client().expect("Error while creating http client");
    let credentials_manager = get_credentials_manager(&http_client)
        .await
        .expect("Error while getting credentials manager");

    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);
    assert!(result.is_ok());
}