blossom/src/live.rs

22 lines
455 B
Rust
Raw Normal View History

2023-06-20 16:02:12 +01:00
use reqwest::Client;
use serde::Deserialize;
use crate::Result;
#[derive(Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct LiveStatus {
pub online: bool,
pub viewer_count: u32,
}
pub async fn get_live_status(client: &Client) -> Result<LiveStatus> {
let endpoint = "https://weirdstar.stream/api/status";
Ok(client
.get(endpoint)
.send()
.await?
.json::<LiveStatus>()
.await?)
}