pub struct ThanixClient {
pub client: reqwest::blocking::Client,
pub base_url: String,
pub auth_header_value: Option<String>,
}
impl ThanixClient {
pub fn new(base_url: &str) -> Self {
Self {
client: reqwest::blocking::Client::new(),
base_url: base_url.to_string(),
auth_header_value: None,
}
}
}
/// Removes array index brackets (e.g. `[0]`) from query strings.
/// Fixes an incompatibility between `serde_qs` and some API query parsers.
pub fn remove_square_braces(s: &str) -> String {
let re = regex::Regex::new(r"\[\d+\]").unwrap();
re.replace_all(s, "").to_string()
}