Skip to main content

megacommerce_proto/
user.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct SupplierCreateRequest {
4    #[prost(string, tag = "1")]
5    pub username: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub email: ::prost::alloc::string::String,
8    #[prost(string, tag = "3")]
9    pub first_name: ::prost::alloc::string::String,
10    #[prost(string, tag = "4")]
11    pub last_name: ::prost::alloc::string::String,
12    #[prost(string, tag = "5")]
13    pub password: ::prost::alloc::string::String,
14    #[prost(string, tag = "6")]
15    pub membership: ::prost::alloc::string::String,
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct SupplierCreateResponse {
19    #[prost(oneof = "supplier_create_response::Response", tags = "1, 2")]
20    pub response: ::core::option::Option<supplier_create_response::Response>,
21}
22/// Nested message and enum types in `SupplierCreateResponse`.
23pub mod supplier_create_response {
24    #[derive(Clone, PartialEq, ::prost::Oneof)]
25    pub enum Response {
26        #[prost(message, tag = "1")]
27        Data(()),
28        #[prost(message, tag = "2")]
29        Error(super::super::super::shared::v1::AppError),
30    }
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct User {
34    #[prost(string, optional, tag = "1")]
35    pub id: ::core::option::Option<::prost::alloc::string::String>,
36    #[prost(string, optional, tag = "2")]
37    pub username: ::core::option::Option<::prost::alloc::string::String>,
38    #[prost(string, optional, tag = "3")]
39    pub first_name: ::core::option::Option<::prost::alloc::string::String>,
40    #[prost(string, optional, tag = "4")]
41    pub last_name: ::core::option::Option<::prost::alloc::string::String>,
42    #[prost(string, optional, tag = "5")]
43    pub email: ::core::option::Option<::prost::alloc::string::String>,
44    #[prost(string, optional, tag = "6")]
45    pub user_type: ::core::option::Option<::prost::alloc::string::String>,
46    #[prost(string, optional, tag = "7")]
47    pub membership: ::core::option::Option<::prost::alloc::string::String>,
48    #[prost(bool, optional, tag = "8")]
49    pub is_email_verified: ::core::option::Option<bool>,
50    #[prost(string, optional, tag = "9")]
51    pub password: ::core::option::Option<::prost::alloc::string::String>,
52    #[prost(string, optional, tag = "10")]
53    pub auth_data: ::core::option::Option<::prost::alloc::string::String>,
54    #[prost(string, optional, tag = "11")]
55    pub auth_service: ::core::option::Option<::prost::alloc::string::String>,
56    #[prost(string, optional, tag = "12")]
57    pub roles: ::core::option::Option<::prost::alloc::string::String>,
58    #[prost(map = "string, string", tag = "13")]
59    pub props: ::std::collections::HashMap<
60        ::prost::alloc::string::String,
61        ::prost::alloc::string::String,
62    >,
63    #[prost(map = "string, string", tag = "14")]
64    pub notify_props: ::std::collections::HashMap<
65        ::prost::alloc::string::String,
66        ::prost::alloc::string::String,
67    >,
68    #[prost(int64, optional, tag = "15")]
69    pub last_password_update: ::core::option::Option<i64>,
70    #[prost(int64, optional, tag = "16")]
71    pub last_picture_update: ::core::option::Option<i64>,
72    #[prost(int32, optional, tag = "17")]
73    pub failed_attempts: ::core::option::Option<i32>,
74    #[prost(string, optional, tag = "18")]
75    pub locale: ::core::option::Option<::prost::alloc::string::String>,
76    #[prost(bool, optional, tag = "19")]
77    pub mfa_active: ::core::option::Option<bool>,
78    #[prost(string, optional, tag = "20")]
79    pub mfa_secret: ::core::option::Option<::prost::alloc::string::String>,
80    #[prost(int64, optional, tag = "21")]
81    pub last_activity_at: ::core::option::Option<i64>,
82    #[prost(int64, optional, tag = "22")]
83    pub last_login: ::core::option::Option<i64>,
84    #[prost(int64, optional, tag = "23")]
85    pub created_at: ::core::option::Option<i64>,
86    #[prost(int64, optional, tag = "24")]
87    pub updated_at: ::core::option::Option<i64>,
88    #[prost(int64, optional, tag = "25")]
89    pub deleted_at: ::core::option::Option<i64>,
90}
91/// Generated client implementations.
92pub mod user_service_client {
93    #![allow(
94        unused_variables,
95        dead_code,
96        missing_docs,
97        clippy::wildcard_imports,
98        clippy::let_unit_value,
99    )]
100    use tonic::codegen::*;
101    use tonic::codegen::http::Uri;
102    #[derive(Debug, Clone)]
103    pub struct UserServiceClient<T> {
104        inner: tonic::client::Grpc<T>,
105    }
106    impl UserServiceClient<tonic::transport::Channel> {
107        /// Attempt to create a new client by connecting to a given endpoint.
108        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
109        where
110            D: TryInto<tonic::transport::Endpoint>,
111            D::Error: Into<StdError>,
112        {
113            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
114            Ok(Self::new(conn))
115        }
116    }
117    impl<T> UserServiceClient<T>
118    where
119        T: tonic::client::GrpcService<tonic::body::Body>,
120        T::Error: Into<StdError>,
121        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
122        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
123    {
124        pub fn new(inner: T) -> Self {
125            let inner = tonic::client::Grpc::new(inner);
126            Self { inner }
127        }
128        pub fn with_origin(inner: T, origin: Uri) -> Self {
129            let inner = tonic::client::Grpc::with_origin(inner, origin);
130            Self { inner }
131        }
132        pub fn with_interceptor<F>(
133            inner: T,
134            interceptor: F,
135        ) -> UserServiceClient<InterceptedService<T, F>>
136        where
137            F: tonic::service::Interceptor,
138            T::ResponseBody: Default,
139            T: tonic::codegen::Service<
140                http::Request<tonic::body::Body>,
141                Response = http::Response<
142                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
143                >,
144            >,
145            <T as tonic::codegen::Service<
146                http::Request<tonic::body::Body>,
147            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
148        {
149            UserServiceClient::new(InterceptedService::new(inner, interceptor))
150        }
151        /// Compress requests with the given encoding.
152        ///
153        /// This requires the server to support it otherwise it might respond with an
154        /// error.
155        #[must_use]
156        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
157            self.inner = self.inner.send_compressed(encoding);
158            self
159        }
160        /// Enable decompressing responses.
161        #[must_use]
162        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
163            self.inner = self.inner.accept_compressed(encoding);
164            self
165        }
166        /// Limits the maximum size of a decoded message.
167        ///
168        /// Default: `4MB`
169        #[must_use]
170        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
171            self.inner = self.inner.max_decoding_message_size(limit);
172            self
173        }
174        /// Limits the maximum size of an encoded message.
175        ///
176        /// Default: `usize::MAX`
177        #[must_use]
178        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
179            self.inner = self.inner.max_encoding_message_size(limit);
180            self
181        }
182        pub async fn create_supplier(
183            &mut self,
184            request: impl tonic::IntoRequest<super::SupplierCreateRequest>,
185        ) -> std::result::Result<
186            tonic::Response<super::SupplierCreateResponse>,
187            tonic::Status,
188        > {
189            self.inner
190                .ready()
191                .await
192                .map_err(|e| {
193                    tonic::Status::unknown(
194                        format!("Service was not ready: {}", e.into()),
195                    )
196                })?;
197            let codec = tonic::codec::ProstCodec::default();
198            let path = http::uri::PathAndQuery::from_static(
199                "/user.v1.UserService/CreateSupplier",
200            );
201            let mut req = request.into_request();
202            req.extensions_mut()
203                .insert(GrpcMethod::new("user.v1.UserService", "CreateSupplier"));
204            self.inner.unary(req, path, codec).await
205        }
206    }
207}
208/// Generated server implementations.
209pub mod user_service_server {
210    #![allow(
211        unused_variables,
212        dead_code,
213        missing_docs,
214        clippy::wildcard_imports,
215        clippy::let_unit_value,
216    )]
217    use tonic::codegen::*;
218    /// Generated trait containing gRPC methods that should be implemented for use with UserServiceServer.
219    #[async_trait]
220    pub trait UserService: std::marker::Send + std::marker::Sync + 'static {
221        async fn create_supplier(
222            &self,
223            request: tonic::Request<super::SupplierCreateRequest>,
224        ) -> std::result::Result<
225            tonic::Response<super::SupplierCreateResponse>,
226            tonic::Status,
227        >;
228    }
229    #[derive(Debug)]
230    pub struct UserServiceServer<T> {
231        inner: Arc<T>,
232        accept_compression_encodings: EnabledCompressionEncodings,
233        send_compression_encodings: EnabledCompressionEncodings,
234        max_decoding_message_size: Option<usize>,
235        max_encoding_message_size: Option<usize>,
236    }
237    impl<T> UserServiceServer<T> {
238        pub fn new(inner: T) -> Self {
239            Self::from_arc(Arc::new(inner))
240        }
241        pub fn from_arc(inner: Arc<T>) -> Self {
242            Self {
243                inner,
244                accept_compression_encodings: Default::default(),
245                send_compression_encodings: Default::default(),
246                max_decoding_message_size: None,
247                max_encoding_message_size: None,
248            }
249        }
250        pub fn with_interceptor<F>(
251            inner: T,
252            interceptor: F,
253        ) -> InterceptedService<Self, F>
254        where
255            F: tonic::service::Interceptor,
256        {
257            InterceptedService::new(Self::new(inner), interceptor)
258        }
259        /// Enable decompressing requests with the given encoding.
260        #[must_use]
261        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
262            self.accept_compression_encodings.enable(encoding);
263            self
264        }
265        /// Compress responses with the given encoding, if the client supports it.
266        #[must_use]
267        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
268            self.send_compression_encodings.enable(encoding);
269            self
270        }
271        /// Limits the maximum size of a decoded message.
272        ///
273        /// Default: `4MB`
274        #[must_use]
275        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
276            self.max_decoding_message_size = Some(limit);
277            self
278        }
279        /// Limits the maximum size of an encoded message.
280        ///
281        /// Default: `usize::MAX`
282        #[must_use]
283        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
284            self.max_encoding_message_size = Some(limit);
285            self
286        }
287    }
288    impl<T, B> tonic::codegen::Service<http::Request<B>> for UserServiceServer<T>
289    where
290        T: UserService,
291        B: Body + std::marker::Send + 'static,
292        B::Error: Into<StdError> + std::marker::Send + 'static,
293    {
294        type Response = http::Response<tonic::body::Body>;
295        type Error = std::convert::Infallible;
296        type Future = BoxFuture<Self::Response, Self::Error>;
297        fn poll_ready(
298            &mut self,
299            _cx: &mut Context<'_>,
300        ) -> Poll<std::result::Result<(), Self::Error>> {
301            Poll::Ready(Ok(()))
302        }
303        fn call(&mut self, req: http::Request<B>) -> Self::Future {
304            match req.uri().path() {
305                "/user.v1.UserService/CreateSupplier" => {
306                    #[allow(non_camel_case_types)]
307                    struct CreateSupplierSvc<T: UserService>(pub Arc<T>);
308                    impl<
309                        T: UserService,
310                    > tonic::server::UnaryService<super::SupplierCreateRequest>
311                    for CreateSupplierSvc<T> {
312                        type Response = super::SupplierCreateResponse;
313                        type Future = BoxFuture<
314                            tonic::Response<Self::Response>,
315                            tonic::Status,
316                        >;
317                        fn call(
318                            &mut self,
319                            request: tonic::Request<super::SupplierCreateRequest>,
320                        ) -> Self::Future {
321                            let inner = Arc::clone(&self.0);
322                            let fut = async move {
323                                <T as UserService>::create_supplier(&inner, request).await
324                            };
325                            Box::pin(fut)
326                        }
327                    }
328                    let accept_compression_encodings = self.accept_compression_encodings;
329                    let send_compression_encodings = self.send_compression_encodings;
330                    let max_decoding_message_size = self.max_decoding_message_size;
331                    let max_encoding_message_size = self.max_encoding_message_size;
332                    let inner = self.inner.clone();
333                    let fut = async move {
334                        let method = CreateSupplierSvc(inner);
335                        let codec = tonic::codec::ProstCodec::default();
336                        let mut grpc = tonic::server::Grpc::new(codec)
337                            .apply_compression_config(
338                                accept_compression_encodings,
339                                send_compression_encodings,
340                            )
341                            .apply_max_message_size_config(
342                                max_decoding_message_size,
343                                max_encoding_message_size,
344                            );
345                        let res = grpc.unary(method, req).await;
346                        Ok(res)
347                    };
348                    Box::pin(fut)
349                }
350                _ => {
351                    Box::pin(async move {
352                        let mut response = http::Response::new(
353                            tonic::body::Body::default(),
354                        );
355                        let headers = response.headers_mut();
356                        headers
357                            .insert(
358                                tonic::Status::GRPC_STATUS,
359                                (tonic::Code::Unimplemented as i32).into(),
360                            );
361                        headers
362                            .insert(
363                                http::header::CONTENT_TYPE,
364                                tonic::metadata::GRPC_CONTENT_TYPE,
365                            );
366                        Ok(response)
367                    })
368                }
369            }
370        }
371    }
372    impl<T> Clone for UserServiceServer<T> {
373        fn clone(&self) -> Self {
374            let inner = self.inner.clone();
375            Self {
376                inner,
377                accept_compression_encodings: self.accept_compression_encodings,
378                send_compression_encodings: self.send_compression_encodings,
379                max_decoding_message_size: self.max_decoding_message_size,
380                max_encoding_message_size: self.max_encoding_message_size,
381            }
382        }
383    }
384    /// Generated gRPC service name
385    pub const SERVICE_NAME: &str = "user.v1.UserService";
386    impl<T> tonic::server::NamedService for UserServiceServer<T> {
387        const NAME: &'static str = SERVICE_NAME;
388    }
389}