aiscanned_proto_rust/generated/
aiscanned.v1.profile.rs

1// This file is @generated by prost-build.
2/// -----------------------
3/// Profile entity
4/// -----------------------
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct Profile {
7    /// Unique profile identifier
8    #[prost(string, tag = "1")]
9    pub profile_id: ::prost::alloc::string::String,
10    #[prost(message, optional, tag = "2")]
11    pub metadata: ::core::option::Option<super::common::Metadata>,
12    #[prost(string, tag = "3")]
13    pub full_name: ::prost::alloc::string::String,
14    #[prost(enumeration = "super::common::Gender", tag = "4")]
15    pub gender: i32,
16    #[prost(int32, tag = "5")]
17    pub age: i32,
18    #[prost(string, tag = "6")]
19    pub email: ::prost::alloc::string::String,
20    #[prost(string, tag = "7")]
21    pub phone: ::prost::alloc::string::String,
22    #[prost(message, optional, tag = "8")]
23    pub location: ::core::option::Option<super::common::Address>,
24    /// e.g., sports, music
25    #[prost(string, repeated, tag = "9")]
26    pub interests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
27    #[prost(enumeration = "super::common::Status", tag = "10")]
28    pub status: i32,
29    #[prost(message, repeated, tag = "11")]
30    pub tags: ::prost::alloc::vec::Vec<super::common::Tag>,
31}
32/// -----------------------
33/// Requests and Responses
34/// -----------------------
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct CreateProfileRequest {
37    #[prost(message, optional, tag = "1")]
38    pub profile: ::core::option::Option<Profile>,
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct CreateProfileResponse {
42    #[prost(message, optional, tag = "1")]
43    pub profile: ::core::option::Option<Profile>,
44    #[prost(message, optional, tag = "2")]
45    pub error: ::core::option::Option<super::common::Error>,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct GetProfileRequest {
49    #[prost(string, tag = "1")]
50    pub profile_id: ::prost::alloc::string::String,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct GetProfileResponse {
54    #[prost(message, optional, tag = "1")]
55    pub profile: ::core::option::Option<Profile>,
56    #[prost(message, optional, tag = "2")]
57    pub error: ::core::option::Option<super::common::Error>,
58}
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct ListProfilesRequest {
61    #[prost(message, optional, tag = "1")]
62    pub pagination: ::core::option::Option<super::common::PaginationRequest>,
63    #[prost(enumeration = "super::common::Gender", tag = "2")]
64    pub gender_filter: i32,
65    #[prost(enumeration = "super::common::Status", tag = "3")]
66    pub status_filter: i32,
67}
68#[derive(Clone, PartialEq, ::prost::Message)]
69pub struct ListProfilesResponse {
70    #[prost(message, repeated, tag = "1")]
71    pub profiles: ::prost::alloc::vec::Vec<Profile>,
72    #[prost(message, optional, tag = "2")]
73    pub pagination: ::core::option::Option<super::common::PaginationResponse>,
74    #[prost(message, optional, tag = "3")]
75    pub error: ::core::option::Option<super::common::Error>,
76}
77/// Generated client implementations.
78pub mod profile_service_client {
79    #![allow(
80        unused_variables,
81        dead_code,
82        missing_docs,
83        clippy::wildcard_imports,
84        clippy::let_unit_value,
85    )]
86    use tonic::codegen::*;
87    use tonic::codegen::http::Uri;
88    /// -----------------------
89    /// Profile Service
90    /// -----------------------
91    #[derive(Debug, Clone)]
92    pub struct ProfileServiceClient<T> {
93        inner: tonic::client::Grpc<T>,
94    }
95    impl ProfileServiceClient<tonic::transport::Channel> {
96        /// Attempt to create a new client by connecting to a given endpoint.
97        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
98        where
99            D: TryInto<tonic::transport::Endpoint>,
100            D::Error: Into<StdError>,
101        {
102            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
103            Ok(Self::new(conn))
104        }
105    }
106    impl<T> ProfileServiceClient<T>
107    where
108        T: tonic::client::GrpcService<tonic::body::Body>,
109        T::Error: Into<StdError>,
110        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
111        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
112    {
113        pub fn new(inner: T) -> Self {
114            let inner = tonic::client::Grpc::new(inner);
115            Self { inner }
116        }
117        pub fn with_origin(inner: T, origin: Uri) -> Self {
118            let inner = tonic::client::Grpc::with_origin(inner, origin);
119            Self { inner }
120        }
121        pub fn with_interceptor<F>(
122            inner: T,
123            interceptor: F,
124        ) -> ProfileServiceClient<InterceptedService<T, F>>
125        where
126            F: tonic::service::Interceptor,
127            T::ResponseBody: Default,
128            T: tonic::codegen::Service<
129                http::Request<tonic::body::Body>,
130                Response = http::Response<
131                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
132                >,
133            >,
134            <T as tonic::codegen::Service<
135                http::Request<tonic::body::Body>,
136            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
137        {
138            ProfileServiceClient::new(InterceptedService::new(inner, interceptor))
139        }
140        /// Compress requests with the given encoding.
141        ///
142        /// This requires the server to support it otherwise it might respond with an
143        /// error.
144        #[must_use]
145        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
146            self.inner = self.inner.send_compressed(encoding);
147            self
148        }
149        /// Enable decompressing responses.
150        #[must_use]
151        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
152            self.inner = self.inner.accept_compressed(encoding);
153            self
154        }
155        /// Limits the maximum size of a decoded message.
156        ///
157        /// Default: `4MB`
158        #[must_use]
159        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
160            self.inner = self.inner.max_decoding_message_size(limit);
161            self
162        }
163        /// Limits the maximum size of an encoded message.
164        ///
165        /// Default: `usize::MAX`
166        #[must_use]
167        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
168            self.inner = self.inner.max_encoding_message_size(limit);
169            self
170        }
171        pub async fn create_profile(
172            &mut self,
173            request: impl tonic::IntoRequest<super::CreateProfileRequest>,
174        ) -> std::result::Result<
175            tonic::Response<super::CreateProfileResponse>,
176            tonic::Status,
177        > {
178            self.inner
179                .ready()
180                .await
181                .map_err(|e| {
182                    tonic::Status::unknown(
183                        format!("Service was not ready: {}", e.into()),
184                    )
185                })?;
186            let codec = tonic::codec::ProstCodec::default();
187            let path = http::uri::PathAndQuery::from_static(
188                "/aiscanned.v1.profile.ProfileService/CreateProfile",
189            );
190            let mut req = request.into_request();
191            req.extensions_mut()
192                .insert(
193                    GrpcMethod::new(
194                        "aiscanned.v1.profile.ProfileService",
195                        "CreateProfile",
196                    ),
197                );
198            self.inner.unary(req, path, codec).await
199        }
200        pub async fn get_profile(
201            &mut self,
202            request: impl tonic::IntoRequest<super::GetProfileRequest>,
203        ) -> std::result::Result<
204            tonic::Response<super::GetProfileResponse>,
205            tonic::Status,
206        > {
207            self.inner
208                .ready()
209                .await
210                .map_err(|e| {
211                    tonic::Status::unknown(
212                        format!("Service was not ready: {}", e.into()),
213                    )
214                })?;
215            let codec = tonic::codec::ProstCodec::default();
216            let path = http::uri::PathAndQuery::from_static(
217                "/aiscanned.v1.profile.ProfileService/GetProfile",
218            );
219            let mut req = request.into_request();
220            req.extensions_mut()
221                .insert(
222                    GrpcMethod::new("aiscanned.v1.profile.ProfileService", "GetProfile"),
223                );
224            self.inner.unary(req, path, codec).await
225        }
226        pub async fn list_profiles(
227            &mut self,
228            request: impl tonic::IntoRequest<super::ListProfilesRequest>,
229        ) -> std::result::Result<
230            tonic::Response<super::ListProfilesResponse>,
231            tonic::Status,
232        > {
233            self.inner
234                .ready()
235                .await
236                .map_err(|e| {
237                    tonic::Status::unknown(
238                        format!("Service was not ready: {}", e.into()),
239                    )
240                })?;
241            let codec = tonic::codec::ProstCodec::default();
242            let path = http::uri::PathAndQuery::from_static(
243                "/aiscanned.v1.profile.ProfileService/ListProfiles",
244            );
245            let mut req = request.into_request();
246            req.extensions_mut()
247                .insert(
248                    GrpcMethod::new(
249                        "aiscanned.v1.profile.ProfileService",
250                        "ListProfiles",
251                    ),
252                );
253            self.inner.unary(req, path, codec).await
254        }
255    }
256}
257/// Generated server implementations.
258pub mod profile_service_server {
259    #![allow(
260        unused_variables,
261        dead_code,
262        missing_docs,
263        clippy::wildcard_imports,
264        clippy::let_unit_value,
265    )]
266    use tonic::codegen::*;
267    /// Generated trait containing gRPC methods that should be implemented for use with ProfileServiceServer.
268    #[async_trait]
269    pub trait ProfileService: std::marker::Send + std::marker::Sync + 'static {
270        async fn create_profile(
271            &self,
272            request: tonic::Request<super::CreateProfileRequest>,
273        ) -> std::result::Result<
274            tonic::Response<super::CreateProfileResponse>,
275            tonic::Status,
276        >;
277        async fn get_profile(
278            &self,
279            request: tonic::Request<super::GetProfileRequest>,
280        ) -> std::result::Result<
281            tonic::Response<super::GetProfileResponse>,
282            tonic::Status,
283        >;
284        async fn list_profiles(
285            &self,
286            request: tonic::Request<super::ListProfilesRequest>,
287        ) -> std::result::Result<
288            tonic::Response<super::ListProfilesResponse>,
289            tonic::Status,
290        >;
291    }
292    /// -----------------------
293    /// Profile Service
294    /// -----------------------
295    #[derive(Debug)]
296    pub struct ProfileServiceServer<T> {
297        inner: Arc<T>,
298        accept_compression_encodings: EnabledCompressionEncodings,
299        send_compression_encodings: EnabledCompressionEncodings,
300        max_decoding_message_size: Option<usize>,
301        max_encoding_message_size: Option<usize>,
302    }
303    impl<T> ProfileServiceServer<T> {
304        pub fn new(inner: T) -> Self {
305            Self::from_arc(Arc::new(inner))
306        }
307        pub fn from_arc(inner: Arc<T>) -> Self {
308            Self {
309                inner,
310                accept_compression_encodings: Default::default(),
311                send_compression_encodings: Default::default(),
312                max_decoding_message_size: None,
313                max_encoding_message_size: None,
314            }
315        }
316        pub fn with_interceptor<F>(
317            inner: T,
318            interceptor: F,
319        ) -> InterceptedService<Self, F>
320        where
321            F: tonic::service::Interceptor,
322        {
323            InterceptedService::new(Self::new(inner), interceptor)
324        }
325        /// Enable decompressing requests with the given encoding.
326        #[must_use]
327        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
328            self.accept_compression_encodings.enable(encoding);
329            self
330        }
331        /// Compress responses with the given encoding, if the client supports it.
332        #[must_use]
333        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
334            self.send_compression_encodings.enable(encoding);
335            self
336        }
337        /// Limits the maximum size of a decoded message.
338        ///
339        /// Default: `4MB`
340        #[must_use]
341        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
342            self.max_decoding_message_size = Some(limit);
343            self
344        }
345        /// Limits the maximum size of an encoded message.
346        ///
347        /// Default: `usize::MAX`
348        #[must_use]
349        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
350            self.max_encoding_message_size = Some(limit);
351            self
352        }
353    }
354    impl<T, B> tonic::codegen::Service<http::Request<B>> for ProfileServiceServer<T>
355    where
356        T: ProfileService,
357        B: Body + std::marker::Send + 'static,
358        B::Error: Into<StdError> + std::marker::Send + 'static,
359    {
360        type Response = http::Response<tonic::body::Body>;
361        type Error = std::convert::Infallible;
362        type Future = BoxFuture<Self::Response, Self::Error>;
363        fn poll_ready(
364            &mut self,
365            _cx: &mut Context<'_>,
366        ) -> Poll<std::result::Result<(), Self::Error>> {
367            Poll::Ready(Ok(()))
368        }
369        fn call(&mut self, req: http::Request<B>) -> Self::Future {
370            match req.uri().path() {
371                "/aiscanned.v1.profile.ProfileService/CreateProfile" => {
372                    #[allow(non_camel_case_types)]
373                    struct CreateProfileSvc<T: ProfileService>(pub Arc<T>);
374                    impl<
375                        T: ProfileService,
376                    > tonic::server::UnaryService<super::CreateProfileRequest>
377                    for CreateProfileSvc<T> {
378                        type Response = super::CreateProfileResponse;
379                        type Future = BoxFuture<
380                            tonic::Response<Self::Response>,
381                            tonic::Status,
382                        >;
383                        fn call(
384                            &mut self,
385                            request: tonic::Request<super::CreateProfileRequest>,
386                        ) -> Self::Future {
387                            let inner = Arc::clone(&self.0);
388                            let fut = async move {
389                                <T as ProfileService>::create_profile(&inner, request).await
390                            };
391                            Box::pin(fut)
392                        }
393                    }
394                    let accept_compression_encodings = self.accept_compression_encodings;
395                    let send_compression_encodings = self.send_compression_encodings;
396                    let max_decoding_message_size = self.max_decoding_message_size;
397                    let max_encoding_message_size = self.max_encoding_message_size;
398                    let inner = self.inner.clone();
399                    let fut = async move {
400                        let method = CreateProfileSvc(inner);
401                        let codec = tonic::codec::ProstCodec::default();
402                        let mut grpc = tonic::server::Grpc::new(codec)
403                            .apply_compression_config(
404                                accept_compression_encodings,
405                                send_compression_encodings,
406                            )
407                            .apply_max_message_size_config(
408                                max_decoding_message_size,
409                                max_encoding_message_size,
410                            );
411                        let res = grpc.unary(method, req).await;
412                        Ok(res)
413                    };
414                    Box::pin(fut)
415                }
416                "/aiscanned.v1.profile.ProfileService/GetProfile" => {
417                    #[allow(non_camel_case_types)]
418                    struct GetProfileSvc<T: ProfileService>(pub Arc<T>);
419                    impl<
420                        T: ProfileService,
421                    > tonic::server::UnaryService<super::GetProfileRequest>
422                    for GetProfileSvc<T> {
423                        type Response = super::GetProfileResponse;
424                        type Future = BoxFuture<
425                            tonic::Response<Self::Response>,
426                            tonic::Status,
427                        >;
428                        fn call(
429                            &mut self,
430                            request: tonic::Request<super::GetProfileRequest>,
431                        ) -> Self::Future {
432                            let inner = Arc::clone(&self.0);
433                            let fut = async move {
434                                <T as ProfileService>::get_profile(&inner, request).await
435                            };
436                            Box::pin(fut)
437                        }
438                    }
439                    let accept_compression_encodings = self.accept_compression_encodings;
440                    let send_compression_encodings = self.send_compression_encodings;
441                    let max_decoding_message_size = self.max_decoding_message_size;
442                    let max_encoding_message_size = self.max_encoding_message_size;
443                    let inner = self.inner.clone();
444                    let fut = async move {
445                        let method = GetProfileSvc(inner);
446                        let codec = tonic::codec::ProstCodec::default();
447                        let mut grpc = tonic::server::Grpc::new(codec)
448                            .apply_compression_config(
449                                accept_compression_encodings,
450                                send_compression_encodings,
451                            )
452                            .apply_max_message_size_config(
453                                max_decoding_message_size,
454                                max_encoding_message_size,
455                            );
456                        let res = grpc.unary(method, req).await;
457                        Ok(res)
458                    };
459                    Box::pin(fut)
460                }
461                "/aiscanned.v1.profile.ProfileService/ListProfiles" => {
462                    #[allow(non_camel_case_types)]
463                    struct ListProfilesSvc<T: ProfileService>(pub Arc<T>);
464                    impl<
465                        T: ProfileService,
466                    > tonic::server::UnaryService<super::ListProfilesRequest>
467                    for ListProfilesSvc<T> {
468                        type Response = super::ListProfilesResponse;
469                        type Future = BoxFuture<
470                            tonic::Response<Self::Response>,
471                            tonic::Status,
472                        >;
473                        fn call(
474                            &mut self,
475                            request: tonic::Request<super::ListProfilesRequest>,
476                        ) -> Self::Future {
477                            let inner = Arc::clone(&self.0);
478                            let fut = async move {
479                                <T as ProfileService>::list_profiles(&inner, request).await
480                            };
481                            Box::pin(fut)
482                        }
483                    }
484                    let accept_compression_encodings = self.accept_compression_encodings;
485                    let send_compression_encodings = self.send_compression_encodings;
486                    let max_decoding_message_size = self.max_decoding_message_size;
487                    let max_encoding_message_size = self.max_encoding_message_size;
488                    let inner = self.inner.clone();
489                    let fut = async move {
490                        let method = ListProfilesSvc(inner);
491                        let codec = tonic::codec::ProstCodec::default();
492                        let mut grpc = tonic::server::Grpc::new(codec)
493                            .apply_compression_config(
494                                accept_compression_encodings,
495                                send_compression_encodings,
496                            )
497                            .apply_max_message_size_config(
498                                max_decoding_message_size,
499                                max_encoding_message_size,
500                            );
501                        let res = grpc.unary(method, req).await;
502                        Ok(res)
503                    };
504                    Box::pin(fut)
505                }
506                _ => {
507                    Box::pin(async move {
508                        let mut response = http::Response::new(
509                            tonic::body::Body::default(),
510                        );
511                        let headers = response.headers_mut();
512                        headers
513                            .insert(
514                                tonic::Status::GRPC_STATUS,
515                                (tonic::Code::Unimplemented as i32).into(),
516                            );
517                        headers
518                            .insert(
519                                http::header::CONTENT_TYPE,
520                                tonic::metadata::GRPC_CONTENT_TYPE,
521                            );
522                        Ok(response)
523                    })
524                }
525            }
526        }
527    }
528    impl<T> Clone for ProfileServiceServer<T> {
529        fn clone(&self) -> Self {
530            let inner = self.inner.clone();
531            Self {
532                inner,
533                accept_compression_encodings: self.accept_compression_encodings,
534                send_compression_encodings: self.send_compression_encodings,
535                max_decoding_message_size: self.max_decoding_message_size,
536                max_encoding_message_size: self.max_encoding_message_size,
537            }
538        }
539    }
540    /// Generated gRPC service name
541    pub const SERVICE_NAME: &str = "aiscanned.v1.profile.ProfileService";
542    impl<T> tonic::server::NamedService for ProfileServiceServer<T> {
543        const NAME: &'static str = SERVICE_NAME;
544    }
545}
546/// -----------------------
547/// Match result for profiles
548/// -----------------------
549#[derive(Clone, PartialEq, ::prost::Message)]
550pub struct ProfileMatchResult {
551    #[prost(string, tag = "1")]
552    pub profile_id_a: ::prost::alloc::string::String,
553    #[prost(string, tag = "2")]
554    pub profile_id_b: ::prost::alloc::string::String,
555    /// Matching score 0.0 - 1.0
556    #[prost(double, tag = "3")]
557    pub score: f64,
558    #[prost(string, repeated, tag = "4")]
559    pub matched_interests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
560    #[prost(string, repeated, tag = "5")]
561    pub missing_interests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
562}
563/// -----------------------
564/// Requests and Responses
565/// -----------------------
566#[derive(Clone, PartialEq, ::prost::Message)]
567pub struct MatchProfilesRequest {
568    /// Profile to match others against
569    #[prost(string, tag = "1")]
570    pub profile_id: ::prost::alloc::string::String,
571    /// Optional list of profiles to consider
572    #[prost(string, repeated, tag = "2")]
573    pub candidate_profile_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
574}
575#[derive(Clone, PartialEq, ::prost::Message)]
576pub struct MatchProfilesResponse {
577    #[prost(message, repeated, tag = "1")]
578    pub results: ::prost::alloc::vec::Vec<ProfileMatchResult>,
579    #[prost(message, optional, tag = "2")]
580    pub error: ::core::option::Option<super::common::Error>,
581}
582/// Generated client implementations.
583pub mod profile_matching_service_client {
584    #![allow(
585        unused_variables,
586        dead_code,
587        missing_docs,
588        clippy::wildcard_imports,
589        clippy::let_unit_value,
590    )]
591    use tonic::codegen::*;
592    use tonic::codegen::http::Uri;
593    /// -----------------------
594    /// Matching Service
595    /// -----------------------
596    #[derive(Debug, Clone)]
597    pub struct ProfileMatchingServiceClient<T> {
598        inner: tonic::client::Grpc<T>,
599    }
600    impl ProfileMatchingServiceClient<tonic::transport::Channel> {
601        /// Attempt to create a new client by connecting to a given endpoint.
602        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
603        where
604            D: TryInto<tonic::transport::Endpoint>,
605            D::Error: Into<StdError>,
606        {
607            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
608            Ok(Self::new(conn))
609        }
610    }
611    impl<T> ProfileMatchingServiceClient<T>
612    where
613        T: tonic::client::GrpcService<tonic::body::Body>,
614        T::Error: Into<StdError>,
615        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
616        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
617    {
618        pub fn new(inner: T) -> Self {
619            let inner = tonic::client::Grpc::new(inner);
620            Self { inner }
621        }
622        pub fn with_origin(inner: T, origin: Uri) -> Self {
623            let inner = tonic::client::Grpc::with_origin(inner, origin);
624            Self { inner }
625        }
626        pub fn with_interceptor<F>(
627            inner: T,
628            interceptor: F,
629        ) -> ProfileMatchingServiceClient<InterceptedService<T, F>>
630        where
631            F: tonic::service::Interceptor,
632            T::ResponseBody: Default,
633            T: tonic::codegen::Service<
634                http::Request<tonic::body::Body>,
635                Response = http::Response<
636                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
637                >,
638            >,
639            <T as tonic::codegen::Service<
640                http::Request<tonic::body::Body>,
641            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
642        {
643            ProfileMatchingServiceClient::new(
644                InterceptedService::new(inner, interceptor),
645            )
646        }
647        /// Compress requests with the given encoding.
648        ///
649        /// This requires the server to support it otherwise it might respond with an
650        /// error.
651        #[must_use]
652        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
653            self.inner = self.inner.send_compressed(encoding);
654            self
655        }
656        /// Enable decompressing responses.
657        #[must_use]
658        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
659            self.inner = self.inner.accept_compressed(encoding);
660            self
661        }
662        /// Limits the maximum size of a decoded message.
663        ///
664        /// Default: `4MB`
665        #[must_use]
666        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
667            self.inner = self.inner.max_decoding_message_size(limit);
668            self
669        }
670        /// Limits the maximum size of an encoded message.
671        ///
672        /// Default: `usize::MAX`
673        #[must_use]
674        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
675            self.inner = self.inner.max_encoding_message_size(limit);
676            self
677        }
678        pub async fn match_profiles(
679            &mut self,
680            request: impl tonic::IntoRequest<super::MatchProfilesRequest>,
681        ) -> std::result::Result<
682            tonic::Response<super::MatchProfilesResponse>,
683            tonic::Status,
684        > {
685            self.inner
686                .ready()
687                .await
688                .map_err(|e| {
689                    tonic::Status::unknown(
690                        format!("Service was not ready: {}", e.into()),
691                    )
692                })?;
693            let codec = tonic::codec::ProstCodec::default();
694            let path = http::uri::PathAndQuery::from_static(
695                "/aiscanned.v1.profile.ProfileMatchingService/MatchProfiles",
696            );
697            let mut req = request.into_request();
698            req.extensions_mut()
699                .insert(
700                    GrpcMethod::new(
701                        "aiscanned.v1.profile.ProfileMatchingService",
702                        "MatchProfiles",
703                    ),
704                );
705            self.inner.unary(req, path, codec).await
706        }
707    }
708}
709/// Generated server implementations.
710pub mod profile_matching_service_server {
711    #![allow(
712        unused_variables,
713        dead_code,
714        missing_docs,
715        clippy::wildcard_imports,
716        clippy::let_unit_value,
717    )]
718    use tonic::codegen::*;
719    /// Generated trait containing gRPC methods that should be implemented for use with ProfileMatchingServiceServer.
720    #[async_trait]
721    pub trait ProfileMatchingService: std::marker::Send + std::marker::Sync + 'static {
722        async fn match_profiles(
723            &self,
724            request: tonic::Request<super::MatchProfilesRequest>,
725        ) -> std::result::Result<
726            tonic::Response<super::MatchProfilesResponse>,
727            tonic::Status,
728        >;
729    }
730    /// -----------------------
731    /// Matching Service
732    /// -----------------------
733    #[derive(Debug)]
734    pub struct ProfileMatchingServiceServer<T> {
735        inner: Arc<T>,
736        accept_compression_encodings: EnabledCompressionEncodings,
737        send_compression_encodings: EnabledCompressionEncodings,
738        max_decoding_message_size: Option<usize>,
739        max_encoding_message_size: Option<usize>,
740    }
741    impl<T> ProfileMatchingServiceServer<T> {
742        pub fn new(inner: T) -> Self {
743            Self::from_arc(Arc::new(inner))
744        }
745        pub fn from_arc(inner: Arc<T>) -> Self {
746            Self {
747                inner,
748                accept_compression_encodings: Default::default(),
749                send_compression_encodings: Default::default(),
750                max_decoding_message_size: None,
751                max_encoding_message_size: None,
752            }
753        }
754        pub fn with_interceptor<F>(
755            inner: T,
756            interceptor: F,
757        ) -> InterceptedService<Self, F>
758        where
759            F: tonic::service::Interceptor,
760        {
761            InterceptedService::new(Self::new(inner), interceptor)
762        }
763        /// Enable decompressing requests with the given encoding.
764        #[must_use]
765        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
766            self.accept_compression_encodings.enable(encoding);
767            self
768        }
769        /// Compress responses with the given encoding, if the client supports it.
770        #[must_use]
771        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
772            self.send_compression_encodings.enable(encoding);
773            self
774        }
775        /// Limits the maximum size of a decoded message.
776        ///
777        /// Default: `4MB`
778        #[must_use]
779        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
780            self.max_decoding_message_size = Some(limit);
781            self
782        }
783        /// Limits the maximum size of an encoded message.
784        ///
785        /// Default: `usize::MAX`
786        #[must_use]
787        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
788            self.max_encoding_message_size = Some(limit);
789            self
790        }
791    }
792    impl<T, B> tonic::codegen::Service<http::Request<B>>
793    for ProfileMatchingServiceServer<T>
794    where
795        T: ProfileMatchingService,
796        B: Body + std::marker::Send + 'static,
797        B::Error: Into<StdError> + std::marker::Send + 'static,
798    {
799        type Response = http::Response<tonic::body::Body>;
800        type Error = std::convert::Infallible;
801        type Future = BoxFuture<Self::Response, Self::Error>;
802        fn poll_ready(
803            &mut self,
804            _cx: &mut Context<'_>,
805        ) -> Poll<std::result::Result<(), Self::Error>> {
806            Poll::Ready(Ok(()))
807        }
808        fn call(&mut self, req: http::Request<B>) -> Self::Future {
809            match req.uri().path() {
810                "/aiscanned.v1.profile.ProfileMatchingService/MatchProfiles" => {
811                    #[allow(non_camel_case_types)]
812                    struct MatchProfilesSvc<T: ProfileMatchingService>(pub Arc<T>);
813                    impl<
814                        T: ProfileMatchingService,
815                    > tonic::server::UnaryService<super::MatchProfilesRequest>
816                    for MatchProfilesSvc<T> {
817                        type Response = super::MatchProfilesResponse;
818                        type Future = BoxFuture<
819                            tonic::Response<Self::Response>,
820                            tonic::Status,
821                        >;
822                        fn call(
823                            &mut self,
824                            request: tonic::Request<super::MatchProfilesRequest>,
825                        ) -> Self::Future {
826                            let inner = Arc::clone(&self.0);
827                            let fut = async move {
828                                <T as ProfileMatchingService>::match_profiles(
829                                        &inner,
830                                        request,
831                                    )
832                                    .await
833                            };
834                            Box::pin(fut)
835                        }
836                    }
837                    let accept_compression_encodings = self.accept_compression_encodings;
838                    let send_compression_encodings = self.send_compression_encodings;
839                    let max_decoding_message_size = self.max_decoding_message_size;
840                    let max_encoding_message_size = self.max_encoding_message_size;
841                    let inner = self.inner.clone();
842                    let fut = async move {
843                        let method = MatchProfilesSvc(inner);
844                        let codec = tonic::codec::ProstCodec::default();
845                        let mut grpc = tonic::server::Grpc::new(codec)
846                            .apply_compression_config(
847                                accept_compression_encodings,
848                                send_compression_encodings,
849                            )
850                            .apply_max_message_size_config(
851                                max_decoding_message_size,
852                                max_encoding_message_size,
853                            );
854                        let res = grpc.unary(method, req).await;
855                        Ok(res)
856                    };
857                    Box::pin(fut)
858                }
859                _ => {
860                    Box::pin(async move {
861                        let mut response = http::Response::new(
862                            tonic::body::Body::default(),
863                        );
864                        let headers = response.headers_mut();
865                        headers
866                            .insert(
867                                tonic::Status::GRPC_STATUS,
868                                (tonic::Code::Unimplemented as i32).into(),
869                            );
870                        headers
871                            .insert(
872                                http::header::CONTENT_TYPE,
873                                tonic::metadata::GRPC_CONTENT_TYPE,
874                            );
875                        Ok(response)
876                    })
877                }
878            }
879        }
880    }
881    impl<T> Clone for ProfileMatchingServiceServer<T> {
882        fn clone(&self) -> Self {
883            let inner = self.inner.clone();
884            Self {
885                inner,
886                accept_compression_encodings: self.accept_compression_encodings,
887                send_compression_encodings: self.send_compression_encodings,
888                max_decoding_message_size: self.max_decoding_message_size,
889                max_encoding_message_size: self.max_encoding_message_size,
890            }
891        }
892    }
893    /// Generated gRPC service name
894    pub const SERVICE_NAME: &str = "aiscanned.v1.profile.ProfileMatchingService";
895    impl<T> tonic::server::NamedService for ProfileMatchingServiceServer<T> {
896        const NAME: &'static str = SERVICE_NAME;
897    }
898}