1#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Animation {
5 #[prost(string, tag = "1")]
7 pub resource_name: ::prost::alloc::string::String,
8 #[prost(string, tag = "2")]
10 pub file_name: ::prost::alloc::string::String,
11 #[prost(string, tag = "3")]
13 pub animation_url: ::prost::alloc::string::String,
14 #[prost(int64, tag = "4")]
16 pub width: i64,
17 #[prost(int64, tag = "5")]
19 pub height: i64,
20 #[prost(int64, tag = "6")]
22 pub r#type: i64,
23}
24#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct AudioCmdMsg {
27 #[prost(enumeration = "AudioCmdType", tag = "1")]
29 pub cmd: i32,
30 #[prost(message, optional, tag = "2")]
32 pub extra: ::core::option::Option<AudioCmdMsgExtra>,
33}
34#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct AudioCmdMsgExtra {
37 #[prost(message, optional, tag = "1")]
39 pub invitation_mic: ::core::option::Option<AudioCmdMsgExtraForInvitationMic>,
40 #[prost(message, optional, tag = "2")]
42 pub reject_mic: ::core::option::Option<AudioCmdMsgExtraForRejectMic>,
43 #[prost(message, optional, tag = "3")]
45 pub audio_room_info: ::core::option::Option<AudioCmdMsgExtraForRoomInfo>,
46 #[prost(message, optional, tag = "4")]
48 pub audio_room_apply_count: ::core::option::Option<
49 AudioCmdMsgExtraForRoomApplyCount,
50 >,
51 #[prost(message, optional, tag = "5")]
53 pub audio_room_seat_info: ::core::option::Option<AudioCmdMsgExtraForRoomSeatsInfo>,
54 #[prost(message, optional, tag = "6")]
56 pub set_seat_mute: ::core::option::Option<AudioCmdMsgExtraForSetSeatMute>,
57 #[prost(message, optional, tag = "7")]
59 pub update_rtc_token: ::core::option::Option<AudioCmdMsgExtraForUpdateRtcToken>,
60 #[prost(message, optional, tag = "8")]
62 pub contribution: ::core::option::Option<AudioCmdMsgExtraForContribution>,
63 #[prost(message, optional, tag = "9")]
65 pub blacklist: ::core::option::Option<AudioCmdMsgExtraForBlacklist>,
66}
67#[derive(Clone, Copy, PartialEq, ::prost::Message)]
69pub struct AudioCmdMsgExtraForBlacklist {
70 #[prost(bool, tag = "1")]
72 pub state: bool,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
76pub struct AudioCmdMsgExtraForContribution {
77 #[prost(string, tag = "1")]
79 pub contribution: ::prost::alloc::string::String,
80}
81#[derive(Clone, Copy, PartialEq, ::prost::Message)]
83pub struct AudioCmdMsgExtraForInvitationMic {
84 #[prost(int64, tag = "1")]
86 pub duration: i64,
87}
88#[derive(Clone, PartialEq, ::prost::Message)]
90pub struct AudioCmdMsgExtraForRejectMic {
91 #[prost(string, tag = "1")]
93 pub nickname: ::prost::alloc::string::String,
94}
95#[derive(Clone, Copy, PartialEq, ::prost::Message)]
97pub struct AudioCmdMsgExtraForRoomApplyCount {
98 #[prost(int64, tag = "1")]
100 pub count: i64,
101}
102#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct AudioCmdMsgExtraForRoomInfo {
105 #[prost(int64, tag = "1")]
107 pub room_id: i64,
108 #[prost(string, tag = "2")]
110 pub channel_name: ::prost::alloc::string::String,
111 #[prost(int64, tag = "3")]
113 pub mid: i64,
114 #[prost(string, tag = "4")]
116 pub title: ::prost::alloc::string::String,
117 #[prost(string, tag = "5")]
119 pub cover: ::prost::alloc::string::String,
120 #[prost(string, tag = "6")]
122 pub description: ::prost::alloc::string::String,
123 #[prost(string, tag = "7")]
125 pub music: ::prost::alloc::string::String,
126 #[prost(string, tag = "8")]
128 pub bg: ::prost::alloc::string::String,
129 #[prost(bool, tag = "9")]
131 pub need_apply: bool,
132 #[prost(int64, tag = "10")]
134 pub create_time: i64,
135 #[prost(int64, tag = "11")]
137 pub seat_count: i64,
138}
139#[derive(Clone, PartialEq, ::prost::Message)]
141pub struct AudioCmdMsgExtraForRoomSeatsInfo {
142 #[prost(message, repeated, tag = "1")]
144 pub room_seats: ::prost::alloc::vec::Vec<AuditRoomSeatInfo>,
145}
146#[derive(Clone, Copy, PartialEq, ::prost::Message)]
148pub struct AudioCmdMsgExtraForSetSeatMute {
149 #[prost(bool, tag = "1")]
151 pub mute: bool,
152}
153#[derive(Clone, PartialEq, ::prost::Message)]
155pub struct AudioCmdMsgExtraForUpdateRtcToken {
156 #[prost(string, tag = "1")]
158 pub rtc_token: ::prost::alloc::string::String,
159}
160#[derive(Clone, PartialEq, ::prost::Message)]
162pub struct AudioLevelUpMsg {
163 #[prost(string, tag = "1")]
165 pub user_name: ::prost::alloc::string::String,
166 #[prost(int64, tag = "2")]
168 pub user_id: i64,
169 #[prost(int64, tag = "3")]
171 pub level: i64,
172 #[prost(string, tag = "4")]
174 pub left_icon: ::prost::alloc::string::String,
175 #[prost(string, tag = "5")]
177 pub right_icon: ::prost::alloc::string::String,
178 #[prost(string, tag = "6")]
180 pub bg_color: ::prost::alloc::string::String,
181 #[prost(int64, tag = "7")]
183 pub room_id: i64,
184}
185#[derive(Clone, PartialEq, ::prost::Message)]
187pub struct AudioRoomSeatUser {
188 #[prost(int64, tag = "1")]
190 pub mid: i64,
191 #[prost(string, tag = "2")]
193 pub nickname: ::prost::alloc::string::String,
194 #[prost(string, tag = "3")]
196 pub avatar: ::prost::alloc::string::String,
197 #[prost(bool, tag = "4")]
199 pub mute_audio: bool,
200 #[prost(string, tag = "5")]
202 pub send_gift_num: ::prost::alloc::string::String,
203 #[prost(string, tag = "6")]
205 pub receive_gift_num: ::prost::alloc::string::String,
206 #[prost(int64, tag = "7")]
208 pub connect_status: i64,
209}
210#[derive(Clone, PartialEq, ::prost::Message)]
212pub struct AuditRoomSeatInfo {
213 #[prost(int64, tag = "1")]
215 pub seat_index: i64,
216 #[prost(bool, tag = "2")]
218 pub mute_audio: bool,
219 #[prost(message, optional, tag = "3")]
221 pub user: ::core::option::Option<AudioRoomSeatUser>,
222}
223#[derive(Clone, PartialEq, ::prost::Message)]
225pub struct Author {
226 #[prost(int64, tag = "1")]
228 pub mid: i64,
229 #[prost(string, tag = "2")]
231 pub name: ::prost::alloc::string::String,
232 #[prost(int32, tag = "3")]
234 pub rank: i32,
235 #[prost(string, tag = "4")]
237 pub avatar: ::prost::alloc::string::String,
238}
239#[derive(Clone, PartialEq, ::prost::Message)]
241pub struct BlockInfo {
242 #[prost(string, tag = "1")]
244 pub notice: ::prost::alloc::string::String,
245 #[prost(int64, tag = "2")]
247 pub end_time: i64,
248}
249#[derive(Clone, PartialEq, ::prost::Message)]
251pub struct Combo {
252 #[prost(message, optional, tag = "1")]
254 pub author: ::core::option::Option<Author>,
255 #[prost(string, tag = "2")]
257 pub action: ::prost::alloc::string::String,
258 #[prost(message, optional, tag = "3")]
260 pub treasure: ::core::option::Option<Treasure>,
261 #[prost(message, optional, tag = "4")]
263 pub style: ::core::option::Option<ComboStyle>,
264 #[prost(string, tag = "5")]
266 pub combo_id: ::prost::alloc::string::String,
267 #[prost(int64, repeated, tag = "6")]
269 pub target_mids: ::prost::alloc::vec::Vec<i64>,
270}
271#[derive(Clone, PartialEq, ::prost::Message)]
273pub struct ComboStyle {
274 #[prost(string, tag = "1")]
276 pub bg_color_start: ::prost::alloc::string::String,
277 #[prost(string, tag = "2")]
279 pub bg_color_end: ::prost::alloc::string::String,
280 #[prost(string, tag = "3")]
282 pub gift_color: ::prost::alloc::string::String,
283 #[prost(string, tag = "4")]
285 pub name_color: ::prost::alloc::string::String,
286 #[prost(int32, tag = "5")]
288 pub gift_num_size: i32,
289 #[prost(int64, tag = "6")]
291 pub duration: i64,
292 #[prost(int64, tag = "7")]
294 pub period: i64,
295 #[prost(string, tag = "8")]
297 pub bg_color_center: ::prost::alloc::string::String,
298 #[prost(string, tag = "9")]
300 pub gift_num_color: ::prost::alloc::string::String,
301}
302#[derive(Clone, PartialEq, ::prost::Message)]
304pub struct DmEventReply {
305 #[prost(message, repeated, tag = "1")]
307 pub items: ::prost::alloc::vec::Vec<DmItem>,
308}
309#[derive(Clone, PartialEq, ::prost::Message)]
311pub struct DmEventReplyI18n {
312 #[prost(map = "string, message", tag = "1")]
314 pub items_i18_n: ::std::collections::HashMap<
315 ::prost::alloc::string::String,
316 DmEventReply,
317 >,
318}
319#[derive(Clone, PartialEq, ::prost::Message)]
321pub struct DmItem {
322 #[prost(enumeration = "DmType", tag = "1")]
324 pub cmd: i32,
325 #[prost(string, tag = "2")]
327 pub message: ::prost::alloc::string::String,
328 #[prost(message, optional, tag = "3")]
330 pub author: ::core::option::Option<Author>,
331 #[prost(int64, tag = "4")]
333 pub room_i_d: i64,
334 #[prost(int64, tag = "5")]
336 pub delay: i64,
337 #[prost(int64, tag = "6")]
339 pub c_time: i64,
340 #[prost(message, optional, tag = "7")]
342 pub reply_to: ::core::option::Option<Author>,
343 #[prost(message, optional, tag = "8")]
345 pub style: ::core::option::Option<Style>,
346 #[prost(message, optional, tag = "9")]
348 pub sticker: ::core::option::Option<Sticker>,
349 #[prost(message, optional, tag = "10")]
351 pub top_user: ::core::option::Option<TopUser>,
352 #[prost(message, repeated, tag = "11")]
354 pub message_list: ::prost::alloc::vec::Vec<MessageItem>,
355 #[prost(message, repeated, tag = "12")]
357 pub combos: ::prost::alloc::vec::Vec<Combo>,
358 #[prost(string, tag = "13")]
360 pub msg_id: ::prost::alloc::string::String,
361 #[prost(string, tag = "14")]
363 pub live_key: ::prost::alloc::string::String,
364 #[prost(message, optional, tag = "15")]
366 pub popup_info: ::core::option::Option<PopupInfo>,
367 #[prost(message, optional, tag = "16")]
369 pub block_info: ::core::option::Option<BlockInfo>,
370 #[prost(message, optional, tag = "17")]
372 pub likes: ::core::option::Option<Likes>,
373 #[prost(message, optional, tag = "18")]
375 pub recharge_bar_info: ::core::option::Option<RechargeBarInfo>,
376 #[prost(message, optional, tag = "19")]
378 pub audio_cmd_msg: ::core::option::Option<AudioCmdMsg>,
379 #[prost(message, optional, tag = "20")]
381 pub global_gift_broadcast: ::core::option::Option<GlobalGiftBroadcastMsg>,
382 #[prost(message, optional, tag = "21")]
384 pub audio_level_up_msg: ::core::option::Option<AudioLevelUpMsg>,
385}
386#[derive(Clone, PartialEq, ::prost::Message)]
388pub struct GlobalGiftBroadcastMsg {
389 #[prost(string, tag = "1")]
391 pub giver_avatar: ::prost::alloc::string::String,
392 #[prost(string, tag = "2")]
394 pub giver_name: ::prost::alloc::string::String,
395 #[prost(int64, tag = "3")]
397 pub giver_id: i64,
398 #[prost(string, tag = "4")]
400 pub receiver_avatar: ::prost::alloc::string::String,
401 #[prost(string, tag = "5")]
403 pub receiver_name: ::prost::alloc::string::String,
404 #[prost(int64, tag = "6")]
406 pub receiver_id: i64,
407 #[prost(string, tag = "7")]
409 pub action_name: ::prost::alloc::string::String,
410 #[prost(int64, tag = "8")]
412 pub treasure_number: i64,
413 #[prost(string, tag = "9")]
415 pub treasure_icon: ::prost::alloc::string::String,
416 #[prost(string, tag = "10")]
418 pub treasure_name: ::prost::alloc::string::String,
419 #[prost(int64, tag = "11")]
421 pub room_id: i64,
422 #[prost(string, tag = "12")]
424 pub left_icon: ::prost::alloc::string::String,
425 #[prost(string, tag = "13")]
427 pub right_icon: ::prost::alloc::string::String,
428 #[prost(string, tag = "14")]
430 pub bg_color: ::prost::alloc::string::String,
431}
432#[derive(Clone, Copy, PartialEq, ::prost::Message)]
434pub struct Likes {
435 #[prost(int64, tag = "1")]
437 pub number: i64,
438}
439#[derive(Clone, PartialEq, ::prost::Message)]
441pub struct MessageItem {
442 #[prost(enumeration = "MessageItemType", tag = "1")]
444 pub r#type: i32,
445 #[prost(string, tag = "2")]
447 pub content: ::prost::alloc::string::String,
448 #[prost(string, tag = "3")]
450 pub color: ::prost::alloc::string::String,
451 #[prost(bool, tag = "4")]
453 pub bold: bool,
454 #[prost(string, tag = "5")]
456 pub icon_name: ::prost::alloc::string::String,
457 #[prost(string, tag = "6")]
459 pub icon_url: ::prost::alloc::string::String,
460 #[prost(int32, tag = "7")]
462 pub width: i32,
463 #[prost(int32, tag = "8")]
465 pub height: i32,
466 #[prost(string, tag = "9")]
468 pub bg_color: ::prost::alloc::string::String,
469 #[prost(enumeration = "MessageItemSubType", tag = "10")]
471 pub sub_type: i32,
472 #[prost(int64, tag = "11")]
474 pub treasure_id: i64,
475 #[prost(int64, tag = "12")]
477 pub mid: i64,
478}
479#[derive(Clone, PartialEq, ::prost::Message)]
481pub struct MsgNotify {
482 #[prost(enumeration = "MsgNotifyCmd", tag = "1")]
484 pub cmd: i32,
485 #[prost(message, optional, tag = "2")]
487 pub entity: ::core::option::Option<::prost_types::Any>,
488}
489#[derive(Clone, PartialEq, ::prost::Message)]
491pub struct Notify {
492 #[prost(int64, tag = "1")]
494 pub notify_id: i64,
495 #[prost(int64, tag = "2")]
497 pub card_type: i64,
498 #[prost(message, optional, tag = "3")]
500 pub content: ::core::option::Option<NotifyContent>,
501 #[prost(message, optional, tag = "4")]
503 pub rule: ::core::option::Option<NotifyRule>,
504}
505#[derive(Clone, PartialEq, ::prost::Message)]
507pub struct NotifyButton {
508 #[prost(string, tag = "1")]
510 pub name: ::prost::alloc::string::String,
511 #[prost(enumeration = "NotifyActionType", tag = "2")]
513 pub action: i32,
514}
515#[derive(Clone, PartialEq, ::prost::Message)]
517pub struct NotifyContent {
518 #[prost(int64, tag = "1")]
520 pub id: i64,
521 #[prost(string, tag = "2")]
523 pub title: ::prost::alloc::string::String,
524 #[prost(string, tag = "3")]
526 pub sub_title: ::prost::alloc::string::String,
527 #[prost(string, tag = "4")]
529 pub icon_title: ::prost::alloc::string::String,
530 #[prost(string, tag = "5")]
532 pub icon_sub_title: ::prost::alloc::string::String,
533 #[prost(string, tag = "6")]
535 pub icon: ::prost::alloc::string::String,
536 #[prost(string, tag = "7")]
538 pub url: ::prost::alloc::string::String,
539 #[prost(message, optional, tag = "8")]
541 pub button: ::core::option::Option<NotifyButton>,
542 #[prost(string, tag = "9")]
544 pub union_id: ::prost::alloc::string::String,
545 #[prost(message, optional, tag = "10")]
547 pub extra: ::core::option::Option<NotifyContentExtra>,
548}
549#[derive(Clone, Copy, PartialEq, ::prost::Message)]
551pub struct NotifyContentExtra {
552 #[prost(bool, tag = "1")]
554 pub multi_seasons: bool,
555 #[prost(int64, tag = "2")]
557 pub fav_season_id: i64,
558}
559#[derive(Clone, Copy, PartialEq, ::prost::Message)]
561pub struct NotifyPullImMsg {
562 #[prost(int64, tag = "1")]
564 pub mid: i64,
565 #[prost(int64, tag = "2")]
567 pub max_seq_id: i64,
568}
569#[derive(Clone, PartialEq, ::prost::Message)]
571pub struct NotifyRule {
572 #[prost(int64, tag = "1")]
574 pub show_time: i64,
575 #[prost(int64, tag = "2")]
577 pub show_type: i64,
578 #[prost(int64, tag = "3")]
580 pub show_times: i64,
581 #[prost(string, repeated, tag = "4")]
583 pub exempt_pages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
584}
585#[derive(Clone, PartialEq, ::prost::Message)]
587pub struct PopupInfo {
588 #[prost(message, repeated, tag = "1")]
590 pub popup_info_list: ::prost::alloc::vec::Vec<PopupInfoItem>,
591 #[prost(int64, tag = "2")]
593 pub duration: i64,
594}
595#[derive(Clone, PartialEq, ::prost::Message)]
597pub struct PopupInfoItem {
598 #[prost(enumeration = "PopupItemType", tag = "1")]
600 pub r#type: i32,
601 #[prost(enumeration = "PopupItemPosition", tag = "2")]
603 pub positon: i32,
604 #[prost(string, tag = "3")]
606 pub content: ::prost::alloc::string::String,
607 #[prost(string, tag = "4")]
609 pub color: ::prost::alloc::string::String,
610 #[prost(bool, tag = "5")]
612 pub bold: bool,
613 #[prost(string, tag = "6")]
615 pub icon_name: ::prost::alloc::string::String,
616 #[prost(string, tag = "7")]
618 pub icon_url: ::prost::alloc::string::String,
619 #[prost(int64, tag = "8")]
621 pub width: i64,
622 #[prost(int64, tag = "9")]
624 pub height: i64,
625 #[prost(string, tag = "10")]
627 pub bg_color: ::prost::alloc::string::String,
628}
629#[derive(Clone, PartialEq, ::prost::Message)]
631pub struct RechargeBarColor {
632 #[prost(string, tag = "1")]
634 pub content_color: ::prost::alloc::string::String,
635 #[prost(string, tag = "2")]
637 pub gradient_color_start: ::prost::alloc::string::String,
638 #[prost(string, tag = "3")]
640 pub gradient_color_end: ::prost::alloc::string::String,
641}
642#[derive(Clone, PartialEq, ::prost::Message)]
644pub struct RechargeBarInfo {
645 #[prost(string, tag = "1")]
647 pub name: ::prost::alloc::string::String,
648 #[prost(string, tag = "2")]
650 pub level: ::prost::alloc::string::String,
651 #[prost(string, tag = "3")]
653 pub icon: ::prost::alloc::string::String,
654 #[prost(message, optional, tag = "4")]
656 pub color: ::core::option::Option<RechargeBarColor>,
657 #[prost(message, optional, tag = "5")]
659 pub notice: ::core::option::Option<RechargeBarNotice>,
660 #[prost(string, tag = "6")]
662 pub target_url: ::prost::alloc::string::String,
663 #[prost(int64, tag = "7")]
665 pub current_point: i64,
666 #[prost(int64, tag = "8")]
668 pub min_point: i64,
669 #[prost(int64, tag = "9")]
671 pub max_point: i64,
672}
673#[derive(Clone, PartialEq, ::prost::Message)]
675pub struct RechargeBarNotice {
676 #[prost(string, tag = "1")]
678 pub content: ::prost::alloc::string::String,
679 #[prost(int64, tag = "2")]
681 pub delay: i64,
682 #[prost(int64, tag = "3")]
684 pub duration: i64,
685}
686#[derive(Clone, PartialEq, ::prost::Message)]
688pub struct Sticker {
689 #[prost(int64, tag = "1")]
691 pub i_d: i64,
692 #[prost(string, tag = "2")]
694 pub title: ::prost::alloc::string::String,
695 #[prost(string, tag = "3")]
697 pub icon: ::prost::alloc::string::String,
698 #[prost(int64, tag = "4")]
700 pub number: i64,
701}
702#[derive(Clone, PartialEq, ::prost::Message)]
704pub struct Style {
705 #[prost(string, tag = "1")]
707 pub name_color: ::prost::alloc::string::String,
708 #[prost(string, tag = "2")]
710 pub content_color: ::prost::alloc::string::String,
711 #[prost(string, tag = "3")]
713 pub bg_color: ::prost::alloc::string::String,
714 #[prost(bool, tag = "4")]
716 pub is_bold: bool,
717 #[prost(bool, tag = "5")]
719 pub play_area_hidden: bool,
720}
721#[derive(Clone, PartialEq, ::prost::Message)]
723pub struct TopUser {
724 #[prost(string, tag = "1")]
726 pub paid_user_num: ::prost::alloc::string::String,
727 #[prost(message, repeated, tag = "2")]
729 pub users: ::prost::alloc::vec::Vec<User>,
730 #[prost(int64, tag = "3")]
732 pub online_user_num: i64,
733}
734#[derive(Clone, PartialEq, ::prost::Message)]
736pub struct Treasure {
737 #[prost(int64, tag = "1")]
739 pub id: i64,
740 #[prost(string, tag = "2")]
742 pub title: ::prost::alloc::string::String,
743 #[prost(string, tag = "3")]
745 pub icon: ::prost::alloc::string::String,
746 #[prost(int64, tag = "4")]
748 pub number: i64,
749 #[prost(int64, tag = "5")]
751 pub stars: i64,
752 #[prost(message, optional, tag = "6")]
754 pub animation: ::core::option::Option<Animation>,
755 #[prost(int64, tag = "7")]
757 pub animation_type: i64,
758 #[prost(message, repeated, tag = "8")]
760 pub animation_list: ::prost::alloc::vec::Vec<Animation>,
761 #[prost(string, tag = "9")]
763 pub flow_icon: ::prost::alloc::string::String,
764}
765#[derive(Clone, PartialEq, ::prost::Message)]
767pub struct User {
768 #[prost(int64, tag = "1")]
770 pub mid: i64,
771 #[prost(string, tag = "2")]
773 pub name: ::prost::alloc::string::String,
774 #[prost(string, tag = "3")]
776 pub face: ::prost::alloc::string::String,
777 #[prost(int64, tag = "4")]
779 pub score: i64,
780}
781#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
783#[repr(i32)]
784pub enum AudioCmdType {
785 Default = 0,
787 AcceptApply = 1,
789 Invitation = 2,
791 RejectInvitation = 3,
793 SetRoomInfo = 4,
795 SetApplyCount = 5,
797 SetSeatInfo = 6,
799 SetSeatMute = 7,
801 DownSeat = 8,
803 RejectApply = 9,
805 ForceLeave = 10,
807 SetContribution = 11,
809 SetBlacklist = 12,
811}
812impl AudioCmdType {
813 pub fn as_str_name(&self) -> &'static str {
818 match self {
819 Self::Default => "AudioCmdTypeDefault",
820 Self::AcceptApply => "AudioCmdTypeAcceptApply",
821 Self::Invitation => "AudioCmdTypeInvitation",
822 Self::RejectInvitation => "AudioCmdTypeRejectInvitation",
823 Self::SetRoomInfo => "AudioCmdTypeSetRoomInfo",
824 Self::SetApplyCount => "AudioCmdTypeSetApplyCount",
825 Self::SetSeatInfo => "AudioCmdTypeSetSeatInfo",
826 Self::SetSeatMute => "AudioCmdTypeSetSeatMute",
827 Self::DownSeat => "AudioCmdTypeDownSeat",
828 Self::RejectApply => "AudioCmdTypeRejectApply",
829 Self::ForceLeave => "AudioCmdTypeForceLeave",
830 Self::SetContribution => "AudioCmdTypeSetContribution",
831 Self::SetBlacklist => "AudioCmdTypeSetBlacklist",
832 }
833 }
834 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
836 match value {
837 "AudioCmdTypeDefault" => Some(Self::Default),
838 "AudioCmdTypeAcceptApply" => Some(Self::AcceptApply),
839 "AudioCmdTypeInvitation" => Some(Self::Invitation),
840 "AudioCmdTypeRejectInvitation" => Some(Self::RejectInvitation),
841 "AudioCmdTypeSetRoomInfo" => Some(Self::SetRoomInfo),
842 "AudioCmdTypeSetApplyCount" => Some(Self::SetApplyCount),
843 "AudioCmdTypeSetSeatInfo" => Some(Self::SetSeatInfo),
844 "AudioCmdTypeSetSeatMute" => Some(Self::SetSeatMute),
845 "AudioCmdTypeDownSeat" => Some(Self::DownSeat),
846 "AudioCmdTypeRejectApply" => Some(Self::RejectApply),
847 "AudioCmdTypeForceLeave" => Some(Self::ForceLeave),
848 "AudioCmdTypeSetContribution" => Some(Self::SetContribution),
849 "AudioCmdTypeSetBlacklist" => Some(Self::SetBlacklist),
850 _ => None,
851 }
852 }
853}
854#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
856#[repr(i32)]
857pub enum DmType {
858 DefaultType = 0,
860 EnterRoom = 1,
862 LiveOpen = 2,
864 LiveClose = 3,
866 Reply = 4,
868 TreasureSticker = 5,
870 RoomTopUser = 6,
872 ActionMsg = 7,
874 ComboMsg = 8,
876 LiveKeyChange = 9,
878 MuteMsg = 10,
880 WarnMsg = 11,
882 PopupMsg = 12,
884 BlockMsg = 13,
886 LikesMsg = 14,
888 UltimatePrizeMsg = 15,
890 RechargeBarMsg = 16,
892 AudioCmd = 17,
894 AudioLevelUp = 18,
896 Announcement = 19,
898 GlobalGiftBroadcast = 20,
900 PremiumEntranceMsg = 21,
902}
903impl DmType {
904 pub fn as_str_name(&self) -> &'static str {
909 match self {
910 Self::DefaultType => "DefaultType",
911 Self::EnterRoom => "EnterRoom",
912 Self::LiveOpen => "LiveOpen",
913 Self::LiveClose => "LiveClose",
914 Self::Reply => "Reply",
915 Self::TreasureSticker => "TreasureSticker",
916 Self::RoomTopUser => "RoomTopUser",
917 Self::ActionMsg => "ActionMsg",
918 Self::ComboMsg => "ComboMsg",
919 Self::LiveKeyChange => "LiveKeyChange",
920 Self::MuteMsg => "MuteMsg",
921 Self::WarnMsg => "WarnMsg",
922 Self::PopupMsg => "PopupMsg",
923 Self::BlockMsg => "BlockMsg",
924 Self::LikesMsg => "LikesMsg",
925 Self::UltimatePrizeMsg => "UltimatePrizeMsg",
926 Self::RechargeBarMsg => "RechargeBarMsg",
927 Self::AudioCmd => "AudioCmd",
928 Self::AudioLevelUp => "AudioLevelUp",
929 Self::Announcement => "Announcement",
930 Self::GlobalGiftBroadcast => "GlobalGiftBroadcast",
931 Self::PremiumEntranceMsg => "PremiumEntranceMsg",
932 }
933 }
934 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
936 match value {
937 "DefaultType" => Some(Self::DefaultType),
938 "EnterRoom" => Some(Self::EnterRoom),
939 "LiveOpen" => Some(Self::LiveOpen),
940 "LiveClose" => Some(Self::LiveClose),
941 "Reply" => Some(Self::Reply),
942 "TreasureSticker" => Some(Self::TreasureSticker),
943 "RoomTopUser" => Some(Self::RoomTopUser),
944 "ActionMsg" => Some(Self::ActionMsg),
945 "ComboMsg" => Some(Self::ComboMsg),
946 "LiveKeyChange" => Some(Self::LiveKeyChange),
947 "MuteMsg" => Some(Self::MuteMsg),
948 "WarnMsg" => Some(Self::WarnMsg),
949 "PopupMsg" => Some(Self::PopupMsg),
950 "BlockMsg" => Some(Self::BlockMsg),
951 "LikesMsg" => Some(Self::LikesMsg),
952 "UltimatePrizeMsg" => Some(Self::UltimatePrizeMsg),
953 "RechargeBarMsg" => Some(Self::RechargeBarMsg),
954 "AudioCmd" => Some(Self::AudioCmd),
955 "AudioLevelUp" => Some(Self::AudioLevelUp),
956 "Announcement" => Some(Self::Announcement),
957 "GlobalGiftBroadcast" => Some(Self::GlobalGiftBroadcast),
958 "PremiumEntranceMsg" => Some(Self::PremiumEntranceMsg),
959 _ => None,
960 }
961 }
962}
963#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
965#[repr(i32)]
966pub enum MessageItemSubType {
967 DefaultSubType = 0,
969 Name = 1,
971 Gift = 2,
973 GiftNum = 3,
975 GiftIcon = 4,
977 NewLine = 5,
979 AudioLevelIcon = 6,
981}
982impl MessageItemSubType {
983 pub fn as_str_name(&self) -> &'static str {
988 match self {
989 Self::DefaultSubType => "DefaultSubType",
990 Self::Name => "Name",
991 Self::Gift => "Gift",
992 Self::GiftNum => "GiftNum",
993 Self::GiftIcon => "GiftIcon",
994 Self::NewLine => "NewLine",
995 Self::AudioLevelIcon => "AudioLevelIcon",
996 }
997 }
998 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1000 match value {
1001 "DefaultSubType" => Some(Self::DefaultSubType),
1002 "Name" => Some(Self::Name),
1003 "Gift" => Some(Self::Gift),
1004 "GiftNum" => Some(Self::GiftNum),
1005 "GiftIcon" => Some(Self::GiftIcon),
1006 "NewLine" => Some(Self::NewLine),
1007 "AudioLevelIcon" => Some(Self::AudioLevelIcon),
1008 _ => None,
1009 }
1010 }
1011}
1012#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1014#[repr(i32)]
1015pub enum MessageItemType {
1016 Default = 0,
1018 Text = 1,
1020 Icon = 2,
1022}
1023impl MessageItemType {
1024 pub fn as_str_name(&self) -> &'static str {
1029 match self {
1030 Self::Default => "Default",
1031 Self::Text => "Text",
1032 Self::Icon => "Icon",
1033 }
1034 }
1035 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1037 match value {
1038 "Default" => Some(Self::Default),
1039 "Text" => Some(Self::Text),
1040 "Icon" => Some(Self::Icon),
1041 _ => None,
1042 }
1043 }
1044}
1045#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1047#[repr(i32)]
1048pub enum MsgNotifyCmd {
1049 Unspecified = 0,
1051 PullIm = 1,
1053}
1054impl MsgNotifyCmd {
1055 pub fn as_str_name(&self) -> &'static str {
1060 match self {
1061 Self::Unspecified => "MSG_NOTIFY_CMD_UNSPECIFIED",
1062 Self::PullIm => "MSG_NOTIFY_CMD_PULL_IM",
1063 }
1064 }
1065 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1067 match value {
1068 "MSG_NOTIFY_CMD_UNSPECIFIED" => Some(Self::Unspecified),
1069 "MSG_NOTIFY_CMD_PULL_IM" => Some(Self::PullIm),
1070 _ => None,
1071 }
1072 }
1073}
1074#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1076#[repr(i32)]
1077pub enum NotifyActionType {
1078 DefaultActionType = 0,
1080 JumpActionType = 1,
1082 FavActionType = 2,
1084}
1085impl NotifyActionType {
1086 pub fn as_str_name(&self) -> &'static str {
1091 match self {
1092 Self::DefaultActionType => "DefaultActionType",
1093 Self::JumpActionType => "JumpActionType",
1094 Self::FavActionType => "FavActionType",
1095 }
1096 }
1097 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1099 match value {
1100 "DefaultActionType" => Some(Self::DefaultActionType),
1101 "JumpActionType" => Some(Self::JumpActionType),
1102 "FavActionType" => Some(Self::FavActionType),
1103 _ => None,
1104 }
1105 }
1106}
1107#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1109#[repr(i32)]
1110pub enum PopupItemPosition {
1111 Default = 0,
1113 Title = 1,
1115 Content = 2,
1117}
1118impl PopupItemPosition {
1119 pub fn as_str_name(&self) -> &'static str {
1124 match self {
1125 Self::Default => "PopupItemPositionDefault",
1126 Self::Title => "PopupItemPositionTitle",
1127 Self::Content => "PopupItemPositionContent",
1128 }
1129 }
1130 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1132 match value {
1133 "PopupItemPositionDefault" => Some(Self::Default),
1134 "PopupItemPositionTitle" => Some(Self::Title),
1135 "PopupItemPositionContent" => Some(Self::Content),
1136 _ => None,
1137 }
1138 }
1139}
1140#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1142#[repr(i32)]
1143pub enum PopupItemType {
1144 Default = 0,
1146 Text = 1,
1148 Icon = 2,
1150}
1151impl PopupItemType {
1152 pub fn as_str_name(&self) -> &'static str {
1157 match self {
1158 Self::Default => "PopupItemTypeDefault",
1159 Self::Text => "PopupItemTypeText",
1160 Self::Icon => "PopupItemTypeIcon",
1161 }
1162 }
1163 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1165 match value {
1166 "PopupItemTypeDefault" => Some(Self::Default),
1167 "PopupItemTypeText" => Some(Self::Text),
1168 "PopupItemTypeIcon" => Some(Self::Icon),
1169 _ => None,
1170 }
1171 }
1172}
1173pub mod app_client {
1175 #![allow(
1176 unused_variables,
1177 dead_code,
1178 missing_docs,
1179 clippy::wildcard_imports,
1180 clippy::let_unit_value,
1181 )]
1182 use tonic::codegen::*;
1183 use tonic::codegen::http::Uri;
1184 #[derive(Debug, Clone)]
1186 pub struct AppClient<T> {
1187 inner: tonic::client::Grpc<T>,
1188 }
1189 impl<T> AppClient<T>
1190 where
1191 T: tonic::client::GrpcService<tonic::body::BoxBody>,
1192 T::Error: Into<StdError>,
1193 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1194 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1195 {
1196 pub fn new(inner: T) -> Self {
1197 let inner = tonic::client::Grpc::new(inner);
1198 Self { inner }
1199 }
1200 pub fn with_origin(inner: T, origin: Uri) -> Self {
1201 let inner = tonic::client::Grpc::with_origin(inner, origin);
1202 Self { inner }
1203 }
1204 pub fn with_interceptor<F>(
1205 inner: T,
1206 interceptor: F,
1207 ) -> AppClient<InterceptedService<T, F>>
1208 where
1209 F: tonic::service::Interceptor,
1210 T::ResponseBody: Default,
1211 T: tonic::codegen::Service<
1212 http::Request<tonic::body::BoxBody>,
1213 Response = http::Response<
1214 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
1215 >,
1216 >,
1217 <T as tonic::codegen::Service<
1218 http::Request<tonic::body::BoxBody>,
1219 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1220 {
1221 AppClient::new(InterceptedService::new(inner, interceptor))
1222 }
1223 #[must_use]
1228 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1229 self.inner = self.inner.send_compressed(encoding);
1230 self
1231 }
1232 #[must_use]
1234 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1235 self.inner = self.inner.accept_compressed(encoding);
1236 self
1237 }
1238 #[must_use]
1242 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1243 self.inner = self.inner.max_decoding_message_size(limit);
1244 self
1245 }
1246 #[must_use]
1250 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1251 self.inner = self.inner.max_encoding_message_size(limit);
1252 self
1253 }
1254 pub async fn app_notify(
1256 &mut self,
1257 request: impl tonic::IntoRequest<()>,
1258 ) -> std::result::Result<tonic::Response<super::Notify>, tonic::Status> {
1259 self.inner
1260 .ready()
1261 .await
1262 .map_err(|e| {
1263 tonic::Status::unknown(
1264 format!("Service was not ready: {}", e.into()),
1265 )
1266 })?;
1267 let codec = tonic::codec::ProstCodec::default();
1268 let path = http::uri::PathAndQuery::from_static(
1269 "/bilibili.broadcast.message.intl.App/AppNotify",
1270 );
1271 let mut req = request.into_request();
1272 req.extensions_mut()
1273 .insert(
1274 GrpcMethod::new("bilibili.broadcast.message.intl.App", "AppNotify"),
1275 );
1276 self.inner.unary(req, path, codec).await
1277 }
1278 }
1279}
1280pub mod msg_client {
1282 #![allow(
1283 unused_variables,
1284 dead_code,
1285 missing_docs,
1286 clippy::wildcard_imports,
1287 clippy::let_unit_value,
1288 )]
1289 use tonic::codegen::*;
1290 use tonic::codegen::http::Uri;
1291 #[derive(Debug, Clone)]
1293 pub struct MsgClient<T> {
1294 inner: tonic::client::Grpc<T>,
1295 }
1296 impl<T> MsgClient<T>
1297 where
1298 T: tonic::client::GrpcService<tonic::body::BoxBody>,
1299 T::Error: Into<StdError>,
1300 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1301 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1302 {
1303 pub fn new(inner: T) -> Self {
1304 let inner = tonic::client::Grpc::new(inner);
1305 Self { inner }
1306 }
1307 pub fn with_origin(inner: T, origin: Uri) -> Self {
1308 let inner = tonic::client::Grpc::with_origin(inner, origin);
1309 Self { inner }
1310 }
1311 pub fn with_interceptor<F>(
1312 inner: T,
1313 interceptor: F,
1314 ) -> MsgClient<InterceptedService<T, F>>
1315 where
1316 F: tonic::service::Interceptor,
1317 T::ResponseBody: Default,
1318 T: tonic::codegen::Service<
1319 http::Request<tonic::body::BoxBody>,
1320 Response = http::Response<
1321 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
1322 >,
1323 >,
1324 <T as tonic::codegen::Service<
1325 http::Request<tonic::body::BoxBody>,
1326 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1327 {
1328 MsgClient::new(InterceptedService::new(inner, interceptor))
1329 }
1330 #[must_use]
1335 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1336 self.inner = self.inner.send_compressed(encoding);
1337 self
1338 }
1339 #[must_use]
1341 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1342 self.inner = self.inner.accept_compressed(encoding);
1343 self
1344 }
1345 #[must_use]
1349 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1350 self.inner = self.inner.max_decoding_message_size(limit);
1351 self
1352 }
1353 #[must_use]
1357 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1358 self.inner = self.inner.max_encoding_message_size(limit);
1359 self
1360 }
1361 pub async fn notify(
1363 &mut self,
1364 request: impl tonic::IntoRequest<()>,
1365 ) -> std::result::Result<tonic::Response<super::MsgNotify>, tonic::Status> {
1366 self.inner
1367 .ready()
1368 .await
1369 .map_err(|e| {
1370 tonic::Status::unknown(
1371 format!("Service was not ready: {}", e.into()),
1372 )
1373 })?;
1374 let codec = tonic::codec::ProstCodec::default();
1375 let path = http::uri::PathAndQuery::from_static(
1376 "/bilibili.broadcast.message.intl.Msg/Notify",
1377 );
1378 let mut req = request.into_request();
1379 req.extensions_mut()
1380 .insert(
1381 GrpcMethod::new("bilibili.broadcast.message.intl.Msg", "Notify"),
1382 );
1383 self.inner.unary(req, path, codec).await
1384 }
1385 }
1386}
1387pub mod app_server {
1389 #![allow(
1390 unused_variables,
1391 dead_code,
1392 missing_docs,
1393 clippy::wildcard_imports,
1394 clippy::let_unit_value,
1395 )]
1396 use tonic::codegen::*;
1397 #[async_trait]
1399 pub trait App: std::marker::Send + std::marker::Sync + 'static {
1400 async fn app_notify(
1402 &self,
1403 request: tonic::Request<()>,
1404 ) -> std::result::Result<tonic::Response<super::Notify>, tonic::Status>;
1405 }
1406 #[derive(Debug)]
1408 pub struct AppServer<T> {
1409 inner: Arc<T>,
1410 accept_compression_encodings: EnabledCompressionEncodings,
1411 send_compression_encodings: EnabledCompressionEncodings,
1412 max_decoding_message_size: Option<usize>,
1413 max_encoding_message_size: Option<usize>,
1414 }
1415 impl<T> AppServer<T> {
1416 pub fn new(inner: T) -> Self {
1417 Self::from_arc(Arc::new(inner))
1418 }
1419 pub fn from_arc(inner: Arc<T>) -> Self {
1420 Self {
1421 inner,
1422 accept_compression_encodings: Default::default(),
1423 send_compression_encodings: Default::default(),
1424 max_decoding_message_size: None,
1425 max_encoding_message_size: None,
1426 }
1427 }
1428 pub fn with_interceptor<F>(
1429 inner: T,
1430 interceptor: F,
1431 ) -> InterceptedService<Self, F>
1432 where
1433 F: tonic::service::Interceptor,
1434 {
1435 InterceptedService::new(Self::new(inner), interceptor)
1436 }
1437 #[must_use]
1439 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1440 self.accept_compression_encodings.enable(encoding);
1441 self
1442 }
1443 #[must_use]
1445 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1446 self.send_compression_encodings.enable(encoding);
1447 self
1448 }
1449 #[must_use]
1453 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1454 self.max_decoding_message_size = Some(limit);
1455 self
1456 }
1457 #[must_use]
1461 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1462 self.max_encoding_message_size = Some(limit);
1463 self
1464 }
1465 }
1466 impl<T, B> tonic::codegen::Service<http::Request<B>> for AppServer<T>
1467 where
1468 T: App,
1469 B: Body + std::marker::Send + 'static,
1470 B::Error: Into<StdError> + std::marker::Send + 'static,
1471 {
1472 type Response = http::Response<tonic::body::BoxBody>;
1473 type Error = std::convert::Infallible;
1474 type Future = BoxFuture<Self::Response, Self::Error>;
1475 fn poll_ready(
1476 &mut self,
1477 _cx: &mut Context<'_>,
1478 ) -> Poll<std::result::Result<(), Self::Error>> {
1479 Poll::Ready(Ok(()))
1480 }
1481 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1482 match req.uri().path() {
1483 "/bilibili.broadcast.message.intl.App/AppNotify" => {
1484 #[allow(non_camel_case_types)]
1485 struct AppNotifySvc<T: App>(pub Arc<T>);
1486 impl<T: App> tonic::server::UnaryService<()> for AppNotifySvc<T> {
1487 type Response = super::Notify;
1488 type Future = BoxFuture<
1489 tonic::Response<Self::Response>,
1490 tonic::Status,
1491 >;
1492 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1493 let inner = Arc::clone(&self.0);
1494 let fut = async move {
1495 <T as App>::app_notify(&inner, request).await
1496 };
1497 Box::pin(fut)
1498 }
1499 }
1500 let accept_compression_encodings = self.accept_compression_encodings;
1501 let send_compression_encodings = self.send_compression_encodings;
1502 let max_decoding_message_size = self.max_decoding_message_size;
1503 let max_encoding_message_size = self.max_encoding_message_size;
1504 let inner = self.inner.clone();
1505 let fut = async move {
1506 let method = AppNotifySvc(inner);
1507 let codec = tonic::codec::ProstCodec::default();
1508 let mut grpc = tonic::server::Grpc::new(codec)
1509 .apply_compression_config(
1510 accept_compression_encodings,
1511 send_compression_encodings,
1512 )
1513 .apply_max_message_size_config(
1514 max_decoding_message_size,
1515 max_encoding_message_size,
1516 );
1517 let res = grpc.unary(method, req).await;
1518 Ok(res)
1519 };
1520 Box::pin(fut)
1521 }
1522 _ => {
1523 Box::pin(async move {
1524 let mut response = http::Response::new(empty_body());
1525 let headers = response.headers_mut();
1526 headers
1527 .insert(
1528 tonic::Status::GRPC_STATUS,
1529 (tonic::Code::Unimplemented as i32).into(),
1530 );
1531 headers
1532 .insert(
1533 http::header::CONTENT_TYPE,
1534 tonic::metadata::GRPC_CONTENT_TYPE,
1535 );
1536 Ok(response)
1537 })
1538 }
1539 }
1540 }
1541 }
1542 impl<T> Clone for AppServer<T> {
1543 fn clone(&self) -> Self {
1544 let inner = self.inner.clone();
1545 Self {
1546 inner,
1547 accept_compression_encodings: self.accept_compression_encodings,
1548 send_compression_encodings: self.send_compression_encodings,
1549 max_decoding_message_size: self.max_decoding_message_size,
1550 max_encoding_message_size: self.max_encoding_message_size,
1551 }
1552 }
1553 }
1554 pub const SERVICE_NAME: &str = "bilibili.broadcast.message.intl.App";
1556 impl<T> tonic::server::NamedService for AppServer<T> {
1557 const NAME: &'static str = SERVICE_NAME;
1558 }
1559}
1560pub mod msg_server {
1562 #![allow(
1563 unused_variables,
1564 dead_code,
1565 missing_docs,
1566 clippy::wildcard_imports,
1567 clippy::let_unit_value,
1568 )]
1569 use tonic::codegen::*;
1570 #[async_trait]
1572 pub trait Msg: std::marker::Send + std::marker::Sync + 'static {
1573 async fn notify(
1575 &self,
1576 request: tonic::Request<()>,
1577 ) -> std::result::Result<tonic::Response<super::MsgNotify>, tonic::Status>;
1578 }
1579 #[derive(Debug)]
1581 pub struct MsgServer<T> {
1582 inner: Arc<T>,
1583 accept_compression_encodings: EnabledCompressionEncodings,
1584 send_compression_encodings: EnabledCompressionEncodings,
1585 max_decoding_message_size: Option<usize>,
1586 max_encoding_message_size: Option<usize>,
1587 }
1588 impl<T> MsgServer<T> {
1589 pub fn new(inner: T) -> Self {
1590 Self::from_arc(Arc::new(inner))
1591 }
1592 pub fn from_arc(inner: Arc<T>) -> Self {
1593 Self {
1594 inner,
1595 accept_compression_encodings: Default::default(),
1596 send_compression_encodings: Default::default(),
1597 max_decoding_message_size: None,
1598 max_encoding_message_size: None,
1599 }
1600 }
1601 pub fn with_interceptor<F>(
1602 inner: T,
1603 interceptor: F,
1604 ) -> InterceptedService<Self, F>
1605 where
1606 F: tonic::service::Interceptor,
1607 {
1608 InterceptedService::new(Self::new(inner), interceptor)
1609 }
1610 #[must_use]
1612 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1613 self.accept_compression_encodings.enable(encoding);
1614 self
1615 }
1616 #[must_use]
1618 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1619 self.send_compression_encodings.enable(encoding);
1620 self
1621 }
1622 #[must_use]
1626 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1627 self.max_decoding_message_size = Some(limit);
1628 self
1629 }
1630 #[must_use]
1634 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1635 self.max_encoding_message_size = Some(limit);
1636 self
1637 }
1638 }
1639 impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
1640 where
1641 T: Msg,
1642 B: Body + std::marker::Send + 'static,
1643 B::Error: Into<StdError> + std::marker::Send + 'static,
1644 {
1645 type Response = http::Response<tonic::body::BoxBody>;
1646 type Error = std::convert::Infallible;
1647 type Future = BoxFuture<Self::Response, Self::Error>;
1648 fn poll_ready(
1649 &mut self,
1650 _cx: &mut Context<'_>,
1651 ) -> Poll<std::result::Result<(), Self::Error>> {
1652 Poll::Ready(Ok(()))
1653 }
1654 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1655 match req.uri().path() {
1656 "/bilibili.broadcast.message.intl.Msg/Notify" => {
1657 #[allow(non_camel_case_types)]
1658 struct NotifySvc<T: Msg>(pub Arc<T>);
1659 impl<T: Msg> tonic::server::UnaryService<()> for NotifySvc<T> {
1660 type Response = super::MsgNotify;
1661 type Future = BoxFuture<
1662 tonic::Response<Self::Response>,
1663 tonic::Status,
1664 >;
1665 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
1666 let inner = Arc::clone(&self.0);
1667 let fut = async move {
1668 <T as Msg>::notify(&inner, request).await
1669 };
1670 Box::pin(fut)
1671 }
1672 }
1673 let accept_compression_encodings = self.accept_compression_encodings;
1674 let send_compression_encodings = self.send_compression_encodings;
1675 let max_decoding_message_size = self.max_decoding_message_size;
1676 let max_encoding_message_size = self.max_encoding_message_size;
1677 let inner = self.inner.clone();
1678 let fut = async move {
1679 let method = NotifySvc(inner);
1680 let codec = tonic::codec::ProstCodec::default();
1681 let mut grpc = tonic::server::Grpc::new(codec)
1682 .apply_compression_config(
1683 accept_compression_encodings,
1684 send_compression_encodings,
1685 )
1686 .apply_max_message_size_config(
1687 max_decoding_message_size,
1688 max_encoding_message_size,
1689 );
1690 let res = grpc.unary(method, req).await;
1691 Ok(res)
1692 };
1693 Box::pin(fut)
1694 }
1695 _ => {
1696 Box::pin(async move {
1697 let mut response = http::Response::new(empty_body());
1698 let headers = response.headers_mut();
1699 headers
1700 .insert(
1701 tonic::Status::GRPC_STATUS,
1702 (tonic::Code::Unimplemented as i32).into(),
1703 );
1704 headers
1705 .insert(
1706 http::header::CONTENT_TYPE,
1707 tonic::metadata::GRPC_CONTENT_TYPE,
1708 );
1709 Ok(response)
1710 })
1711 }
1712 }
1713 }
1714 }
1715 impl<T> Clone for MsgServer<T> {
1716 fn clone(&self) -> Self {
1717 let inner = self.inner.clone();
1718 Self {
1719 inner,
1720 accept_compression_encodings: self.accept_compression_encodings,
1721 send_compression_encodings: self.send_compression_encodings,
1722 max_decoding_message_size: self.max_decoding_message_size,
1723 max_encoding_message_size: self.max_encoding_message_size,
1724 }
1725 }
1726 }
1727 pub const SERVICE_NAME: &str = "bilibili.broadcast.message.intl.Msg";
1729 impl<T> tonic::server::NamedService for MsgServer<T> {
1730 const NAME: &'static str = SERVICE_NAME;
1731 }
1732}