#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#[derive(Clone, Debug)]
pub struct Solar {
inner: std::sync::Arc<dyn super::stub::dynamic::Solar>,
}
impl Solar {
pub fn builder() -> super::builder::solar::ClientBuilder {
crate::new_client_builder(super::builder::solar::client::Factory)
}
pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
where
T: super::stub::Solar + 'static,
{
Self { inner: stub.into() }
}
pub(crate) async fn new(
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self> {
let inner = Self::build_inner(config).await?;
Ok(Self { inner })
}
async fn build_inner(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Solar>> {
if gaxi::options::tracing_enabled(&conf) {
return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
}
Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
}
async fn build_transport(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::Solar> {
super::transport::Solar::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::Solar> {
Self::build_transport(conf)
.await
.map(super::tracing::Solar::new)
}
pub fn find_closest_building_insights(
&self,
) -> super::builder::solar::FindClosestBuildingInsights {
super::builder::solar::FindClosestBuildingInsights::new(self.inner.clone())
}
pub fn get_data_layers(&self) -> super::builder::solar::GetDataLayers {
super::builder::solar::GetDataLayers::new(self.inner.clone())
}
pub fn get_geo_tiff(&self) -> super::builder::solar::GetGeoTiff {
super::builder::solar::GetGeoTiff::new(self.inner.clone())
}
}