cartel_api 0.1.0

This crate attemps to provide a wrapper around the http://cartelempire.online/api
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::model::CooldownResponse;
use crate::client::Client;
use crate::error::Error;

impl Client {
    pub async fn get_cooldowns(&self) -> Result<CooldownResponse, Error>{
        let url = format!("{}/user?type=cooldowns&key={}", self.api_url, self.api_key);
        let response = self.http_client.get(&url).send().await?;
        let cooldowns: CooldownResponse = response.json().await?;
        Ok(cooldowns)
    }
}