#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#[derive(Clone, Debug)]
pub struct EssentialContactsService {
inner: std::sync::Arc<dyn super::stub::dynamic::EssentialContactsService>,
}
impl EssentialContactsService {
pub fn builder() -> super::builder::essential_contacts_service::ClientBuilder {
crate::new_client_builder(super::builder::essential_contacts_service::client::Factory)
}
pub fn from_stub<T>(stub: T) -> Self
where
T: super::stub::EssentialContactsService + 'static,
{
Self {
inner: std::sync::Arc::new(stub),
}
}
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::EssentialContactsService>,
> {
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::EssentialContactsService> {
super::transport::EssentialContactsService::new(conf).await
}
async fn build_with_tracing(
conf: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<impl super::stub::EssentialContactsService> {
Self::build_transport(conf)
.await
.map(super::tracing::EssentialContactsService::new)
}
pub fn create_contact(&self) -> super::builder::essential_contacts_service::CreateContact {
super::builder::essential_contacts_service::CreateContact::new(self.inner.clone())
}
pub fn update_contact(&self) -> super::builder::essential_contacts_service::UpdateContact {
super::builder::essential_contacts_service::UpdateContact::new(self.inner.clone())
}
pub fn list_contacts(&self) -> super::builder::essential_contacts_service::ListContacts {
super::builder::essential_contacts_service::ListContacts::new(self.inner.clone())
}
pub fn get_contact(&self) -> super::builder::essential_contacts_service::GetContact {
super::builder::essential_contacts_service::GetContact::new(self.inner.clone())
}
pub fn delete_contact(&self) -> super::builder::essential_contacts_service::DeleteContact {
super::builder::essential_contacts_service::DeleteContact::new(self.inner.clone())
}
pub fn compute_contacts(&self) -> super::builder::essential_contacts_service::ComputeContacts {
super::builder::essential_contacts_service::ComputeContacts::new(self.inner.clone())
}
pub fn send_test_message(&self) -> super::builder::essential_contacts_service::SendTestMessage {
super::builder::essential_contacts_service::SendTestMessage::new(self.inner.clone())
}
}