normal/
normal.rs

1use eskom_se_push_api::{
2  allowance::{AllowanceCheck, AllowanceCheckURLBuilder},
3  constants::TOKEN_KEY,
4  ureq_client::handle_ureq_response,
5  Endpoint,
6};
7
8fn main() {
9  let api = AllowanceCheckURLBuilder::default().build().unwrap();
10  // Need to import the Endpoint trait
11  let response = ureq::request(api.method(), api.url().unwrap().as_str())
12    .set(TOKEN_KEY, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13    .call();
14  match handle_ureq_response::<AllowanceCheck>(response) {
15    Ok(allowance) => {
16      println!(
17        "You have made {} API calls today",
18        allowance.allowance.count
19      );
20    }
21    Err(e) => {
22      eprintln!("Error: {}", e);
23    }
24  }
25}