mikufans_proto_intl/
bilibili.app.splash.v1.rs

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