1#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct FieldCertPopActionReq {
5 #[prost(int64, tag = "1")]
7 pub avid: i64,
8 #[prost(enumeration = "Action", tag = "2")]
10 pub action: i32,
11}
12#[derive(Clone, Copy, PartialEq, ::prost::Message)]
14pub struct FieldCertPopActionRsp {}
15#[derive(Clone, Copy, PartialEq, ::prost::Message)]
17pub struct FieldCertPopRecordReq {
18 #[prost(int64, tag = "1")]
20 pub avid: i64,
21}
22#[derive(Clone, Copy, PartialEq, ::prost::Message)]
24pub struct FieldCertPopRecordRsp {}
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
27#[repr(i32)]
28pub enum Action {
29 CertCancel = 0,
31 CertConfirm = 1,
33}
34impl Action {
35 pub fn as_str_name(&self) -> &'static str {
40 match self {
41 Self::CertCancel => "ACTION_CERT_CANCEL",
42 Self::CertConfirm => "ACTION_CERT_CONFIRM",
43 }
44 }
45 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
47 match value {
48 "ACTION_CERT_CANCEL" => Some(Self::CertCancel),
49 "ACTION_CERT_CONFIRM" => Some(Self::CertConfirm),
50 _ => None,
51 }
52 }
53}
54pub mod field_cert_client {
56 #![allow(
57 unused_variables,
58 dead_code,
59 missing_docs,
60 clippy::wildcard_imports,
61 clippy::let_unit_value,
62 )]
63 use tonic::codegen::*;
64 use tonic::codegen::http::Uri;
65 #[derive(Debug, Clone)]
67 pub struct FieldCertClient<T> {
68 inner: tonic::client::Grpc<T>,
69 }
70 impl<T> FieldCertClient<T>
71 where
72 T: tonic::client::GrpcService<tonic::body::BoxBody>,
73 T::Error: Into<StdError>,
74 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
75 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
76 {
77 pub fn new(inner: T) -> Self {
78 let inner = tonic::client::Grpc::new(inner);
79 Self { inner }
80 }
81 pub fn with_origin(inner: T, origin: Uri) -> Self {
82 let inner = tonic::client::Grpc::with_origin(inner, origin);
83 Self { inner }
84 }
85 pub fn with_interceptor<F>(
86 inner: T,
87 interceptor: F,
88 ) -> FieldCertClient<InterceptedService<T, F>>
89 where
90 F: tonic::service::Interceptor,
91 T::ResponseBody: Default,
92 T: tonic::codegen::Service<
93 http::Request<tonic::body::BoxBody>,
94 Response = http::Response<
95 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
96 >,
97 >,
98 <T as tonic::codegen::Service<
99 http::Request<tonic::body::BoxBody>,
100 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
101 {
102 FieldCertClient::new(InterceptedService::new(inner, interceptor))
103 }
104 #[must_use]
109 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
110 self.inner = self.inner.send_compressed(encoding);
111 self
112 }
113 #[must_use]
115 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
116 self.inner = self.inner.accept_compressed(encoding);
117 self
118 }
119 #[must_use]
123 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
124 self.inner = self.inner.max_decoding_message_size(limit);
125 self
126 }
127 #[must_use]
131 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
132 self.inner = self.inner.max_encoding_message_size(limit);
133 self
134 }
135 pub async fn field_cert_pop_action(
137 &mut self,
138 request: impl tonic::IntoRequest<super::FieldCertPopActionReq>,
139 ) -> std::result::Result<
140 tonic::Response<super::FieldCertPopActionRsp>,
141 tonic::Status,
142 > {
143 self.inner
144 .ready()
145 .await
146 .map_err(|e| {
147 tonic::Status::unknown(
148 format!("Service was not ready: {}", e.into()),
149 )
150 })?;
151 let codec = tonic::codec::ProstCodec::default();
152 let path = http::uri::PathAndQuery::from_static(
153 "/bilibili.community.service.cert.v1.FieldCert/FieldCertPopAction",
154 );
155 let mut req = request.into_request();
156 req.extensions_mut()
157 .insert(
158 GrpcMethod::new(
159 "bilibili.community.service.cert.v1.FieldCert",
160 "FieldCertPopAction",
161 ),
162 );
163 self.inner.unary(req, path, codec).await
164 }
165 pub async fn field_cert_pop_record(
167 &mut self,
168 request: impl tonic::IntoRequest<super::FieldCertPopRecordReq>,
169 ) -> std::result::Result<
170 tonic::Response<super::FieldCertPopRecordRsp>,
171 tonic::Status,
172 > {
173 self.inner
174 .ready()
175 .await
176 .map_err(|e| {
177 tonic::Status::unknown(
178 format!("Service was not ready: {}", e.into()),
179 )
180 })?;
181 let codec = tonic::codec::ProstCodec::default();
182 let path = http::uri::PathAndQuery::from_static(
183 "/bilibili.community.service.cert.v1.FieldCert/FieldCertPopRecord",
184 );
185 let mut req = request.into_request();
186 req.extensions_mut()
187 .insert(
188 GrpcMethod::new(
189 "bilibili.community.service.cert.v1.FieldCert",
190 "FieldCertPopRecord",
191 ),
192 );
193 self.inner.unary(req, path, codec).await
194 }
195 }
196}
197pub mod field_cert_server {
199 #![allow(
200 unused_variables,
201 dead_code,
202 missing_docs,
203 clippy::wildcard_imports,
204 clippy::let_unit_value,
205 )]
206 use tonic::codegen::*;
207 #[async_trait]
209 pub trait FieldCert: std::marker::Send + std::marker::Sync + 'static {
210 async fn field_cert_pop_action(
212 &self,
213 request: tonic::Request<super::FieldCertPopActionReq>,
214 ) -> std::result::Result<
215 tonic::Response<super::FieldCertPopActionRsp>,
216 tonic::Status,
217 >;
218 async fn field_cert_pop_record(
220 &self,
221 request: tonic::Request<super::FieldCertPopRecordReq>,
222 ) -> std::result::Result<
223 tonic::Response<super::FieldCertPopRecordRsp>,
224 tonic::Status,
225 >;
226 }
227 #[derive(Debug)]
229 pub struct FieldCertServer<T> {
230 inner: Arc<T>,
231 accept_compression_encodings: EnabledCompressionEncodings,
232 send_compression_encodings: EnabledCompressionEncodings,
233 max_decoding_message_size: Option<usize>,
234 max_encoding_message_size: Option<usize>,
235 }
236 impl<T> FieldCertServer<T> {
237 pub fn new(inner: T) -> Self {
238 Self::from_arc(Arc::new(inner))
239 }
240 pub fn from_arc(inner: Arc<T>) -> Self {
241 Self {
242 inner,
243 accept_compression_encodings: Default::default(),
244 send_compression_encodings: Default::default(),
245 max_decoding_message_size: None,
246 max_encoding_message_size: None,
247 }
248 }
249 pub fn with_interceptor<F>(
250 inner: T,
251 interceptor: F,
252 ) -> InterceptedService<Self, F>
253 where
254 F: tonic::service::Interceptor,
255 {
256 InterceptedService::new(Self::new(inner), interceptor)
257 }
258 #[must_use]
260 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
261 self.accept_compression_encodings.enable(encoding);
262 self
263 }
264 #[must_use]
266 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
267 self.send_compression_encodings.enable(encoding);
268 self
269 }
270 #[must_use]
274 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
275 self.max_decoding_message_size = Some(limit);
276 self
277 }
278 #[must_use]
282 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
283 self.max_encoding_message_size = Some(limit);
284 self
285 }
286 }
287 impl<T, B> tonic::codegen::Service<http::Request<B>> for FieldCertServer<T>
288 where
289 T: FieldCert,
290 B: Body + std::marker::Send + 'static,
291 B::Error: Into<StdError> + std::marker::Send + 'static,
292 {
293 type Response = http::Response<tonic::body::BoxBody>;
294 type Error = std::convert::Infallible;
295 type Future = BoxFuture<Self::Response, Self::Error>;
296 fn poll_ready(
297 &mut self,
298 _cx: &mut Context<'_>,
299 ) -> Poll<std::result::Result<(), Self::Error>> {
300 Poll::Ready(Ok(()))
301 }
302 fn call(&mut self, req: http::Request<B>) -> Self::Future {
303 match req.uri().path() {
304 "/bilibili.community.service.cert.v1.FieldCert/FieldCertPopAction" => {
305 #[allow(non_camel_case_types)]
306 struct FieldCertPopActionSvc<T: FieldCert>(pub Arc<T>);
307 impl<
308 T: FieldCert,
309 > tonic::server::UnaryService<super::FieldCertPopActionReq>
310 for FieldCertPopActionSvc<T> {
311 type Response = super::FieldCertPopActionRsp;
312 type Future = BoxFuture<
313 tonic::Response<Self::Response>,
314 tonic::Status,
315 >;
316 fn call(
317 &mut self,
318 request: tonic::Request<super::FieldCertPopActionReq>,
319 ) -> Self::Future {
320 let inner = Arc::clone(&self.0);
321 let fut = async move {
322 <T as FieldCert>::field_cert_pop_action(&inner, request)
323 .await
324 };
325 Box::pin(fut)
326 }
327 }
328 let accept_compression_encodings = self.accept_compression_encodings;
329 let send_compression_encodings = self.send_compression_encodings;
330 let max_decoding_message_size = self.max_decoding_message_size;
331 let max_encoding_message_size = self.max_encoding_message_size;
332 let inner = self.inner.clone();
333 let fut = async move {
334 let method = FieldCertPopActionSvc(inner);
335 let codec = tonic::codec::ProstCodec::default();
336 let mut grpc = tonic::server::Grpc::new(codec)
337 .apply_compression_config(
338 accept_compression_encodings,
339 send_compression_encodings,
340 )
341 .apply_max_message_size_config(
342 max_decoding_message_size,
343 max_encoding_message_size,
344 );
345 let res = grpc.unary(method, req).await;
346 Ok(res)
347 };
348 Box::pin(fut)
349 }
350 "/bilibili.community.service.cert.v1.FieldCert/FieldCertPopRecord" => {
351 #[allow(non_camel_case_types)]
352 struct FieldCertPopRecordSvc<T: FieldCert>(pub Arc<T>);
353 impl<
354 T: FieldCert,
355 > tonic::server::UnaryService<super::FieldCertPopRecordReq>
356 for FieldCertPopRecordSvc<T> {
357 type Response = super::FieldCertPopRecordRsp;
358 type Future = BoxFuture<
359 tonic::Response<Self::Response>,
360 tonic::Status,
361 >;
362 fn call(
363 &mut self,
364 request: tonic::Request<super::FieldCertPopRecordReq>,
365 ) -> Self::Future {
366 let inner = Arc::clone(&self.0);
367 let fut = async move {
368 <T as FieldCert>::field_cert_pop_record(&inner, request)
369 .await
370 };
371 Box::pin(fut)
372 }
373 }
374 let accept_compression_encodings = self.accept_compression_encodings;
375 let send_compression_encodings = self.send_compression_encodings;
376 let max_decoding_message_size = self.max_decoding_message_size;
377 let max_encoding_message_size = self.max_encoding_message_size;
378 let inner = self.inner.clone();
379 let fut = async move {
380 let method = FieldCertPopRecordSvc(inner);
381 let codec = tonic::codec::ProstCodec::default();
382 let mut grpc = tonic::server::Grpc::new(codec)
383 .apply_compression_config(
384 accept_compression_encodings,
385 send_compression_encodings,
386 )
387 .apply_max_message_size_config(
388 max_decoding_message_size,
389 max_encoding_message_size,
390 );
391 let res = grpc.unary(method, req).await;
392 Ok(res)
393 };
394 Box::pin(fut)
395 }
396 _ => {
397 Box::pin(async move {
398 let mut response = http::Response::new(empty_body());
399 let headers = response.headers_mut();
400 headers
401 .insert(
402 tonic::Status::GRPC_STATUS,
403 (tonic::Code::Unimplemented as i32).into(),
404 );
405 headers
406 .insert(
407 http::header::CONTENT_TYPE,
408 tonic::metadata::GRPC_CONTENT_TYPE,
409 );
410 Ok(response)
411 })
412 }
413 }
414 }
415 }
416 impl<T> Clone for FieldCertServer<T> {
417 fn clone(&self) -> Self {
418 let inner = self.inner.clone();
419 Self {
420 inner,
421 accept_compression_encodings: self.accept_compression_encodings,
422 send_compression_encodings: self.send_compression_encodings,
423 max_decoding_message_size: self.max_decoding_message_size,
424 max_encoding_message_size: self.max_encoding_message_size,
425 }
426 }
427 }
428 pub const SERVICE_NAME: &str = "bilibili.community.service.cert.v1.FieldCert";
430 impl<T> tonic::server::NamedService for FieldCertServer<T> {
431 const NAME: &'static str = SERVICE_NAME;
432 }
433}