#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CommandMsg {
#[prost(oneof = "command_msg::Command", tags = "1, 2, 3, 4")]
pub command: ::core::option::Option<command_msg::Command>,
}
pub mod command_msg {
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Command {
#[prost(message, tag = "1")]
UpdateTotalUnreadCommand(super::UpdateTotalUnreadCommand),
#[prost(message, tag = "2")]
UpdateSessionListCommand(super::UpdateSessionListCommand),
#[prost(message, tag = "3")]
UpdateQuickLinkCommand(super::UpdateQuickLinkCommand),
#[prost(message, tag = "4")]
FetchMessageCommand(super::FetchMessageCommand),
}
}
impl ::prost::Name for CommandMsg {
const NAME: &'static str = "CommandMsg";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.CommandMsg".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.CommandMsg".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CustomerId {
#[prost(int64, tag = "1")]
pub shop_id: i64,
#[prost(int64, tag = "2")]
pub shop_type: i64,
}
impl ::prost::Name for CustomerId {
const NAME: &'static str = "CustomerId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.CustomerId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.CustomerId".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FetchMessageCommand {
#[prost(message, optional, tag = "1")]
pub session_id: ::core::option::Option<SessionId>,
}
impl ::prost::Name for FetchMessageCommand {
const NAME: &'static str = "FetchMessageCommand";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.FetchMessageCommand".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.FetchMessageCommand".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FoldId {
#[prost(enumeration = "SessionType", tag = "1")]
pub r#type: i32,
}
impl ::prost::Name for FoldId {
const NAME: &'static str = "FoldId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.FoldId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.FoldId".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GroupId {
#[prost(int64, tag = "1")]
pub group_id: i64,
}
impl ::prost::Name for GroupId {
const NAME: &'static str = "GroupId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.GroupId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.GroupId".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Msg {
#[prost(int64, tag = "1")]
pub sender_uid: i64,
#[prost(int32, tag = "2")]
pub receiver_type: i32,
#[prost(int64, tag = "3")]
pub receiver_id: i64,
#[prost(int64, tag = "4")]
pub cli_msg_id: i64,
#[prost(int32, tag = "5")]
pub msg_type: i32,
#[prost(string, tag = "6")]
pub content: ::prost::alloc::string::String,
#[prost(int64, tag = "7")]
pub msg_seqno: i64,
#[prost(int64, tag = "8")]
pub timestamp: i64,
#[prost(int64, repeated, tag = "9")]
pub at_uids: ::prost::alloc::vec::Vec<i64>,
#[prost(int64, repeated, tag = "10")]
pub recver_ids: ::prost::alloc::vec::Vec<i64>,
#[prost(int64, tag = "11")]
pub msg_key: i64,
#[prost(int32, tag = "12")]
pub msg_status: i32,
#[prost(bool, tag = "13")]
pub sys_cancel: bool,
#[prost(int32, tag = "14")]
pub is_multi_chat: i32,
#[prost(int64, tag = "15")]
pub withdraw_seqno: i64,
#[prost(string, tag = "16")]
pub notify_code: ::prost::alloc::string::String,
#[prost(int32, tag = "17")]
pub msg_source: i32,
}
impl ::prost::Name for Msg {
const NAME: &'static str = "Msg";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.Msg".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.Msg".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NotifyInfo {
#[prost(int32, tag = "1")]
pub msg_type: i32,
#[prost(int64, tag = "2")]
pub talker_id: i64,
#[prost(int32, tag = "3")]
pub session_type: i32,
}
impl ::prost::Name for NotifyInfo {
const NAME: &'static str = "NotifyInfo";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.NotifyInfo".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.NotifyInfo".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotifyRsp {
#[prost(int64, tag = "1")]
pub uid: i64,
#[prost(int64, tag = "2")]
pub cmd: i64,
#[prost(bytes = "bytes", tag = "3")]
pub payload: ::prost::bytes::Bytes,
#[prost(enumeration = "PlType", tag = "4")]
pub payload_type: i32,
}
impl ::prost::Name for NotifyRsp {
const NAME: &'static str = "NotifyRsp";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.NotifyRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.NotifyRsp".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PrivateId {
#[prost(int64, tag = "1")]
pub talker_uid: i64,
}
impl ::prost::Name for PrivateId {
const NAME: &'static str = "PrivateId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.PrivateId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.PrivateId".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReqServerNotify {
#[prost(int64, tag = "1")]
pub lastest_seqno: i64,
#[prost(message, optional, tag = "2")]
pub instant_msg: ::core::option::Option<Msg>,
#[prost(message, optional, tag = "3")]
pub notify_info: ::core::option::Option<NotifyInfo>,
#[prost(message, repeated, tag = "4")]
pub command_msgs: ::prost::alloc::vec::Vec<CommandMsg>,
}
impl ::prost::Name for ReqServerNotify {
const NAME: &'static str = "ReqServerNotify";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.ReqServerNotify".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.ReqServerNotify".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SessionId {
#[prost(oneof = "session_id::Id", tags = "1, 2, 3, 4, 5")]
pub id: ::core::option::Option<session_id::Id>,
}
pub mod session_id {
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Id {
#[prost(message, tag = "1")]
PrivateId(super::PrivateId),
#[prost(message, tag = "2")]
GroupId(super::GroupId),
#[prost(message, tag = "3")]
FoldId(super::FoldId),
#[prost(message, tag = "4")]
SystemId(super::SystemId),
#[prost(message, tag = "5")]
CustomerId(super::CustomerId),
}
}
impl ::prost::Name for SessionId {
const NAME: &'static str = "SessionId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.SessionId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.SessionId".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SystemId {
#[prost(enumeration = "SessionType", tag = "1")]
pub r#type: i32,
}
impl ::prost::Name for SystemId {
const NAME: &'static str = "SystemId";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.SystemId".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.SystemId".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateQuickLinkCommand {}
impl ::prost::Name for UpdateQuickLinkCommand {
const NAME: &'static str = "UpdateQuickLinkCommand";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.UpdateQuickLinkCommand".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.UpdateQuickLinkCommand".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateSessionListCommand {
#[prost(message, optional, tag = "1")]
pub session_id: ::core::option::Option<SessionId>,
}
impl ::prost::Name for UpdateSessionListCommand {
const NAME: &'static str = "UpdateSessionListCommand";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.UpdateSessionListCommand".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.UpdateSessionListCommand".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateTotalUnreadCommand {}
impl ::prost::Name for UpdateTotalUnreadCommand {
const NAME: &'static str = "UpdateTotalUnreadCommand";
const PACKAGE: &'static str = "bilibili.broadcast.message.im";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.broadcast.message.im.UpdateTotalUnreadCommand".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.broadcast.message.im.UpdateTotalUnreadCommand".into()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CmdId {
EnCmdIdInvalid = 0,
EnCmdIdMsgNotify = 1,
EnCmdIdKickOut = 2,
}
impl CmdId {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::EnCmdIdInvalid => "EN_CMD_ID_INVALID",
Self::EnCmdIdMsgNotify => "EN_CMD_ID_MSG_NOTIFY",
Self::EnCmdIdKickOut => "EN_CMD_ID_KICK_OUT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EN_CMD_ID_INVALID" => Some(Self::EnCmdIdInvalid),
"EN_CMD_ID_MSG_NOTIFY" => Some(Self::EnCmdIdMsgNotify),
"EN_CMD_ID_KICK_OUT" => Some(Self::EnCmdIdKickOut),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PlType {
EnPayloadNormal = 0,
EnPayloadBase64 = 1,
}
impl PlType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::EnPayloadNormal => "EN_PAYLOAD_NORMAL",
Self::EnPayloadBase64 => "EN_PAYLOAD_BASE64",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EN_PAYLOAD_NORMAL" => Some(Self::EnPayloadNormal),
"EN_PAYLOAD_BASE64" => Some(Self::EnPayloadBase64),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SessionType {
Unknown = 0,
Private = 1,
Group = 2,
GroupFold = 3,
Unfollowed = 4,
Stranger = 5,
Dustbin = 6,
CustomerFold = 7,
System = 8,
AiFold = 9,
CustomerAccount = 10,
}
impl SessionType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unknown => "SESSION_TYPE_UNKNOWN",
Self::Private => "SESSION_TYPE_PRIVATE",
Self::Group => "SESSION_TYPE_GROUP",
Self::GroupFold => "SESSION_TYPE_GROUP_FOLD",
Self::Unfollowed => "SESSION_TYPE_UNFOLLOWED",
Self::Stranger => "SESSION_TYPE_STRANGER",
Self::Dustbin => "SESSION_TYPE_DUSTBIN",
Self::CustomerFold => "SESSION_TYPE_CUSTOMER_FOLD",
Self::System => "SESSION_TYPE_SYSTEM",
Self::AiFold => "SESSION_TYPE_AI_FOLD",
Self::CustomerAccount => "SESSION_TYPE_CUSTOMER_ACCOUNT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SESSION_TYPE_UNKNOWN" => Some(Self::Unknown),
"SESSION_TYPE_PRIVATE" => Some(Self::Private),
"SESSION_TYPE_GROUP" => Some(Self::Group),
"SESSION_TYPE_GROUP_FOLD" => Some(Self::GroupFold),
"SESSION_TYPE_UNFOLLOWED" => Some(Self::Unfollowed),
"SESSION_TYPE_STRANGER" => Some(Self::Stranger),
"SESSION_TYPE_DUSTBIN" => Some(Self::Dustbin),
"SESSION_TYPE_CUSTOMER_FOLD" => Some(Self::CustomerFold),
"SESSION_TYPE_SYSTEM" => Some(Self::System),
"SESSION_TYPE_AI_FOLD" => Some(Self::AiFold),
"SESSION_TYPE_CUSTOMER_ACCOUNT" => Some(Self::CustomerAccount),
_ => None,
}
}
}
#[cfg(feature = "feat-enable-generated-client")]
pub mod notify_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 NotifyClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> NotifyClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> NotifyClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
NotifyClient::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 watch_notify(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::NotifyRsp>>,
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.im.Notify/WatchNotify",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.broadcast.message.im.Notify",
"WatchNotify",
),
);
self.inner.server_streaming(req, path, codec).await
}
}
}
#[cfg(feature = "feat-enable-generated-server")]
pub mod notify_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Notify: std::marker::Send + std::marker::Sync + 'static {
type WatchNotifyStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::NotifyRsp, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn watch_notify(
&self,
request: tonic::Request<()>,
) -> std::result::Result<
tonic::Response<Self::WatchNotifyStream>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct NotifyServer<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> NotifyServer<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 NotifyServer<T>
where
T: Notify,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
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.im.Notify/WatchNotify" => {
#[allow(non_camel_case_types)]
struct WatchNotifySvc<T: Notify>(pub Arc<T>);
impl<T: Notify> tonic::server::ServerStreamingService<()>
for WatchNotifySvc<T> {
type Response = super::NotifyRsp;
type ResponseStream = T::WatchNotifyStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Notify>::watch_notify(&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 = WatchNotifySvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
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 NotifyServer<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.im.Notify";
impl<T> tonic::server::NamedService for NotifyServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}