pub mod error;
pub mod four_byte;
pub mod v2;
pub use error::{Error, Result};
use reqwest::Client as HttpClient;
use std::sync::Arc;
pub struct Sourcify {
v2_client: v2::Client,
four_byte_client: four_byte::Client,
}
impl Sourcify {
pub fn new() -> Self {
Self::with_client(HttpClient::new())
}
pub fn with_client(client: HttpClient) -> Self {
let http = Arc::new(client);
Self {
v2_client: v2::Client::new(Arc::clone(&http)),
four_byte_client: four_byte::Client::new(Arc::clone(&http)),
}
}
pub fn v2(&self) -> &v2::Client {
&self.v2_client
}
pub fn four_byte(&self) -> &four_byte::Client {
&self.four_byte_client
}
}
impl Default for Sourcify {
fn default() -> Self {
Self::new()
}
}