use std::collections::HashMap;
#[derive(Debug, Clone, Default)]
pub struct RequestOptions {
pub api_key: Option<String>,
pub token: Option<String>,
pub max_retries: Option<u32>,
pub timeout_seconds: Option<u64>,
pub additional_headers: HashMap<String, String>,
pub additional_query_params: HashMap<String, String>,
}
impl RequestOptions {
pub fn new() -> Self {
Self::default()
}
pub fn api_key(mut self, key: impl Into<String>) -> Self {
self.api_key = Some(key.into());
self
}
pub fn token(mut self, token: impl Into<String>) -> Self {
self.token = Some(token.into());
self
}
pub fn max_retries(mut self, retries: u32) -> Self {
self.max_retries = Some(retries);
self
}
pub fn timeout_seconds(mut self, timeout: u64) -> Self {
self.timeout_seconds = Some(timeout);
self
}
pub fn additional_header(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.additional_headers.insert(key.into(), value.into());
self
}
pub fn additional_query_param(
mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self {
self.additional_query_params
.insert(key.into(), value.into());
self
}
}