mikufans_proto_intl/
bilibili.broadcast.message.main.rs

1// This file is @generated by prost-build.
2///
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Animate {
5    ///
6    #[prost(string, tag = "1")]
7    pub icon: ::prost::alloc::string::String,
8    ///
9    #[prost(string, tag = "2")]
10    pub json: ::prost::alloc::string::String,
11    ///
12    #[prost(string, tag = "3")]
13    pub svg: ::prost::alloc::string::String,
14    ///
15    #[prost(int32, tag = "4")]
16    pub r#loop: i32,
17}
18///
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct ArticleCard {
21    ///
22    #[prost(string, tag = "1")]
23    pub title: ::prost::alloc::string::String,
24    ///
25    #[prost(string, tag = "2")]
26    pub desc: ::prost::alloc::string::String,
27    ///
28    #[prost(string, tag = "3")]
29    pub cover: ::prost::alloc::string::String,
30    ///
31    #[prost(string, tag = "4")]
32    pub author: ::prost::alloc::string::String,
33    ///
34    #[prost(int64, tag = "5")]
35    pub mid: i64,
36    ///
37    #[prost(int32, tag = "6")]
38    pub view: i32,
39    ///
40    #[prost(int32, tag = "7")]
41    pub like: i32,
42    ///
43    #[prost(int32, tag = "8")]
44    pub reply: i32,
45    ///
46    #[prost(string, tag = "9")]
47    pub pub_time: ::prost::alloc::string::String,
48    ///
49    #[prost(string, tag = "10")]
50    pub badge: ::prost::alloc::string::String,
51}
52///
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct Bubble {
55    ///
56    #[prost(message, repeated, tag = "1")]
57    pub paragraphs: ::prost::alloc::vec::Vec<
58        super::super::super::app::dynamic::v2::Paragraph,
59    >,
60    ///
61    #[prost(message, repeated, tag = "2")]
62    pub item: ::prost::alloc::vec::Vec<CardItem>,
63}
64///
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct CardItem {
67    ///
68    #[prost(string, tag = "1")]
69    pub uri: ::prost::alloc::string::String,
70    ///
71    #[prost(string, tag = "2")]
72    pub param: ::prost::alloc::string::String,
73    ///
74    #[prost(string, tag = "3")]
75    pub goto: ::prost::alloc::string::String,
76    ///
77    #[prost(oneof = "card_item::CardItem", tags = "4, 5")]
78    pub card_item: ::core::option::Option<card_item::CardItem>,
79}
80/// Nested message and enum types in `CardItem`.
81pub mod card_item {
82    ///
83    #[derive(Clone, PartialEq, ::prost::Oneof)]
84    pub enum CardItem {
85        ///
86        #[prost(message, tag = "4")]
87        Article(super::ArticleCard),
88        ///
89        #[prost(message, tag = "5")]
90        Av(super::VideoCard),
91    }
92}
93///
94#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct ChatResult {
96    ///
97    #[prost(int32, tag = "1")]
98    pub code: i32,
99    ///
100    #[prost(string, tag = "2")]
101    pub session_id: ::prost::alloc::string::String,
102    ///
103    #[prost(message, repeated, tag = "3")]
104    pub bubbles: ::prost::alloc::vec::Vec<Bubble>,
105    ///
106    #[prost(string, tag = "4")]
107    pub rewrite_word: ::prost::alloc::string::String,
108    ///
109    #[prost(string, tag = "5")]
110    pub title: ::prost::alloc::string::String,
111    ///
112    #[prost(string, tag = "6")]
113    pub business: ::prost::alloc::string::String,
114    ///
115    #[prost(int64, tag = "7")]
116    pub message_id: i64,
117    ///
118    #[prost(enumeration = "LikeState", tag = "8")]
119    pub like_state: i32,
120    ///
121    #[prost(int64, tag = "9")]
122    pub like_number: i64,
123}
124///
125#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct CommandDm {
127    ///
128    #[prost(int64, tag = "1")]
129    pub id: i64,
130    ///
131    #[prost(int64, tag = "2")]
132    pub oid: i64,
133    ///
134    #[prost(int64, tag = "3")]
135    pub mid: i64,
136    ///
137    #[prost(int32, tag = "4")]
138    pub r#type: i32,
139    ///
140    #[prost(string, tag = "5")]
141    pub command: ::prost::alloc::string::String,
142    ///
143    #[prost(string, tag = "6")]
144    pub content: ::prost::alloc::string::String,
145    ///
146    #[prost(int32, tag = "7")]
147    pub state: i32,
148    ///
149    #[prost(int32, tag = "8")]
150    pub progress: i32,
151    ///
152    #[prost(string, tag = "9")]
153    pub ctime: ::prost::alloc::string::String,
154    ///
155    #[prost(string, tag = "10")]
156    pub mtime: ::prost::alloc::string::String,
157    ///
158    #[prost(string, tag = "11")]
159    pub extra: ::prost::alloc::string::String,
160    ///
161    #[prost(string, tag = "12")]
162    pub id_str: ::prost::alloc::string::String,
163}
164///
165#[derive(Clone, PartialEq, ::prost::Message)]
166pub struct DanmakuElem {
167    ///
168    #[prost(int64, tag = "1")]
169    pub id: i64,
170    ///
171    #[prost(int32, tag = "2")]
172    pub progress: i32,
173    ///
174    #[prost(int32, tag = "3")]
175    pub mode: i32,
176    ///
177    #[prost(int32, tag = "4")]
178    pub fontsize: i32,
179    ///
180    #[prost(int32, tag = "5")]
181    pub color: i32,
182    ///
183    #[prost(string, tag = "6")]
184    pub mid_hash: ::prost::alloc::string::String,
185    ///
186    #[prost(string, tag = "7")]
187    pub content: ::prost::alloc::string::String,
188    ///
189    #[prost(int64, tag = "8")]
190    pub ctime: i64,
191    ///
192    #[prost(string, tag = "9")]
193    pub action: ::prost::alloc::string::String,
194    ///
195    #[prost(int32, tag = "10")]
196    pub pool: i32,
197    ///
198    #[prost(string, tag = "11")]
199    pub id_str: ::prost::alloc::string::String,
200    ///
201    #[prost(int32, tag = "12")]
202    pub weight: i32,
203    ///
204    #[prost(int32, tag = "13")]
205    pub attr: i32,
206    ///
207    #[prost(string, tag = "14")]
208    pub animation: ::prost::alloc::string::String,
209}
210///
211#[derive(Clone, PartialEq, ::prost::Message)]
212pub struct DanmukuEvent {
213    ///
214    #[prost(message, repeated, tag = "1")]
215    pub elems: ::prost::alloc::vec::Vec<DanmakuElem>,
216}
217///
218#[derive(Clone, PartialEq, ::prost::Message)]
219pub struct EventItem {
220    ///
221    #[prost(int64, tag = "1")]
222    pub item_i_d: i64,
223    ///
224    #[prost(string, tag = "2")]
225    pub r#type: ::prost::alloc::string::String,
226    ///
227    #[prost(int64, tag = "3")]
228    pub num: i64,
229    ///
230    #[prost(string, tag = "4")]
231    pub display_num: ::prost::alloc::string::String,
232    ///
233    #[prost(string, tag = "5")]
234    pub web_key: ::prost::alloc::string::String,
235    ///
236    #[prost(int64, tag = "6")]
237    pub dimension: i64,
238}
239///
240#[derive(Clone, PartialEq, ::prost::Message)]
241pub struct HistoryReportEvent {
242    ///
243    #[prost(int64, tag = "1")]
244    pub aid: i64,
245    ///
246    #[prost(int32, tag = "2")]
247    pub r#type: i32,
248    ///
249    #[prost(int64, tag = "3")]
250    pub cid: i64,
251    ///
252    #[prost(int64, tag = "4")]
253    pub epid: i64,
254    ///
255    #[prost(int64, tag = "5")]
256    pub sid: i64,
257    ///
258    #[prost(int32, tag = "6")]
259    pub sub_type: i32,
260    ///
261    #[prost(int32, tag = "7")]
262    pub dt: i32,
263    ///
264    #[prost(int64, tag = "8")]
265    pub realtime: i64,
266    ///
267    #[prost(string, tag = "9")]
268    pub source: ::prost::alloc::string::String,
269    ///
270    #[prost(int64, tag = "10")]
271    pub progress: i64,
272    ///
273    #[prost(int64, tag = "11")]
274    pub duration: i64,
275    ///
276    #[prost(string, tag = "12")]
277    pub platform: ::prost::alloc::string::String,
278    ///
279    #[prost(string, tag = "13")]
280    pub device: ::prost::alloc::string::String,
281    ///
282    #[prost(int64, tag = "14")]
283    pub play_time: i64,
284    ///
285    #[prost(string, tag = "15")]
286    pub statistics: ::prost::alloc::string::String,
287    ///
288    #[prost(int64, tag = "16")]
289    pub start_ts: i64,
290    ///
291    #[prost(int64, tag = "17")]
292    pub device_ts: i64,
293    ///
294    #[prost(string, tag = "18")]
295    pub scene: ::prost::alloc::string::String,
296}
297///
298#[derive(Clone, PartialEq, ::prost::Message)]
299pub struct NativePageEvent {
300    ///
301    #[prost(int64, tag = "1")]
302    pub page_i_d: i64,
303    ///
304    #[prost(message, repeated, tag = "2")]
305    pub items: ::prost::alloc::vec::Vec<EventItem>,
306}
307///
308#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct ReasonStyle {
310    ///
311    #[prost(string, tag = "1")]
312    pub text: ::prost::alloc::string::String,
313    ///
314    #[prost(string, tag = "2")]
315    pub text_color: ::prost::alloc::string::String,
316    ///
317    #[prost(string, tag = "3")]
318    pub text_color_night: ::prost::alloc::string::String,
319    ///
320    #[prost(string, tag = "4")]
321    pub bg_color: ::prost::alloc::string::String,
322    ///
323    #[prost(string, tag = "5")]
324    pub bg_color_night: ::prost::alloc::string::String,
325    ///
326    #[prost(string, tag = "6")]
327    pub border_color: ::prost::alloc::string::String,
328    ///
329    #[prost(string, tag = "7")]
330    pub border_color_night: ::prost::alloc::string::String,
331    ///
332    #[prost(int32, tag = "8")]
333    pub bg_style: i32,
334}
335///
336#[derive(Clone, Copy, PartialEq, ::prost::Message)]
337pub struct RedDot {
338    ///
339    #[prost(int32, tag = "1")]
340    pub r#type: i32,
341    ///
342    #[prost(int32, tag = "2")]
343    pub number: i32,
344}
345///
346#[derive(Clone, Copy, PartialEq, ::prost::Message)]
347pub struct Stats {
348    ///
349    #[prost(int32, tag = "1")]
350    pub like: i32,
351    ///
352    #[prost(int32, tag = "2")]
353    pub coin: i32,
354    ///
355    #[prost(int32, tag = "3")]
356    pub fav: i32,
357    ///
358    #[prost(int32, tag = "4")]
359    pub share: i32,
360}
361///
362#[derive(Clone, PartialEq, ::prost::Message)]
363pub struct TopActivityReply {
364    ///
365    #[prost(message, optional, tag = "1")]
366    pub online: ::core::option::Option<TopOnline>,
367    ///
368    #[prost(string, tag = "2")]
369    pub hash: ::prost::alloc::string::String,
370}
371///
372#[derive(Clone, PartialEq, ::prost::Message)]
373pub struct TopOnline {
374    ///
375    #[prost(int32, tag = "1")]
376    pub r#type: i32,
377    ///
378    #[prost(string, tag = "2")]
379    pub icon: ::prost::alloc::string::String,
380    ///
381    #[prost(string, tag = "3")]
382    pub uri: ::prost::alloc::string::String,
383    ///
384    #[prost(string, tag = "4")]
385    pub unique_id: ::prost::alloc::string::String,
386    ///
387    #[prost(message, optional, tag = "5")]
388    pub animate: ::core::option::Option<Animate>,
389    ///
390    #[prost(message, optional, tag = "6")]
391    pub red_dot: ::core::option::Option<RedDot>,
392    ///
393    #[prost(string, tag = "7")]
394    pub name: ::prost::alloc::string::String,
395    ///
396    #[prost(int64, tag = "8")]
397    pub interval: i64,
398}
399///
400#[derive(Clone, PartialEq, ::prost::Message)]
401pub struct VideoCard {
402    ///
403    #[prost(string, tag = "1")]
404    pub title: ::prost::alloc::string::String,
405    ///
406    #[prost(string, tag = "2")]
407    pub desc: ::prost::alloc::string::String,
408    ///
409    #[prost(string, tag = "3")]
410    pub cover: ::prost::alloc::string::String,
411    ///
412    #[prost(string, tag = "4")]
413    pub author: ::prost::alloc::string::String,
414    ///
415    #[prost(string, tag = "5")]
416    pub duration: ::prost::alloc::string::String,
417    ///
418    #[prost(message, repeated, tag = "6")]
419    pub new_rec_tags: ::prost::alloc::vec::Vec<ReasonStyle>,
420    ///
421    #[prost(message, repeated, tag = "7")]
422    pub badges: ::prost::alloc::vec::Vec<ReasonStyle>,
423    ///
424    #[prost(string, tag = "8")]
425    pub show_card_desc2: ::prost::alloc::string::String,
426    ///
427    #[prost(string, tag = "9")]
428    pub view_content: ::prost::alloc::string::String,
429    ///
430    #[prost(int32, tag = "10")]
431    pub icon_type: i32,
432}
433///
434#[derive(Clone, Copy, PartialEq, ::prost::Message)]
435pub struct ViewPush {
436    ///
437    #[prost(message, optional, tag = "1")]
438    pub stats: ::core::option::Option<Stats>,
439    ///
440    #[prost(int64, tag = "2")]
441    pub aid: i64,
442    ///
443    #[prost(int64, tag = "3")]
444    pub up_time: i64,
445}
446///
447#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
448#[repr(i32)]
449pub enum LikeState {
450    ///
451    Default = 0,
452    ///
453    Like = 1,
454    ///
455    Dislike = 2,
456}
457impl LikeState {
458    /// String value of the enum field names used in the ProtoBuf definition.
459    ///
460    /// The values are not transformed in any way and thus are considered stable
461    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
462    pub fn as_str_name(&self) -> &'static str {
463        match self {
464            Self::Default => "DEFAULT",
465            Self::Like => "LIKE",
466            Self::Dislike => "DISLIKE",
467        }
468    }
469    /// Creates an enum from field names used in the ProtoBuf definition.
470    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
471        match value {
472            "DEFAULT" => Some(Self::Default),
473            "LIKE" => Some(Self::Like),
474            "DISLIKE" => Some(Self::Dislike),
475            _ => None,
476        }
477    }
478}
479/// Generated client implementations.
480pub mod native_page_client {
481    #![allow(
482        unused_variables,
483        dead_code,
484        missing_docs,
485        clippy::wildcard_imports,
486        clippy::let_unit_value,
487    )]
488    use tonic::codegen::*;
489    use tonic::codegen::http::Uri;
490    ///
491    #[derive(Debug, Clone)]
492    pub struct NativePageClient<T> {
493        inner: tonic::client::Grpc<T>,
494    }
495    impl<T> NativePageClient<T>
496    where
497        T: tonic::client::GrpcService<tonic::body::BoxBody>,
498        T::Error: Into<StdError>,
499        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
500        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
501    {
502        pub fn new(inner: T) -> Self {
503            let inner = tonic::client::Grpc::new(inner);
504            Self { inner }
505        }
506        pub fn with_origin(inner: T, origin: Uri) -> Self {
507            let inner = tonic::client::Grpc::with_origin(inner, origin);
508            Self { inner }
509        }
510        pub fn with_interceptor<F>(
511            inner: T,
512            interceptor: F,
513        ) -> NativePageClient<InterceptedService<T, F>>
514        where
515            F: tonic::service::Interceptor,
516            T::ResponseBody: Default,
517            T: tonic::codegen::Service<
518                http::Request<tonic::body::BoxBody>,
519                Response = http::Response<
520                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
521                >,
522            >,
523            <T as tonic::codegen::Service<
524                http::Request<tonic::body::BoxBody>,
525            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
526        {
527            NativePageClient::new(InterceptedService::new(inner, interceptor))
528        }
529        /// Compress requests with the given encoding.
530        ///
531        /// This requires the server to support it otherwise it might respond with an
532        /// error.
533        #[must_use]
534        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
535            self.inner = self.inner.send_compressed(encoding);
536            self
537        }
538        /// Enable decompressing responses.
539        #[must_use]
540        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
541            self.inner = self.inner.accept_compressed(encoding);
542            self
543        }
544        /// Limits the maximum size of a decoded message.
545        ///
546        /// Default: `4MB`
547        #[must_use]
548        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
549            self.inner = self.inner.max_decoding_message_size(limit);
550            self
551        }
552        /// Limits the maximum size of an encoded message.
553        ///
554        /// Default: `usize::MAX`
555        #[must_use]
556        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
557            self.inner = self.inner.max_encoding_message_size(limit);
558            self
559        }
560        ///
561        pub async fn watch_notify(
562            &mut self,
563            request: impl tonic::IntoRequest<()>,
564        ) -> std::result::Result<
565            tonic::Response<super::NativePageEvent>,
566            tonic::Status,
567        > {
568            self.inner
569                .ready()
570                .await
571                .map_err(|e| {
572                    tonic::Status::unknown(
573                        format!("Service was not ready: {}", e.into()),
574                    )
575                })?;
576            let codec = tonic::codec::ProstCodec::default();
577            let path = http::uri::PathAndQuery::from_static(
578                "/bilibili.broadcast.message.main.NativePage/WatchNotify",
579            );
580            let mut req = request.into_request();
581            req.extensions_mut()
582                .insert(
583                    GrpcMethod::new(
584                        "bilibili.broadcast.message.main.NativePage",
585                        "WatchNotify",
586                    ),
587                );
588            self.inner.unary(req, path, codec).await
589        }
590    }
591}
592/// Generated client implementations.
593pub mod resource_client {
594    #![allow(
595        unused_variables,
596        dead_code,
597        missing_docs,
598        clippy::wildcard_imports,
599        clippy::let_unit_value,
600    )]
601    use tonic::codegen::*;
602    use tonic::codegen::http::Uri;
603    ///
604    #[derive(Debug, Clone)]
605    pub struct ResourceClient<T> {
606        inner: tonic::client::Grpc<T>,
607    }
608    impl<T> ResourceClient<T>
609    where
610        T: tonic::client::GrpcService<tonic::body::BoxBody>,
611        T::Error: Into<StdError>,
612        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
613        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
614    {
615        pub fn new(inner: T) -> Self {
616            let inner = tonic::client::Grpc::new(inner);
617            Self { inner }
618        }
619        pub fn with_origin(inner: T, origin: Uri) -> Self {
620            let inner = tonic::client::Grpc::with_origin(inner, origin);
621            Self { inner }
622        }
623        pub fn with_interceptor<F>(
624            inner: T,
625            interceptor: F,
626        ) -> ResourceClient<InterceptedService<T, F>>
627        where
628            F: tonic::service::Interceptor,
629            T::ResponseBody: Default,
630            T: tonic::codegen::Service<
631                http::Request<tonic::body::BoxBody>,
632                Response = http::Response<
633                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
634                >,
635            >,
636            <T as tonic::codegen::Service<
637                http::Request<tonic::body::BoxBody>,
638            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
639        {
640            ResourceClient::new(InterceptedService::new(inner, interceptor))
641        }
642        /// Compress requests with the given encoding.
643        ///
644        /// This requires the server to support it otherwise it might respond with an
645        /// error.
646        #[must_use]
647        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
648            self.inner = self.inner.send_compressed(encoding);
649            self
650        }
651        /// Enable decompressing responses.
652        #[must_use]
653        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
654            self.inner = self.inner.accept_compressed(encoding);
655            self
656        }
657        /// Limits the maximum size of a decoded message.
658        ///
659        /// Default: `4MB`
660        #[must_use]
661        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
662            self.inner = self.inner.max_decoding_message_size(limit);
663            self
664        }
665        /// Limits the maximum size of an encoded message.
666        ///
667        /// Default: `usize::MAX`
668        #[must_use]
669        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
670            self.inner = self.inner.max_encoding_message_size(limit);
671            self
672        }
673        ///
674        pub async fn top_activity(
675            &mut self,
676            request: impl tonic::IntoRequest<()>,
677        ) -> std::result::Result<
678            tonic::Response<super::TopActivityReply>,
679            tonic::Status,
680        > {
681            self.inner
682                .ready()
683                .await
684                .map_err(|e| {
685                    tonic::Status::unknown(
686                        format!("Service was not ready: {}", e.into()),
687                    )
688                })?;
689            let codec = tonic::codec::ProstCodec::default();
690            let path = http::uri::PathAndQuery::from_static(
691                "/bilibili.broadcast.message.main.Resource/TopActivity",
692            );
693            let mut req = request.into_request();
694            req.extensions_mut()
695                .insert(
696                    GrpcMethod::new(
697                        "bilibili.broadcast.message.main.Resource",
698                        "TopActivity",
699                    ),
700                );
701            self.inner.unary(req, path, codec).await
702        }
703    }
704}
705/// Generated client implementations.
706pub mod search_client {
707    #![allow(
708        unused_variables,
709        dead_code,
710        missing_docs,
711        clippy::wildcard_imports,
712        clippy::let_unit_value,
713    )]
714    use tonic::codegen::*;
715    use tonic::codegen::http::Uri;
716    ///
717    #[derive(Debug, Clone)]
718    pub struct SearchClient<T> {
719        inner: tonic::client::Grpc<T>,
720    }
721    impl<T> SearchClient<T>
722    where
723        T: tonic::client::GrpcService<tonic::body::BoxBody>,
724        T::Error: Into<StdError>,
725        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
726        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
727    {
728        pub fn new(inner: T) -> Self {
729            let inner = tonic::client::Grpc::new(inner);
730            Self { inner }
731        }
732        pub fn with_origin(inner: T, origin: Uri) -> Self {
733            let inner = tonic::client::Grpc::with_origin(inner, origin);
734            Self { inner }
735        }
736        pub fn with_interceptor<F>(
737            inner: T,
738            interceptor: F,
739        ) -> SearchClient<InterceptedService<T, F>>
740        where
741            F: tonic::service::Interceptor,
742            T::ResponseBody: Default,
743            T: tonic::codegen::Service<
744                http::Request<tonic::body::BoxBody>,
745                Response = http::Response<
746                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
747                >,
748            >,
749            <T as tonic::codegen::Service<
750                http::Request<tonic::body::BoxBody>,
751            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
752        {
753            SearchClient::new(InterceptedService::new(inner, interceptor))
754        }
755        /// Compress requests with the given encoding.
756        ///
757        /// This requires the server to support it otherwise it might respond with an
758        /// error.
759        #[must_use]
760        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
761            self.inner = self.inner.send_compressed(encoding);
762            self
763        }
764        /// Enable decompressing responses.
765        #[must_use]
766        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
767            self.inner = self.inner.accept_compressed(encoding);
768            self
769        }
770        /// Limits the maximum size of a decoded message.
771        ///
772        /// Default: `4MB`
773        #[must_use]
774        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
775            self.inner = self.inner.max_decoding_message_size(limit);
776            self
777        }
778        /// Limits the maximum size of an encoded message.
779        ///
780        /// Default: `usize::MAX`
781        #[must_use]
782        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
783            self.inner = self.inner.max_encoding_message_size(limit);
784            self
785        }
786        ///
787        pub async fn chat_result_push(
788            &mut self,
789            request: impl tonic::IntoRequest<()>,
790        ) -> std::result::Result<tonic::Response<super::ChatResult>, tonic::Status> {
791            self.inner
792                .ready()
793                .await
794                .map_err(|e| {
795                    tonic::Status::unknown(
796                        format!("Service was not ready: {}", e.into()),
797                    )
798                })?;
799            let codec = tonic::codec::ProstCodec::default();
800            let path = http::uri::PathAndQuery::from_static(
801                "/bilibili.broadcast.message.main.Search/ChatResultPush",
802            );
803            let mut req = request.into_request();
804            req.extensions_mut()
805                .insert(
806                    GrpcMethod::new(
807                        "bilibili.broadcast.message.main.Search",
808                        "ChatResultPush",
809                    ),
810                );
811            self.inner.unary(req, path, codec).await
812        }
813    }
814}
815/// Generated server implementations.
816pub mod native_page_server {
817    #![allow(
818        unused_variables,
819        dead_code,
820        missing_docs,
821        clippy::wildcard_imports,
822        clippy::let_unit_value,
823    )]
824    use tonic::codegen::*;
825    /// Generated trait containing gRPC methods that should be implemented for use with NativePageServer.
826    #[async_trait]
827    pub trait NativePage: std::marker::Send + std::marker::Sync + 'static {
828        ///
829        async fn watch_notify(
830            &self,
831            request: tonic::Request<()>,
832        ) -> std::result::Result<tonic::Response<super::NativePageEvent>, tonic::Status>;
833    }
834    ///
835    #[derive(Debug)]
836    pub struct NativePageServer<T> {
837        inner: Arc<T>,
838        accept_compression_encodings: EnabledCompressionEncodings,
839        send_compression_encodings: EnabledCompressionEncodings,
840        max_decoding_message_size: Option<usize>,
841        max_encoding_message_size: Option<usize>,
842    }
843    impl<T> NativePageServer<T> {
844        pub fn new(inner: T) -> Self {
845            Self::from_arc(Arc::new(inner))
846        }
847        pub fn from_arc(inner: Arc<T>) -> Self {
848            Self {
849                inner,
850                accept_compression_encodings: Default::default(),
851                send_compression_encodings: Default::default(),
852                max_decoding_message_size: None,
853                max_encoding_message_size: None,
854            }
855        }
856        pub fn with_interceptor<F>(
857            inner: T,
858            interceptor: F,
859        ) -> InterceptedService<Self, F>
860        where
861            F: tonic::service::Interceptor,
862        {
863            InterceptedService::new(Self::new(inner), interceptor)
864        }
865        /// Enable decompressing requests with the given encoding.
866        #[must_use]
867        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
868            self.accept_compression_encodings.enable(encoding);
869            self
870        }
871        /// Compress responses with the given encoding, if the client supports it.
872        #[must_use]
873        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
874            self.send_compression_encodings.enable(encoding);
875            self
876        }
877        /// Limits the maximum size of a decoded message.
878        ///
879        /// Default: `4MB`
880        #[must_use]
881        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
882            self.max_decoding_message_size = Some(limit);
883            self
884        }
885        /// Limits the maximum size of an encoded message.
886        ///
887        /// Default: `usize::MAX`
888        #[must_use]
889        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
890            self.max_encoding_message_size = Some(limit);
891            self
892        }
893    }
894    impl<T, B> tonic::codegen::Service<http::Request<B>> for NativePageServer<T>
895    where
896        T: NativePage,
897        B: Body + std::marker::Send + 'static,
898        B::Error: Into<StdError> + std::marker::Send + 'static,
899    {
900        type Response = http::Response<tonic::body::BoxBody>;
901        type Error = std::convert::Infallible;
902        type Future = BoxFuture<Self::Response, Self::Error>;
903        fn poll_ready(
904            &mut self,
905            _cx: &mut Context<'_>,
906        ) -> Poll<std::result::Result<(), Self::Error>> {
907            Poll::Ready(Ok(()))
908        }
909        fn call(&mut self, req: http::Request<B>) -> Self::Future {
910            match req.uri().path() {
911                "/bilibili.broadcast.message.main.NativePage/WatchNotify" => {
912                    #[allow(non_camel_case_types)]
913                    struct WatchNotifySvc<T: NativePage>(pub Arc<T>);
914                    impl<T: NativePage> tonic::server::UnaryService<()>
915                    for WatchNotifySvc<T> {
916                        type Response = super::NativePageEvent;
917                        type Future = BoxFuture<
918                            tonic::Response<Self::Response>,
919                            tonic::Status,
920                        >;
921                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
922                            let inner = Arc::clone(&self.0);
923                            let fut = async move {
924                                <T as NativePage>::watch_notify(&inner, request).await
925                            };
926                            Box::pin(fut)
927                        }
928                    }
929                    let accept_compression_encodings = self.accept_compression_encodings;
930                    let send_compression_encodings = self.send_compression_encodings;
931                    let max_decoding_message_size = self.max_decoding_message_size;
932                    let max_encoding_message_size = self.max_encoding_message_size;
933                    let inner = self.inner.clone();
934                    let fut = async move {
935                        let method = WatchNotifySvc(inner);
936                        let codec = tonic::codec::ProstCodec::default();
937                        let mut grpc = tonic::server::Grpc::new(codec)
938                            .apply_compression_config(
939                                accept_compression_encodings,
940                                send_compression_encodings,
941                            )
942                            .apply_max_message_size_config(
943                                max_decoding_message_size,
944                                max_encoding_message_size,
945                            );
946                        let res = grpc.unary(method, req).await;
947                        Ok(res)
948                    };
949                    Box::pin(fut)
950                }
951                _ => {
952                    Box::pin(async move {
953                        let mut response = http::Response::new(empty_body());
954                        let headers = response.headers_mut();
955                        headers
956                            .insert(
957                                tonic::Status::GRPC_STATUS,
958                                (tonic::Code::Unimplemented as i32).into(),
959                            );
960                        headers
961                            .insert(
962                                http::header::CONTENT_TYPE,
963                                tonic::metadata::GRPC_CONTENT_TYPE,
964                            );
965                        Ok(response)
966                    })
967                }
968            }
969        }
970    }
971    impl<T> Clone for NativePageServer<T> {
972        fn clone(&self) -> Self {
973            let inner = self.inner.clone();
974            Self {
975                inner,
976                accept_compression_encodings: self.accept_compression_encodings,
977                send_compression_encodings: self.send_compression_encodings,
978                max_decoding_message_size: self.max_decoding_message_size,
979                max_encoding_message_size: self.max_encoding_message_size,
980            }
981        }
982    }
983    /// Generated gRPC service name
984    pub const SERVICE_NAME: &str = "bilibili.broadcast.message.main.NativePage";
985    impl<T> tonic::server::NamedService for NativePageServer<T> {
986        const NAME: &'static str = SERVICE_NAME;
987    }
988}
989/// Generated server implementations.
990pub mod resource_server {
991    #![allow(
992        unused_variables,
993        dead_code,
994        missing_docs,
995        clippy::wildcard_imports,
996        clippy::let_unit_value,
997    )]
998    use tonic::codegen::*;
999    /// Generated trait containing gRPC methods that should be implemented for use with ResourceServer.
1000    #[async_trait]
1001    pub trait Resource: std::marker::Send + std::marker::Sync + 'static {
1002        ///
1003        async fn top_activity(
1004            &self,
1005            request: tonic::Request<()>,
1006        ) -> std::result::Result<
1007            tonic::Response<super::TopActivityReply>,
1008            tonic::Status,
1009        >;
1010    }
1011    ///
1012    #[derive(Debug)]
1013    pub struct ResourceServer<T> {
1014        inner: Arc<T>,
1015        accept_compression_encodings: EnabledCompressionEncodings,
1016        send_compression_encodings: EnabledCompressionEncodings,
1017        max_decoding_message_size: Option<usize>,
1018        max_encoding_message_size: Option<usize>,
1019    }
1020    impl<T> ResourceServer<T> {
1021        pub fn new(inner: T) -> Self {
1022            Self::from_arc(Arc::new(inner))
1023        }
1024        pub fn from_arc(inner: Arc<T>) -> Self {
1025            Self {
1026                inner,
1027                accept_compression_encodings: Default::default(),
1028                send_compression_encodings: Default::default(),
1029                max_decoding_message_size: None,
1030                max_encoding_message_size: None,
1031            }
1032        }
1033        pub fn with_interceptor<F>(
1034            inner: T,
1035            interceptor: F,
1036        ) -> InterceptedService<Self, F>
1037        where
1038            F: tonic::service::Interceptor,
1039        {
1040            InterceptedService::new(Self::new(inner), interceptor)
1041        }
1042        /// Enable decompressing requests with the given encoding.
1043        #[must_use]
1044        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1045            self.accept_compression_encodings.enable(encoding);
1046            self
1047        }
1048        /// Compress responses with the given encoding, if the client supports it.
1049        #[must_use]
1050        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1051            self.send_compression_encodings.enable(encoding);
1052            self
1053        }
1054        /// Limits the maximum size of a decoded message.
1055        ///
1056        /// Default: `4MB`
1057        #[must_use]
1058        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1059            self.max_decoding_message_size = Some(limit);
1060            self
1061        }
1062        /// Limits the maximum size of an encoded message.
1063        ///
1064        /// Default: `usize::MAX`
1065        #[must_use]
1066        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1067            self.max_encoding_message_size = Some(limit);
1068            self
1069        }
1070    }
1071    impl<T, B> tonic::codegen::Service<http::Request<B>> for ResourceServer<T>
1072    where
1073        T: Resource,
1074        B: Body + std::marker::Send + 'static,
1075        B::Error: Into<StdError> + std::marker::Send + 'static,
1076    {
1077        type Response = http::Response<tonic::body::BoxBody>;
1078        type Error = std::convert::Infallible;
1079        type Future = BoxFuture<Self::Response, Self::Error>;
1080        fn poll_ready(
1081            &mut self,
1082            _cx: &mut Context<'_>,
1083        ) -> Poll<std::result::Result<(), Self::Error>> {
1084            Poll::Ready(Ok(()))
1085        }
1086        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1087            match req.uri().path() {
1088                "/bilibili.broadcast.message.main.Resource/TopActivity" => {
1089                    #[allow(non_camel_case_types)]
1090                    struct TopActivitySvc<T: Resource>(pub Arc<T>);
1091                    impl<T: Resource> tonic::server::UnaryService<()>
1092                    for TopActivitySvc<T> {
1093                        type Response = super::TopActivityReply;
1094                        type Future = BoxFuture<
1095                            tonic::Response<Self::Response>,
1096                            tonic::Status,
1097                        >;
1098                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1099                            let inner = Arc::clone(&self.0);
1100                            let fut = async move {
1101                                <T as Resource>::top_activity(&inner, request).await
1102                            };
1103                            Box::pin(fut)
1104                        }
1105                    }
1106                    let accept_compression_encodings = self.accept_compression_encodings;
1107                    let send_compression_encodings = self.send_compression_encodings;
1108                    let max_decoding_message_size = self.max_decoding_message_size;
1109                    let max_encoding_message_size = self.max_encoding_message_size;
1110                    let inner = self.inner.clone();
1111                    let fut = async move {
1112                        let method = TopActivitySvc(inner);
1113                        let codec = tonic::codec::ProstCodec::default();
1114                        let mut grpc = tonic::server::Grpc::new(codec)
1115                            .apply_compression_config(
1116                                accept_compression_encodings,
1117                                send_compression_encodings,
1118                            )
1119                            .apply_max_message_size_config(
1120                                max_decoding_message_size,
1121                                max_encoding_message_size,
1122                            );
1123                        let res = grpc.unary(method, req).await;
1124                        Ok(res)
1125                    };
1126                    Box::pin(fut)
1127                }
1128                _ => {
1129                    Box::pin(async move {
1130                        let mut response = http::Response::new(empty_body());
1131                        let headers = response.headers_mut();
1132                        headers
1133                            .insert(
1134                                tonic::Status::GRPC_STATUS,
1135                                (tonic::Code::Unimplemented as i32).into(),
1136                            );
1137                        headers
1138                            .insert(
1139                                http::header::CONTENT_TYPE,
1140                                tonic::metadata::GRPC_CONTENT_TYPE,
1141                            );
1142                        Ok(response)
1143                    })
1144                }
1145            }
1146        }
1147    }
1148    impl<T> Clone for ResourceServer<T> {
1149        fn clone(&self) -> Self {
1150            let inner = self.inner.clone();
1151            Self {
1152                inner,
1153                accept_compression_encodings: self.accept_compression_encodings,
1154                send_compression_encodings: self.send_compression_encodings,
1155                max_decoding_message_size: self.max_decoding_message_size,
1156                max_encoding_message_size: self.max_encoding_message_size,
1157            }
1158        }
1159    }
1160    /// Generated gRPC service name
1161    pub const SERVICE_NAME: &str = "bilibili.broadcast.message.main.Resource";
1162    impl<T> tonic::server::NamedService for ResourceServer<T> {
1163        const NAME: &'static str = SERVICE_NAME;
1164    }
1165}
1166/// Generated server implementations.
1167pub mod search_server {
1168    #![allow(
1169        unused_variables,
1170        dead_code,
1171        missing_docs,
1172        clippy::wildcard_imports,
1173        clippy::let_unit_value,
1174    )]
1175    use tonic::codegen::*;
1176    /// Generated trait containing gRPC methods that should be implemented for use with SearchServer.
1177    #[async_trait]
1178    pub trait Search: std::marker::Send + std::marker::Sync + 'static {
1179        ///
1180        async fn chat_result_push(
1181            &self,
1182            request: tonic::Request<()>,
1183        ) -> std::result::Result<tonic::Response<super::ChatResult>, tonic::Status>;
1184    }
1185    ///
1186    #[derive(Debug)]
1187    pub struct SearchServer<T> {
1188        inner: Arc<T>,
1189        accept_compression_encodings: EnabledCompressionEncodings,
1190        send_compression_encodings: EnabledCompressionEncodings,
1191        max_decoding_message_size: Option<usize>,
1192        max_encoding_message_size: Option<usize>,
1193    }
1194    impl<T> SearchServer<T> {
1195        pub fn new(inner: T) -> Self {
1196            Self::from_arc(Arc::new(inner))
1197        }
1198        pub fn from_arc(inner: Arc<T>) -> Self {
1199            Self {
1200                inner,
1201                accept_compression_encodings: Default::default(),
1202                send_compression_encodings: Default::default(),
1203                max_decoding_message_size: None,
1204                max_encoding_message_size: None,
1205            }
1206        }
1207        pub fn with_interceptor<F>(
1208            inner: T,
1209            interceptor: F,
1210        ) -> InterceptedService<Self, F>
1211        where
1212            F: tonic::service::Interceptor,
1213        {
1214            InterceptedService::new(Self::new(inner), interceptor)
1215        }
1216        /// Enable decompressing requests with the given encoding.
1217        #[must_use]
1218        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1219            self.accept_compression_encodings.enable(encoding);
1220            self
1221        }
1222        /// Compress responses with the given encoding, if the client supports it.
1223        #[must_use]
1224        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1225            self.send_compression_encodings.enable(encoding);
1226            self
1227        }
1228        /// Limits the maximum size of a decoded message.
1229        ///
1230        /// Default: `4MB`
1231        #[must_use]
1232        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1233            self.max_decoding_message_size = Some(limit);
1234            self
1235        }
1236        /// Limits the maximum size of an encoded message.
1237        ///
1238        /// Default: `usize::MAX`
1239        #[must_use]
1240        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1241            self.max_encoding_message_size = Some(limit);
1242            self
1243        }
1244    }
1245    impl<T, B> tonic::codegen::Service<http::Request<B>> for SearchServer<T>
1246    where
1247        T: Search,
1248        B: Body + std::marker::Send + 'static,
1249        B::Error: Into<StdError> + std::marker::Send + 'static,
1250    {
1251        type Response = http::Response<tonic::body::BoxBody>;
1252        type Error = std::convert::Infallible;
1253        type Future = BoxFuture<Self::Response, Self::Error>;
1254        fn poll_ready(
1255            &mut self,
1256            _cx: &mut Context<'_>,
1257        ) -> Poll<std::result::Result<(), Self::Error>> {
1258            Poll::Ready(Ok(()))
1259        }
1260        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1261            match req.uri().path() {
1262                "/bilibili.broadcast.message.main.Search/ChatResultPush" => {
1263                    #[allow(non_camel_case_types)]
1264                    struct ChatResultPushSvc<T: Search>(pub Arc<T>);
1265                    impl<T: Search> tonic::server::UnaryService<()>
1266                    for ChatResultPushSvc<T> {
1267                        type Response = super::ChatResult;
1268                        type Future = BoxFuture<
1269                            tonic::Response<Self::Response>,
1270                            tonic::Status,
1271                        >;
1272                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1273                            let inner = Arc::clone(&self.0);
1274                            let fut = async move {
1275                                <T as Search>::chat_result_push(&inner, request).await
1276                            };
1277                            Box::pin(fut)
1278                        }
1279                    }
1280                    let accept_compression_encodings = self.accept_compression_encodings;
1281                    let send_compression_encodings = self.send_compression_encodings;
1282                    let max_decoding_message_size = self.max_decoding_message_size;
1283                    let max_encoding_message_size = self.max_encoding_message_size;
1284                    let inner = self.inner.clone();
1285                    let fut = async move {
1286                        let method = ChatResultPushSvc(inner);
1287                        let codec = tonic::codec::ProstCodec::default();
1288                        let mut grpc = tonic::server::Grpc::new(codec)
1289                            .apply_compression_config(
1290                                accept_compression_encodings,
1291                                send_compression_encodings,
1292                            )
1293                            .apply_max_message_size_config(
1294                                max_decoding_message_size,
1295                                max_encoding_message_size,
1296                            );
1297                        let res = grpc.unary(method, req).await;
1298                        Ok(res)
1299                    };
1300                    Box::pin(fut)
1301                }
1302                _ => {
1303                    Box::pin(async move {
1304                        let mut response = http::Response::new(empty_body());
1305                        let headers = response.headers_mut();
1306                        headers
1307                            .insert(
1308                                tonic::Status::GRPC_STATUS,
1309                                (tonic::Code::Unimplemented as i32).into(),
1310                            );
1311                        headers
1312                            .insert(
1313                                http::header::CONTENT_TYPE,
1314                                tonic::metadata::GRPC_CONTENT_TYPE,
1315                            );
1316                        Ok(response)
1317                    })
1318                }
1319            }
1320        }
1321    }
1322    impl<T> Clone for SearchServer<T> {
1323        fn clone(&self) -> Self {
1324            let inner = self.inner.clone();
1325            Self {
1326                inner,
1327                accept_compression_encodings: self.accept_compression_encodings,
1328                send_compression_encodings: self.send_compression_encodings,
1329                max_decoding_message_size: self.max_decoding_message_size,
1330                max_encoding_message_size: self.max_encoding_message_size,
1331            }
1332        }
1333    }
1334    /// Generated gRPC service name
1335    pub const SERVICE_NAME: &str = "bilibili.broadcast.message.main.Search";
1336    impl<T> tonic::server::NamedService for SearchServer<T> {
1337        const NAME: &'static str = SERVICE_NAME;
1338    }
1339}