1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use super::http;
use {Profile, Leaderboard};

pub fn leaderboard(mode: &str, start: Option<usize>, end: Option<usize>) -> Leaderboard {

    let url;
    match start {
        None => url = format!("https://api.roccodev.pw/{}/winstreaks/leaderboard/", mode),
        Some(ref start) => url = format!("https://api.roccodev.pw/{}/winstreaks/leaderboard?from={}&to={}", mode, start, end.unwrap_or(500)),
    }
    let json = http::json_from_url(url);
    return json;
        
}

pub fn profile(mode: &str, uuid: &str) -> Profile {
    let url = format!("https://api.roccodev.pw/{}/winstreaks/profile/{}", mode, uuid);
    let json = http::json_from_url(url);
    return json; 
}