aboutsummaryrefslogtreecommitdiffstats
path: root/src/visits.rs
blob: 1e0685c0b9d4e75bb98f4532805ed4ce45dd7847 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use reqwest::Client;
use serde::Deserialize;

use crate::Result;

#[derive(Deserialize, Default)]
pub struct Visits {
    pub count: String,
}

pub async fn get_visits(client: &Client) -> Result<Visits> {
    let endpoint = "https://stats.blos.sm/counter/TOTAL.json";
    Ok(client.get(endpoint).send().await?.json::<Visits>().await?)
}