#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Button {
#[prost(bool, tag = "1")]
pub disable: bool,
#[prost(int32, tag = "2")]
pub op_type: i32,
#[prost(string, tag = "3")]
pub text: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub jump_url: ::prost::alloc::string::String,
#[prost(message, optional, tag = "5")]
pub time_limit: ::core::option::Option<TimeLimited>,
}
impl ::prost::Name for Button {
const NAME: &'static str = "Button";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.Button".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.Button".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CosmoBusiness {
#[prost(string, tag = "1")]
pub business: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub sub_business: ::prost::alloc::string::String,
}
impl ::prost::Name for CosmoBusiness {
const NAME: &'static str = "CosmoBusiness";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.CosmoBusiness".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.CosmoBusiness".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CosmoMeta {
#[prost(string, tag = "1")]
pub platform: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub build: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub mobi_app: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub buvid: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub device: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub version: ::prost::alloc::string::String,
#[prost(int32, tag = "7")]
pub network: i32,
#[prost(string, tag = "8")]
pub ip: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub port: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub ua: ::prost::alloc::string::String,
#[prost(string, tag = "11")]
pub refer: ::prost::alloc::string::String,
#[prost(string, tag = "12")]
pub spmid: ::prost::alloc::string::String,
#[prost(string, tag = "13")]
pub from_spmid: ::prost::alloc::string::String,
#[prost(string, tag = "14")]
pub trace_id: ::prost::alloc::string::String,
#[prost(int32, tag = "15")]
pub teenager_mode: i32,
#[prost(int32, tag = "16")]
pub cold_start: i32,
#[prost(string, tag = "17")]
pub from: ::prost::alloc::string::String,
#[prost(string, tag = "18")]
pub buvid3: ::prost::alloc::string::String,
#[prost(int64, tag = "19")]
pub app_id: i64,
}
impl ::prost::Name for CosmoMeta {
const NAME: &'static str = "CosmoMeta";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.CosmoMeta".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.CosmoMeta".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CosmoParaMeta {
#[prost(string, tag = "1")]
pub spmid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub from_spmid: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub from: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub action_id: ::prost::alloc::string::String,
}
impl ::prost::Name for CosmoParaMeta {
const NAME: &'static str = "CosmoParaMeta";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.CosmoParaMeta".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.CosmoParaMeta".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entity {
#[prost(message, optional, tag = "1")]
pub r#type: ::core::option::Option<EntityType>,
#[prost(int64, tag = "2")]
pub object_id: i64,
#[prost(string, tag = "3")]
pub object_id_str: ::prost::alloc::string::String,
#[prost(int64, tag = "4")]
pub up_mid: i64,
}
impl ::prost::Name for Entity {
const NAME: &'static str = "Entity";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.Entity".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.Entity".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EntityType {
#[prost(enumeration = "EntityBiz", tag = "1")]
pub biz: i32,
}
impl ::prost::Name for EntityType {
const NAME: &'static str = "EntityType";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.EntityType".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.EntityType".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IconRes {
#[prost(string, tag = "1")]
pub light: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub dark: ::prost::alloc::string::String,
}
impl ::prost::Name for IconRes {
const NAME: &'static str = "IconRes";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.IconRes".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.IconRes".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ShowText {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub sub_title: ::prost::alloc::string::String,
}
impl ::prost::Name for ShowText {
const NAME: &'static str = "ShowText";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.ShowText".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.ShowText".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimpleActionReq {
#[prost(message, optional, tag = "1")]
pub entity: ::core::option::Option<Entity>,
#[prost(enumeration = "Action", tag = "2")]
pub action: i32,
#[prost(message, optional, tag = "3")]
pub meta: ::core::option::Option<CosmoParaMeta>,
}
impl ::prost::Name for SimpleActionReq {
const NAME: &'static str = "SimpleActionReq";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SimpleActionReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SimpleActionReq".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SimpleActionRsp {}
impl ::prost::Name for SimpleActionRsp {
const NAME: &'static str = "SimpleActionRsp";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SimpleActionRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SimpleActionRsp".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCard {
#[prost(message, optional, tag = "1")]
pub show_text: ::core::option::Option<ShowText>,
#[prost(message, optional, tag = "2")]
pub icon_res: ::core::option::Option<IconRes>,
#[prost(message, optional, tag = "3")]
pub button: ::core::option::Option<Button>,
}
impl ::prost::Name for SubscribeCard {
const NAME: &'static str = "SubscribeCard";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SubscribeCard".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SubscribeCard".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCardReq {
#[prost(message, optional, tag = "1")]
pub business: ::core::option::Option<CosmoBusiness>,
}
impl ::prost::Name for SubscribeCardReq {
const NAME: &'static str = "SubscribeCardReq";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SubscribeCardReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SubscribeCardReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeCardRsp {
#[prost(string, tag = "1")]
pub unique_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub card: ::core::option::Option<SubscribeCard>,
}
impl ::prost::Name for SubscribeCardRsp {
const NAME: &'static str = "SubscribeCardRsp";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SubscribeCardRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SubscribeCardRsp".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeReq {
#[prost(message, optional, tag = "1")]
pub business: ::core::option::Option<CosmoBusiness>,
#[prost(string, tag = "2")]
pub unique_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub button: ::core::option::Option<Button>,
}
impl ::prost::Name for SubscribeReq {
const NAME: &'static str = "SubscribeReq";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SubscribeReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SubscribeReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeRsp {
#[prost(message, optional, tag = "1")]
pub button: ::core::option::Option<Button>,
}
impl ::prost::Name for SubscribeRsp {
const NAME: &'static str = "SubscribeRsp";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.SubscribeRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.SubscribeRsp".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TimeLimited {
#[prost(int64, tag = "1")]
pub start_ts: i64,
#[prost(int64, tag = "2")]
pub end_ts: i64,
}
impl ::prost::Name for TimeLimited {
const NAME: &'static str = "TimeLimited";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.TimeLimited".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.TimeLimited".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ToggleTribeeReq {
#[prost(int64, tag = "1")]
pub tribee_id: i64,
#[prost(int32, tag = "2")]
pub action: i32,
}
impl ::prost::Name for ToggleTribeeReq {
const NAME: &'static str = "ToggleTribeeReq";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.ToggleTribeeReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.ToggleTribeeReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToggleTribeeRsp {
#[prost(message, optional, tag = "1")]
pub member_info: ::core::option::Option<TribeeMemberInfo>,
}
impl ::prost::Name for ToggleTribeeRsp {
const NAME: &'static str = "ToggleTribeeRsp";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.ToggleTribeeRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.ToggleTribeeRsp".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TribeeDynClickReq {
#[prost(int64, tag = "1")]
pub tribee_id: i64,
#[prost(int64, tag = "2")]
pub dyn_id: i64,
#[prost(string, tag = "3")]
pub dyn_id_str: ::prost::alloc::string::String,
}
impl ::prost::Name for TribeeDynClickReq {
const NAME: &'static str = "TribeeDynClickReq";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.TribeeDynClickReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.TribeeDynClickReq".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TribeeDynClickRsp {}
impl ::prost::Name for TribeeDynClickRsp {
const NAME: &'static str = "TribeeDynClickRsp";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.TribeeDynClickRsp".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.TribeeDynClickRsp".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TribeeMemberInfo {
#[prost(int64, tag = "1")]
pub uid: i64,
#[prost(int64, tag = "2")]
pub tribee_id: i64,
#[prost(int64, tag = "3")]
pub member_sn: i64,
#[prost(enumeration = "TribeeMemberStatus", tag = "4")]
pub status: i32,
#[prost(int64, tag = "5")]
pub join_ts: i64,
#[prost(string, tag = "6")]
pub uid_str: ::prost::alloc::string::String,
}
impl ::prost::Name for TribeeMemberInfo {
const NAME: &'static str = "TribeeMemberInfo";
const PACKAGE: &'static str = "bilibili.community.interfacess.cosmoconn.v1";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.community.interfacess.cosmoconn.v1.TribeeMemberInfo".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.community.interfacess.cosmoconn.v1.TribeeMemberInfo".into()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Action {
Invalid = 0,
Thumb = 1,
CancelThumb = 2,
Fav = 3,
CancelFav = 4,
}
impl Action {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Invalid => "ACTION_INVALID",
Self::Thumb => "ACTION_THUMB",
Self::CancelThumb => "ACTION_CANCEL_THUMB",
Self::Fav => "ACTION_FAV",
Self::CancelFav => "ACTION_CANCEL_FAV",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACTION_INVALID" => Some(Self::Invalid),
"ACTION_THUMB" => Some(Self::Thumb),
"ACTION_CANCEL_THUMB" => Some(Self::CancelThumb),
"ACTION_FAV" => Some(Self::Fav),
"ACTION_CANCEL_FAV" => Some(Self::CancelFav),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EntityBiz {
Invalid = 0,
Video = 1,
Opus = 2,
Dynamic = 3,
Reply = 4,
Topic = 5,
}
impl EntityBiz {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Invalid => "ENTITY_BIZ_INVALID",
Self::Video => "ENTITY_BIZ_VIDEO",
Self::Opus => "ENTITY_BIZ_OPUS",
Self::Dynamic => "ENTITY_BIZ_DYNAMIC",
Self::Reply => "ENTITY_BIZ_REPLY",
Self::Topic => "ENTITY_BIZ_TOPIC",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENTITY_BIZ_INVALID" => Some(Self::Invalid),
"ENTITY_BIZ_VIDEO" => Some(Self::Video),
"ENTITY_BIZ_OPUS" => Some(Self::Opus),
"ENTITY_BIZ_DYNAMIC" => Some(Self::Dynamic),
"ENTITY_BIZ_REPLY" => Some(Self::Reply),
"ENTITY_BIZ_TOPIC" => Some(Self::Topic),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TribeeMemberStatus {
Default = 0,
Joined = 1,
Owner = 2,
Maintainer = 3,
Banned = 100,
}
impl TribeeMemberStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Default => "DEFAULT",
Self::Joined => "JOINED",
Self::Owner => "OWNER",
Self::Maintainer => "MAINTAINER",
Self::Banned => "BANNED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DEFAULT" => Some(Self::Default),
"JOINED" => Some(Self::Joined),
"OWNER" => Some(Self::Owner),
"MAINTAINER" => Some(Self::Maintainer),
"BANNED" => Some(Self::Banned),
_ => None,
}
}
}
#[cfg(feature = "feat-enable-generated-client")]
pub mod cosmo_interface_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 CosmoInterfaceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> CosmoInterfaceClient<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,
) -> CosmoInterfaceClient<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,
{
CosmoInterfaceClient::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 ping(
&mut self,
request: impl tonic::IntoRequest<()>,
) -> std::result::Result<tonic::Response<()>, 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.community.interfacess.cosmoconn.v1.CosmoInterface/Ping",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"Ping",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn simple_action(
&mut self,
request: impl tonic::IntoRequest<super::SimpleActionReq>,
) -> std::result::Result<
tonic::Response<super::SimpleActionRsp>,
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.community.interfacess.cosmoconn.v1.CosmoInterface/SimpleAction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"SimpleAction",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn subscribe(
&mut self,
request: impl tonic::IntoRequest<super::SubscribeReq>,
) -> std::result::Result<tonic::Response<super::SubscribeRsp>, 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.community.interfacess.cosmoconn.v1.CosmoInterface/Subscribe",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"Subscribe",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn subscribe_card(
&mut self,
request: impl tonic::IntoRequest<super::SubscribeCardReq>,
) -> std::result::Result<
tonic::Response<super::SubscribeCardRsp>,
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.community.interfacess.cosmoconn.v1.CosmoInterface/SubscribeCard",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"SubscribeCard",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn toggle_tribee_membership(
&mut self,
request: impl tonic::IntoRequest<super::ToggleTribeeReq>,
) -> std::result::Result<
tonic::Response<super::ToggleTribeeRsp>,
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.community.interfacess.cosmoconn.v1.CosmoInterface/ToggleTribeeMembership",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"ToggleTribeeMembership",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn tribee_dyn_click(
&mut self,
request: impl tonic::IntoRequest<super::TribeeDynClickReq>,
) -> std::result::Result<
tonic::Response<super::TribeeDynClickRsp>,
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.community.interfacess.cosmoconn.v1.CosmoInterface/TribeeDynClick",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.community.interfacess.cosmoconn.v1.CosmoInterface",
"TribeeDynClick",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[cfg(feature = "feat-enable-generated-server")]
pub mod cosmo_interface_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait CosmoInterface: std::marker::Send + std::marker::Sync + 'static {
async fn ping(
&self,
request: tonic::Request<()>,
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
async fn simple_action(
&self,
request: tonic::Request<super::SimpleActionReq>,
) -> std::result::Result<tonic::Response<super::SimpleActionRsp>, tonic::Status>;
async fn subscribe(
&self,
request: tonic::Request<super::SubscribeReq>,
) -> std::result::Result<tonic::Response<super::SubscribeRsp>, tonic::Status>;
async fn subscribe_card(
&self,
request: tonic::Request<super::SubscribeCardReq>,
) -> std::result::Result<
tonic::Response<super::SubscribeCardRsp>,
tonic::Status,
>;
async fn toggle_tribee_membership(
&self,
request: tonic::Request<super::ToggleTribeeReq>,
) -> std::result::Result<tonic::Response<super::ToggleTribeeRsp>, tonic::Status>;
async fn tribee_dyn_click(
&self,
request: tonic::Request<super::TribeeDynClickReq>,
) -> std::result::Result<
tonic::Response<super::TribeeDynClickRsp>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct CosmoInterfaceServer<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> CosmoInterfaceServer<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 CosmoInterfaceServer<T>
where
T: CosmoInterface,
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.community.interfacess.cosmoconn.v1.CosmoInterface/Ping" => {
#[allow(non_camel_case_types)]
struct PingSvc<T: CosmoInterface>(pub Arc<T>);
impl<T: CosmoInterface> tonic::server::UnaryService<()>
for PingSvc<T> {
type Response = ();
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 CosmoInterface>::ping(&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 = PingSvc(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.community.interfacess.cosmoconn.v1.CosmoInterface/SimpleAction" => {
#[allow(non_camel_case_types)]
struct SimpleActionSvc<T: CosmoInterface>(pub Arc<T>);
impl<
T: CosmoInterface,
> tonic::server::UnaryService<super::SimpleActionReq>
for SimpleActionSvc<T> {
type Response = super::SimpleActionRsp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SimpleActionReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as CosmoInterface>::simple_action(&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 = SimpleActionSvc(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.community.interfacess.cosmoconn.v1.CosmoInterface/Subscribe" => {
#[allow(non_camel_case_types)]
struct SubscribeSvc<T: CosmoInterface>(pub Arc<T>);
impl<
T: CosmoInterface,
> tonic::server::UnaryService<super::SubscribeReq>
for SubscribeSvc<T> {
type Response = super::SubscribeRsp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubscribeReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as CosmoInterface>::subscribe(&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 = SubscribeSvc(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.community.interfacess.cosmoconn.v1.CosmoInterface/SubscribeCard" => {
#[allow(non_camel_case_types)]
struct SubscribeCardSvc<T: CosmoInterface>(pub Arc<T>);
impl<
T: CosmoInterface,
> tonic::server::UnaryService<super::SubscribeCardReq>
for SubscribeCardSvc<T> {
type Response = super::SubscribeCardRsp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SubscribeCardReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as CosmoInterface>::subscribe_card(&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 = SubscribeCardSvc(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.community.interfacess.cosmoconn.v1.CosmoInterface/ToggleTribeeMembership" => {
#[allow(non_camel_case_types)]
struct ToggleTribeeMembershipSvc<T: CosmoInterface>(pub Arc<T>);
impl<
T: CosmoInterface,
> tonic::server::UnaryService<super::ToggleTribeeReq>
for ToggleTribeeMembershipSvc<T> {
type Response = super::ToggleTribeeRsp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ToggleTribeeReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as CosmoInterface>::toggle_tribee_membership(
&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 = ToggleTribeeMembershipSvc(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.community.interfacess.cosmoconn.v1.CosmoInterface/TribeeDynClick" => {
#[allow(non_camel_case_types)]
struct TribeeDynClickSvc<T: CosmoInterface>(pub Arc<T>);
impl<
T: CosmoInterface,
> tonic::server::UnaryService<super::TribeeDynClickReq>
for TribeeDynClickSvc<T> {
type Response = super::TribeeDynClickRsp;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TribeeDynClickReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as CosmoInterface>::tribee_dyn_click(&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 = TribeeDynClickSvc(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(
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 CosmoInterfaceServer<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.community.interfacess.cosmoconn.v1.CosmoInterface";
impl<T> tonic::server::NamedService for CosmoInterfaceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}