pub mod nav_connect_service {
use crate::Result;
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::NavConnectService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = NavConnectService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::NavConnectService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NavConnectService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct CreateTrip(RequestBuilder<crate::model::CreateTripRequest>);
impl CreateTrip {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NavConnectService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateTripRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Trip> {
(*self.0.stub)
.create_trip(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_trip_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.trip_id = v.into();
self
}
pub fn set_trip<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Trip>,
{
self.0.request.trip = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_trip<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Trip>,
{
self.0.request.trip = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTrip {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetTrip(RequestBuilder<crate::model::GetTripRequest>);
impl GetTrip {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NavConnectService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetTripRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Trip> {
(*self.0.stub)
.get_trip(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTrip {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}