#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccountNotify {
#[prost(string, tag = "1")]
pub biz: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub data: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommonPushNotify {
#[prost(string, tag = "1")]
pub cmd: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub data: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DanmakuElem {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(int32, tag = "2")]
pub progress: i32,
#[prost(int32, tag = "3")]
pub mode: i32,
#[prost(int32, tag = "4")]
pub fontsize: i32,
#[prost(int32, tag = "5")]
pub color: i32,
#[prost(string, tag = "6")]
pub mid_hash: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub content: ::prost::alloc::string::String,
#[prost(int64, tag = "8")]
pub ctime: i64,
#[prost(int32, tag = "9")]
pub weight: i32,
#[prost(string, tag = "10")]
pub action: ::prost::alloc::string::String,
#[prost(int32, tag = "11")]
pub pool: i32,
#[prost(string, tag = "12")]
pub id_str: ::prost::alloc::string::String,
#[prost(int32, tag = "13")]
pub attr: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DmLiveElem {
#[prost(int64, tag = "1")]
pub room_id: i64,
#[prost(int64, tag = "2")]
pub room_uid: i64,
#[prost(int64, tag = "3")]
pub uid: i64,
#[prost(string, tag = "4")]
pub uname: ::prost::alloc::string::String,
#[prost(int32, tag = "5")]
pub user_level: i32,
#[prost(int32, tag = "6")]
pub color: i32,
#[prost(string, tag = "7")]
pub content: ::prost::alloc::string::String,
#[prost(int64, tag = "8")]
pub time: i64,
#[prost(string, tag = "9")]
pub msg_id: ::prost::alloc::string::String,
#[prost(int32, tag = "10")]
pub msg_type: i32,
#[prost(int32, tag = "11")]
pub area_id: i32,
#[prost(int32, tag = "12")]
pub parent_area_id: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DmLiveReply {
#[prost(message, repeated, tag = "1")]
pub elems: ::prost::alloc::vec::Vec<DmLiveElem>,
#[prost(int32, tag = "2")]
pub state: i32,
#[prost(int32, tag = "3")]
pub source: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DmLiveSwitchReload {
#[prost(bool, tag = "1")]
pub reload: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DmSegLiveReply {
#[prost(message, repeated, tag = "1")]
pub elems: ::prost::alloc::vec::Vec<DanmakuElem>,
#[prost(int32, tag = "2")]
pub state: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EsportsNotify {
#[prost(int64, tag = "1")]
pub cid: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeedClientSmartNotify {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(string, tag = "2")]
pub cards: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LiveBottomConfNotify {
#[prost(int64, tag = "1")]
pub room_id: i64,
#[prost(string, tag = "2")]
pub bottom_msg: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LiveCommonNotify {
#[prost(string, tag = "1")]
pub cmd: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub data: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LiveSkipNotify {
#[prost(int64, tag = "1")]
pub live_id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LiveStatusNotify {
#[prost(int64, tag = "1")]
pub status: i64,
#[prost(string, tag = "2")]
pub msg: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub cid: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LiveViewerMsgNotify {
#[prost(int64, tag = "1")]
pub room_id: i64,
#[prost(string, tag = "2")]
pub viewer_msg: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MainRedDotReply {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(int64, tag = "2")]
pub reddot: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotifyPop {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(int32, tag = "2")]
pub style: i32,
#[prost(string, tag = "3")]
pub img: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub text_type: i32,
#[prost(string, tag = "5")]
pub text_top: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub text_bottom: ::prost::alloc::string::String,
#[prost(int32, tag = "7")]
pub expire: i32,
#[prost(message, repeated, tag = "8")]
pub notify_btn_list: ::prost::alloc::vec::Vec<NotifyPopBtn>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotifyPopBtn {
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub url: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotifyPopReply {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(message, optional, tag = "2")]
pub notify: ::core::option::Option<NotifyPop>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OgvPayOrderReply {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(int64, tag = "2")]
pub season_id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjLiveEventNotify {
#[prost(int64, tag = "1")]
pub room_id: i64,
#[prost(int64, tag = "2")]
pub event_type: i64,
#[prost(string, tag = "3")]
pub event_msg: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjReply {
#[prost(int64, tag = "1")]
pub cmd_type: i64,
#[prost(int64, tag = "2")]
pub mid: i64,
#[prost(int64, tag = "3")]
pub aid: i64,
#[prost(int64, tag = "4")]
pub cid: i64,
#[prost(int64, tag = "5")]
pub video_type: i64,
#[prost(int64, tag = "6")]
pub ep_id: i64,
#[prost(int64, tag = "7")]
pub season_id: i64,
#[prost(int64, tag = "8")]
pub seek_ts: i64,
#[prost(string, tag = "9")]
pub extra: ::prost::alloc::string::String,
#[prost(int64, tag = "10")]
pub room_id: i64,
#[prost(string, tag = "11")]
pub device_info: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PublicityNotify {
#[prost(int64, tag = "1")]
pub publicity_id: i64,
#[prost(int64, tag = "2")]
pub room_id: i64,
#[prost(int64, tag = "3")]
pub status: i64,
}
pub mod tv_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 TvClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> TvClient<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,
) -> TvClient<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,
{
TvClient::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 account(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::AccountNotify>, 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.broadcast.message.tv.Tv/Account",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "Account"));
self.inner.unary(req, path, codec).await
}
pub async fn common_push(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::CommonPushNotify>,
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.broadcast.message.tv.Tv/CommonPush",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "CommonPush"),
);
self.inner.unary(req, path, codec).await
}
pub async fn esports(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::EsportsNotify>, 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.broadcast.message.tv.Tv/Esports",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "Esports"));
self.inner.unary(req, path, codec).await
}
pub async fn feed_client_smart(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::FeedClientSmartNotify>,
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.broadcast.message.tv.Tv/FeedClientSmart",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.broadcast.message.tv.Tv",
"FeedClientSmart",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn live_bottom(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::LiveBottomConfNotify>,
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.broadcast.message.tv.Tv/LiveBottom",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "LiveBottom"),
);
self.inner.unary(req, path, codec).await
}
pub async fn live_common_msg(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::LiveCommonNotify>,
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.broadcast.message.tv.Tv/LiveCommonMsg",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "LiveCommonMsg"),
);
self.inner.unary(req, path, codec).await
}
pub async fn live_skip(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::LiveSkipNotify>, 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.broadcast.message.tv.Tv/LiveSkip",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "LiveSkip"));
self.inner.unary(req, path, codec).await
}
pub async fn live_status(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::LiveStatusNotify>,
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.broadcast.message.tv.Tv/LiveStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "LiveStatus"),
);
self.inner.unary(req, path, codec).await
}
pub async fn main_red_dot(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::MainRedDotReply>,
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.broadcast.message.tv.Tv/MainRedDot",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "MainRedDot"),
);
self.inner.unary(req, path, codec).await
}
pub async fn notify_pop(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::NotifyPopReply>, 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.broadcast.message.tv.Tv/NotifyPop",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "NotifyPop"),
);
self.inner.unary(req, path, codec).await
}
pub async fn ogv_pay_order(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::OgvPayOrderReply>,
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.broadcast.message.tv.Tv/OgvPayOrder",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "OgvPayOrder"),
);
self.inner.unary(req, path, codec).await
}
pub async fn proj(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::ProjReply>, 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.broadcast.message.tv.Tv/Proj",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "Proj"));
self.inner.unary(req, path, codec).await
}
pub async fn proj_core(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<super::ProjReply>, 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.broadcast.message.tv.Tv/ProjCore",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "ProjCore"));
self.inner.unary(req, path, codec).await
}
pub async fn proj_live_event(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::ProjLiveEventNotify>,
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.broadcast.message.tv.Tv/ProjLiveEvent",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "ProjLiveEvent"),
);
self.inner.unary(req, path, codec).await
}
pub async fn publicity(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::PublicityNotify>,
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.broadcast.message.tv.Tv/Publicity",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "Publicity"),
);
self.inner.unary(req, path, codec).await
}
pub async fn viewer_num_msg(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<super::LiveViewerMsgNotify>,
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.broadcast.message.tv.Tv/ViewerNumMsg",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("bilibili.broadcast.message.tv.Tv", "ViewerNumMsg"),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod tv_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Tv: std::marker::Send + std::marker::Sync + 'static {
async fn account(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::AccountNotify>, tonic::Status>;
async fn common_push(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::CommonPushNotify>,
tonic::Status,
>;
async fn esports(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::EsportsNotify>, tonic::Status>;
async fn feed_client_smart(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::FeedClientSmartNotify>,
tonic::Status,
>;
async fn live_bottom(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::LiveBottomConfNotify>,
tonic::Status,
>;
async fn live_common_msg(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::LiveCommonNotify>,
tonic::Status,
>;
async fn live_skip(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::LiveSkipNotify>, tonic::Status>;
async fn live_status(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::LiveStatusNotify>,
tonic::Status,
>;
async fn main_red_dot(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::MainRedDotReply>, tonic::Status>;
async fn notify_pop(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::NotifyPopReply>, tonic::Status>;
async fn ogv_pay_order(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::OgvPayOrderReply>,
tonic::Status,
>;
async fn proj(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::ProjReply>, tonic::Status>;
async fn proj_core(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::ProjReply>, tonic::Status>;
async fn proj_live_event(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::ProjLiveEventNotify>,
tonic::Status,
>;
async fn publicity(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<super::PublicityNotify>, tonic::Status>;
async fn viewer_num_msg(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<super::LiveViewerMsgNotify>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct TvServer<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> TvServer<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 TvServer<T>
where
T: Tv,
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.broadcast.message.tv.Tv/Account" => {
#[allow(non_camel_case_types)]
struct AccountSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for AccountSvc<T> {
type Response = super::AccountNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::account(&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 = AccountSvc(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.broadcast.message.tv.Tv/CommonPush" => {
#[allow(non_camel_case_types)]
struct CommonPushSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for CommonPushSvc<T> {
type Response = super::CommonPushNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::common_push(&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 = CommonPushSvc(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.broadcast.message.tv.Tv/Esports" => {
#[allow(non_camel_case_types)]
struct EsportsSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for EsportsSvc<T> {
type Response = super::EsportsNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::esports(&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 = EsportsSvc(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.broadcast.message.tv.Tv/FeedClientSmart" => {
#[allow(non_camel_case_types)]
struct FeedClientSmartSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()>
for FeedClientSmartSvc<T> {
type Response = super::FeedClientSmartNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::feed_client_smart(&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 = FeedClientSmartSvc(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.broadcast.message.tv.Tv/LiveBottom" => {
#[allow(non_camel_case_types)]
struct LiveBottomSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for LiveBottomSvc<T> {
type Response = super::LiveBottomConfNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::live_bottom(&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 = LiveBottomSvc(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.broadcast.message.tv.Tv/LiveCommonMsg" => {
#[allow(non_camel_case_types)]
struct LiveCommonMsgSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for LiveCommonMsgSvc<T> {
type Response = super::LiveCommonNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::live_common_msg(&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 = LiveCommonMsgSvc(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.broadcast.message.tv.Tv/LiveSkip" => {
#[allow(non_camel_case_types)]
struct LiveSkipSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for LiveSkipSvc<T> {
type Response = super::LiveSkipNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::live_skip(&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 = LiveSkipSvc(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.broadcast.message.tv.Tv/LiveStatus" => {
#[allow(non_camel_case_types)]
struct LiveStatusSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for LiveStatusSvc<T> {
type Response = super::LiveStatusNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::live_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 = LiveStatusSvc(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.broadcast.message.tv.Tv/MainRedDot" => {
#[allow(non_camel_case_types)]
struct MainRedDotSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for MainRedDotSvc<T> {
type Response = super::MainRedDotReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::main_red_dot(&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 = MainRedDotSvc(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.broadcast.message.tv.Tv/NotifyPop" => {
#[allow(non_camel_case_types)]
struct NotifyPopSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for NotifyPopSvc<T> {
type Response = super::NotifyPopReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::notify_pop(&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 = NotifyPopSvc(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.broadcast.message.tv.Tv/OgvPayOrder" => {
#[allow(non_camel_case_types)]
struct OgvPayOrderSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for OgvPayOrderSvc<T> {
type Response = super::OgvPayOrderReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::ogv_pay_order(&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 = OgvPayOrderSvc(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.broadcast.message.tv.Tv/Proj" => {
#[allow(non_camel_case_types)]
struct ProjSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for ProjSvc<T> {
type Response = super::ProjReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::proj(&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 = ProjSvc(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.broadcast.message.tv.Tv/ProjCore" => {
#[allow(non_camel_case_types)]
struct ProjCoreSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for ProjCoreSvc<T> {
type Response = super::ProjReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::proj_core(&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 = ProjCoreSvc(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.broadcast.message.tv.Tv/ProjLiveEvent" => {
#[allow(non_camel_case_types)]
struct ProjLiveEventSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for ProjLiveEventSvc<T> {
type Response = super::ProjLiveEventNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::proj_live_event(&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 = ProjLiveEventSvc(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.broadcast.message.tv.Tv/Publicity" => {
#[allow(non_camel_case_types)]
struct PublicitySvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for PublicitySvc<T> {
type Response = super::PublicityNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::publicity(&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 = PublicitySvc(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.broadcast.message.tv.Tv/ViewerNumMsg" => {
#[allow(non_camel_case_types)]
struct ViewerNumMsgSvc<T: Tv>(pub Arc<T>);
impl<T: Tv> tonic::server::UnaryService<()> for ViewerNumMsgSvc<T> {
type Response = super::LiveViewerMsgNotify;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Tv>::viewer_num_msg(&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 = ViewerNumMsgSvc(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 TvServer<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.broadcast.message.tv.Tv";
impl<T> tonic::server::NamedService for TvServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}