mikufans_proto_intl/
bilibili.account.interfaces.v1.rs

1// This file is @generated by prost-build.
2///
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct MidByNameReply {
5    ///
6    #[prost(map = "string, int64", tag = "1")]
7    pub name_map: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
8}
9///
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct MidByNameReq {
12    ///
13    #[prost(string, repeated, tag = "1")]
14    pub names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
15}
16///
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct UnameMessageReply {
19    ///
20    #[prost(bool, tag = "1")]
21    pub allow: bool,
22    ///
23    #[prost(bool, tag = "2")]
24    pub realname_or_tel: bool,
25    ///
26    #[prost(string, tag = "3")]
27    pub uname_message: ::prost::alloc::string::String,
28    ///
29    #[prost(string, tag = "4")]
30    pub confirm_message: ::prost::alloc::string::String,
31    ///
32    #[prost(string, tag = "5")]
33    pub condition_message: ::prost::alloc::string::String,
34    ///
35    #[prost(string, tag = "6")]
36    pub bind_tel: ::prost::alloc::string::String,
37}
38///
39#[derive(Clone, Copy, PartialEq, ::prost::Message)]
40pub struct UnameMessageReq {}
41///
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct UpdateNameReply {
44    ///
45    #[prost(int64, tag = "1")]
46    pub code: i64,
47    ///
48    #[prost(string, tag = "2")]
49    pub msg: ::prost::alloc::string::String,
50    ///
51    #[prost(string, repeated, tag = "3")]
52    pub name_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
53    ///
54    #[prost(string, tag = "4")]
55    pub name: ::prost::alloc::string::String,
56}
57///
58#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct UpdateNameReq {
60    ///
61    #[prost(string, tag = "1")]
62    pub uname: ::prost::alloc::string::String,
63    ///
64    #[prost(string, tag = "2")]
65    pub source: ::prost::alloc::string::String,
66}
67/// Generated client implementations.
68pub mod account_interface_v1_client {
69    #![allow(
70        unused_variables,
71        dead_code,
72        missing_docs,
73        clippy::wildcard_imports,
74        clippy::let_unit_value,
75    )]
76    use tonic::codegen::*;
77    use tonic::codegen::http::Uri;
78    ///
79    #[derive(Debug, Clone)]
80    pub struct AccountInterfaceV1Client<T> {
81        inner: tonic::client::Grpc<T>,
82    }
83    impl<T> AccountInterfaceV1Client<T>
84    where
85        T: tonic::client::GrpcService<tonic::body::BoxBody>,
86        T::Error: Into<StdError>,
87        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
88        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
89    {
90        pub fn new(inner: T) -> Self {
91            let inner = tonic::client::Grpc::new(inner);
92            Self { inner }
93        }
94        pub fn with_origin(inner: T, origin: Uri) -> Self {
95            let inner = tonic::client::Grpc::with_origin(inner, origin);
96            Self { inner }
97        }
98        pub fn with_interceptor<F>(
99            inner: T,
100            interceptor: F,
101        ) -> AccountInterfaceV1Client<InterceptedService<T, F>>
102        where
103            F: tonic::service::Interceptor,
104            T::ResponseBody: Default,
105            T: tonic::codegen::Service<
106                http::Request<tonic::body::BoxBody>,
107                Response = http::Response<
108                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
109                >,
110            >,
111            <T as tonic::codegen::Service<
112                http::Request<tonic::body::BoxBody>,
113            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
114        {
115            AccountInterfaceV1Client::new(InterceptedService::new(inner, interceptor))
116        }
117        /// Compress requests with the given encoding.
118        ///
119        /// This requires the server to support it otherwise it might respond with an
120        /// error.
121        #[must_use]
122        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
123            self.inner = self.inner.send_compressed(encoding);
124            self
125        }
126        /// Enable decompressing responses.
127        #[must_use]
128        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
129            self.inner = self.inner.accept_compressed(encoding);
130            self
131        }
132        /// Limits the maximum size of a decoded message.
133        ///
134        /// Default: `4MB`
135        #[must_use]
136        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
137            self.inner = self.inner.max_decoding_message_size(limit);
138            self
139        }
140        /// Limits the maximum size of an encoded message.
141        ///
142        /// Default: `usize::MAX`
143        #[must_use]
144        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
145            self.inner = self.inner.max_encoding_message_size(limit);
146            self
147        }
148        ///
149        pub async fn mid_by_name(
150            &mut self,
151            request: impl tonic::IntoRequest<super::MidByNameReq>,
152        ) -> std::result::Result<tonic::Response<super::MidByNameReply>, tonic::Status> {
153            self.inner
154                .ready()
155                .await
156                .map_err(|e| {
157                    tonic::Status::unknown(
158                        format!("Service was not ready: {}", e.into()),
159                    )
160                })?;
161            let codec = tonic::codec::ProstCodec::default();
162            let path = http::uri::PathAndQuery::from_static(
163                "/bilibili.account.interfaces.v1.AccountInterfaceV1/MidByName",
164            );
165            let mut req = request.into_request();
166            req.extensions_mut()
167                .insert(
168                    GrpcMethod::new(
169                        "bilibili.account.interfaces.v1.AccountInterfaceV1",
170                        "MidByName",
171                    ),
172                );
173            self.inner.unary(req, path, codec).await
174        }
175        ///
176        pub async fn uname_message(
177            &mut self,
178            request: impl tonic::IntoRequest<super::UnameMessageReq>,
179        ) -> std::result::Result<
180            tonic::Response<super::UnameMessageReply>,
181            tonic::Status,
182        > {
183            self.inner
184                .ready()
185                .await
186                .map_err(|e| {
187                    tonic::Status::unknown(
188                        format!("Service was not ready: {}", e.into()),
189                    )
190                })?;
191            let codec = tonic::codec::ProstCodec::default();
192            let path = http::uri::PathAndQuery::from_static(
193                "/bilibili.account.interfaces.v1.AccountInterfaceV1/UnameMessage",
194            );
195            let mut req = request.into_request();
196            req.extensions_mut()
197                .insert(
198                    GrpcMethod::new(
199                        "bilibili.account.interfaces.v1.AccountInterfaceV1",
200                        "UnameMessage",
201                    ),
202                );
203            self.inner.unary(req, path, codec).await
204        }
205        ///
206        pub async fn update_name_v2(
207            &mut self,
208            request: impl tonic::IntoRequest<super::UpdateNameReq>,
209        ) -> std::result::Result<
210            tonic::Response<super::UpdateNameReply>,
211            tonic::Status,
212        > {
213            self.inner
214                .ready()
215                .await
216                .map_err(|e| {
217                    tonic::Status::unknown(
218                        format!("Service was not ready: {}", e.into()),
219                    )
220                })?;
221            let codec = tonic::codec::ProstCodec::default();
222            let path = http::uri::PathAndQuery::from_static(
223                "/bilibili.account.interfaces.v1.AccountInterfaceV1/UpdateNameV2",
224            );
225            let mut req = request.into_request();
226            req.extensions_mut()
227                .insert(
228                    GrpcMethod::new(
229                        "bilibili.account.interfaces.v1.AccountInterfaceV1",
230                        "UpdateNameV2",
231                    ),
232                );
233            self.inner.unary(req, path, codec).await
234        }
235    }
236}
237/// Generated server implementations.
238pub mod account_interface_v1_server {
239    #![allow(
240        unused_variables,
241        dead_code,
242        missing_docs,
243        clippy::wildcard_imports,
244        clippy::let_unit_value,
245    )]
246    use tonic::codegen::*;
247    /// Generated trait containing gRPC methods that should be implemented for use with AccountInterfaceV1Server.
248    #[async_trait]
249    pub trait AccountInterfaceV1: std::marker::Send + std::marker::Sync + 'static {
250        ///
251        async fn mid_by_name(
252            &self,
253            request: tonic::Request<super::MidByNameReq>,
254        ) -> std::result::Result<tonic::Response<super::MidByNameReply>, tonic::Status>;
255        ///
256        async fn uname_message(
257            &self,
258            request: tonic::Request<super::UnameMessageReq>,
259        ) -> std::result::Result<
260            tonic::Response<super::UnameMessageReply>,
261            tonic::Status,
262        >;
263        ///
264        async fn update_name_v2(
265            &self,
266            request: tonic::Request<super::UpdateNameReq>,
267        ) -> std::result::Result<tonic::Response<super::UpdateNameReply>, tonic::Status>;
268    }
269    ///
270    #[derive(Debug)]
271    pub struct AccountInterfaceV1Server<T> {
272        inner: Arc<T>,
273        accept_compression_encodings: EnabledCompressionEncodings,
274        send_compression_encodings: EnabledCompressionEncodings,
275        max_decoding_message_size: Option<usize>,
276        max_encoding_message_size: Option<usize>,
277    }
278    impl<T> AccountInterfaceV1Server<T> {
279        pub fn new(inner: T) -> Self {
280            Self::from_arc(Arc::new(inner))
281        }
282        pub fn from_arc(inner: Arc<T>) -> Self {
283            Self {
284                inner,
285                accept_compression_encodings: Default::default(),
286                send_compression_encodings: Default::default(),
287                max_decoding_message_size: None,
288                max_encoding_message_size: None,
289            }
290        }
291        pub fn with_interceptor<F>(
292            inner: T,
293            interceptor: F,
294        ) -> InterceptedService<Self, F>
295        where
296            F: tonic::service::Interceptor,
297        {
298            InterceptedService::new(Self::new(inner), interceptor)
299        }
300        /// Enable decompressing requests with the given encoding.
301        #[must_use]
302        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
303            self.accept_compression_encodings.enable(encoding);
304            self
305        }
306        /// Compress responses with the given encoding, if the client supports it.
307        #[must_use]
308        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
309            self.send_compression_encodings.enable(encoding);
310            self
311        }
312        /// Limits the maximum size of a decoded message.
313        ///
314        /// Default: `4MB`
315        #[must_use]
316        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
317            self.max_decoding_message_size = Some(limit);
318            self
319        }
320        /// Limits the maximum size of an encoded message.
321        ///
322        /// Default: `usize::MAX`
323        #[must_use]
324        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
325            self.max_encoding_message_size = Some(limit);
326            self
327        }
328    }
329    impl<T, B> tonic::codegen::Service<http::Request<B>> for AccountInterfaceV1Server<T>
330    where
331        T: AccountInterfaceV1,
332        B: Body + std::marker::Send + 'static,
333        B::Error: Into<StdError> + std::marker::Send + 'static,
334    {
335        type Response = http::Response<tonic::body::BoxBody>;
336        type Error = std::convert::Infallible;
337        type Future = BoxFuture<Self::Response, Self::Error>;
338        fn poll_ready(
339            &mut self,
340            _cx: &mut Context<'_>,
341        ) -> Poll<std::result::Result<(), Self::Error>> {
342            Poll::Ready(Ok(()))
343        }
344        fn call(&mut self, req: http::Request<B>) -> Self::Future {
345            match req.uri().path() {
346                "/bilibili.account.interfaces.v1.AccountInterfaceV1/MidByName" => {
347                    #[allow(non_camel_case_types)]
348                    struct MidByNameSvc<T: AccountInterfaceV1>(pub Arc<T>);
349                    impl<
350                        T: AccountInterfaceV1,
351                    > tonic::server::UnaryService<super::MidByNameReq>
352                    for MidByNameSvc<T> {
353                        type Response = super::MidByNameReply;
354                        type Future = BoxFuture<
355                            tonic::Response<Self::Response>,
356                            tonic::Status,
357                        >;
358                        fn call(
359                            &mut self,
360                            request: tonic::Request<super::MidByNameReq>,
361                        ) -> Self::Future {
362                            let inner = Arc::clone(&self.0);
363                            let fut = async move {
364                                <T as AccountInterfaceV1>::mid_by_name(&inner, request)
365                                    .await
366                            };
367                            Box::pin(fut)
368                        }
369                    }
370                    let accept_compression_encodings = self.accept_compression_encodings;
371                    let send_compression_encodings = self.send_compression_encodings;
372                    let max_decoding_message_size = self.max_decoding_message_size;
373                    let max_encoding_message_size = self.max_encoding_message_size;
374                    let inner = self.inner.clone();
375                    let fut = async move {
376                        let method = MidByNameSvc(inner);
377                        let codec = tonic::codec::ProstCodec::default();
378                        let mut grpc = tonic::server::Grpc::new(codec)
379                            .apply_compression_config(
380                                accept_compression_encodings,
381                                send_compression_encodings,
382                            )
383                            .apply_max_message_size_config(
384                                max_decoding_message_size,
385                                max_encoding_message_size,
386                            );
387                        let res = grpc.unary(method, req).await;
388                        Ok(res)
389                    };
390                    Box::pin(fut)
391                }
392                "/bilibili.account.interfaces.v1.AccountInterfaceV1/UnameMessage" => {
393                    #[allow(non_camel_case_types)]
394                    struct UnameMessageSvc<T: AccountInterfaceV1>(pub Arc<T>);
395                    impl<
396                        T: AccountInterfaceV1,
397                    > tonic::server::UnaryService<super::UnameMessageReq>
398                    for UnameMessageSvc<T> {
399                        type Response = super::UnameMessageReply;
400                        type Future = BoxFuture<
401                            tonic::Response<Self::Response>,
402                            tonic::Status,
403                        >;
404                        fn call(
405                            &mut self,
406                            request: tonic::Request<super::UnameMessageReq>,
407                        ) -> Self::Future {
408                            let inner = Arc::clone(&self.0);
409                            let fut = async move {
410                                <T as AccountInterfaceV1>::uname_message(&inner, request)
411                                    .await
412                            };
413                            Box::pin(fut)
414                        }
415                    }
416                    let accept_compression_encodings = self.accept_compression_encodings;
417                    let send_compression_encodings = self.send_compression_encodings;
418                    let max_decoding_message_size = self.max_decoding_message_size;
419                    let max_encoding_message_size = self.max_encoding_message_size;
420                    let inner = self.inner.clone();
421                    let fut = async move {
422                        let method = UnameMessageSvc(inner);
423                        let codec = tonic::codec::ProstCodec::default();
424                        let mut grpc = tonic::server::Grpc::new(codec)
425                            .apply_compression_config(
426                                accept_compression_encodings,
427                                send_compression_encodings,
428                            )
429                            .apply_max_message_size_config(
430                                max_decoding_message_size,
431                                max_encoding_message_size,
432                            );
433                        let res = grpc.unary(method, req).await;
434                        Ok(res)
435                    };
436                    Box::pin(fut)
437                }
438                "/bilibili.account.interfaces.v1.AccountInterfaceV1/UpdateNameV2" => {
439                    #[allow(non_camel_case_types)]
440                    struct UpdateNameV2Svc<T: AccountInterfaceV1>(pub Arc<T>);
441                    impl<
442                        T: AccountInterfaceV1,
443                    > tonic::server::UnaryService<super::UpdateNameReq>
444                    for UpdateNameV2Svc<T> {
445                        type Response = super::UpdateNameReply;
446                        type Future = BoxFuture<
447                            tonic::Response<Self::Response>,
448                            tonic::Status,
449                        >;
450                        fn call(
451                            &mut self,
452                            request: tonic::Request<super::UpdateNameReq>,
453                        ) -> Self::Future {
454                            let inner = Arc::clone(&self.0);
455                            let fut = async move {
456                                <T as AccountInterfaceV1>::update_name_v2(&inner, request)
457                                    .await
458                            };
459                            Box::pin(fut)
460                        }
461                    }
462                    let accept_compression_encodings = self.accept_compression_encodings;
463                    let send_compression_encodings = self.send_compression_encodings;
464                    let max_decoding_message_size = self.max_decoding_message_size;
465                    let max_encoding_message_size = self.max_encoding_message_size;
466                    let inner = self.inner.clone();
467                    let fut = async move {
468                        let method = UpdateNameV2Svc(inner);
469                        let codec = tonic::codec::ProstCodec::default();
470                        let mut grpc = tonic::server::Grpc::new(codec)
471                            .apply_compression_config(
472                                accept_compression_encodings,
473                                send_compression_encodings,
474                            )
475                            .apply_max_message_size_config(
476                                max_decoding_message_size,
477                                max_encoding_message_size,
478                            );
479                        let res = grpc.unary(method, req).await;
480                        Ok(res)
481                    };
482                    Box::pin(fut)
483                }
484                _ => {
485                    Box::pin(async move {
486                        let mut response = http::Response::new(empty_body());
487                        let headers = response.headers_mut();
488                        headers
489                            .insert(
490                                tonic::Status::GRPC_STATUS,
491                                (tonic::Code::Unimplemented as i32).into(),
492                            );
493                        headers
494                            .insert(
495                                http::header::CONTENT_TYPE,
496                                tonic::metadata::GRPC_CONTENT_TYPE,
497                            );
498                        Ok(response)
499                    })
500                }
501            }
502        }
503    }
504    impl<T> Clone for AccountInterfaceV1Server<T> {
505        fn clone(&self) -> Self {
506            let inner = self.inner.clone();
507            Self {
508                inner,
509                accept_compression_encodings: self.accept_compression_encodings,
510                send_compression_encodings: self.send_compression_encodings,
511                max_decoding_message_size: self.max_decoding_message_size,
512                max_encoding_message_size: self.max_encoding_message_size,
513            }
514        }
515    }
516    /// Generated gRPC service name
517    pub const SERVICE_NAME: &str = "bilibili.account.interfaces.v1.AccountInterfaceV1";
518    impl<T> tonic::server::NamedService for AccountInterfaceV1Server<T> {
519        const NAME: &'static str = SERVICE_NAME;
520    }
521}