1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Animate {
5 #[prost(string, tag = "1")]
7 pub icon: ::prost::alloc::string::String,
8 #[prost(string, tag = "2")]
10 pub json: ::prost::alloc::string::String,
11 #[prost(string, tag = "3")]
13 pub svg: ::prost::alloc::string::String,
14 #[prost(int32, tag = "4")]
16 pub r#loop: i32,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct ArticleCard {
21 #[prost(string, tag = "1")]
23 pub title: ::prost::alloc::string::String,
24 #[prost(string, tag = "2")]
26 pub desc: ::prost::alloc::string::String,
27 #[prost(string, tag = "3")]
29 pub cover: ::prost::alloc::string::String,
30 #[prost(string, tag = "4")]
32 pub author: ::prost::alloc::string::String,
33 #[prost(int64, tag = "5")]
35 pub mid: i64,
36 #[prost(int32, tag = "6")]
38 pub view: i32,
39 #[prost(int32, tag = "7")]
41 pub like: i32,
42 #[prost(int32, tag = "8")]
44 pub reply: i32,
45 #[prost(string, tag = "9")]
47 pub pub_time: ::prost::alloc::string::String,
48 #[prost(string, tag = "10")]
50 pub badge: ::prost::alloc::string::String,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct Bubble {
55 #[prost(message, repeated, tag = "1")]
57 pub paragraphs: ::prost::alloc::vec::Vec<
58 super::super::super::app::dynamic::v2::Paragraph,
59 >,
60 #[prost(message, repeated, tag = "2")]
62 pub item: ::prost::alloc::vec::Vec<CardItem>,
63}
64#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct CardItem {
67 #[prost(string, tag = "1")]
69 pub uri: ::prost::alloc::string::String,
70 #[prost(string, tag = "2")]
72 pub param: ::prost::alloc::string::String,
73 #[prost(string, tag = "3")]
75 pub goto: ::prost::alloc::string::String,
76 #[prost(oneof = "card_item::CardItem", tags = "4, 5")]
78 pub card_item: ::core::option::Option<card_item::CardItem>,
79}
80pub mod card_item {
82 #[derive(Clone, PartialEq, ::prost::Oneof)]
84 pub enum CardItem {
85 #[prost(message, tag = "4")]
87 Article(super::ArticleCard),
88 #[prost(message, tag = "5")]
90 Av(super::VideoCard),
91 }
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct ChatResult {
96 #[prost(int32, tag = "1")]
98 pub code: i32,
99 #[prost(string, tag = "2")]
101 pub session_id: ::prost::alloc::string::String,
102 #[prost(message, repeated, tag = "3")]
104 pub bubbles: ::prost::alloc::vec::Vec<Bubble>,
105 #[prost(string, tag = "4")]
107 pub rewrite_word: ::prost::alloc::string::String,
108 #[prost(string, tag = "5")]
110 pub title: ::prost::alloc::string::String,
111 #[prost(string, tag = "6")]
113 pub business: ::prost::alloc::string::String,
114 #[prost(int64, tag = "7")]
116 pub message_id: i64,
117 #[prost(enumeration = "LikeState", tag = "8")]
119 pub like_state: i32,
120 #[prost(int64, tag = "9")]
122 pub like_number: i64,
123}
124#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct CommandDm {
127 #[prost(int64, tag = "1")]
129 pub id: i64,
130 #[prost(int64, tag = "2")]
132 pub oid: i64,
133 #[prost(int64, tag = "3")]
135 pub mid: i64,
136 #[prost(int32, tag = "4")]
138 pub r#type: i32,
139 #[prost(string, tag = "5")]
141 pub command: ::prost::alloc::string::String,
142 #[prost(string, tag = "6")]
144 pub content: ::prost::alloc::string::String,
145 #[prost(int32, tag = "7")]
147 pub state: i32,
148 #[prost(int32, tag = "8")]
150 pub progress: i32,
151 #[prost(string, tag = "9")]
153 pub ctime: ::prost::alloc::string::String,
154 #[prost(string, tag = "10")]
156 pub mtime: ::prost::alloc::string::String,
157 #[prost(string, tag = "11")]
159 pub extra: ::prost::alloc::string::String,
160 #[prost(string, tag = "12")]
162 pub id_str: ::prost::alloc::string::String,
163}
164#[derive(Clone, PartialEq, ::prost::Message)]
166pub struct DanmakuElem {
167 #[prost(int64, tag = "1")]
169 pub id: i64,
170 #[prost(int32, tag = "2")]
172 pub progress: i32,
173 #[prost(int32, tag = "3")]
175 pub mode: i32,
176 #[prost(int32, tag = "4")]
178 pub fontsize: i32,
179 #[prost(int32, tag = "5")]
181 pub color: i32,
182 #[prost(string, tag = "6")]
184 pub mid_hash: ::prost::alloc::string::String,
185 #[prost(string, tag = "7")]
187 pub content: ::prost::alloc::string::String,
188 #[prost(int64, tag = "8")]
190 pub ctime: i64,
191 #[prost(string, tag = "9")]
193 pub action: ::prost::alloc::string::String,
194 #[prost(int32, tag = "10")]
196 pub pool: i32,
197 #[prost(string, tag = "11")]
199 pub id_str: ::prost::alloc::string::String,
200 #[prost(int32, tag = "12")]
202 pub weight: i32,
203 #[prost(int32, tag = "13")]
205 pub attr: i32,
206 #[prost(string, tag = "14")]
208 pub animation: ::prost::alloc::string::String,
209}
210#[derive(Clone, PartialEq, ::prost::Message)]
212pub struct DanmukuEvent {
213 #[prost(message, repeated, tag = "1")]
215 pub elems: ::prost::alloc::vec::Vec<DanmakuElem>,
216}
217#[derive(Clone, PartialEq, ::prost::Message)]
219pub struct EventItem {
220 #[prost(int64, tag = "1")]
222 pub item_i_d: i64,
223 #[prost(string, tag = "2")]
225 pub r#type: ::prost::alloc::string::String,
226 #[prost(int64, tag = "3")]
228 pub num: i64,
229 #[prost(string, tag = "4")]
231 pub display_num: ::prost::alloc::string::String,
232 #[prost(string, tag = "5")]
234 pub web_key: ::prost::alloc::string::String,
235 #[prost(int64, tag = "6")]
237 pub dimension: i64,
238}
239#[derive(Clone, PartialEq, ::prost::Message)]
241pub struct HistoryReportEvent {
242 #[prost(int64, tag = "1")]
244 pub aid: i64,
245 #[prost(int32, tag = "2")]
247 pub r#type: i32,
248 #[prost(int64, tag = "3")]
250 pub cid: i64,
251 #[prost(int64, tag = "4")]
253 pub epid: i64,
254 #[prost(int64, tag = "5")]
256 pub sid: i64,
257 #[prost(int32, tag = "6")]
259 pub sub_type: i32,
260 #[prost(int32, tag = "7")]
262 pub dt: i32,
263 #[prost(int64, tag = "8")]
265 pub realtime: i64,
266 #[prost(string, tag = "9")]
268 pub source: ::prost::alloc::string::String,
269 #[prost(int64, tag = "10")]
271 pub progress: i64,
272 #[prost(int64, tag = "11")]
274 pub duration: i64,
275 #[prost(string, tag = "12")]
277 pub platform: ::prost::alloc::string::String,
278 #[prost(string, tag = "13")]
280 pub device: ::prost::alloc::string::String,
281 #[prost(int64, tag = "14")]
283 pub play_time: i64,
284 #[prost(string, tag = "15")]
286 pub statistics: ::prost::alloc::string::String,
287 #[prost(int64, tag = "16")]
289 pub start_ts: i64,
290 #[prost(int64, tag = "17")]
292 pub device_ts: i64,
293 #[prost(string, tag = "18")]
295 pub scene: ::prost::alloc::string::String,
296}
297#[derive(Clone, PartialEq, ::prost::Message)]
299pub struct NativePageEvent {
300 #[prost(int64, tag = "1")]
302 pub page_i_d: i64,
303 #[prost(message, repeated, tag = "2")]
305 pub items: ::prost::alloc::vec::Vec<EventItem>,
306}
307#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct ReasonStyle {
310 #[prost(string, tag = "1")]
312 pub text: ::prost::alloc::string::String,
313 #[prost(string, tag = "2")]
315 pub text_color: ::prost::alloc::string::String,
316 #[prost(string, tag = "3")]
318 pub text_color_night: ::prost::alloc::string::String,
319 #[prost(string, tag = "4")]
321 pub bg_color: ::prost::alloc::string::String,
322 #[prost(string, tag = "5")]
324 pub bg_color_night: ::prost::alloc::string::String,
325 #[prost(string, tag = "6")]
327 pub border_color: ::prost::alloc::string::String,
328 #[prost(string, tag = "7")]
330 pub border_color_night: ::prost::alloc::string::String,
331 #[prost(int32, tag = "8")]
333 pub bg_style: i32,
334}
335#[derive(Clone, Copy, PartialEq, ::prost::Message)]
337pub struct RedDot {
338 #[prost(int32, tag = "1")]
340 pub r#type: i32,
341 #[prost(int32, tag = "2")]
343 pub number: i32,
344}
345#[derive(Clone, Copy, PartialEq, ::prost::Message)]
347pub struct Stats {
348 #[prost(int32, tag = "1")]
350 pub like: i32,
351 #[prost(int32, tag = "2")]
353 pub coin: i32,
354 #[prost(int32, tag = "3")]
356 pub fav: i32,
357 #[prost(int32, tag = "4")]
359 pub share: i32,
360}
361#[derive(Clone, PartialEq, ::prost::Message)]
363pub struct TopActivityReply {
364 #[prost(message, optional, tag = "1")]
366 pub online: ::core::option::Option<TopOnline>,
367 #[prost(string, tag = "2")]
369 pub hash: ::prost::alloc::string::String,
370}
371#[derive(Clone, PartialEq, ::prost::Message)]
373pub struct TopOnline {
374 #[prost(int32, tag = "1")]
376 pub r#type: i32,
377 #[prost(string, tag = "2")]
379 pub icon: ::prost::alloc::string::String,
380 #[prost(string, tag = "3")]
382 pub uri: ::prost::alloc::string::String,
383 #[prost(string, tag = "4")]
385 pub unique_id: ::prost::alloc::string::String,
386 #[prost(message, optional, tag = "5")]
388 pub animate: ::core::option::Option<Animate>,
389 #[prost(message, optional, tag = "6")]
391 pub red_dot: ::core::option::Option<RedDot>,
392 #[prost(string, tag = "7")]
394 pub name: ::prost::alloc::string::String,
395 #[prost(int64, tag = "8")]
397 pub interval: i64,
398}
399#[derive(Clone, PartialEq, ::prost::Message)]
401pub struct VideoCard {
402 #[prost(string, tag = "1")]
404 pub title: ::prost::alloc::string::String,
405 #[prost(string, tag = "2")]
407 pub desc: ::prost::alloc::string::String,
408 #[prost(string, tag = "3")]
410 pub cover: ::prost::alloc::string::String,
411 #[prost(string, tag = "4")]
413 pub author: ::prost::alloc::string::String,
414 #[prost(string, tag = "5")]
416 pub duration: ::prost::alloc::string::String,
417 #[prost(message, repeated, tag = "6")]
419 pub new_rec_tags: ::prost::alloc::vec::Vec<ReasonStyle>,
420 #[prost(message, repeated, tag = "7")]
422 pub badges: ::prost::alloc::vec::Vec<ReasonStyle>,
423 #[prost(string, tag = "8")]
425 pub show_card_desc2: ::prost::alloc::string::String,
426 #[prost(string, tag = "9")]
428 pub view_content: ::prost::alloc::string::String,
429 #[prost(int32, tag = "10")]
431 pub icon_type: i32,
432}
433#[derive(Clone, Copy, PartialEq, ::prost::Message)]
435pub struct ViewPush {
436 #[prost(message, optional, tag = "1")]
438 pub stats: ::core::option::Option<Stats>,
439 #[prost(int64, tag = "2")]
441 pub aid: i64,
442 #[prost(int64, tag = "3")]
444 pub up_time: i64,
445}
446#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
448#[repr(i32)]
449pub enum LikeState {
450 Default = 0,
452 Like = 1,
454 Dislike = 2,
456}
457impl LikeState {
458 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 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}
479pub 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 #[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 #[must_use]
534 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
535 self.inner = self.inner.send_compressed(encoding);
536 self
537 }
538 #[must_use]
540 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
541 self.inner = self.inner.accept_compressed(encoding);
542 self
543 }
544 #[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 #[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 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}
592pub 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 #[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 #[must_use]
647 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
648 self.inner = self.inner.send_compressed(encoding);
649 self
650 }
651 #[must_use]
653 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
654 self.inner = self.inner.accept_compressed(encoding);
655 self
656 }
657 #[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 #[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 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}
705pub 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 #[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 #[must_use]
760 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
761 self.inner = self.inner.send_compressed(encoding);
762 self
763 }
764 #[must_use]
766 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
767 self.inner = self.inner.accept_compressed(encoding);
768 self
769 }
770 #[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 #[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 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}
815pub 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 #[async_trait]
827 pub trait NativePage: std::marker::Send + std::marker::Sync + 'static {
828 async fn watch_notify(
830 &self,
831 request: tonic::Request<()>,
832 ) -> std::result::Result<tonic::Response<super::NativePageEvent>, tonic::Status>;
833 }
834 #[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 #[must_use]
867 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
868 self.accept_compression_encodings.enable(encoding);
869 self
870 }
871 #[must_use]
873 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
874 self.send_compression_encodings.enable(encoding);
875 self
876 }
877 #[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 #[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 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}
989pub 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 #[async_trait]
1001 pub trait Resource: std::marker::Send + std::marker::Sync + 'static {
1002 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 #[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 #[must_use]
1044 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1045 self.accept_compression_encodings.enable(encoding);
1046 self
1047 }
1048 #[must_use]
1050 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1051 self.send_compression_encodings.enable(encoding);
1052 self
1053 }
1054 #[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 #[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 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}
1166pub 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 #[async_trait]
1178 pub trait Search: std::marker::Send + std::marker::Sync + 'static {
1179 async fn chat_result_push(
1181 &self,
1182 request: tonic::Request<()>,
1183 ) -> std::result::Result<tonic::Response<super::ChatResult>, tonic::Status>;
1184 }
1185 #[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 #[must_use]
1218 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1219 self.accept_compression_encodings.enable(encoding);
1220 self
1221 }
1222 #[must_use]
1224 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1225 self.send_compression_encodings.enable(encoding);
1226 self
1227 }
1228 #[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 #[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 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}