1#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct GetSyncCursorRequest {}
4impl ::prost::Name for GetSyncCursorRequest {
5 const NAME: &'static str = "GetSyncCursorRequest";
6 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
7 fn full_name() -> ::prost::alloc::string::String {
8 "xmtp.xmtpv4.metadata_api.GetSyncCursorRequest".into()
9 }
10 fn type_url() -> ::prost::alloc::string::String {
11 "/xmtp.xmtpv4.metadata_api.GetSyncCursorRequest".into()
12 }
13}
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct GetSyncCursorResponse {
16 #[prost(message, optional, tag = "1")]
17 pub latest_sync: ::core::option::Option<super::envelopes::Cursor>,
18}
19impl ::prost::Name for GetSyncCursorResponse {
20 const NAME: &'static str = "GetSyncCursorResponse";
21 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
22 fn full_name() -> ::prost::alloc::string::String {
23 "xmtp.xmtpv4.metadata_api.GetSyncCursorResponse".into()
24 }
25 fn type_url() -> ::prost::alloc::string::String {
26 "/xmtp.xmtpv4.metadata_api.GetSyncCursorResponse".into()
27 }
28}
29#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
30pub struct GetVersionRequest {}
31impl ::prost::Name for GetVersionRequest {
32 const NAME: &'static str = "GetVersionRequest";
33 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
34 fn full_name() -> ::prost::alloc::string::String {
35 "xmtp.xmtpv4.metadata_api.GetVersionRequest".into()
36 }
37 fn type_url() -> ::prost::alloc::string::String {
38 "/xmtp.xmtpv4.metadata_api.GetVersionRequest".into()
39 }
40}
41#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
42pub struct GetVersionResponse {
43 #[prost(string, tag = "1")]
44 pub version: ::prost::alloc::string::String,
45}
46impl ::prost::Name for GetVersionResponse {
47 const NAME: &'static str = "GetVersionResponse";
48 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
49 fn full_name() -> ::prost::alloc::string::String {
50 "xmtp.xmtpv4.metadata_api.GetVersionResponse".into()
51 }
52 fn type_url() -> ::prost::alloc::string::String {
53 "/xmtp.xmtpv4.metadata_api.GetVersionResponse".into()
54 }
55}
56#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
58pub struct GetPayerInfoRequest {
59 #[prost(string, repeated, tag = "1")]
60 pub payer_addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
61 #[prost(enumeration = "PayerInfoGranularity", tag = "2")]
62 pub granularity: i32,
63}
64impl ::prost::Name for GetPayerInfoRequest {
65 const NAME: &'static str = "GetPayerInfoRequest";
66 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
67 fn full_name() -> ::prost::alloc::string::String {
68 "xmtp.xmtpv4.metadata_api.GetPayerInfoRequest".into()
69 }
70 fn type_url() -> ::prost::alloc::string::String {
71 "/xmtp.xmtpv4.metadata_api.GetPayerInfoRequest".into()
72 }
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
76pub struct GetPayerInfoResponse {
77 #[prost(map = "string, message", tag = "1")]
79 pub payer_info: ::std::collections::HashMap<
80 ::prost::alloc::string::String,
81 get_payer_info_response::PayerInfo,
82 >,
83}
84pub mod get_payer_info_response {
86 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
87 pub struct PeriodSummary {
88 #[prost(uint64, tag = "1")]
89 pub amount_spent_picodollars: u64,
90 #[prost(uint64, tag = "2")]
91 pub num_messages: u64,
92 #[prost(uint64, tag = "3")]
93 pub period_start_unix_seconds: u64,
94 }
95 impl ::prost::Name for PeriodSummary {
96 const NAME: &'static str = "PeriodSummary";
97 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
98 fn full_name() -> ::prost::alloc::string::String {
99 "xmtp.xmtpv4.metadata_api.GetPayerInfoResponse.PeriodSummary".into()
100 }
101 fn type_url() -> ::prost::alloc::string::String {
102 "/xmtp.xmtpv4.metadata_api.GetPayerInfoResponse.PeriodSummary".into()
103 }
104 }
105 #[derive(Clone, PartialEq, ::prost::Message)]
106 pub struct PayerInfo {
107 #[prost(message, repeated, tag = "1")]
108 pub period_summaries: ::prost::alloc::vec::Vec<PeriodSummary>,
109 }
110 impl ::prost::Name for PayerInfo {
111 const NAME: &'static str = "PayerInfo";
112 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
113 fn full_name() -> ::prost::alloc::string::String {
114 "xmtp.xmtpv4.metadata_api.GetPayerInfoResponse.PayerInfo".into()
115 }
116 fn type_url() -> ::prost::alloc::string::String {
117 "/xmtp.xmtpv4.metadata_api.GetPayerInfoResponse.PayerInfo".into()
118 }
119 }
120}
121impl ::prost::Name for GetPayerInfoResponse {
122 const NAME: &'static str = "GetPayerInfoResponse";
123 const PACKAGE: &'static str = "xmtp.xmtpv4.metadata_api";
124 fn full_name() -> ::prost::alloc::string::String {
125 "xmtp.xmtpv4.metadata_api.GetPayerInfoResponse".into()
126 }
127 fn type_url() -> ::prost::alloc::string::String {
128 "/xmtp.xmtpv4.metadata_api.GetPayerInfoResponse".into()
129 }
130}
131#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
133#[repr(i32)]
134pub enum PayerInfoGranularity {
135 Unspecified = 0,
136 Hour = 1,
137 Day = 2,
138}
139impl PayerInfoGranularity {
140 pub fn as_str_name(&self) -> &'static str {
145 match self {
146 Self::Unspecified => "PAYER_INFO_GRANULARITY_UNSPECIFIED",
147 Self::Hour => "PAYER_INFO_GRANULARITY_HOUR",
148 Self::Day => "PAYER_INFO_GRANULARITY_DAY",
149 }
150 }
151 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
153 match value {
154 "PAYER_INFO_GRANULARITY_UNSPECIFIED" => Some(Self::Unspecified),
155 "PAYER_INFO_GRANULARITY_HOUR" => Some(Self::Hour),
156 "PAYER_INFO_GRANULARITY_DAY" => Some(Self::Day),
157 _ => None,
158 }
159 }
160}
161#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))]
163pub mod metadata_api_server {
164 #![allow(
165 unused_variables,
166 dead_code,
167 missing_docs,
168 clippy::wildcard_imports,
169 clippy::let_unit_value,
170 )]
171 use tonic::codegen::*;
172 #[async_trait]
174 pub trait MetadataApi: std::marker::Send + std::marker::Sync + 'static {
175 async fn get_sync_cursor(
176 &self,
177 request: tonic::Request<super::GetSyncCursorRequest>,
178 ) -> std::result::Result<
179 tonic::Response<super::GetSyncCursorResponse>,
180 tonic::Status,
181 >;
182 type SubscribeSyncCursorStream: tonic::codegen::tokio_stream::Stream<
184 Item = std::result::Result<super::GetSyncCursorResponse, tonic::Status>,
185 >
186 + std::marker::Send
187 + 'static;
188 async fn subscribe_sync_cursor(
189 &self,
190 request: tonic::Request<super::GetSyncCursorRequest>,
191 ) -> std::result::Result<
192 tonic::Response<Self::SubscribeSyncCursorStream>,
193 tonic::Status,
194 >;
195 async fn get_version(
196 &self,
197 request: tonic::Request<super::GetVersionRequest>,
198 ) -> std::result::Result<
199 tonic::Response<super::GetVersionResponse>,
200 tonic::Status,
201 >;
202 async fn get_payer_info(
203 &self,
204 request: tonic::Request<super::GetPayerInfoRequest>,
205 ) -> std::result::Result<
206 tonic::Response<super::GetPayerInfoResponse>,
207 tonic::Status,
208 >;
209 }
210 #[derive(Debug)]
212 pub struct MetadataApiServer<T> {
213 inner: Arc<T>,
214 accept_compression_encodings: EnabledCompressionEncodings,
215 send_compression_encodings: EnabledCompressionEncodings,
216 max_decoding_message_size: Option<usize>,
217 max_encoding_message_size: Option<usize>,
218 }
219 impl<T> MetadataApiServer<T> {
220 pub fn new(inner: T) -> Self {
221 Self::from_arc(Arc::new(inner))
222 }
223 pub fn from_arc(inner: Arc<T>) -> Self {
224 Self {
225 inner,
226 accept_compression_encodings: Default::default(),
227 send_compression_encodings: Default::default(),
228 max_decoding_message_size: None,
229 max_encoding_message_size: None,
230 }
231 }
232 pub fn with_interceptor<F>(
233 inner: T,
234 interceptor: F,
235 ) -> InterceptedService<Self, F>
236 where
237 F: tonic::service::Interceptor,
238 {
239 InterceptedService::new(Self::new(inner), interceptor)
240 }
241 #[must_use]
243 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
244 self.accept_compression_encodings.enable(encoding);
245 self
246 }
247 #[must_use]
249 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
250 self.send_compression_encodings.enable(encoding);
251 self
252 }
253 #[must_use]
257 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
258 self.max_decoding_message_size = Some(limit);
259 self
260 }
261 #[must_use]
265 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
266 self.max_encoding_message_size = Some(limit);
267 self
268 }
269 }
270 impl<T, B> tonic::codegen::Service<http::Request<B>> for MetadataApiServer<T>
271 where
272 T: MetadataApi,
273 B: Body + std::marker::Send + 'static,
274 B::Error: Into<StdError> + std::marker::Send + 'static,
275 {
276 type Response = http::Response<tonic::body::Body>;
277 type Error = std::convert::Infallible;
278 type Future = BoxFuture<Self::Response, Self::Error>;
279 fn poll_ready(
280 &mut self,
281 _cx: &mut Context<'_>,
282 ) -> Poll<std::result::Result<(), Self::Error>> {
283 Poll::Ready(Ok(()))
284 }
285 fn call(&mut self, req: http::Request<B>) -> Self::Future {
286 match req.uri().path() {
287 "/xmtp.xmtpv4.metadata_api.MetadataApi/GetSyncCursor" => {
288 #[allow(non_camel_case_types)]
289 struct GetSyncCursorSvc<T: MetadataApi>(pub Arc<T>);
290 impl<
291 T: MetadataApi,
292 > tonic::server::UnaryService<super::GetSyncCursorRequest>
293 for GetSyncCursorSvc<T> {
294 type Response = super::GetSyncCursorResponse;
295 type Future = BoxFuture<
296 tonic::Response<Self::Response>,
297 tonic::Status,
298 >;
299 fn call(
300 &mut self,
301 request: tonic::Request<super::GetSyncCursorRequest>,
302 ) -> Self::Future {
303 let inner = Arc::clone(&self.0);
304 let fut = async move {
305 <T as MetadataApi>::get_sync_cursor(&inner, request).await
306 };
307 Box::pin(fut)
308 }
309 }
310 let accept_compression_encodings = self.accept_compression_encodings;
311 let send_compression_encodings = self.send_compression_encodings;
312 let max_decoding_message_size = self.max_decoding_message_size;
313 let max_encoding_message_size = self.max_encoding_message_size;
314 let inner = self.inner.clone();
315 let fut = async move {
316 let method = GetSyncCursorSvc(inner);
317 let codec = tonic_prost::ProstCodec::default();
318 let mut grpc = tonic::server::Grpc::new(codec)
319 .apply_compression_config(
320 accept_compression_encodings,
321 send_compression_encodings,
322 )
323 .apply_max_message_size_config(
324 max_decoding_message_size,
325 max_encoding_message_size,
326 );
327 let res = grpc.unary(method, req).await;
328 Ok(res)
329 };
330 Box::pin(fut)
331 }
332 "/xmtp.xmtpv4.metadata_api.MetadataApi/SubscribeSyncCursor" => {
333 #[allow(non_camel_case_types)]
334 struct SubscribeSyncCursorSvc<T: MetadataApi>(pub Arc<T>);
335 impl<
336 T: MetadataApi,
337 > tonic::server::ServerStreamingService<super::GetSyncCursorRequest>
338 for SubscribeSyncCursorSvc<T> {
339 type Response = super::GetSyncCursorResponse;
340 type ResponseStream = T::SubscribeSyncCursorStream;
341 type Future = BoxFuture<
342 tonic::Response<Self::ResponseStream>,
343 tonic::Status,
344 >;
345 fn call(
346 &mut self,
347 request: tonic::Request<super::GetSyncCursorRequest>,
348 ) -> Self::Future {
349 let inner = Arc::clone(&self.0);
350 let fut = async move {
351 <T as MetadataApi>::subscribe_sync_cursor(&inner, request)
352 .await
353 };
354 Box::pin(fut)
355 }
356 }
357 let accept_compression_encodings = self.accept_compression_encodings;
358 let send_compression_encodings = self.send_compression_encodings;
359 let max_decoding_message_size = self.max_decoding_message_size;
360 let max_encoding_message_size = self.max_encoding_message_size;
361 let inner = self.inner.clone();
362 let fut = async move {
363 let method = SubscribeSyncCursorSvc(inner);
364 let codec = tonic_prost::ProstCodec::default();
365 let mut grpc = tonic::server::Grpc::new(codec)
366 .apply_compression_config(
367 accept_compression_encodings,
368 send_compression_encodings,
369 )
370 .apply_max_message_size_config(
371 max_decoding_message_size,
372 max_encoding_message_size,
373 );
374 let res = grpc.server_streaming(method, req).await;
375 Ok(res)
376 };
377 Box::pin(fut)
378 }
379 "/xmtp.xmtpv4.metadata_api.MetadataApi/GetVersion" => {
380 #[allow(non_camel_case_types)]
381 struct GetVersionSvc<T: MetadataApi>(pub Arc<T>);
382 impl<
383 T: MetadataApi,
384 > tonic::server::UnaryService<super::GetVersionRequest>
385 for GetVersionSvc<T> {
386 type Response = super::GetVersionResponse;
387 type Future = BoxFuture<
388 tonic::Response<Self::Response>,
389 tonic::Status,
390 >;
391 fn call(
392 &mut self,
393 request: tonic::Request<super::GetVersionRequest>,
394 ) -> Self::Future {
395 let inner = Arc::clone(&self.0);
396 let fut = async move {
397 <T as MetadataApi>::get_version(&inner, request).await
398 };
399 Box::pin(fut)
400 }
401 }
402 let accept_compression_encodings = self.accept_compression_encodings;
403 let send_compression_encodings = self.send_compression_encodings;
404 let max_decoding_message_size = self.max_decoding_message_size;
405 let max_encoding_message_size = self.max_encoding_message_size;
406 let inner = self.inner.clone();
407 let fut = async move {
408 let method = GetVersionSvc(inner);
409 let codec = tonic_prost::ProstCodec::default();
410 let mut grpc = tonic::server::Grpc::new(codec)
411 .apply_compression_config(
412 accept_compression_encodings,
413 send_compression_encodings,
414 )
415 .apply_max_message_size_config(
416 max_decoding_message_size,
417 max_encoding_message_size,
418 );
419 let res = grpc.unary(method, req).await;
420 Ok(res)
421 };
422 Box::pin(fut)
423 }
424 "/xmtp.xmtpv4.metadata_api.MetadataApi/GetPayerInfo" => {
425 #[allow(non_camel_case_types)]
426 struct GetPayerInfoSvc<T: MetadataApi>(pub Arc<T>);
427 impl<
428 T: MetadataApi,
429 > tonic::server::UnaryService<super::GetPayerInfoRequest>
430 for GetPayerInfoSvc<T> {
431 type Response = super::GetPayerInfoResponse;
432 type Future = BoxFuture<
433 tonic::Response<Self::Response>,
434 tonic::Status,
435 >;
436 fn call(
437 &mut self,
438 request: tonic::Request<super::GetPayerInfoRequest>,
439 ) -> Self::Future {
440 let inner = Arc::clone(&self.0);
441 let fut = async move {
442 <T as MetadataApi>::get_payer_info(&inner, request).await
443 };
444 Box::pin(fut)
445 }
446 }
447 let accept_compression_encodings = self.accept_compression_encodings;
448 let send_compression_encodings = self.send_compression_encodings;
449 let max_decoding_message_size = self.max_decoding_message_size;
450 let max_encoding_message_size = self.max_encoding_message_size;
451 let inner = self.inner.clone();
452 let fut = async move {
453 let method = GetPayerInfoSvc(inner);
454 let codec = tonic_prost::ProstCodec::default();
455 let mut grpc = tonic::server::Grpc::new(codec)
456 .apply_compression_config(
457 accept_compression_encodings,
458 send_compression_encodings,
459 )
460 .apply_max_message_size_config(
461 max_decoding_message_size,
462 max_encoding_message_size,
463 );
464 let res = grpc.unary(method, req).await;
465 Ok(res)
466 };
467 Box::pin(fut)
468 }
469 _ => {
470 Box::pin(async move {
471 let mut response = http::Response::new(
472 tonic::body::Body::default(),
473 );
474 let headers = response.headers_mut();
475 headers
476 .insert(
477 tonic::Status::GRPC_STATUS,
478 (tonic::Code::Unimplemented as i32).into(),
479 );
480 headers
481 .insert(
482 http::header::CONTENT_TYPE,
483 tonic::metadata::GRPC_CONTENT_TYPE,
484 );
485 Ok(response)
486 })
487 }
488 }
489 }
490 }
491 impl<T> Clone for MetadataApiServer<T> {
492 fn clone(&self) -> Self {
493 let inner = self.inner.clone();
494 Self {
495 inner,
496 accept_compression_encodings: self.accept_compression_encodings,
497 send_compression_encodings: self.send_compression_encodings,
498 max_decoding_message_size: self.max_decoding_message_size,
499 max_encoding_message_size: self.max_encoding_message_size,
500 }
501 }
502 }
503 pub const SERVICE_NAME: &str = "xmtp.xmtpv4.metadata_api.MetadataApi";
505 impl<T> tonic::server::NamedService for MetadataApiServer<T> {
506 const NAME: &'static str = SERVICE_NAME;
507 }
508}