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(
77 &self,
78 request: tonic::Request<super::PublishClientEnvelopesRequest>,
79 ) -> std::result::Result<
80 tonic::Response<super::PublishClientEnvelopesResponse>,
81 tonic::Status,
82 >;
83 async fn get_nodes(
84 &self,
85 request: tonic::Request<super::GetNodesRequest>,
86 ) -> std::result::Result<
87 tonic::Response<super::GetNodesResponse>,
88 tonic::Status,
89 >;
90 }
91 #[derive(Debug)]
93 pub struct PayerApiServer<T> {
94 inner: Arc<T>,
95 accept_compression_encodings: EnabledCompressionEncodings,
96 send_compression_encodings: EnabledCompressionEncodings,
97 max_decoding_message_size: Option<usize>,
98 max_encoding_message_size: Option<usize>,
99 }
100 impl<T> PayerApiServer<T> {
101 pub fn new(inner: T) -> Self {
102 Self::from_arc(Arc::new(inner))
103 }
104 pub fn from_arc(inner: Arc<T>) -> Self {
105 Self {
106 inner,
107 accept_compression_encodings: Default::default(),
108 send_compression_encodings: Default::default(),
109 max_decoding_message_size: None,
110 max_encoding_message_size: None,
111 }
112 }
113 pub fn with_interceptor<F>(
114 inner: T,
115 interceptor: F,
116 ) -> InterceptedService<Self, F>
117 where
118 F: tonic::service::Interceptor,
119 {
120 InterceptedService::new(Self::new(inner), interceptor)
121 }
122 #[must_use]
124 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
125 self.accept_compression_encodings.enable(encoding);
126 self
127 }
128 #[must_use]
130 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
131 self.send_compression_encodings.enable(encoding);
132 self
133 }
134 #[must_use]
138 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
139 self.max_decoding_message_size = Some(limit);
140 self
141 }
142 #[must_use]
146 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
147 self.max_encoding_message_size = Some(limit);
148 self
149 }
150 }
151 impl<T, B> tonic::codegen::Service<http::Request<B>> for PayerApiServer<T>
152 where
153 T: PayerApi,
154 B: Body + std::marker::Send + 'static,
155 B::Error: Into<StdError> + std::marker::Send + 'static,
156 {
157 type Response = http::Response<tonic::body::Body>;
158 type Error = std::convert::Infallible;
159 type Future = BoxFuture<Self::Response, Self::Error>;
160 fn poll_ready(
161 &mut self,
162 _cx: &mut Context<'_>,
163 ) -> Poll<std::result::Result<(), Self::Error>> {
164 Poll::Ready(Ok(()))
165 }
166 fn call(&mut self, req: http::Request<B>) -> Self::Future {
167 match req.uri().path() {
168 "/xmtp.xmtpv4.payer_api.PayerApi/PublishClientEnvelopes" => {
169 #[allow(non_camel_case_types)]
170 struct PublishClientEnvelopesSvc<T: PayerApi>(pub Arc<T>);
171 impl<
172 T: PayerApi,
173 > tonic::server::UnaryService<super::PublishClientEnvelopesRequest>
174 for PublishClientEnvelopesSvc<T> {
175 type Response = super::PublishClientEnvelopesResponse;
176 type Future = BoxFuture<
177 tonic::Response<Self::Response>,
178 tonic::Status,
179 >;
180 fn call(
181 &mut self,
182 request: tonic::Request<super::PublishClientEnvelopesRequest>,
183 ) -> Self::Future {
184 let inner = Arc::clone(&self.0);
185 let fut = async move {
186 <T as PayerApi>::publish_client_envelopes(&inner, request)
187 .await
188 };
189 Box::pin(fut)
190 }
191 }
192 let accept_compression_encodings = self.accept_compression_encodings;
193 let send_compression_encodings = self.send_compression_encodings;
194 let max_decoding_message_size = self.max_decoding_message_size;
195 let max_encoding_message_size = self.max_encoding_message_size;
196 let inner = self.inner.clone();
197 let fut = async move {
198 let method = PublishClientEnvelopesSvc(inner);
199 let codec = tonic_prost::ProstCodec::default();
200 let mut grpc = tonic::server::Grpc::new(codec)
201 .apply_compression_config(
202 accept_compression_encodings,
203 send_compression_encodings,
204 )
205 .apply_max_message_size_config(
206 max_decoding_message_size,
207 max_encoding_message_size,
208 );
209 let res = grpc.unary(method, req).await;
210 Ok(res)
211 };
212 Box::pin(fut)
213 }
214 "/xmtp.xmtpv4.payer_api.PayerApi/GetNodes" => {
215 #[allow(non_camel_case_types)]
216 struct GetNodesSvc<T: PayerApi>(pub Arc<T>);
217 impl<T: PayerApi> tonic::server::UnaryService<super::GetNodesRequest>
218 for GetNodesSvc<T> {
219 type Response = super::GetNodesResponse;
220 type Future = BoxFuture<
221 tonic::Response<Self::Response>,
222 tonic::Status,
223 >;
224 fn call(
225 &mut self,
226 request: tonic::Request<super::GetNodesRequest>,
227 ) -> Self::Future {
228 let inner = Arc::clone(&self.0);
229 let fut = async move {
230 <T as PayerApi>::get_nodes(&inner, request).await
231 };
232 Box::pin(fut)
233 }
234 }
235 let accept_compression_encodings = self.accept_compression_encodings;
236 let send_compression_encodings = self.send_compression_encodings;
237 let max_decoding_message_size = self.max_decoding_message_size;
238 let max_encoding_message_size = self.max_encoding_message_size;
239 let inner = self.inner.clone();
240 let fut = async move {
241 let method = GetNodesSvc(inner);
242 let codec = tonic_prost::ProstCodec::default();
243 let mut grpc = tonic::server::Grpc::new(codec)
244 .apply_compression_config(
245 accept_compression_encodings,
246 send_compression_encodings,
247 )
248 .apply_max_message_size_config(
249 max_decoding_message_size,
250 max_encoding_message_size,
251 );
252 let res = grpc.unary(method, req).await;
253 Ok(res)
254 };
255 Box::pin(fut)
256 }
257 _ => {
258 Box::pin(async move {
259 let mut response = http::Response::new(
260 tonic::body::Body::default(),
261 );
262 let headers = response.headers_mut();
263 headers
264 .insert(
265 tonic::Status::GRPC_STATUS,
266 (tonic::Code::Unimplemented as i32).into(),
267 );
268 headers
269 .insert(
270 http::header::CONTENT_TYPE,
271 tonic::metadata::GRPC_CONTENT_TYPE,
272 );
273 Ok(response)
274 })
275 }
276 }
277 }
278 }
279 impl<T> Clone for PayerApiServer<T> {
280 fn clone(&self) -> Self {
281 let inner = self.inner.clone();
282 Self {
283 inner,
284 accept_compression_encodings: self.accept_compression_encodings,
285 send_compression_encodings: self.send_compression_encodings,
286 max_decoding_message_size: self.max_decoding_message_size,
287 max_encoding_message_size: self.max_encoding_message_size,
288 }
289 }
290 }
291 pub const SERVICE_NAME: &str = "xmtp.xmtpv4.payer_api.PayerApi";
293 impl<T> tonic::server::NamedService for PayerApiServer<T> {
294 const NAME: &'static str = SERVICE_NAME;
295 }
296}