#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Answer {
#[prost(string, tag = "1")]
pub question_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub user_option: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Badge {
#[prost(message, optional, tag = "1")]
pub background_color: ::core::option::Option<Color>,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ButtonWithToggleState {
#[prost(message, optional, tag = "1")]
pub button_checked: ::core::option::Option<ButtonWithUrl>,
#[prost(message, optional, tag = "2")]
pub button_unchecked: ::core::option::Option<ButtonWithUrl>,
#[prost(bool, tag = "3")]
pub is_checked: bool,
#[prost(string, tag = "4")]
pub oid: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub desc_text: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub desc_img: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ButtonWithUrl {
#[prost(string, tag = "1")]
pub btn_text: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub btn_img: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CampaignBrief {
#[prost(string, tag = "1")]
pub start_time: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sub_title: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub title_image: ::prost::alloc::string::String,
#[prost(bool, tag = "5")]
pub is_active: bool,
#[prost(string, tag = "6")]
pub active_text: ::prost::alloc::string::String,
#[prost(bool, tag = "7")]
pub show_reserve_button: bool,
#[prost(int64, tag = "8")]
pub reserve_sid: i64,
#[prost(bool, tag = "9")]
pub is_reserved: bool,
#[prost(bool, tag = "10")]
pub is_finished: bool,
#[prost(string, tag = "11")]
pub finished_text: ::prost::alloc::string::String,
#[prost(int64, tag = "12")]
pub sort_idx: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CampaignsToday {
#[prost(string, tag = "1")]
pub today_date: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub campaigns: ::prost::alloc::vec::Vec<CampaignBrief>,
#[prost(bool, tag = "3")]
pub default_check: bool,
#[prost(string, tag = "4")]
pub today_date_image_checked: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub today_date_image_unchecked: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClickAction {
#[prost(int64, tag = "1")]
pub r#type: i64,
#[prost(int64, tag = "2")]
pub timestamp: i64,
#[prost(int64, tag = "3")]
pub x: i64,
#[prost(int64, tag = "4")]
pub y: i64,
#[prost(int64, tag = "5")]
pub z: i64,
#[prost(int64, tag = "6")]
pub answer_type: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Color {
#[prost(string, tag = "1")]
pub argb_light: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub argb_dark: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComponentHeaderLotteryScratch {
#[prost(string, tag = "1")]
pub image_url: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub jump_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageWithHw {
#[prost(string, tag = "1")]
pub image_url: ::prost::alloc::string::String,
#[prost(double, tag = "2")]
pub height: f64,
#[prost(double, tag = "3")]
pub width: f64,
#[prost(string, tag = "4")]
pub jump_url: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub track_data: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Option {
#[prost(int64, tag = "1")]
pub index: i64,
#[prost(string, tag = "2")]
pub content: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub ratio: i64,
#[prost(bool, tag = "4")]
pub user_selected: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrizeInfo {
#[prost(string, tag = "1")]
pub img: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub desc: ::prost::alloc::string::String,
#[prost(enumeration = "PrizeType", tag = "3")]
pub r#type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Question {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub question: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub options: ::prost::alloc::vec::Vec<Option>,
#[prost(int64, tag = "4")]
pub question_duration: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuestionReview {
#[prost(string, tag = "1")]
pub question: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub answer: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub is_correct: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuizReport {
#[prost(bool, tag = "1")]
pub switch: bool,
#[prost(int64, tag = "2")]
pub answer_time: i64,
#[prost(message, repeated, tag = "3")]
pub clicks: ::prost::alloc::vec::Vec<ClickAction>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuizResultReq {
#[prost(string, tag = "1")]
pub session_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuizResultResp {
#[prost(enumeration = "UserSessionStatus", tag = "1")]
pub result: i32,
#[prost(message, repeated, tag = "2")]
pub questions: ::prost::alloc::vec::Vec<QuestionReview>,
#[prost(message, repeated, tag = "3")]
pub prizes: ::prost::alloc::vec::Vec<PrizeInfo>,
#[prost(string, tag = "4")]
pub button_link: ::prost::alloc::string::String,
#[prost(bool, tag = "5")]
pub stat_completed: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QuizReviewReq {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuizReviewResp {
#[prost(message, repeated, tag = "1")]
pub list: ::prost::alloc::vec::Vec<SessionReview>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RcmdItemBrief {
#[prost(string, tag = "1")]
pub item_type: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub item_oid: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub cover: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub jump_url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "6")]
pub badge: ::core::option::Option<Badge>,
#[prost(string, tag = "7")]
pub cover_left_text1: ::prost::alloc::string::String,
#[prost(enumeration = "PegasusIcon", tag = "8")]
pub cover_left_icon1: i32,
#[prost(string, tag = "9")]
pub cover_left_text2: ::prost::alloc::string::String,
#[prost(enumeration = "PegasusIcon", tag = "10")]
pub cover_left_icon2: i32,
#[prost(string, tag = "11")]
pub cover_right_text: ::prost::alloc::string::String,
#[prost(message, optional, tag = "12")]
pub bottom_text: ::core::option::Option<TextWithPrefixImage>,
#[prost(message, optional, tag = "13")]
pub background_color: ::core::option::Option<Color>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Session {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(enumeration = "SessionType", tag = "2")]
pub r#type: i32,
#[prost(int64, tag = "3")]
pub stime: i64,
#[prost(int64, tag = "4")]
pub etime: i64,
#[prost(int64, tag = "5")]
pub answer_etime: i64,
#[prost(string, tag = "6")]
pub title_img: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub background_img: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub after_background_img: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub live_card_img: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub jump_url: ::prost::alloc::string::String,
#[prost(int64, tag = "11")]
pub next_quiz_stime: i64,
#[prost(int64, tag = "12")]
pub mtime: i64,
#[prost(bool, tag = "13")]
pub show_live_card: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionReview {
#[prost(string, tag = "1")]
pub session_name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub questions: ::prost::alloc::vec::Vec<QuestionReview>,
#[prost(message, repeated, tag = "3")]
pub prizes: ::prost::alloc::vec::Vec<PrizeInfo>,
#[prost(string, tag = "4")]
pub session_id: ::prost::alloc::string::String,
#[prost(enumeration = "SessionType", tag = "5")]
pub r#type: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SessionStatusBriefReq {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionStatusBriefResp {
#[prost(message, optional, tag = "1")]
pub session: ::core::option::Option<Session>,
#[prost(message, optional, tag = "2")]
pub upcoming_session: ::core::option::Option<Session>,
#[prost(int64, tag = "3")]
pub request_random: i64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SessionStatusReq {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionStatusResp {
#[prost(message, optional, tag = "1")]
pub session: ::core::option::Option<Session>,
#[prost(message, optional, tag = "2")]
pub upcoming_session: ::core::option::Option<Session>,
#[prost(enumeration = "UserSessionStatus", tag = "3")]
pub user_status: i32,
#[prost(message, repeated, tag = "4")]
pub questions: ::prost::alloc::vec::Vec<Question>,
#[prost(int64, tag = "5")]
pub request_random: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartQuizReq {
#[prost(string, tag = "1")]
pub session_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub timestamp: i64,
#[prost(string, tag = "3")]
pub sign: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StartQuizResp {
#[prost(message, repeated, tag = "1")]
pub questions: ::prost::alloc::vec::Vec<Question>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubmitQuizReq {
#[prost(string, tag = "1")]
pub session_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub answers: ::prost::alloc::vec::Vec<Answer>,
#[prost(message, optional, tag = "3")]
pub report: ::core::option::Option<QuizReport>,
#[prost(int64, tag = "4")]
pub timestamp: i64,
#[prost(string, tag = "5")]
pub sign: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubmitQuizResp {
#[prost(enumeration = "UserSessionStatus", tag = "1")]
pub result: i32,
#[prost(message, repeated, tag = "2")]
pub questions_review: ::prost::alloc::vec::Vec<QuestionReview>,
#[prost(message, repeated, tag = "3")]
pub prizes: ::prost::alloc::vec::Vec<PrizeInfo>,
#[prost(message, repeated, tag = "4")]
pub questions: ::prost::alloc::vec::Vec<Question>,
#[prost(string, tag = "5")]
pub button_link: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TabPageComponent {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabPageProperty {
#[prost(message, optional, tag = "1")]
pub background_color: ::core::option::Option<Color>,
#[prost(enumeration = "PageTheme", tag = "2")]
pub page_theme: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSection {
#[prost(enumeration = "TabSectionType", tag = "1")]
pub section_type: i32,
#[prost(oneof = "tab_section::SectionData", tags = "2, 3, 4, 5, 6, 7, 8, 9, 10")]
pub section_data: ::core::option::Option<tab_section::SectionData>,
}
pub mod tab_section {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SectionData {
#[prost(message, tag = "2")]
Header(super::TabSectionHeader),
#[prost(message, tag = "3")]
LongLive(super::TabSectionLongLive),
#[prost(message, tag = "4")]
CampaignScheduling(super::TabSectionCampaignScheduling),
#[prost(message, tag = "5")]
CampaignSheet(super::TabSectionCampaignSheet),
#[prost(message, tag = "6")]
Quiz(super::TabSectionQuiz),
#[prost(message, tag = "7")]
RelatedRcmd(super::TabSectionRelatedRcmd),
#[prost(message, tag = "8")]
CampaignBanners(super::TabSectionCampaignBanners),
#[prost(message, tag = "9")]
GuidanceLongLive(super::TabSectionGuidanceLongLive),
#[prost(message, tag = "10")]
BackToPegasus(super::TabSectionBackToPegasus),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionBackToPegasus {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub slide_content_img: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub slide_arrow_img: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub background_img: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionCampaignBanners {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub title_img: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub banners: ::prost::alloc::vec::Vec<ImageWithHw>,
#[prost(double, tag = "4")]
pub display_w_h_ratio: f64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionCampaignScheduling {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub title_img: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub scheduling: ::prost::alloc::vec::Vec<CampaignsToday>,
#[prost(message, optional, tag = "4")]
pub view_all_btn: ::core::option::Option<ButtonWithUrl>,
#[prost(string, tag = "5")]
pub dialog_header_background_img: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub dialog_header_title: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub dialog_header_title_img: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub dialog_header_close_btn_img: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionCampaignSheet {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub title_img: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub view_all_btn: ::core::option::Option<ButtonWithUrl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionGuidanceLongLive {
#[prost(message, optional, tag = "1")]
pub guidance_button: ::core::option::Option<ButtonWithUrl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionHeader {
#[prost(string, tag = "1")]
pub banner_url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub reward_button: ::core::option::Option<ButtonWithUrl>,
#[prost(message, optional, tag = "3")]
pub rule_button: ::core::option::Option<ButtonWithUrl>,
#[prost(message, optional, tag = "4")]
pub lottery_scratch: ::core::option::Option<ComponentHeaderLotteryScratch>,
#[prost(message, optional, tag = "5")]
pub reserve_button: ::core::option::Option<ButtonWithToggleState>,
#[prost(string, tag = "6")]
pub sponsor_logo_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionLongLive {
#[prost(int64, tag = "1")]
pub room_id: i64,
#[prost(bool, tag = "2")]
pub is_streaming: bool,
#[prost(string, tag = "3")]
pub player_url: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub room_cover: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub jump_url: ::prost::alloc::string::String,
#[prost(bool, tag = "6")]
pub show_co_live_users: bool,
#[prost(message, repeated, tag = "7")]
pub co_live_users_info: ::prost::alloc::vec::Vec<UserInfo>,
#[prost(string, tag = "8")]
pub co_live_user_title: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub fallback_player_url: ::prost::alloc::string::String,
#[prost(int64, tag = "10")]
pub area_id: i64,
#[prost(int64, tag = "11")]
pub parent_area_id: i64,
#[prost(int64, tag = "12")]
pub anchor_id: i64,
#[prost(int64, tag = "13")]
pub live_id: i64,
#[prost(string, tag = "14")]
pub sub_session_key: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionQuiz {
#[prost(message, optional, tag = "1")]
pub quiz_session_status: ::core::option::Option<SessionStatusResp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabSectionRelatedRcmd {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub item_list: ::prost::alloc::vec::Vec<RcmdItemBrief>,
#[prost(message, optional, tag = "3")]
pub bottom_button: ::core::option::Option<ButtonWithUrl>,
#[prost(string, tag = "4")]
pub background_img_top: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub background_img_middle: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub background_img_bottom: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TabViewReq {
#[prost(message, optional, tag = "1")]
pub player_args: ::core::option::Option<
super::super::archive::middleware::v1::PlayerArgs,
>,
#[prost(bool, tag = "2")]
pub is_preload: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabViewResp {
#[prost(message, optional, tag = "1")]
pub page_property: ::core::option::Option<TabPageProperty>,
#[prost(message, optional, tag = "2")]
pub page_component: ::core::option::Option<TabPageComponent>,
#[prost(message, repeated, tag = "3")]
pub tab_sections: ::prost::alloc::vec::Vec<TabSection>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextWithPrefixImage {
#[prost(string, tag = "1")]
pub text_show: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub prefix_img: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub text_type: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub text_oid: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub jump_url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserInfo {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub face: ::prost::alloc::string::String,
#[prost(bool, tag = "4")]
pub is_following: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PageTheme {
Invalid = 0,
ProjectCny = 1,
ProjectNewYear2025 = 2,
}
impl PageTheme {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Invalid => "Page_Theme_Invalid",
Self::ProjectCny => "Page_Theme_Project_CNY",
Self::ProjectNewYear2025 => "Page_Theme_Project_NewYear2025",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Page_Theme_Invalid" => Some(Self::Invalid),
"Page_Theme_Project_CNY" => Some(Self::ProjectCny),
"Page_Theme_Project_NewYear2025" => Some(Self::ProjectNewYear2025),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PegasusIcon {
Invalid = 0,
Plays = 1,
Danmakus = 3,
}
impl PegasusIcon {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Invalid => "Pegasus_Icon_Invalid",
Self::Plays => "Pegasus_Icon_Plays",
Self::Danmakus => "Pegasus_Icon_Danmakus",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Pegasus_Icon_Invalid" => Some(Self::Invalid),
"Pegasus_Icon_Plays" => Some(Self::Plays),
"Pegasus_Icon_Danmakus" => Some(Self::Danmakus),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PrizeType {
Unknown = 0,
GameCount = 1,
Cash = 2,
Gift = 3,
}
impl PrizeType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "PrizeTypeUnknown",
Self::GameCount => "PrizeTypeGameCount",
Self::Cash => "PrizeTypeCash",
Self::Gift => "PrizeTypeGift",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PrizeTypeUnknown" => Some(Self::Unknown),
"PrizeTypeGameCount" => Some(Self::GameCount),
"PrizeTypeCash" => Some(Self::Cash),
"PrizeTypeGift" => Some(Self::Gift),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SessionType {
Unknown = 0,
Guess = 1,
Quiz = 2,
Activity = 3,
}
impl SessionType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "SessionTypeUnknown",
Self::Guess => "SessionTypeGuess",
Self::Quiz => "SessionTypeQuiz",
Self::Activity => "SessionTypeActivity",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SessionTypeUnknown" => Some(Self::Unknown),
"SessionTypeGuess" => Some(Self::Guess),
"SessionTypeQuiz" => Some(Self::Quiz),
"SessionTypeActivity" => Some(Self::Activity),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TabSectionType {
TabSectionInvalid = 0,
TabSectionHeader = 1,
TabSectionLongLive = 2,
TabSectionCampaignScheduling = 3,
TabSectionCampaignSheet = 4,
TabSectionQuiz = 5,
TabSectionRelatedRcmd = 6,
TabSectionCampaignBanners = 7,
TabSectionGuidanceLongLive = 8,
TabSectionBackToPegasus = 9,
}
impl TabSectionType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::TabSectionInvalid => "Tab_Section_Invalid",
Self::TabSectionHeader => "Tab_Section_Header",
Self::TabSectionLongLive => "Tab_Section_LongLive",
Self::TabSectionCampaignScheduling => "Tab_Section_CampaignScheduling",
Self::TabSectionCampaignSheet => "Tab_Section_CampaignSheet",
Self::TabSectionQuiz => "Tab_Section_Quiz",
Self::TabSectionRelatedRcmd => "Tab_Section_RelatedRcmd",
Self::TabSectionCampaignBanners => "Tab_Section_CampaignBanners",
Self::TabSectionGuidanceLongLive => "Tab_Section_GuidanceLongLive",
Self::TabSectionBackToPegasus => "Tab_Section_BackToPegasus",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Tab_Section_Invalid" => Some(Self::TabSectionInvalid),
"Tab_Section_Header" => Some(Self::TabSectionHeader),
"Tab_Section_LongLive" => Some(Self::TabSectionLongLive),
"Tab_Section_CampaignScheduling" => Some(Self::TabSectionCampaignScheduling),
"Tab_Section_CampaignSheet" => Some(Self::TabSectionCampaignSheet),
"Tab_Section_Quiz" => Some(Self::TabSectionQuiz),
"Tab_Section_RelatedRcmd" => Some(Self::TabSectionRelatedRcmd),
"Tab_Section_CampaignBanners" => Some(Self::TabSectionCampaignBanners),
"Tab_Section_GuidanceLongLive" => Some(Self::TabSectionGuidanceLongLive),
"Tab_Section_BackToPegasus" => Some(Self::TabSectionBackToPegasus),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserSessionStatus {
UserSessionNotStart = 0,
UserSessionParticipated = 1,
UserSessionSubmitted = 2,
UserSessionSucceed = 3,
UserSessionFailed = 4,
UserSessionInvalid = 5,
}
impl UserSessionStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::UserSessionNotStart => "UserSessionNotStart",
Self::UserSessionParticipated => "UserSessionParticipated",
Self::UserSessionSubmitted => "UserSessionSubmitted",
Self::UserSessionSucceed => "UserSessionSucceed",
Self::UserSessionFailed => "UserSessionFailed",
Self::UserSessionInvalid => "UserSessionInvalid",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UserSessionNotStart" => Some(Self::UserSessionNotStart),
"UserSessionParticipated" => Some(Self::UserSessionParticipated),
"UserSessionSubmitted" => Some(Self::UserSessionSubmitted),
"UserSessionSucceed" => Some(Self::UserSessionSucceed),
"UserSessionFailed" => Some(Self::UserSessionFailed),
"UserSessionInvalid" => Some(Self::UserSessionInvalid),
_ => None,
}
}
}
pub mod quiz_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct QuizClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> QuizClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> QuizClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
QuizClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn quiz_result(
&mut self,
request: impl tonic::IntoRequest<super::QuizResultReq>,
) -> std::result::Result<tonic::Response<super::QuizResultResp>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/QuizResult",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.app.project.cny.Quiz", "QuizResult"));
self.inner.unary(req, path, codec).await
}
pub async fn quiz_review(
&mut self,
request: impl tonic::IntoRequest<super::QuizReviewReq>,
) -> std::result::Result<tonic::Response<super::QuizReviewResp>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/QuizReview",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.app.project.cny.Quiz", "QuizReview"));
self.inner.unary(req, path, codec).await
}
pub async fn session_status(
&mut self,
request: impl tonic::IntoRequest<super::SessionStatusReq>,
) -> std::result::Result<
tonic::Response<super::SessionStatusResp>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/SessionStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.app.project.cny.Quiz", "SessionStatus"),
);
self.inner.unary(req, path, codec).await
}
pub async fn session_status_brief(
&mut self,
request: impl tonic::IntoRequest<super::SessionStatusBriefReq>,
) -> std::result::Result<
tonic::Response<super::SessionStatusBriefResp>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/SessionStatusBrief",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.app.project.cny.Quiz",
"SessionStatusBrief",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn start_quiz(
&mut self,
request: impl tonic::IntoRequest<super::StartQuizReq>,
) -> std::result::Result<tonic::Response<super::StartQuizResp>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/StartQuiz",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.app.project.cny.Quiz", "StartQuiz"));
self.inner.unary(req, path, codec).await
}
pub async fn submit_quiz(
&mut self,
request: impl tonic::IntoRequest<super::SubmitQuizReq>,
) -> std::result::Result<tonic::Response<super::SubmitQuizResp>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Quiz/SubmitQuiz",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.app.project.cny.Quiz", "SubmitQuiz"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod tab_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TabClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> TabClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TabClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TabClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn view(
&mut self,
request: impl tonic::IntoRequest<super::TabViewReq>,
) -> std::result::Result<tonic::Response<super::TabViewResp>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.app.project.cny.Tab/View",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.app.project.cny.Tab", "View"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod quiz_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Quiz: std::marker::Send + std::marker::Sync + 'static {
async fn quiz_result(
&self,
request: tonic::Request<super::QuizResultReq>,
) -> std::result::Result<tonic::Response<super::QuizResultResp>, tonic::Status>;
async fn quiz_review(
&self,
request: tonic::Request<super::QuizReviewReq>,
) -> std::result::Result<tonic::Response<super::QuizReviewResp>, tonic::Status>;
async fn session_status(
&self,
request: tonic::Request<super::SessionStatusReq>,
) -> std::result::Result<
tonic::Response<super::SessionStatusResp>,
tonic::Status,
>;
async fn session_status_brief(
&self,
request: tonic::Request<super::SessionStatusBriefReq>,
) -> std::result::Result<
tonic::Response<super::SessionStatusBriefResp>,
tonic::Status,
>;
async fn start_quiz(
&self,
request: tonic::Request<super::StartQuizReq>,
) -> std::result::Result<tonic::Response<super::StartQuizResp>, tonic::Status>;
async fn submit_quiz(
&self,
request: tonic::Request<super::SubmitQuizReq>,
) -> std::result::Result<tonic::Response<super::SubmitQuizResp>, tonic::Status>;
}
#[derive(Debug)]
pub struct QuizServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> QuizServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for QuizServer<T>
where
T: Quiz,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bilibili.app.project.cny.Quiz/QuizResult" => {
#[allow(non_camel_case_types)]
struct QuizResultSvc<T: Quiz>(pub Arc<T>);
impl<T: Quiz> tonic::server::UnaryService<super::QuizResultReq>
for QuizResultSvc<T> {
type Response = super::QuizResultResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QuizResultReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::quiz_result(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = QuizResultSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.app.project.cny.Quiz/QuizReview" => {
#[allow(non_camel_case_types)]
struct QuizReviewSvc<T: Quiz>(pub Arc<T>);
impl<T: Quiz> tonic::server::UnaryService<super::QuizReviewReq>
for QuizReviewSvc<T> {
type Response = super::QuizReviewResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::QuizReviewReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::quiz_review(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = QuizReviewSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.app.project.cny.Quiz/SessionStatus" => {
#[allow(non_camel_case_types)]
struct SessionStatusSvc<T: Quiz>(pub Arc<T>);
impl<T: Quiz> tonic::server::UnaryService<super::SessionStatusReq>
for SessionStatusSvc<T> {
type Response = super::SessionStatusResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SessionStatusReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::session_status(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SessionStatusSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.app.project.cny.Quiz/SessionStatusBrief" => {
#[allow(non_camel_case_types)]
struct SessionStatusBriefSvc<T: Quiz>(pub Arc<T>);
impl<
T: Quiz,
> tonic::server::UnaryService<super::SessionStatusBriefReq>
for SessionStatusBriefSvc<T> {
type Response = super::SessionStatusBriefResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SessionStatusBriefReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::session_status_brief(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SessionStatusBriefSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.app.project.cny.Quiz/StartQuiz" => {
#[allow(non_camel_case_types)]
struct StartQuizSvc<T: Quiz>(pub Arc<T>);
impl<T: Quiz> tonic::server::UnaryService<super::StartQuizReq>
for StartQuizSvc<T> {
type Response = super::StartQuizResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StartQuizReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::start_quiz(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = StartQuizSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.app.project.cny.Quiz/SubmitQuiz" => {
#[allow(non_camel_case_types)]
struct SubmitQuizSvc<T: Quiz>(pub Arc<T>);
impl<T: Quiz> tonic::server::UnaryService<super::SubmitQuizReq>
for SubmitQuizSvc<T> {
type Response = super::SubmitQuizResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubmitQuizReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Quiz>::submit_quiz(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SubmitQuizSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for QuizServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "bilibili.app.project.cny.Quiz";
impl<T> tonic::server::NamedService for QuizServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod tab_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Tab: std::marker::Send + std::marker::Sync + 'static {
async fn view(
&self,
request: tonic::Request<super::TabViewReq>,
) -> std::result::Result<tonic::Response<super::TabViewResp>, tonic::Status>;
}
#[derive(Debug)]
pub struct TabServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TabServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TabServer<T>
where
T: Tab,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bilibili.app.project.cny.Tab/View" => {
#[allow(non_camel_case_types)]
struct ViewSvc<T: Tab>(pub Arc<T>);
impl<T: Tab> tonic::server::UnaryService<super::TabViewReq>
for ViewSvc<T> {
type Response = super::TabViewResp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TabViewReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tab>::view(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ViewSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TabServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "bilibili.app.project.cny.Tab";
impl<T> tonic::server::NamedService for TabServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}