1use crate::AuthDetails;
2
3type HClient = hyper::Client<hyper_rustls::HttpsConnector<hyper::client::HttpConnector>>;
4
5pub struct Client {
10 pub(crate) http_client: HClient,
11 pub(crate) auth: Option<AuthDetails>,
12}
13
14impl Client {
15 fn base() -> Self {
16 let connector = hyper_rustls::HttpsConnectorBuilder::new()
17 .with_native_roots()
18 .https_only()
19 .enable_http1()
20 .build();
21 let http_client = hyper::Client::builder().build::<_, hyper::Body>(connector);
22
23 Self {
24 http_client,
25 auth: None,
26 }
27 }
28
29 pub fn public() -> Self {
33 Self::base()
34 }
35
36 pub fn with_auth(details: AuthDetails) -> Self {
41 let mut client = Self::base();
42 client.auth = Some(details);
43 client
44 }
45}