megacommerce_proto/
search.v1.rs

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