use crate::AuthDetails;
type HClient = hyper::Client<hyper_rustls::HttpsConnector<hyper::client::HttpConnector>>;
pub struct Client {
pub(crate) http_client: HClient,
pub(crate) auth: Option<AuthDetails>,
}
impl Client {
fn base() -> Self {
let connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_only()
.enable_http1()
.build();
let http_client = hyper::Client::builder().build::<_, hyper::Body>(connector);
Self {
http_client,
auth: None,
}
}
pub fn public() -> Self {
Self::base()
}
pub fn with_auth(details: AuthDetails) -> Self {
let mut client = Self::base();
client.auth = Some(details);
client
}
}