1pub mod valuation_client {
3 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4 use tonic::codegen::*;
5 use tonic::codegen::http::Uri;
6 #[derive(Debug, Clone)]
7 pub struct ValuationClient<T> {
8 inner: tonic::client::Grpc<T>,
9 }
10 impl ValuationClient<tonic::transport::Channel> {
11 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
13 where
14 D: TryInto<tonic::transport::Endpoint>,
15 D::Error: Into<StdError>,
16 {
17 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
18 Ok(Self::new(conn))
19 }
20 }
21 impl<T> ValuationClient<T>
22 where
23 T: tonic::client::GrpcService<tonic::body::BoxBody>,
24 T::Error: Into<StdError>,
25 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
26 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
27 {
28 pub fn new(inner: T) -> Self {
29 let inner = tonic::client::Grpc::new(inner);
30 Self { inner }
31 }
32 pub fn with_origin(inner: T, origin: Uri) -> Self {
33 let inner = tonic::client::Grpc::with_origin(inner, origin);
34 Self { inner }
35 }
36 pub fn with_interceptor<F>(
37 inner: T,
38 interceptor: F,
39 ) -> ValuationClient<InterceptedService<T, F>>
40 where
41 F: tonic::service::Interceptor,
42 T::ResponseBody: Default,
43 T: tonic::codegen::Service<
44 http::Request<tonic::body::BoxBody>,
45 Response = http::Response<
46 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
47 >,
48 >,
49 <T as tonic::codegen::Service<
50 http::Request<tonic::body::BoxBody>,
51 >>::Error: Into<StdError> + Send + Sync,
52 {
53 ValuationClient::new(InterceptedService::new(inner, interceptor))
54 }
55 #[must_use]
60 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
61 self.inner = self.inner.send_compressed(encoding);
62 self
63 }
64 #[must_use]
66 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
67 self.inner = self.inner.accept_compressed(encoding);
68 self
69 }
70 #[must_use]
74 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
75 self.inner = self.inner.max_decoding_message_size(limit);
76 self
77 }
78 #[must_use]
82 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
83 self.inner = self.inner.max_encoding_message_size(limit);
84 self
85 }
86 pub async fn run_valuation(
87 &mut self,
88 request: impl tonic::IntoRequest<
89 super::super::super::requests::valuation::ValuationRequestProto,
90 >,
91 ) -> std::result::Result<
92 tonic::Response<
93 super::super::super::requests::valuation::ValuationResponseProto,
94 >,
95 tonic::Status,
96 > {
97 self.inner
98 .ready()
99 .await
100 .map_err(|e| {
101 tonic::Status::new(
102 tonic::Code::Unknown,
103 format!("Service was not ready: {}", e.into()),
104 )
105 })?;
106 let codec = tonic::codec::ProstCodec::default();
107 let path = http::uri::PathAndQuery::from_static(
108 "/fintekkers.services.valuation_service.Valuation/RunValuation",
109 );
110 let mut req = request.into_request();
111 req.extensions_mut()
112 .insert(
113 GrpcMethod::new(
114 "fintekkers.services.valuation_service.Valuation",
115 "RunValuation",
116 ),
117 );
118 self.inner.unary(req, path, codec).await
119 }
120 }
121}
122pub mod valuation_server {
124 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
125 use tonic::codegen::*;
126 #[async_trait]
128 pub trait Valuation: Send + Sync + 'static {
129 async fn run_valuation(
130 &self,
131 request: tonic::Request<
132 super::super::super::requests::valuation::ValuationRequestProto,
133 >,
134 ) -> std::result::Result<
135 tonic::Response<
136 super::super::super::requests::valuation::ValuationResponseProto,
137 >,
138 tonic::Status,
139 >;
140 }
141 #[derive(Debug)]
142 pub struct ValuationServer<T: Valuation> {
143 inner: _Inner<T>,
144 accept_compression_encodings: EnabledCompressionEncodings,
145 send_compression_encodings: EnabledCompressionEncodings,
146 max_decoding_message_size: Option<usize>,
147 max_encoding_message_size: Option<usize>,
148 }
149 struct _Inner<T>(Arc<T>);
150 impl<T: Valuation> ValuationServer<T> {
151 pub fn new(inner: T) -> Self {
152 Self::from_arc(Arc::new(inner))
153 }
154 pub fn from_arc(inner: Arc<T>) -> Self {
155 let inner = _Inner(inner);
156 Self {
157 inner,
158 accept_compression_encodings: Default::default(),
159 send_compression_encodings: Default::default(),
160 max_decoding_message_size: None,
161 max_encoding_message_size: None,
162 }
163 }
164 pub fn with_interceptor<F>(
165 inner: T,
166 interceptor: F,
167 ) -> InterceptedService<Self, F>
168 where
169 F: tonic::service::Interceptor,
170 {
171 InterceptedService::new(Self::new(inner), interceptor)
172 }
173 #[must_use]
175 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
176 self.accept_compression_encodings.enable(encoding);
177 self
178 }
179 #[must_use]
181 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
182 self.send_compression_encodings.enable(encoding);
183 self
184 }
185 #[must_use]
189 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
190 self.max_decoding_message_size = Some(limit);
191 self
192 }
193 #[must_use]
197 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
198 self.max_encoding_message_size = Some(limit);
199 self
200 }
201 }
202 impl<T, B> tonic::codegen::Service<http::Request<B>> for ValuationServer<T>
203 where
204 T: Valuation,
205 B: Body + Send + 'static,
206 B::Error: Into<StdError> + Send + 'static,
207 {
208 type Response = http::Response<tonic::body::BoxBody>;
209 type Error = std::convert::Infallible;
210 type Future = BoxFuture<Self::Response, Self::Error>;
211 fn poll_ready(
212 &mut self,
213 _cx: &mut Context<'_>,
214 ) -> Poll<std::result::Result<(), Self::Error>> {
215 Poll::Ready(Ok(()))
216 }
217 fn call(&mut self, req: http::Request<B>) -> Self::Future {
218 let inner = self.inner.clone();
219 match req.uri().path() {
220 "/fintekkers.services.valuation_service.Valuation/RunValuation" => {
221 #[allow(non_camel_case_types)]
222 struct RunValuationSvc<T: Valuation>(pub Arc<T>);
223 impl<
224 T: Valuation,
225 > tonic::server::UnaryService<
226 super::super::super::requests::valuation::ValuationRequestProto,
227 > for RunValuationSvc<T> {
228 type Response = super::super::super::requests::valuation::ValuationResponseProto;
229 type Future = BoxFuture<
230 tonic::Response<Self::Response>,
231 tonic::Status,
232 >;
233 fn call(
234 &mut self,
235 request: tonic::Request<
236 super::super::super::requests::valuation::ValuationRequestProto,
237 >,
238 ) -> Self::Future {
239 let inner = Arc::clone(&self.0);
240 let fut = async move {
241 (*inner).run_valuation(request).await
242 };
243 Box::pin(fut)
244 }
245 }
246 let accept_compression_encodings = self.accept_compression_encodings;
247 let send_compression_encodings = self.send_compression_encodings;
248 let max_decoding_message_size = self.max_decoding_message_size;
249 let max_encoding_message_size = self.max_encoding_message_size;
250 let inner = self.inner.clone();
251 let fut = async move {
252 let inner = inner.0;
253 let method = RunValuationSvc(inner);
254 let codec = tonic::codec::ProstCodec::default();
255 let mut grpc = tonic::server::Grpc::new(codec)
256 .apply_compression_config(
257 accept_compression_encodings,
258 send_compression_encodings,
259 )
260 .apply_max_message_size_config(
261 max_decoding_message_size,
262 max_encoding_message_size,
263 );
264 let res = grpc.unary(method, req).await;
265 Ok(res)
266 };
267 Box::pin(fut)
268 }
269 _ => {
270 Box::pin(async move {
271 Ok(
272 http::Response::builder()
273 .status(200)
274 .header("grpc-status", "12")
275 .header("content-type", "application/grpc")
276 .body(empty_body())
277 .unwrap(),
278 )
279 })
280 }
281 }
282 }
283 }
284 impl<T: Valuation> Clone for ValuationServer<T> {
285 fn clone(&self) -> Self {
286 let inner = self.inner.clone();
287 Self {
288 inner,
289 accept_compression_encodings: self.accept_compression_encodings,
290 send_compression_encodings: self.send_compression_encodings,
291 max_decoding_message_size: self.max_decoding_message_size,
292 max_encoding_message_size: self.max_encoding_message_size,
293 }
294 }
295 }
296 impl<T: Valuation> Clone for _Inner<T> {
297 fn clone(&self) -> Self {
298 Self(Arc::clone(&self.0))
299 }
300 }
301 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
302 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
303 write!(f, "{:?}", self.0)
304 }
305 }
306 impl<T: Valuation> tonic::server::NamedService for ValuationServer<T> {
307 const NAME: &'static str = "fintekkers.services.valuation_service.Valuation";
308 }
309}