#[derive(Debug, Clone, Default)]
pub struct Config {
pub api_key: Option<String>,
pub api_base: Option<String>,
pub extra: std::collections::HashMap<String, String>,
}
impl Config {
pub fn new(api_key: impl Into<String>) -> Self {
Self {
api_key: Some(api_key.into()),
..Default::default()
}
}
pub fn with_api_base(mut self, api_base: impl Into<String>) -> Self {
self.api_base = Some(api_base.into());
self
}
pub fn with_extra(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.extra.insert(key.into(), value.into());
self
}
}