mikufans_proto_intl/
bilibili.polymer.chronos.v1.rs

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