1#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct Notification {
7 #[prost(string, tag = "1")]
8 pub notification_id: ::prost::alloc::string::String,
9 #[prost(string, tag = "2")]
11 pub entity_id: ::prost::alloc::string::String,
12 #[prost(string, tag = "3")]
14 pub entity_type: ::prost::alloc::string::String,
15 #[prost(string, tag = "4")]
16 pub title: ::prost::alloc::string::String,
17 #[prost(string, tag = "5")]
18 pub message: ::prost::alloc::string::String,
19 #[prost(string, tag = "6")]
21 pub channel: ::prost::alloc::string::String,
22 #[prost(bool, tag = "7")]
23 pub read: bool,
24 #[prost(message, optional, tag = "8")]
25 pub created_at: ::core::option::Option<prost_types::Timestamp>,
26 #[prost(message, optional, tag = "9")]
27 pub updated_at: ::core::option::Option<prost_types::Timestamp>,
28}
29#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct SendNotificationRequest {
34 #[prost(message, optional, tag = "1")]
35 pub notification: ::core::option::Option<Notification>,
36}
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct SendNotificationResponse {
39 #[prost(message, optional, tag = "1")]
40 pub notification: ::core::option::Option<Notification>,
41 #[prost(message, optional, tag = "2")]
42 pub error: ::core::option::Option<super::common::Error>,
43}
44#[derive(Clone, PartialEq, ::prost::Message)]
45pub struct GetNotificationsRequest {
46 #[prost(string, tag = "1")]
47 pub entity_id: ::prost::alloc::string::String,
48 #[prost(string, tag = "2")]
49 pub entity_type: ::prost::alloc::string::String,
50 #[prost(bool, tag = "3")]
51 pub unread_only: bool,
52 #[prost(message, optional, tag = "4")]
53 pub pagination: ::core::option::Option<super::common::PaginationRequest>,
54}
55#[derive(Clone, PartialEq, ::prost::Message)]
56pub struct GetNotificationsResponse {
57 #[prost(message, repeated, tag = "1")]
58 pub notifications: ::prost::alloc::vec::Vec<Notification>,
59 #[prost(message, optional, tag = "2")]
60 pub pagination: ::core::option::Option<super::common::PaginationResponse>,
61 #[prost(message, optional, tag = "3")]
62 pub error: ::core::option::Option<super::common::Error>,
63}
64pub mod notification_service_client {
66 #![allow(
67 unused_variables,
68 dead_code,
69 missing_docs,
70 clippy::wildcard_imports,
71 clippy::let_unit_value,
72 )]
73 use tonic::codegen::*;
74 use tonic::codegen::http::Uri;
75 #[derive(Debug, Clone)]
79 pub struct NotificationServiceClient<T> {
80 inner: tonic::client::Grpc<T>,
81 }
82 impl NotificationServiceClient<tonic::transport::Channel> {
83 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
85 where
86 D: TryInto<tonic::transport::Endpoint>,
87 D::Error: Into<StdError>,
88 {
89 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
90 Ok(Self::new(conn))
91 }
92 }
93 impl<T> NotificationServiceClient<T>
94 where
95 T: tonic::client::GrpcService<tonic::body::Body>,
96 T::Error: Into<StdError>,
97 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
98 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
99 {
100 pub fn new(inner: T) -> Self {
101 let inner = tonic::client::Grpc::new(inner);
102 Self { inner }
103 }
104 pub fn with_origin(inner: T, origin: Uri) -> Self {
105 let inner = tonic::client::Grpc::with_origin(inner, origin);
106 Self { inner }
107 }
108 pub fn with_interceptor<F>(
109 inner: T,
110 interceptor: F,
111 ) -> NotificationServiceClient<InterceptedService<T, F>>
112 where
113 F: tonic::service::Interceptor,
114 T::ResponseBody: Default,
115 T: tonic::codegen::Service<
116 http::Request<tonic::body::Body>,
117 Response = http::Response<
118 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
119 >,
120 >,
121 <T as tonic::codegen::Service<
122 http::Request<tonic::body::Body>,
123 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
124 {
125 NotificationServiceClient::new(InterceptedService::new(inner, interceptor))
126 }
127 #[must_use]
132 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
133 self.inner = self.inner.send_compressed(encoding);
134 self
135 }
136 #[must_use]
138 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
139 self.inner = self.inner.accept_compressed(encoding);
140 self
141 }
142 #[must_use]
146 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
147 self.inner = self.inner.max_decoding_message_size(limit);
148 self
149 }
150 #[must_use]
154 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
155 self.inner = self.inner.max_encoding_message_size(limit);
156 self
157 }
158 pub async fn send_notification(
160 &mut self,
161 request: impl tonic::IntoRequest<super::SendNotificationRequest>,
162 ) -> std::result::Result<
163 tonic::Response<super::SendNotificationResponse>,
164 tonic::Status,
165 > {
166 self.inner
167 .ready()
168 .await
169 .map_err(|e| {
170 tonic::Status::unknown(
171 format!("Service was not ready: {}", e.into()),
172 )
173 })?;
174 let codec = tonic::codec::ProstCodec::default();
175 let path = http::uri::PathAndQuery::from_static(
176 "/aiscanned.v1.notification.NotificationService/SendNotification",
177 );
178 let mut req = request.into_request();
179 req.extensions_mut()
180 .insert(
181 GrpcMethod::new(
182 "aiscanned.v1.notification.NotificationService",
183 "SendNotification",
184 ),
185 );
186 self.inner.unary(req, path, codec).await
187 }
188 pub async fn get_notifications(
190 &mut self,
191 request: impl tonic::IntoRequest<super::GetNotificationsRequest>,
192 ) -> std::result::Result<
193 tonic::Response<super::GetNotificationsResponse>,
194 tonic::Status,
195 > {
196 self.inner
197 .ready()
198 .await
199 .map_err(|e| {
200 tonic::Status::unknown(
201 format!("Service was not ready: {}", e.into()),
202 )
203 })?;
204 let codec = tonic::codec::ProstCodec::default();
205 let path = http::uri::PathAndQuery::from_static(
206 "/aiscanned.v1.notification.NotificationService/GetNotifications",
207 );
208 let mut req = request.into_request();
209 req.extensions_mut()
210 .insert(
211 GrpcMethod::new(
212 "aiscanned.v1.notification.NotificationService",
213 "GetNotifications",
214 ),
215 );
216 self.inner.unary(req, path, codec).await
217 }
218 }
219}
220pub mod notification_service_server {
222 #![allow(
223 unused_variables,
224 dead_code,
225 missing_docs,
226 clippy::wildcard_imports,
227 clippy::let_unit_value,
228 )]
229 use tonic::codegen::*;
230 #[async_trait]
232 pub trait NotificationService: std::marker::Send + std::marker::Sync + 'static {
233 async fn send_notification(
235 &self,
236 request: tonic::Request<super::SendNotificationRequest>,
237 ) -> std::result::Result<
238 tonic::Response<super::SendNotificationResponse>,
239 tonic::Status,
240 >;
241 async fn get_notifications(
243 &self,
244 request: tonic::Request<super::GetNotificationsRequest>,
245 ) -> std::result::Result<
246 tonic::Response<super::GetNotificationsResponse>,
247 tonic::Status,
248 >;
249 }
250 #[derive(Debug)]
254 pub struct NotificationServiceServer<T> {
255 inner: Arc<T>,
256 accept_compression_encodings: EnabledCompressionEncodings,
257 send_compression_encodings: EnabledCompressionEncodings,
258 max_decoding_message_size: Option<usize>,
259 max_encoding_message_size: Option<usize>,
260 }
261 impl<T> NotificationServiceServer<T> {
262 pub fn new(inner: T) -> Self {
263 Self::from_arc(Arc::new(inner))
264 }
265 pub fn from_arc(inner: Arc<T>) -> Self {
266 Self {
267 inner,
268 accept_compression_encodings: Default::default(),
269 send_compression_encodings: Default::default(),
270 max_decoding_message_size: None,
271 max_encoding_message_size: None,
272 }
273 }
274 pub fn with_interceptor<F>(
275 inner: T,
276 interceptor: F,
277 ) -> InterceptedService<Self, F>
278 where
279 F: tonic::service::Interceptor,
280 {
281 InterceptedService::new(Self::new(inner), interceptor)
282 }
283 #[must_use]
285 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
286 self.accept_compression_encodings.enable(encoding);
287 self
288 }
289 #[must_use]
291 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
292 self.send_compression_encodings.enable(encoding);
293 self
294 }
295 #[must_use]
299 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
300 self.max_decoding_message_size = Some(limit);
301 self
302 }
303 #[must_use]
307 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
308 self.max_encoding_message_size = Some(limit);
309 self
310 }
311 }
312 impl<T, B> tonic::codegen::Service<http::Request<B>> for NotificationServiceServer<T>
313 where
314 T: NotificationService,
315 B: Body + std::marker::Send + 'static,
316 B::Error: Into<StdError> + std::marker::Send + 'static,
317 {
318 type Response = http::Response<tonic::body::Body>;
319 type Error = std::convert::Infallible;
320 type Future = BoxFuture<Self::Response, Self::Error>;
321 fn poll_ready(
322 &mut self,
323 _cx: &mut Context<'_>,
324 ) -> Poll<std::result::Result<(), Self::Error>> {
325 Poll::Ready(Ok(()))
326 }
327 fn call(&mut self, req: http::Request<B>) -> Self::Future {
328 match req.uri().path() {
329 "/aiscanned.v1.notification.NotificationService/SendNotification" => {
330 #[allow(non_camel_case_types)]
331 struct SendNotificationSvc<T: NotificationService>(pub Arc<T>);
332 impl<
333 T: NotificationService,
334 > tonic::server::UnaryService<super::SendNotificationRequest>
335 for SendNotificationSvc<T> {
336 type Response = super::SendNotificationResponse;
337 type Future = BoxFuture<
338 tonic::Response<Self::Response>,
339 tonic::Status,
340 >;
341 fn call(
342 &mut self,
343 request: tonic::Request<super::SendNotificationRequest>,
344 ) -> Self::Future {
345 let inner = Arc::clone(&self.0);
346 let fut = async move {
347 <T as NotificationService>::send_notification(
348 &inner,
349 request,
350 )
351 .await
352 };
353 Box::pin(fut)
354 }
355 }
356 let accept_compression_encodings = self.accept_compression_encodings;
357 let send_compression_encodings = self.send_compression_encodings;
358 let max_decoding_message_size = self.max_decoding_message_size;
359 let max_encoding_message_size = self.max_encoding_message_size;
360 let inner = self.inner.clone();
361 let fut = async move {
362 let method = SendNotificationSvc(inner);
363 let codec = tonic::codec::ProstCodec::default();
364 let mut grpc = tonic::server::Grpc::new(codec)
365 .apply_compression_config(
366 accept_compression_encodings,
367 send_compression_encodings,
368 )
369 .apply_max_message_size_config(
370 max_decoding_message_size,
371 max_encoding_message_size,
372 );
373 let res = grpc.unary(method, req).await;
374 Ok(res)
375 };
376 Box::pin(fut)
377 }
378 "/aiscanned.v1.notification.NotificationService/GetNotifications" => {
379 #[allow(non_camel_case_types)]
380 struct GetNotificationsSvc<T: NotificationService>(pub Arc<T>);
381 impl<
382 T: NotificationService,
383 > tonic::server::UnaryService<super::GetNotificationsRequest>
384 for GetNotificationsSvc<T> {
385 type Response = super::GetNotificationsResponse;
386 type Future = BoxFuture<
387 tonic::Response<Self::Response>,
388 tonic::Status,
389 >;
390 fn call(
391 &mut self,
392 request: tonic::Request<super::GetNotificationsRequest>,
393 ) -> Self::Future {
394 let inner = Arc::clone(&self.0);
395 let fut = async move {
396 <T as NotificationService>::get_notifications(
397 &inner,
398 request,
399 )
400 .await
401 };
402 Box::pin(fut)
403 }
404 }
405 let accept_compression_encodings = self.accept_compression_encodings;
406 let send_compression_encodings = self.send_compression_encodings;
407 let max_decoding_message_size = self.max_decoding_message_size;
408 let max_encoding_message_size = self.max_encoding_message_size;
409 let inner = self.inner.clone();
410 let fut = async move {
411 let method = GetNotificationsSvc(inner);
412 let codec = tonic::codec::ProstCodec::default();
413 let mut grpc = tonic::server::Grpc::new(codec)
414 .apply_compression_config(
415 accept_compression_encodings,
416 send_compression_encodings,
417 )
418 .apply_max_message_size_config(
419 max_decoding_message_size,
420 max_encoding_message_size,
421 );
422 let res = grpc.unary(method, req).await;
423 Ok(res)
424 };
425 Box::pin(fut)
426 }
427 _ => {
428 Box::pin(async move {
429 let mut response = http::Response::new(
430 tonic::body::Body::default(),
431 );
432 let headers = response.headers_mut();
433 headers
434 .insert(
435 tonic::Status::GRPC_STATUS,
436 (tonic::Code::Unimplemented as i32).into(),
437 );
438 headers
439 .insert(
440 http::header::CONTENT_TYPE,
441 tonic::metadata::GRPC_CONTENT_TYPE,
442 );
443 Ok(response)
444 })
445 }
446 }
447 }
448 }
449 impl<T> Clone for NotificationServiceServer<T> {
450 fn clone(&self) -> Self {
451 let inner = self.inner.clone();
452 Self {
453 inner,
454 accept_compression_encodings: self.accept_compression_encodings,
455 send_compression_encodings: self.send_compression_encodings,
456 max_decoding_message_size: self.max_decoding_message_size,
457 max_encoding_message_size: self.max_encoding_message_size,
458 }
459 }
460 }
461 pub const SERVICE_NAME: &str = "aiscanned.v1.notification.NotificationService";
463 impl<T> tonic::server::NamedService for NotificationServiceServer<T> {
464 const NAME: &'static str = SERVICE_NAME;
465 }
466}