#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AtGroup {
#[prost(enumeration = "at_group::Type", tag = "1")]
pub group_type: i32,
#[prost(string, tag = "2")]
pub group_name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub items: ::prost::alloc::vec::Vec<AtItem>,
}
pub mod at_group {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
AtGroupTypeDefault = 0,
AtGroupTypeRecent = 1,
AtGroupTypeFollow = 2,
AtGroupTypeFans = 3,
AtGroupTypeOthers = 4,
}
impl Type {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::AtGroupTypeDefault => "AT_GROUP_TYPE_DEFAULT",
Self::AtGroupTypeRecent => "AT_GROUP_TYPE_RECENT",
Self::AtGroupTypeFollow => "AT_GROUP_TYPE_FOLLOW",
Self::AtGroupTypeFans => "AT_GROUP_TYPE_FANS",
Self::AtGroupTypeOthers => "AT_GROUP_TYPE_OTHERS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"AT_GROUP_TYPE_DEFAULT" => Some(Self::AtGroupTypeDefault),
"AT_GROUP_TYPE_RECENT" => Some(Self::AtGroupTypeRecent),
"AT_GROUP_TYPE_FOLLOW" => Some(Self::AtGroupTypeFollow),
"AT_GROUP_TYPE_FANS" => Some(Self::AtGroupTypeFans),
"AT_GROUP_TYPE_OTHERS" => Some(Self::AtGroupTypeOthers),
_ => None,
}
}
}
}
impl ::prost::Name for AtGroup {
const NAME: &'static str = "AtGroup";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.AtGroup".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.AtGroup".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AtItem {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub face: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub fans: i32,
#[prost(int32, tag = "5")]
pub official_verify_type: i32,
#[prost(message, optional, tag = "6")]
pub avatar: ::core::option::Option<
super::super::dagw::component::avatar::v1::AvatarItem,
>,
}
impl ::prost::Name for AtItem {
const NAME: &'static str = "AtItem";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.AtItem".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.AtItem".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AtSearchReply {
#[prost(message, repeated, tag = "1")]
pub groups: ::prost::alloc::vec::Vec<AtGroup>,
}
impl ::prost::Name for AtSearchReply {
const NAME: &'static str = "AtSearchReply";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.AtSearchReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.AtSearchReply".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AtSearchReq {
#[prost(int64, tag = "1")]
pub mid: i64,
#[prost(string, tag = "2")]
pub keyword: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub scene: i32,
}
impl ::prost::Name for AtSearchReq {
const NAME: &'static str = "AtSearchReq";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.AtSearchReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.AtSearchReq".into()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FollowingReq {
#[prost(int64, tag = "1")]
pub fid: i64,
#[prost(enumeration = "Act", tag = "2")]
pub act: i32,
#[prost(int32, tag = "3")]
pub source: i32,
#[prost(string, tag = "4")]
pub spmid: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub extend_content: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub from_spmid: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub from_scmid: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub action_id: ::prost::alloc::string::String,
}
impl ::prost::Name for FollowingReq {
const NAME: &'static str = "FollowingReq";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.FollowingReq".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.FollowingReq".into()
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ModifyRelationReply {}
impl ::prost::Name for ModifyRelationReply {
const NAME: &'static str = "ModifyRelationReply";
const PACKAGE: &'static str = "bilibili.relation.interfaces";
fn full_name() -> ::prost::alloc::string::String {
"bilibili.relation.interfaces.ModifyRelationReply".into()
}
fn type_url() -> ::prost::alloc::string::String {
"/bilibili.relation.interfaces.ModifyRelationReply".into()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Act {
Na = 0,
AddFollowing = 1,
DelFollowing = 2,
AddWhisper = 3,
DelWhisper = 4,
AddBlack = 5,
DelBlack = 6,
DelFollower = 7,
}
impl Act {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Na => "ACT_NA",
Self::AddFollowing => "ACT_ADD_FOLLOWING",
Self::DelFollowing => "ACT_DEL_FOLLOWING",
Self::AddWhisper => "ACT_ADD_WHISPER",
Self::DelWhisper => "ACT_DEL_WHISPER",
Self::AddBlack => "ACT_ADD_BLACK",
Self::DelBlack => "ACT_DEL_BLACK",
Self::DelFollower => "ACT_DEL_FOLLOWER",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACT_NA" => Some(Self::Na),
"ACT_ADD_FOLLOWING" => Some(Self::AddFollowing),
"ACT_DEL_FOLLOWING" => Some(Self::DelFollowing),
"ACT_ADD_WHISPER" => Some(Self::AddWhisper),
"ACT_DEL_WHISPER" => Some(Self::DelWhisper),
"ACT_ADD_BLACK" => Some(Self::AddBlack),
"ACT_DEL_BLACK" => Some(Self::DelBlack),
"ACT_DEL_FOLLOWER" => Some(Self::DelFollower),
_ => None,
}
}
}
#[cfg(feature = "feat-enable-generated-client")]
pub mod relation_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 RelationInterfaceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> RelationInterfaceClient<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,
) -> RelationInterfaceClient<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,
{
RelationInterfaceClient::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 at_search(
&mut self,
request: impl tonic::IntoRequest<super::AtSearchReq>,
) -> std::result::Result<tonic::Response<super::AtSearchReply>, 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.relation.interfaces.RelationInterface/AtSearch",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.relation.interfaces.RelationInterface",
"AtSearch",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn modify_relation(
&mut self,
request: impl tonic::IntoRequest<super::FollowingReq>,
) -> std::result::Result<
tonic::Response<super::ModifyRelationReply>,
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.relation.interfaces.RelationInterface/ModifyRelation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.relation.interfaces.RelationInterface",
"ModifyRelation",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[cfg(feature = "feat-enable-generated-server")]
pub mod relation_interface_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait RelationInterface: std::marker::Send + std::marker::Sync + 'static {
async fn at_search(
&self,
request: tonic::Request<super::AtSearchReq>,
) -> std::result::Result<tonic::Response<super::AtSearchReply>, tonic::Status>;
async fn modify_relation(
&self,
request: tonic::Request<super::FollowingReq>,
) -> std::result::Result<
tonic::Response<super::ModifyRelationReply>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct RelationInterfaceServer<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> RelationInterfaceServer<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 RelationInterfaceServer<T>
where
T: RelationInterface,
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.relation.interfaces.RelationInterface/AtSearch" => {
#[allow(non_camel_case_types)]
struct AtSearchSvc<T: RelationInterface>(pub Arc<T>);
impl<
T: RelationInterface,
> tonic::server::UnaryService<super::AtSearchReq>
for AtSearchSvc<T> {
type Response = super::AtSearchReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AtSearchReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as RelationInterface>::at_search(&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 = AtSearchSvc(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.relation.interfaces.RelationInterface/ModifyRelation" => {
#[allow(non_camel_case_types)]
struct ModifyRelationSvc<T: RelationInterface>(pub Arc<T>);
impl<
T: RelationInterface,
> tonic::server::UnaryService<super::FollowingReq>
for ModifyRelationSvc<T> {
type Response = super::ModifyRelationReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::FollowingReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as RelationInterface>::modify_relation(&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 = ModifyRelationSvc(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 RelationInterfaceServer<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.relation.interfaces.RelationInterface";
impl<T> tonic::server::NamedService for RelationInterfaceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}