septoria/util.rs
1/// A macro that builds a query tuple by returning the var name and the value.
2#[macro_export]
3macro_rules! query_tuple {
4 ($var: ident) => {
5 (stringify!($var), $var)
6 };
7}
8
9/// Private function
10/// Builds a reqwest client with the given API key as a bearer auth token
11pub(crate) fn build_reqwest_client(api_key: &str) -> reqwest::blocking::Client {
12 let mut headers = reqwest::header::HeaderMap::new();
13 headers.insert(
14 reqwest::header::AUTHORIZATION,
15 reqwest::header::HeaderValue::from_str(&format!("Bearer {}", api_key)).unwrap(),
16 );
17 reqwest::blocking::Client::builder()
18 .default_headers(headers)
19 .build()
20 .unwrap()
21}