#![allow(non_camel_case_types)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Any {
#[prost(string, tag = "1")]
pub type_url: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metadata {
#[prost(string, tag = "3")]
pub r#type: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub client_ip: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "7")]
pub headers:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Payload {
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<Metadata>,
#[prost(message, optional, tag = "3")]
pub body: ::core::option::Option<Any>,
}
#[doc = r" Generated client implementations."]
pub mod request_client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
pub struct RequestClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RequestClient<tonic::transport::Channel> {
#[doc = r" 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> RequestClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}
#[doc = " Sends a commonRequest"]
pub async fn request(
&mut self,
request: impl tonic::IntoRequest<super::Payload>,
) -> Result<tonic::Response<super::Payload>, 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("/Request/request");
self.inner.unary(request.into_request(), path, codec).await
}
}
impl<T: Clone> Clone for RequestClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for RequestClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RequestClient {{ ... }}")
}
}
}
#[doc = r" Generated client implementations."]
pub mod bi_request_stream_client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
pub struct BiRequestStreamClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BiRequestStreamClient<tonic::transport::Channel> {
#[doc = r" 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> BiRequestStreamClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
Self { inner }
}
#[doc = " Sends a commonRequest"]
pub async fn request_bi_stream(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::Payload>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::Payload>>, 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("/BiRequestStream/requestBiStream");
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
}
impl<T: Clone> Clone for BiRequestStreamClient<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> std::fmt::Debug for BiRequestStreamClient<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "BiRequestStreamClient {{ ... }}")
}
}
}
#[doc = r" Generated server implementations."]
pub mod request_server {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = "Generated trait containing gRPC methods that should be implemented for use with RequestServer."]
#[async_trait]
pub trait Request: Send + Sync + 'static {
#[doc = " Sends a commonRequest"]
async fn request(
&self,
request: tonic::Request<super::Payload>,
) -> Result<tonic::Response<super::Payload>, tonic::Status>;
}
#[derive(Debug)]
pub struct RequestServer<T: Request> {
inner: _Inner<T>,
}
struct _Inner<T>(Arc<T>, Option<tonic::Interceptor>);
impl<T: Request> RequestServer<T> {
pub fn new(inner: T) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, None);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, Some(interceptor.into()));
Self { inner }
}
}
impl<T, B> Service<http::Request<B>> for RequestServer<T>
where
T: Request,
B: HttpBody + Send + Sync + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = Never;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/Request/request" => {
#[allow(non_camel_case_types)]
struct requestSvc<T: Request>(pub Arc<T>);
impl<T: Request> tonic::server::UnaryService<super::Payload> for requestSvc<T> {
type Response = super::Payload;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::Payload>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).request(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1.clone();
let inner = inner.0;
let method = requestSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(tonic::body::BoxBody::empty())
.unwrap())
}),
}
}
}
impl<T: Request> Clone for RequestServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self { inner }
}
}
impl<T: Request> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone(), self.1.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Request> tonic::transport::NamedService for RequestServer<T> {
const NAME: &'static str = "Request";
}
}
#[doc = r" Generated server implementations."]
pub mod bi_request_stream_server {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#[doc = "Generated trait containing gRPC methods that should be implemented for use with BiRequestStreamServer."]
#[async_trait]
pub trait BiRequestStream: Send + Sync + 'static {
#[doc = "Server streaming response type for the requestBiStream method."]
type requestBiStreamStream: futures_core::Stream<Item = Result<super::Payload, tonic::Status>>
+ Send
+ Sync
+ 'static;
#[doc = " Sends a commonRequest"]
async fn request_bi_stream(
&self,
request: tonic::Request<tonic::Streaming<super::Payload>>,
) -> Result<tonic::Response<Self::requestBiStreamStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct BiRequestStreamServer<T: BiRequestStream> {
inner: _Inner<T>,
}
struct _Inner<T>(Arc<T>, Option<tonic::Interceptor>);
impl<T: BiRequestStream> BiRequestStreamServer<T> {
pub fn new(inner: T) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, None);
Self { inner }
}
pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
let inner = Arc::new(inner);
let inner = _Inner(inner, Some(interceptor.into()));
Self { inner }
}
}
impl<T, B> Service<http::Request<B>> for BiRequestStreamServer<T>
where
T: BiRequestStream,
B: HttpBody + Send + Sync + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = Never;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/BiRequestStream/requestBiStream" => {
#[allow(non_camel_case_types)]
struct requestBiStreamSvc<T: BiRequestStream>(pub Arc<T>);
impl<T: BiRequestStream> tonic::server::StreamingService<super::Payload> for requestBiStreamSvc<T> {
type Response = super::Payload;
type ResponseStream = T::requestBiStreamStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::Payload>>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).request_bi_stream(request).await };
Box::pin(fut)
}
}
let inner = self.inner.clone();
let fut = async move {
let interceptor = inner.1;
let inner = inner.0;
let method = requestBiStreamSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = if let Some(interceptor) = interceptor {
tonic::server::Grpc::with_interceptor(codec, interceptor)
} else {
tonic::server::Grpc::new(codec)
};
let res = grpc.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(tonic::body::BoxBody::empty())
.unwrap())
}),
}
}
}
impl<T: BiRequestStream> Clone for BiRequestStreamServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self { inner }
}
}
impl<T: BiRequestStream> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone(), self.1.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: BiRequestStream> tonic::transport::NamedService for BiRequestStreamServer<T> {
const NAME: &'static str = "BiRequestStream";
}
}