1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
mod dto;
pub use dto::*;

pub mod consts;

mod endpoints;
pub use endpoints::*;

mod riot_api_config;
pub use riot_api_config::*;

mod riot_api;
pub use riot_api::*;

mod req;
mod util;


#[cfg(test)]
mod tests {
    use tokio::runtime::Runtime;
    use super::*;

    use url::form_urlencoded::Serializer;
    #[test]
    fn checkme() {
        let mut query = Serializer::new(String::new());
        query.append_pair("hello", "false");
        query.append_pair("hello", "world");
        let result = query.finish();
        println!("{}", result);
    }

    #[test]
    #[ignore]
    fn it_works() {
        env_logger::init();

        let champ = crate::consts::Champion::Riven;
        println!("{}", champ);

        let api_key = std::fs::read_to_string("apikey.txt").unwrap(); // TODO don't use unwrap.

        let rt = Runtime::new().unwrap();
        let riot_api = RiotApi::with_key(api_key.trim());

        for i in 0..2 {
            let my_future = riot_api.champion_mastery_v4().get_all_champion_masteries(
                consts::Region::NA, "SBM8Ubipo4ge2yj7bhEzL7yvV0C9Oc1XA2l6v5okGMA_nCw");
            let val = rt.block_on(my_future).unwrap();
            println!("VAL {}: {:#?}", i, val.unwrap());
        }
    }
}