blob: 9ad6ad6b9e32805f2d403e6a8f9e7a56f56e364a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use eyre::Result;
use log::debug;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct RandomTeawieResponse {
url: String,
}
// TODO: read this from an env var
const GUZZLE: &str = "https://api.getchoo.com";
const RANDOM_TEAWIE: &str = "/random_teawie";
pub async fn random_teawie() -> Result<String> {
let url = format!("{GUZZLE}{RANDOM_TEAWIE}");
debug!("Making request to {url}");
let json: RandomTeawieResponse = super::get_json(&url).await?;
Ok(json.url)
}
|