tmdb_cli/libs/handlers/
core.rs1#[macro_export]
2macro_rules! get {
3 ($handler:expr, $req:expr) => {
4 $handler.client.execute($req.build()?).await?.error_for_status()
5 }
6}
7
8pub struct Core {
9 pub host: String,
11 pub token: String,
13 pub client: reqwest::Client,
15}
16
17impl Core {
18 pub fn new(host: String, token: String) -> Self {
19 let client = reqwest::Client::builder()
21 .timeout(std::time::Duration::from_secs(30))
22 .build()
23 .expect("failed to build client");
24 Core { host, token, client }
25 }
26}