1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct PublishClientEnvelopesRequest {
4 #[prost(message, repeated, tag = "1")]
5 pub envelopes: ::prost::alloc::vec::Vec<super::envelopes::ClientEnvelope>,
6}
7impl ::prost::Name for PublishClientEnvelopesRequest {
8 const NAME: &'static str = "PublishClientEnvelopesRequest";
9 const PACKAGE: &'static str = "xmtp.xmtpv4.payer_api";
10 fn full_name() -> ::prost::alloc::string::String {
11 "xmtp.xmtpv4.payer_api.PublishClientEnvelopesRequest".into()
12 }
13 fn type_url() -> ::prost::alloc::string::String {
14 "/xmtp.xmtpv4.payer_api.PublishClientEnvelopesRequest".into()
15 }
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct PublishClientEnvelopesResponse {
19 #[prost(message, repeated, tag = "1")]
20 pub originator_envelopes: ::prost::alloc::vec::Vec<
21 super::envelopes::OriginatorEnvelope,
22 >,
23}
24impl ::prost::Name for PublishClientEnvelopesResponse {
25 const NAME: &'static str = "PublishClientEnvelopesResponse";
26 const PACKAGE: &'static str = "xmtp.xmtpv4.payer_api";
27 fn full_name() -> ::prost::alloc::string::String {
28 "xmtp.xmtpv4.payer_api.PublishClientEnvelopesResponse".into()
29 }
30 fn type_url() -> ::prost::alloc::string::String {
31 "/xmtp.xmtpv4.payer_api.PublishClientEnvelopesResponse".into()
32 }
33}
34#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
35pub struct GetNodesRequest {}
36impl ::prost::Name for GetNodesRequest {
37 const NAME: &'static str = "GetNodesRequest";
38 const PACKAGE: &'static str = "xmtp.xmtpv4.payer_api";
39 fn full_name() -> ::prost::alloc::string::String {
40 "xmtp.xmtpv4.payer_api.GetNodesRequest".into()
41 }
42 fn type_url() -> ::prost::alloc::string::String {
43 "/xmtp.xmtpv4.payer_api.GetNodesRequest".into()
44 }
45}
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct GetNodesResponse {
48 #[prost(map = "uint32, string", tag = "1")]
49 pub nodes: ::std::collections::HashMap<u32, ::prost::alloc::string::String>,
50}
51impl ::prost::Name for GetNodesResponse {
52 const NAME: &'static str = "GetNodesResponse";
53 const PACKAGE: &'static str = "xmtp.xmtpv4.payer_api";
54 fn full_name() -> ::prost::alloc::string::String {
55 "xmtp.xmtpv4.payer_api.GetNodesResponse".into()
56 }
57 fn type_url() -> ::prost::alloc::string::String {
58 "/xmtp.xmtpv4.payer_api.GetNodesResponse".into()
59 }
60}
61#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))]
63pub mod payer_api_server {
64 #![allow(
65 unused_variables,
66 dead_code,
67 missing_docs,
68 clippy::wildcard_imports,
69 clippy::let_unit_value,
70 )]
71 use tonic::codegen::*;
72 #[async_trait]
74 pub trait PayerApi: std::marker::Send + std::marker::Sync + 'static {
75 async fn publish_client_envelopes(
76 &self,
77 request: tonic::Request<super::PublishClientEnvelopesRequest>,
78 ) -> std::result::Result<
79 tonic::Response<super::PublishClientEnvelopesResponse>,
80 tonic::Status,
81 >;
82 async fn get_nodes(
83 &self,
84 request: tonic::Request<super::GetNodesRequest>,
85 ) -> std::result::Result<
86 tonic::Response<super::GetNodesResponse>,
87 tonic::Status,
88 >;
89 }
90 #[derive(Debug)]
92 pub struct PayerApiServer<T> {
93 inner: Arc<T>,
94 accept_compression_encodings: EnabledCompressionEncodings,
95 send_compression_encodings: EnabledCompressionEncodings,
96 max_decoding_message_size: Option<usize>,
97 max_encoding_message_size: Option<usize>,
98 }
99 impl<T> PayerApiServer<T> {
100 pub fn new(inner: T) -> Self {
101 Self::from_arc(Arc::new(inner))
102 }
103 pub fn from_arc(inner: Arc<T>) -> Self {
104 Self {
105 inner,
106 accept_compression_encodings: Default::default(),
107 send_compression_encodings: Default::default(),
108 max_decoding_message_size: None,
109 max_encoding_message_size: None,
110 }
111 }
112 pub fn with_interceptor<F>(
113 inner: T,
114 interceptor: F,
115 ) -> InterceptedService<Self, F>
116 where
117 F: tonic::service::Interceptor,
118 {
119 InterceptedService::new(Self::new(inner), interceptor)
120 }
121 #[must_use]
123 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
124 self.accept_compression_encodings.enable(encoding);
125 self
126 }
127 #[must_use]
129 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
130 self.send_compression_encodings.enable(encoding);
131 self
132 }
133 #[must_use]
137 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
138 self.max_decoding_message_size = Some(limit);
139 self
140 }
141 #[must_use]
145 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
146 self.max_encoding_message_size = Some(limit);
147 self
148 }
149 }
150 impl<T, B> tonic::codegen::Service<http::Request<B>> for PayerApiServer<T>
151 where
152 T: PayerApi,
153 B: Body + std::marker::Send + 'static,
154 B::Error: Into<StdError> + std::marker::Send + 'static,
155 {
156 type Response = http::Response<tonic::body::Body>;
157 type Error = std::convert::Infallible;
158 type Future = BoxFuture<Self::Response, Self::Error>;
159 fn poll_ready(
160 &mut self,
161 _cx: &mut Context<'_>,
162 ) -> Poll<std::result::Result<(), Self::Error>> {
163 Poll::Ready(Ok(()))
164 }
165 fn call(&mut self, req: http::Request<B>) -> Self::Future {
166 match req.uri().path() {
167 "/xmtp.xmtpv4.payer_api.PayerApi/PublishClientEnvelopes" => {
168 #[allow(non_camel_case_types)]
169 struct PublishClientEnvelopesSvc<T: PayerApi>(pub Arc<T>);
170 impl<
171 T: PayerApi,
172 > tonic::server::UnaryService<super::PublishClientEnvelopesRequest>
173 for PublishClientEnvelopesSvc<T> {
174 type Response = super::PublishClientEnvelopesResponse;
175 type Future = BoxFuture<
176 tonic::Response<Self::Response>,
177 tonic::Status,
178 >;
179 fn call(
180 &mut self,
181 request: tonic::Request<super::PublishClientEnvelopesRequest>,
182 ) -> Self::Future {
183 let inner = Arc::clone(&self.0);
184 let fut = async move {
185 <T as PayerApi>::publish_client_envelopes(&inner, request)
186 .await
187 };
188 Box::pin(fut)
189 }
190 }
191 let accept_compression_encodings = self.accept_compression_encodings;
192 let send_compression_encodings = self.send_compression_encodings;
193 let max_decoding_message_size = self.max_decoding_message_size;
194 let max_encoding_message_size = self.max_encoding_message_size;
195 let inner = self.inner.clone();
196 let fut = async move {
197 let method = PublishClientEnvelopesSvc(inner);
198 let codec = tonic_prost::ProstCodec::default();
199 let mut grpc = tonic::server::Grpc::new(codec)
200 .apply_compression_config(
201 accept_compression_encodings,
202 send_compression_encodings,
203 )
204 .apply_max_message_size_config(
205 max_decoding_message_size,
206 max_encoding_message_size,
207 );
208 let res = grpc.unary(method, req).await;
209 Ok(res)
210 };
211 Box::pin(fut)
212 }
213 "/xmtp.xmtpv4.payer_api.PayerApi/GetNodes" => {
214 #[allow(non_camel_case_types)]
215 struct GetNodesSvc<T: PayerApi>(pub Arc<T>);
216 impl<T: PayerApi> tonic::server::UnaryService<super::GetNodesRequest>
217 for GetNodesSvc<T> {
218 type Response = super::GetNodesResponse;
219 type Future = BoxFuture<
220 tonic::Response<Self::Response>,
221 tonic::Status,
222 >;
223 fn call(
224 &mut self,
225 request: tonic::Request<super::GetNodesRequest>,
226 ) -> Self::Future {
227 let inner = Arc::clone(&self.0);
228 let fut = async move {
229 <T as PayerApi>::get_nodes(&inner, request).await
230 };
231 Box::pin(fut)
232 }
233 }
234 let accept_compression_encodings = self.accept_compression_encodings;
235 let send_compression_encodings = self.send_compression_encodings;
236 let max_decoding_message_size = self.max_decoding_message_size;
237 let max_encoding_message_size = self.max_encoding_message_size;
238 let inner = self.inner.clone();
239 let fut = async move {
240 let method = GetNodesSvc(inner);
241 let codec = tonic_prost::ProstCodec::default();
242 let mut grpc = tonic::server::Grpc::new(codec)
243 .apply_compression_config(
244 accept_compression_encodings,
245 send_compression_encodings,
246 )
247 .apply_max_message_size_config(
248 max_decoding_message_size,
249 max_encoding_message_size,
250 );
251 let res = grpc.unary(method, req).await;
252 Ok(res)
253 };
254 Box::pin(fut)
255 }
256 _ => {
257 Box::pin(async move {
258 let mut response = http::Response::new(
259 tonic::body::Body::default(),
260 );
261 let headers = response.headers_mut();
262 headers
263 .insert(
264 tonic::Status::GRPC_STATUS,
265 (tonic::Code::Unimplemented as i32).into(),
266 );
267 headers
268 .insert(
269 http::header::CONTENT_TYPE,
270 tonic::metadata::GRPC_CONTENT_TYPE,
271 );
272 Ok(response)
273 })
274 }
275 }
276 }
277 }
278 impl<T> Clone for PayerApiServer<T> {
279 fn clone(&self) -> Self {
280 let inner = self.inner.clone();
281 Self {
282 inner,
283 accept_compression_encodings: self.accept_compression_encodings,
284 send_compression_encodings: self.send_compression_encodings,
285 max_decoding_message_size: self.max_decoding_message_size,
286 max_encoding_message_size: self.max_encoding_message_size,
287 }
288 }
289 }
290 pub const SERVICE_NAME: &str = "xmtp.xmtpv4.payer_api.PayerApi";
292 impl<T> tonic::server::NamedService for PayerApiServer<T> {
293 const NAME: &'static str = SERVICE_NAME;
294 }
295}