svc-storage-client-grpc 0.2.0

Arrow template service GRPC client
Documentation
/// Pilot
#[derive(Eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pilot {
    /// UUID v4
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    #[prost(message, optional, tag="2")]
    pub data: ::core::option::Option<PilotData>,
}
/// PilotData
#[derive(Eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PilotData {
    #[prost(string, tag="1")]
    pub first_name: ::prost::alloc::string::String,
    /// string wallet_address = 4;
    /// string type = 5;
    #[prost(string, tag="2")]
    pub last_name: ::prost::alloc::string::String,
}
/// Pilots
#[derive(Eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pilots {
    #[prost(message, repeated, tag="1")]
    pub pilots: ::prost::alloc::vec::Vec<Pilot>,
}
/// Generated client implementations.
pub mod pilot_rpc_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    ///PilotRpc service
    #[derive(Debug, Clone)]
    pub struct PilotRpcClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl PilotRpcClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: std::convert::TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> PilotRpcClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> PilotRpcClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
            >>::Error: Into<StdError> + Send + Sync,
        {
            PilotRpcClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        pub async fn pilots(
            &mut self,
            request: impl tonic::IntoRequest<super::super::SearchFilter>,
        ) -> Result<tonic::Response<super::Pilots>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/grpc.pilot.PilotRpc/pilots",
            );
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn pilot_by_id(
            &mut self,
            request: impl tonic::IntoRequest<super::super::Id>,
        ) -> Result<tonic::Response<super::Pilot>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/grpc.pilot.PilotRpc/pilot_by_id",
            );
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn insert_pilot(
            &mut self,
            request: impl tonic::IntoRequest<super::PilotData>,
        ) -> Result<tonic::Response<super::Pilot>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/grpc.pilot.PilotRpc/insert_pilot",
            );
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn update_pilot(
            &mut self,
            request: impl tonic::IntoRequest<super::Pilot>,
        ) -> Result<tonic::Response<super::Pilot>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/grpc.pilot.PilotRpc/update_pilot",
            );
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn delete_pilot(
            &mut self,
            request: impl tonic::IntoRequest<super::super::Id>,
        ) -> Result<tonic::Response<()>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/grpc.pilot.PilotRpc/delete_pilot",
            );
            self.inner.unary(request.into_request(), path, codec).await
        }
    }
}