mikufans_proto_intl/
bilibili.broadcast.message.archive.rs

1// This file is @generated by prost-build.
2///
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct VideoDataReply {
5    ///
6    #[prost(int64, tag = "1")]
7    pub r#type: i64,
8    ///
9    #[prost(string, tag = "2")]
10    pub data: ::prost::alloc::string::String,
11}
12/// Generated client implementations.
13pub mod video_up_client {
14    #![allow(
15        unused_variables,
16        dead_code,
17        missing_docs,
18        clippy::wildcard_imports,
19        clippy::let_unit_value,
20    )]
21    use tonic::codegen::*;
22    use tonic::codegen::http::Uri;
23    ///
24    #[derive(Debug, Clone)]
25    pub struct VideoUpClient<T> {
26        inner: tonic::client::Grpc<T>,
27    }
28    impl<T> VideoUpClient<T>
29    where
30        T: tonic::client::GrpcService<tonic::body::BoxBody>,
31        T::Error: Into<StdError>,
32        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
33        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
34    {
35        pub fn new(inner: T) -> Self {
36            let inner = tonic::client::Grpc::new(inner);
37            Self { inner }
38        }
39        pub fn with_origin(inner: T, origin: Uri) -> Self {
40            let inner = tonic::client::Grpc::with_origin(inner, origin);
41            Self { inner }
42        }
43        pub fn with_interceptor<F>(
44            inner: T,
45            interceptor: F,
46        ) -> VideoUpClient<InterceptedService<T, F>>
47        where
48            F: tonic::service::Interceptor,
49            T::ResponseBody: Default,
50            T: tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52                Response = http::Response<
53                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
54                >,
55            >,
56            <T as tonic::codegen::Service<
57                http::Request<tonic::body::BoxBody>,
58            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
59        {
60            VideoUpClient::new(InterceptedService::new(inner, interceptor))
61        }
62        /// Compress requests with the given encoding.
63        ///
64        /// This requires the server to support it otherwise it might respond with an
65        /// error.
66        #[must_use]
67        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.send_compressed(encoding);
69            self
70        }
71        /// Enable decompressing responses.
72        #[must_use]
73        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
74            self.inner = self.inner.accept_compressed(encoding);
75            self
76        }
77        /// Limits the maximum size of a decoded message.
78        ///
79        /// Default: `4MB`
80        #[must_use]
81        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
82            self.inner = self.inner.max_decoding_message_size(limit);
83            self
84        }
85        /// Limits the maximum size of an encoded message.
86        ///
87        /// Default: `usize::MAX`
88        #[must_use]
89        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
90            self.inner = self.inner.max_encoding_message_size(limit);
91            self
92        }
93        ///
94        pub async fn video_data(
95            &mut self,
96            request: impl tonic::IntoRequest<()>,
97        ) -> std::result::Result<tonic::Response<super::VideoDataReply>, tonic::Status> {
98            self.inner
99                .ready()
100                .await
101                .map_err(|e| {
102                    tonic::Status::unknown(
103                        format!("Service was not ready: {}", e.into()),
104                    )
105                })?;
106            let codec = tonic::codec::ProstCodec::default();
107            let path = http::uri::PathAndQuery::from_static(
108                "/bilibili.broadcast.message.archive.VideoUp/VideoData",
109            );
110            let mut req = request.into_request();
111            req.extensions_mut()
112                .insert(
113                    GrpcMethod::new(
114                        "bilibili.broadcast.message.archive.VideoUp",
115                        "VideoData",
116                    ),
117                );
118            self.inner.unary(req, path, codec).await
119        }
120    }
121}
122/// Generated server implementations.
123pub mod video_up_server {
124    #![allow(
125        unused_variables,
126        dead_code,
127        missing_docs,
128        clippy::wildcard_imports,
129        clippy::let_unit_value,
130    )]
131    use tonic::codegen::*;
132    /// Generated trait containing gRPC methods that should be implemented for use with VideoUpServer.
133    #[async_trait]
134    pub trait VideoUp: std::marker::Send + std::marker::Sync + 'static {
135        ///
136        async fn video_data(
137            &self,
138            request: tonic::Request<()>,
139        ) -> std::result::Result<tonic::Response<super::VideoDataReply>, tonic::Status>;
140    }
141    ///
142    #[derive(Debug)]
143    pub struct VideoUpServer<T> {
144        inner: Arc<T>,
145        accept_compression_encodings: EnabledCompressionEncodings,
146        send_compression_encodings: EnabledCompressionEncodings,
147        max_decoding_message_size: Option<usize>,
148        max_encoding_message_size: Option<usize>,
149    }
150    impl<T> VideoUpServer<T> {
151        pub fn new(inner: T) -> Self {
152            Self::from_arc(Arc::new(inner))
153        }
154        pub fn from_arc(inner: Arc<T>) -> Self {
155            Self {
156                inner,
157                accept_compression_encodings: Default::default(),
158                send_compression_encodings: Default::default(),
159                max_decoding_message_size: None,
160                max_encoding_message_size: None,
161            }
162        }
163        pub fn with_interceptor<F>(
164            inner: T,
165            interceptor: F,
166        ) -> InterceptedService<Self, F>
167        where
168            F: tonic::service::Interceptor,
169        {
170            InterceptedService::new(Self::new(inner), interceptor)
171        }
172        /// Enable decompressing requests with the given encoding.
173        #[must_use]
174        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
175            self.accept_compression_encodings.enable(encoding);
176            self
177        }
178        /// Compress responses with the given encoding, if the client supports it.
179        #[must_use]
180        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
181            self.send_compression_encodings.enable(encoding);
182            self
183        }
184        /// Limits the maximum size of a decoded message.
185        ///
186        /// Default: `4MB`
187        #[must_use]
188        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
189            self.max_decoding_message_size = Some(limit);
190            self
191        }
192        /// Limits the maximum size of an encoded message.
193        ///
194        /// Default: `usize::MAX`
195        #[must_use]
196        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
197            self.max_encoding_message_size = Some(limit);
198            self
199        }
200    }
201    impl<T, B> tonic::codegen::Service<http::Request<B>> for VideoUpServer<T>
202    where
203        T: VideoUp,
204        B: Body + std::marker::Send + 'static,
205        B::Error: Into<StdError> + std::marker::Send + 'static,
206    {
207        type Response = http::Response<tonic::body::BoxBody>;
208        type Error = std::convert::Infallible;
209        type Future = BoxFuture<Self::Response, Self::Error>;
210        fn poll_ready(
211            &mut self,
212            _cx: &mut Context<'_>,
213        ) -> Poll<std::result::Result<(), Self::Error>> {
214            Poll::Ready(Ok(()))
215        }
216        fn call(&mut self, req: http::Request<B>) -> Self::Future {
217            match req.uri().path() {
218                "/bilibili.broadcast.message.archive.VideoUp/VideoData" => {
219                    #[allow(non_camel_case_types)]
220                    struct VideoDataSvc<T: VideoUp>(pub Arc<T>);
221                    impl<T: VideoUp> tonic::server::UnaryService<()>
222                    for VideoDataSvc<T> {
223                        type Response = super::VideoDataReply;
224                        type Future = BoxFuture<
225                            tonic::Response<Self::Response>,
226                            tonic::Status,
227                        >;
228                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
229                            let inner = Arc::clone(&self.0);
230                            let fut = async move {
231                                <T as VideoUp>::video_data(&inner, request).await
232                            };
233                            Box::pin(fut)
234                        }
235                    }
236                    let accept_compression_encodings = self.accept_compression_encodings;
237                    let send_compression_encodings = self.send_compression_encodings;
238                    let max_decoding_message_size = self.max_decoding_message_size;
239                    let max_encoding_message_size = self.max_encoding_message_size;
240                    let inner = self.inner.clone();
241                    let fut = async move {
242                        let method = VideoDataSvc(inner);
243                        let codec = tonic::codec::ProstCodec::default();
244                        let mut grpc = tonic::server::Grpc::new(codec)
245                            .apply_compression_config(
246                                accept_compression_encodings,
247                                send_compression_encodings,
248                            )
249                            .apply_max_message_size_config(
250                                max_decoding_message_size,
251                                max_encoding_message_size,
252                            );
253                        let res = grpc.unary(method, req).await;
254                        Ok(res)
255                    };
256                    Box::pin(fut)
257                }
258                _ => {
259                    Box::pin(async move {
260                        let mut response = http::Response::new(empty_body());
261                        let headers = response.headers_mut();
262                        headers
263                            .insert(
264                                tonic::Status::GRPC_STATUS,
265                                (tonic::Code::Unimplemented as i32).into(),
266                            );
267                        headers
268                            .insert(
269                                http::header::CONTENT_TYPE,
270                                tonic::metadata::GRPC_CONTENT_TYPE,
271                            );
272                        Ok(response)
273                    })
274                }
275            }
276        }
277    }
278    impl<T> Clone for VideoUpServer<T> {
279        fn clone(&self) -> Self {
280            let inner = self.inner.clone();
281            Self {
282                inner,
283                accept_compression_encodings: self.accept_compression_encodings,
284                send_compression_encodings: self.send_compression_encodings,
285                max_decoding_message_size: self.max_decoding_message_size,
286                max_encoding_message_size: self.max_encoding_message_size,
287            }
288        }
289    }
290    /// Generated gRPC service name
291    pub const SERVICE_NAME: &str = "bilibili.broadcast.message.archive.VideoUp";
292    impl<T> tonic::server::NamedService for VideoUpServer<T> {
293        const NAME: &'static str = SERVICE_NAME;
294    }
295}