mikufans_proto_intl/
bilibili.app.distribution.rs

1// This file is @generated by prost-build.
2///
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct BoolValue {
5    ///
6    #[prost(bool, tag = "1")]
7    pub value: bool,
8    ///
9    #[prost(int64, tag = "2")]
10    pub last_modified: i64,
11    ///
12    #[prost(bool, tag = "3")]
13    pub default_value: bool,
14    ///
15    #[prost(string, tag = "4")]
16    pub exp: ::prost::alloc::string::String,
17}
18///
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct BytesValue {
21    ///
22    #[prost(bytes = "vec", tag = "1")]
23    pub value: ::prost::alloc::vec::Vec<u8>,
24    ///
25    #[prost(int64, tag = "2")]
26    pub last_modified: i64,
27    ///
28    #[prost(bytes = "vec", tag = "3")]
29    pub default_value: ::prost::alloc::vec::Vec<u8>,
30    ///
31    #[prost(string, tag = "4")]
32    pub exp: ::prost::alloc::string::String,
33}
34///
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct DoubleValue {
37    ///
38    #[prost(double, tag = "1")]
39    pub value: f64,
40    ///
41    #[prost(int64, tag = "2")]
42    pub last_modified: i64,
43    ///
44    #[prost(double, tag = "3")]
45    pub default_value: f64,
46    ///
47    #[prost(string, tag = "4")]
48    pub exp: ::prost::alloc::string::String,
49}
50///
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct FloatValue {
53    ///
54    #[prost(float, tag = "1")]
55    pub value: f32,
56    ///
57    #[prost(int64, tag = "2")]
58    pub last_modified: i64,
59    ///
60    #[prost(float, tag = "3")]
61    pub default_value: f32,
62    ///
63    #[prost(string, tag = "4")]
64    pub exp: ::prost::alloc::string::String,
65}
66///
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct GetUserPreferenceReply {
69    ///
70    #[prost(message, repeated, tag = "1")]
71    pub value: ::prost::alloc::vec::Vec<::prost_types::Any>,
72}
73///
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct GetUserPreferenceReq {
76    ///
77    #[prost(string, repeated, tag = "1")]
78    pub type_url: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
79    ///
80    #[prost(map = "string, string", tag = "2")]
81    pub extra_context: ::std::collections::HashMap<
82        ::prost::alloc::string::String,
83        ::prost::alloc::string::String,
84    >,
85}
86///
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct Int32Value {
89    ///
90    #[prost(int32, tag = "1")]
91    pub value: i32,
92    ///
93    #[prost(int64, tag = "2")]
94    pub last_modified: i64,
95    ///
96    #[prost(int32, tag = "3")]
97    pub default_value: i32,
98    ///
99    #[prost(string, tag = "4")]
100    pub exp: ::prost::alloc::string::String,
101}
102///
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct Int64Value {
105    ///
106    #[prost(int64, tag = "1")]
107    pub value: i64,
108    ///
109    #[prost(int64, tag = "2")]
110    pub last_modified: i64,
111    ///
112    #[prost(int64, tag = "3")]
113    pub default_value: i64,
114    ///
115    #[prost(string, tag = "4")]
116    pub exp: ::prost::alloc::string::String,
117}
118///
119#[derive(Clone, Copy, PartialEq, ::prost::Message)]
120pub struct SetUserPreferenceReply {}
121///
122#[derive(Clone, PartialEq, ::prost::Message)]
123pub struct SetUserPreferenceReq {
124    ///
125    #[prost(message, repeated, tag = "1")]
126    pub preference: ::prost::alloc::vec::Vec<::prost_types::Any>,
127    ///
128    #[prost(map = "string, string", tag = "2")]
129    pub extra_context: ::std::collections::HashMap<
130        ::prost::alloc::string::String,
131        ::prost::alloc::string::String,
132    >,
133}
134///
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct StringValue {
137    ///
138    #[prost(string, tag = "1")]
139    pub value: ::prost::alloc::string::String,
140    ///
141    #[prost(int64, tag = "2")]
142    pub last_modified: i64,
143    ///
144    #[prost(string, tag = "3")]
145    pub default_value: ::prost::alloc::string::String,
146    ///
147    #[prost(string, tag = "4")]
148    pub exp: ::prost::alloc::string::String,
149}
150///
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct UInt32Value {
153    ///
154    #[prost(int32, tag = "1")]
155    pub value: i32,
156    ///
157    #[prost(int64, tag = "2")]
158    pub last_modified: i64,
159    ///
160    #[prost(int32, tag = "3")]
161    pub default_value: i32,
162    ///
163    #[prost(string, tag = "4")]
164    pub exp: ::prost::alloc::string::String,
165}
166///
167#[derive(Clone, PartialEq, ::prost::Message)]
168pub struct UInt64Value {
169    ///
170    #[prost(int64, tag = "1")]
171    pub value: i64,
172    ///
173    #[prost(int64, tag = "2")]
174    pub last_modified: i64,
175    ///
176    #[prost(int64, tag = "3")]
177    pub default_value: i64,
178    ///
179    #[prost(string, tag = "4")]
180    pub exp: ::prost::alloc::string::String,
181}
182///
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct UserPreferenceReply {
185    ///
186    #[prost(message, repeated, tag = "1")]
187    pub preference: ::prost::alloc::vec::Vec<::prost_types::Any>,
188}
189///
190#[derive(Clone, Copy, PartialEq, ::prost::Message)]
191pub struct UserPreferenceReq {}
192///
193#[derive(Clone, PartialEq, ::prost::Message)]
194pub struct DefaultValue {
195    ///
196    #[prost(oneof = "default_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9")]
197    pub value: ::core::option::Option<default_value::Value>,
198}
199/// Nested message and enum types in `defaultValue`.
200pub mod default_value {
201    ///
202    #[derive(Clone, PartialEq, ::prost::Oneof)]
203    pub enum Value {
204        ///
205        #[prost(double, tag = "1")]
206        DoubleValue(f64),
207        ///
208        #[prost(float, tag = "2")]
209        FloatValue(f32),
210        ///
211        #[prost(int64, tag = "3")]
212        Int64Value(i64),
213        ///
214        #[prost(int64, tag = "4")]
215        Uint64Value(i64),
216        ///
217        #[prost(int32, tag = "5")]
218        Int32Value(i32),
219        ///
220        #[prost(int32, tag = "6")]
221        Uint32Value(i32),
222        ///
223        #[prost(bool, tag = "7")]
224        BoolValue(bool),
225        ///
226        #[prost(string, tag = "8")]
227        StringValue(::prost::alloc::string::String),
228        ///
229        #[prost(bytes, tag = "9")]
230        BytesValue(::prost::alloc::vec::Vec<u8>),
231    }
232}
233/// Generated client implementations.
234pub mod distribution_client {
235    #![allow(
236        unused_variables,
237        dead_code,
238        missing_docs,
239        clippy::wildcard_imports,
240        clippy::let_unit_value,
241    )]
242    use tonic::codegen::*;
243    use tonic::codegen::http::Uri;
244    ///
245    #[derive(Debug, Clone)]
246    pub struct DistributionClient<T> {
247        inner: tonic::client::Grpc<T>,
248    }
249    impl<T> DistributionClient<T>
250    where
251        T: tonic::client::GrpcService<tonic::body::BoxBody>,
252        T::Error: Into<StdError>,
253        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
254        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
255    {
256        pub fn new(inner: T) -> Self {
257            let inner = tonic::client::Grpc::new(inner);
258            Self { inner }
259        }
260        pub fn with_origin(inner: T, origin: Uri) -> Self {
261            let inner = tonic::client::Grpc::with_origin(inner, origin);
262            Self { inner }
263        }
264        pub fn with_interceptor<F>(
265            inner: T,
266            interceptor: F,
267        ) -> DistributionClient<InterceptedService<T, F>>
268        where
269            F: tonic::service::Interceptor,
270            T::ResponseBody: Default,
271            T: tonic::codegen::Service<
272                http::Request<tonic::body::BoxBody>,
273                Response = http::Response<
274                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
275                >,
276            >,
277            <T as tonic::codegen::Service<
278                http::Request<tonic::body::BoxBody>,
279            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
280        {
281            DistributionClient::new(InterceptedService::new(inner, interceptor))
282        }
283        /// Compress requests with the given encoding.
284        ///
285        /// This requires the server to support it otherwise it might respond with an
286        /// error.
287        #[must_use]
288        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
289            self.inner = self.inner.send_compressed(encoding);
290            self
291        }
292        /// Enable decompressing responses.
293        #[must_use]
294        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
295            self.inner = self.inner.accept_compressed(encoding);
296            self
297        }
298        /// Limits the maximum size of a decoded message.
299        ///
300        /// Default: `4MB`
301        #[must_use]
302        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
303            self.inner = self.inner.max_decoding_message_size(limit);
304            self
305        }
306        /// Limits the maximum size of an encoded message.
307        ///
308        /// Default: `usize::MAX`
309        #[must_use]
310        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
311            self.inner = self.inner.max_encoding_message_size(limit);
312            self
313        }
314        ///
315        pub async fn get_user_preference(
316            &mut self,
317            request: impl tonic::IntoRequest<super::GetUserPreferenceReq>,
318        ) -> std::result::Result<
319            tonic::Response<super::GetUserPreferenceReply>,
320            tonic::Status,
321        > {
322            self.inner
323                .ready()
324                .await
325                .map_err(|e| {
326                    tonic::Status::unknown(
327                        format!("Service was not ready: {}", e.into()),
328                    )
329                })?;
330            let codec = tonic::codec::ProstCodec::default();
331            let path = http::uri::PathAndQuery::from_static(
332                "/bilibili.app.distribution.Distribution/GetUserPreference",
333            );
334            let mut req = request.into_request();
335            req.extensions_mut()
336                .insert(
337                    GrpcMethod::new(
338                        "bilibili.app.distribution.Distribution",
339                        "GetUserPreference",
340                    ),
341                );
342            self.inner.unary(req, path, codec).await
343        }
344        ///
345        pub async fn set_user_preference(
346            &mut self,
347            request: impl tonic::IntoRequest<super::SetUserPreferenceReq>,
348        ) -> std::result::Result<
349            tonic::Response<super::SetUserPreferenceReply>,
350            tonic::Status,
351        > {
352            self.inner
353                .ready()
354                .await
355                .map_err(|e| {
356                    tonic::Status::unknown(
357                        format!("Service was not ready: {}", e.into()),
358                    )
359                })?;
360            let codec = tonic::codec::ProstCodec::default();
361            let path = http::uri::PathAndQuery::from_static(
362                "/bilibili.app.distribution.Distribution/SetUserPreference",
363            );
364            let mut req = request.into_request();
365            req.extensions_mut()
366                .insert(
367                    GrpcMethod::new(
368                        "bilibili.app.distribution.Distribution",
369                        "SetUserPreference",
370                    ),
371                );
372            self.inner.unary(req, path, codec).await
373        }
374        ///
375        pub async fn user_preference(
376            &mut self,
377            request: impl tonic::IntoRequest<super::UserPreferenceReq>,
378        ) -> std::result::Result<
379            tonic::Response<super::UserPreferenceReply>,
380            tonic::Status,
381        > {
382            self.inner
383                .ready()
384                .await
385                .map_err(|e| {
386                    tonic::Status::unknown(
387                        format!("Service was not ready: {}", e.into()),
388                    )
389                })?;
390            let codec = tonic::codec::ProstCodec::default();
391            let path = http::uri::PathAndQuery::from_static(
392                "/bilibili.app.distribution.Distribution/UserPreference",
393            );
394            let mut req = request.into_request();
395            req.extensions_mut()
396                .insert(
397                    GrpcMethod::new(
398                        "bilibili.app.distribution.Distribution",
399                        "UserPreference",
400                    ),
401                );
402            self.inner.unary(req, path, codec).await
403        }
404    }
405}
406/// Generated server implementations.
407pub mod distribution_server {
408    #![allow(
409        unused_variables,
410        dead_code,
411        missing_docs,
412        clippy::wildcard_imports,
413        clippy::let_unit_value,
414    )]
415    use tonic::codegen::*;
416    /// Generated trait containing gRPC methods that should be implemented for use with DistributionServer.
417    #[async_trait]
418    pub trait Distribution: std::marker::Send + std::marker::Sync + 'static {
419        ///
420        async fn get_user_preference(
421            &self,
422            request: tonic::Request<super::GetUserPreferenceReq>,
423        ) -> std::result::Result<
424            tonic::Response<super::GetUserPreferenceReply>,
425            tonic::Status,
426        >;
427        ///
428        async fn set_user_preference(
429            &self,
430            request: tonic::Request<super::SetUserPreferenceReq>,
431        ) -> std::result::Result<
432            tonic::Response<super::SetUserPreferenceReply>,
433            tonic::Status,
434        >;
435        ///
436        async fn user_preference(
437            &self,
438            request: tonic::Request<super::UserPreferenceReq>,
439        ) -> std::result::Result<
440            tonic::Response<super::UserPreferenceReply>,
441            tonic::Status,
442        >;
443    }
444    ///
445    #[derive(Debug)]
446    pub struct DistributionServer<T> {
447        inner: Arc<T>,
448        accept_compression_encodings: EnabledCompressionEncodings,
449        send_compression_encodings: EnabledCompressionEncodings,
450        max_decoding_message_size: Option<usize>,
451        max_encoding_message_size: Option<usize>,
452    }
453    impl<T> DistributionServer<T> {
454        pub fn new(inner: T) -> Self {
455            Self::from_arc(Arc::new(inner))
456        }
457        pub fn from_arc(inner: Arc<T>) -> Self {
458            Self {
459                inner,
460                accept_compression_encodings: Default::default(),
461                send_compression_encodings: Default::default(),
462                max_decoding_message_size: None,
463                max_encoding_message_size: None,
464            }
465        }
466        pub fn with_interceptor<F>(
467            inner: T,
468            interceptor: F,
469        ) -> InterceptedService<Self, F>
470        where
471            F: tonic::service::Interceptor,
472        {
473            InterceptedService::new(Self::new(inner), interceptor)
474        }
475        /// Enable decompressing requests with the given encoding.
476        #[must_use]
477        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
478            self.accept_compression_encodings.enable(encoding);
479            self
480        }
481        /// Compress responses with the given encoding, if the client supports it.
482        #[must_use]
483        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
484            self.send_compression_encodings.enable(encoding);
485            self
486        }
487        /// Limits the maximum size of a decoded message.
488        ///
489        /// Default: `4MB`
490        #[must_use]
491        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
492            self.max_decoding_message_size = Some(limit);
493            self
494        }
495        /// Limits the maximum size of an encoded message.
496        ///
497        /// Default: `usize::MAX`
498        #[must_use]
499        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
500            self.max_encoding_message_size = Some(limit);
501            self
502        }
503    }
504    impl<T, B> tonic::codegen::Service<http::Request<B>> for DistributionServer<T>
505    where
506        T: Distribution,
507        B: Body + std::marker::Send + 'static,
508        B::Error: Into<StdError> + std::marker::Send + 'static,
509    {
510        type Response = http::Response<tonic::body::BoxBody>;
511        type Error = std::convert::Infallible;
512        type Future = BoxFuture<Self::Response, Self::Error>;
513        fn poll_ready(
514            &mut self,
515            _cx: &mut Context<'_>,
516        ) -> Poll<std::result::Result<(), Self::Error>> {
517            Poll::Ready(Ok(()))
518        }
519        fn call(&mut self, req: http::Request<B>) -> Self::Future {
520            match req.uri().path() {
521                "/bilibili.app.distribution.Distribution/GetUserPreference" => {
522                    #[allow(non_camel_case_types)]
523                    struct GetUserPreferenceSvc<T: Distribution>(pub Arc<T>);
524                    impl<
525                        T: Distribution,
526                    > tonic::server::UnaryService<super::GetUserPreferenceReq>
527                    for GetUserPreferenceSvc<T> {
528                        type Response = super::GetUserPreferenceReply;
529                        type Future = BoxFuture<
530                            tonic::Response<Self::Response>,
531                            tonic::Status,
532                        >;
533                        fn call(
534                            &mut self,
535                            request: tonic::Request<super::GetUserPreferenceReq>,
536                        ) -> Self::Future {
537                            let inner = Arc::clone(&self.0);
538                            let fut = async move {
539                                <T as Distribution>::get_user_preference(&inner, request)
540                                    .await
541                            };
542                            Box::pin(fut)
543                        }
544                    }
545                    let accept_compression_encodings = self.accept_compression_encodings;
546                    let send_compression_encodings = self.send_compression_encodings;
547                    let max_decoding_message_size = self.max_decoding_message_size;
548                    let max_encoding_message_size = self.max_encoding_message_size;
549                    let inner = self.inner.clone();
550                    let fut = async move {
551                        let method = GetUserPreferenceSvc(inner);
552                        let codec = tonic::codec::ProstCodec::default();
553                        let mut grpc = tonic::server::Grpc::new(codec)
554                            .apply_compression_config(
555                                accept_compression_encodings,
556                                send_compression_encodings,
557                            )
558                            .apply_max_message_size_config(
559                                max_decoding_message_size,
560                                max_encoding_message_size,
561                            );
562                        let res = grpc.unary(method, req).await;
563                        Ok(res)
564                    };
565                    Box::pin(fut)
566                }
567                "/bilibili.app.distribution.Distribution/SetUserPreference" => {
568                    #[allow(non_camel_case_types)]
569                    struct SetUserPreferenceSvc<T: Distribution>(pub Arc<T>);
570                    impl<
571                        T: Distribution,
572                    > tonic::server::UnaryService<super::SetUserPreferenceReq>
573                    for SetUserPreferenceSvc<T> {
574                        type Response = super::SetUserPreferenceReply;
575                        type Future = BoxFuture<
576                            tonic::Response<Self::Response>,
577                            tonic::Status,
578                        >;
579                        fn call(
580                            &mut self,
581                            request: tonic::Request<super::SetUserPreferenceReq>,
582                        ) -> Self::Future {
583                            let inner = Arc::clone(&self.0);
584                            let fut = async move {
585                                <T as Distribution>::set_user_preference(&inner, request)
586                                    .await
587                            };
588                            Box::pin(fut)
589                        }
590                    }
591                    let accept_compression_encodings = self.accept_compression_encodings;
592                    let send_compression_encodings = self.send_compression_encodings;
593                    let max_decoding_message_size = self.max_decoding_message_size;
594                    let max_encoding_message_size = self.max_encoding_message_size;
595                    let inner = self.inner.clone();
596                    let fut = async move {
597                        let method = SetUserPreferenceSvc(inner);
598                        let codec = tonic::codec::ProstCodec::default();
599                        let mut grpc = tonic::server::Grpc::new(codec)
600                            .apply_compression_config(
601                                accept_compression_encodings,
602                                send_compression_encodings,
603                            )
604                            .apply_max_message_size_config(
605                                max_decoding_message_size,
606                                max_encoding_message_size,
607                            );
608                        let res = grpc.unary(method, req).await;
609                        Ok(res)
610                    };
611                    Box::pin(fut)
612                }
613                "/bilibili.app.distribution.Distribution/UserPreference" => {
614                    #[allow(non_camel_case_types)]
615                    struct UserPreferenceSvc<T: Distribution>(pub Arc<T>);
616                    impl<
617                        T: Distribution,
618                    > tonic::server::UnaryService<super::UserPreferenceReq>
619                    for UserPreferenceSvc<T> {
620                        type Response = super::UserPreferenceReply;
621                        type Future = BoxFuture<
622                            tonic::Response<Self::Response>,
623                            tonic::Status,
624                        >;
625                        fn call(
626                            &mut self,
627                            request: tonic::Request<super::UserPreferenceReq>,
628                        ) -> Self::Future {
629                            let inner = Arc::clone(&self.0);
630                            let fut = async move {
631                                <T as Distribution>::user_preference(&inner, request).await
632                            };
633                            Box::pin(fut)
634                        }
635                    }
636                    let accept_compression_encodings = self.accept_compression_encodings;
637                    let send_compression_encodings = self.send_compression_encodings;
638                    let max_decoding_message_size = self.max_decoding_message_size;
639                    let max_encoding_message_size = self.max_encoding_message_size;
640                    let inner = self.inner.clone();
641                    let fut = async move {
642                        let method = UserPreferenceSvc(inner);
643                        let codec = tonic::codec::ProstCodec::default();
644                        let mut grpc = tonic::server::Grpc::new(codec)
645                            .apply_compression_config(
646                                accept_compression_encodings,
647                                send_compression_encodings,
648                            )
649                            .apply_max_message_size_config(
650                                max_decoding_message_size,
651                                max_encoding_message_size,
652                            );
653                        let res = grpc.unary(method, req).await;
654                        Ok(res)
655                    };
656                    Box::pin(fut)
657                }
658                _ => {
659                    Box::pin(async move {
660                        let mut response = http::Response::new(empty_body());
661                        let headers = response.headers_mut();
662                        headers
663                            .insert(
664                                tonic::Status::GRPC_STATUS,
665                                (tonic::Code::Unimplemented as i32).into(),
666                            );
667                        headers
668                            .insert(
669                                http::header::CONTENT_TYPE,
670                                tonic::metadata::GRPC_CONTENT_TYPE,
671                            );
672                        Ok(response)
673                    })
674                }
675            }
676        }
677    }
678    impl<T> Clone for DistributionServer<T> {
679        fn clone(&self) -> Self {
680            let inner = self.inner.clone();
681            Self {
682                inner,
683                accept_compression_encodings: self.accept_compression_encodings,
684                send_compression_encodings: self.send_compression_encodings,
685                max_decoding_message_size: self.max_decoding_message_size,
686                max_encoding_message_size: self.max_encoding_message_size,
687            }
688        }
689    }
690    /// Generated gRPC service name
691    pub const SERVICE_NAME: &str = "bilibili.app.distribution.Distribution";
692    impl<T> tonic::server::NamedService for DistributionServer<T> {
693        const NAME: &'static str = SERVICE_NAME;
694    }
695}