1#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct PrivacySetting {
7 #[prost(string, tag = "1")]
8 pub setting_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")]
17 pub consent_type: ::prost::alloc::string::String,
18 #[prost(bool, tag = "5")]
19 pub consent_given: bool,
20 #[prost(message, optional, tag = "6")]
22 pub consent_at: ::core::option::Option<prost_types::Timestamp>,
23 #[prost(message, optional, tag = "7")]
25 pub revoked_at: ::core::option::Option<prost_types::Timestamp>,
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct SetPrivacyRequest {
32 #[prost(message, optional, tag = "1")]
33 pub setting: ::core::option::Option<PrivacySetting>,
34}
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct SetPrivacyResponse {
37 #[prost(message, optional, tag = "1")]
38 pub setting: ::core::option::Option<PrivacySetting>,
39 #[prost(message, optional, tag = "2")]
40 pub error: ::core::option::Option<super::common::Error>,
41}
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct GetPrivacyRequest {
44 #[prost(string, tag = "1")]
45 pub entity_id: ::prost::alloc::string::String,
46 #[prost(string, tag = "2")]
47 pub entity_type: ::prost::alloc::string::String,
48 #[prost(string, tag = "3")]
50 pub consent_type: ::prost::alloc::string::String,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct GetPrivacyResponse {
54 #[prost(message, repeated, tag = "1")]
55 pub settings: ::prost::alloc::vec::Vec<PrivacySetting>,
56 #[prost(message, optional, tag = "2")]
57 pub error: ::core::option::Option<super::common::Error>,
58}
59pub mod privacy_service_client {
61 #![allow(
62 unused_variables,
63 dead_code,
64 missing_docs,
65 clippy::wildcard_imports,
66 clippy::let_unit_value,
67 )]
68 use tonic::codegen::*;
69 use tonic::codegen::http::Uri;
70 #[derive(Debug, Clone)]
74 pub struct PrivacyServiceClient<T> {
75 inner: tonic::client::Grpc<T>,
76 }
77 impl PrivacyServiceClient<tonic::transport::Channel> {
78 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
80 where
81 D: TryInto<tonic::transport::Endpoint>,
82 D::Error: Into<StdError>,
83 {
84 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
85 Ok(Self::new(conn))
86 }
87 }
88 impl<T> PrivacyServiceClient<T>
89 where
90 T: tonic::client::GrpcService<tonic::body::Body>,
91 T::Error: Into<StdError>,
92 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
93 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
94 {
95 pub fn new(inner: T) -> Self {
96 let inner = tonic::client::Grpc::new(inner);
97 Self { inner }
98 }
99 pub fn with_origin(inner: T, origin: Uri) -> Self {
100 let inner = tonic::client::Grpc::with_origin(inner, origin);
101 Self { inner }
102 }
103 pub fn with_interceptor<F>(
104 inner: T,
105 interceptor: F,
106 ) -> PrivacyServiceClient<InterceptedService<T, F>>
107 where
108 F: tonic::service::Interceptor,
109 T::ResponseBody: Default,
110 T: tonic::codegen::Service<
111 http::Request<tonic::body::Body>,
112 Response = http::Response<
113 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
114 >,
115 >,
116 <T as tonic::codegen::Service<
117 http::Request<tonic::body::Body>,
118 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
119 {
120 PrivacyServiceClient::new(InterceptedService::new(inner, interceptor))
121 }
122 #[must_use]
127 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
128 self.inner = self.inner.send_compressed(encoding);
129 self
130 }
131 #[must_use]
133 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
134 self.inner = self.inner.accept_compressed(encoding);
135 self
136 }
137 #[must_use]
141 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
142 self.inner = self.inner.max_decoding_message_size(limit);
143 self
144 }
145 #[must_use]
149 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
150 self.inner = self.inner.max_encoding_message_size(limit);
151 self
152 }
153 pub async fn set_privacy(
155 &mut self,
156 request: impl tonic::IntoRequest<super::SetPrivacyRequest>,
157 ) -> std::result::Result<
158 tonic::Response<super::SetPrivacyResponse>,
159 tonic::Status,
160 > {
161 self.inner
162 .ready()
163 .await
164 .map_err(|e| {
165 tonic::Status::unknown(
166 format!("Service was not ready: {}", e.into()),
167 )
168 })?;
169 let codec = tonic::codec::ProstCodec::default();
170 let path = http::uri::PathAndQuery::from_static(
171 "/aiscanned.v1.privacy.PrivacyService/SetPrivacy",
172 );
173 let mut req = request.into_request();
174 req.extensions_mut()
175 .insert(
176 GrpcMethod::new("aiscanned.v1.privacy.PrivacyService", "SetPrivacy"),
177 );
178 self.inner.unary(req, path, codec).await
179 }
180 pub async fn get_privacy(
182 &mut self,
183 request: impl tonic::IntoRequest<super::GetPrivacyRequest>,
184 ) -> std::result::Result<
185 tonic::Response<super::GetPrivacyResponse>,
186 tonic::Status,
187 > {
188 self.inner
189 .ready()
190 .await
191 .map_err(|e| {
192 tonic::Status::unknown(
193 format!("Service was not ready: {}", e.into()),
194 )
195 })?;
196 let codec = tonic::codec::ProstCodec::default();
197 let path = http::uri::PathAndQuery::from_static(
198 "/aiscanned.v1.privacy.PrivacyService/GetPrivacy",
199 );
200 let mut req = request.into_request();
201 req.extensions_mut()
202 .insert(
203 GrpcMethod::new("aiscanned.v1.privacy.PrivacyService", "GetPrivacy"),
204 );
205 self.inner.unary(req, path, codec).await
206 }
207 }
208}
209pub mod privacy_service_server {
211 #![allow(
212 unused_variables,
213 dead_code,
214 missing_docs,
215 clippy::wildcard_imports,
216 clippy::let_unit_value,
217 )]
218 use tonic::codegen::*;
219 #[async_trait]
221 pub trait PrivacyService: std::marker::Send + std::marker::Sync + 'static {
222 async fn set_privacy(
224 &self,
225 request: tonic::Request<super::SetPrivacyRequest>,
226 ) -> std::result::Result<
227 tonic::Response<super::SetPrivacyResponse>,
228 tonic::Status,
229 >;
230 async fn get_privacy(
232 &self,
233 request: tonic::Request<super::GetPrivacyRequest>,
234 ) -> std::result::Result<
235 tonic::Response<super::GetPrivacyResponse>,
236 tonic::Status,
237 >;
238 }
239 #[derive(Debug)]
243 pub struct PrivacyServiceServer<T> {
244 inner: Arc<T>,
245 accept_compression_encodings: EnabledCompressionEncodings,
246 send_compression_encodings: EnabledCompressionEncodings,
247 max_decoding_message_size: Option<usize>,
248 max_encoding_message_size: Option<usize>,
249 }
250 impl<T> PrivacyServiceServer<T> {
251 pub fn new(inner: T) -> Self {
252 Self::from_arc(Arc::new(inner))
253 }
254 pub fn from_arc(inner: Arc<T>) -> Self {
255 Self {
256 inner,
257 accept_compression_encodings: Default::default(),
258 send_compression_encodings: Default::default(),
259 max_decoding_message_size: None,
260 max_encoding_message_size: None,
261 }
262 }
263 pub fn with_interceptor<F>(
264 inner: T,
265 interceptor: F,
266 ) -> InterceptedService<Self, F>
267 where
268 F: tonic::service::Interceptor,
269 {
270 InterceptedService::new(Self::new(inner), interceptor)
271 }
272 #[must_use]
274 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
275 self.accept_compression_encodings.enable(encoding);
276 self
277 }
278 #[must_use]
280 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
281 self.send_compression_encodings.enable(encoding);
282 self
283 }
284 #[must_use]
288 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
289 self.max_decoding_message_size = Some(limit);
290 self
291 }
292 #[must_use]
296 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
297 self.max_encoding_message_size = Some(limit);
298 self
299 }
300 }
301 impl<T, B> tonic::codegen::Service<http::Request<B>> for PrivacyServiceServer<T>
302 where
303 T: PrivacyService,
304 B: Body + std::marker::Send + 'static,
305 B::Error: Into<StdError> + std::marker::Send + 'static,
306 {
307 type Response = http::Response<tonic::body::Body>;
308 type Error = std::convert::Infallible;
309 type Future = BoxFuture<Self::Response, Self::Error>;
310 fn poll_ready(
311 &mut self,
312 _cx: &mut Context<'_>,
313 ) -> Poll<std::result::Result<(), Self::Error>> {
314 Poll::Ready(Ok(()))
315 }
316 fn call(&mut self, req: http::Request<B>) -> Self::Future {
317 match req.uri().path() {
318 "/aiscanned.v1.privacy.PrivacyService/SetPrivacy" => {
319 #[allow(non_camel_case_types)]
320 struct SetPrivacySvc<T: PrivacyService>(pub Arc<T>);
321 impl<
322 T: PrivacyService,
323 > tonic::server::UnaryService<super::SetPrivacyRequest>
324 for SetPrivacySvc<T> {
325 type Response = super::SetPrivacyResponse;
326 type Future = BoxFuture<
327 tonic::Response<Self::Response>,
328 tonic::Status,
329 >;
330 fn call(
331 &mut self,
332 request: tonic::Request<super::SetPrivacyRequest>,
333 ) -> Self::Future {
334 let inner = Arc::clone(&self.0);
335 let fut = async move {
336 <T as PrivacyService>::set_privacy(&inner, request).await
337 };
338 Box::pin(fut)
339 }
340 }
341 let accept_compression_encodings = self.accept_compression_encodings;
342 let send_compression_encodings = self.send_compression_encodings;
343 let max_decoding_message_size = self.max_decoding_message_size;
344 let max_encoding_message_size = self.max_encoding_message_size;
345 let inner = self.inner.clone();
346 let fut = async move {
347 let method = SetPrivacySvc(inner);
348 let codec = tonic::codec::ProstCodec::default();
349 let mut grpc = tonic::server::Grpc::new(codec)
350 .apply_compression_config(
351 accept_compression_encodings,
352 send_compression_encodings,
353 )
354 .apply_max_message_size_config(
355 max_decoding_message_size,
356 max_encoding_message_size,
357 );
358 let res = grpc.unary(method, req).await;
359 Ok(res)
360 };
361 Box::pin(fut)
362 }
363 "/aiscanned.v1.privacy.PrivacyService/GetPrivacy" => {
364 #[allow(non_camel_case_types)]
365 struct GetPrivacySvc<T: PrivacyService>(pub Arc<T>);
366 impl<
367 T: PrivacyService,
368 > tonic::server::UnaryService<super::GetPrivacyRequest>
369 for GetPrivacySvc<T> {
370 type Response = super::GetPrivacyResponse;
371 type Future = BoxFuture<
372 tonic::Response<Self::Response>,
373 tonic::Status,
374 >;
375 fn call(
376 &mut self,
377 request: tonic::Request<super::GetPrivacyRequest>,
378 ) -> Self::Future {
379 let inner = Arc::clone(&self.0);
380 let fut = async move {
381 <T as PrivacyService>::get_privacy(&inner, request).await
382 };
383 Box::pin(fut)
384 }
385 }
386 let accept_compression_encodings = self.accept_compression_encodings;
387 let send_compression_encodings = self.send_compression_encodings;
388 let max_decoding_message_size = self.max_decoding_message_size;
389 let max_encoding_message_size = self.max_encoding_message_size;
390 let inner = self.inner.clone();
391 let fut = async move {
392 let method = GetPrivacySvc(inner);
393 let codec = tonic::codec::ProstCodec::default();
394 let mut grpc = tonic::server::Grpc::new(codec)
395 .apply_compression_config(
396 accept_compression_encodings,
397 send_compression_encodings,
398 )
399 .apply_max_message_size_config(
400 max_decoding_message_size,
401 max_encoding_message_size,
402 );
403 let res = grpc.unary(method, req).await;
404 Ok(res)
405 };
406 Box::pin(fut)
407 }
408 _ => {
409 Box::pin(async move {
410 let mut response = http::Response::new(
411 tonic::body::Body::default(),
412 );
413 let headers = response.headers_mut();
414 headers
415 .insert(
416 tonic::Status::GRPC_STATUS,
417 (tonic::Code::Unimplemented as i32).into(),
418 );
419 headers
420 .insert(
421 http::header::CONTENT_TYPE,
422 tonic::metadata::GRPC_CONTENT_TYPE,
423 );
424 Ok(response)
425 })
426 }
427 }
428 }
429 }
430 impl<T> Clone for PrivacyServiceServer<T> {
431 fn clone(&self) -> Self {
432 let inner = self.inner.clone();
433 Self {
434 inner,
435 accept_compression_encodings: self.accept_compression_encodings,
436 send_compression_encodings: self.send_compression_encodings,
437 max_decoding_message_size: self.max_decoding_message_size,
438 max_encoding_message_size: self.max_encoding_message_size,
439 }
440 }
441 }
442 pub const SERVICE_NAME: &str = "aiscanned.v1.privacy.PrivacyService";
444 impl<T> tonic::server::NamedService for PrivacyServiceServer<T> {
445 const NAME: &'static str = SERVICE_NAME;
446 }
447}