Browse and listen to thousands of radio stations across the globe right from your terminal 🌎 📻 🎵✨
radio
rust
tokio
web-radio
command-line-tool
tui
1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct GetCategoriesRequest {
4 #[prost(string, optional, tag = "1")]
5 pub provider: ::core::option::Option<::prost::alloc::string::String>,
6 #[prost(uint32, optional, tag = "2")]
7 pub offset: ::core::option::Option<u32>,
8 #[prost(uint32, optional, tag = "3")]
9 pub limit: ::core::option::Option<u32>,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct GetCategoriesResponse {
13 #[prost(message, repeated, tag = "1")]
14 pub categories: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Category>,
15}
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct BrowseCategoryRequest {
18 #[prost(string, tag = "1")]
19 pub category_id: ::prost::alloc::string::String,
20 #[prost(string, optional, tag = "2")]
21 pub provider: ::core::option::Option<::prost::alloc::string::String>,
22 #[prost(uint32, optional, tag = "3")]
23 pub offset: ::core::option::Option<u32>,
24 #[prost(uint32, optional, tag = "4")]
25 pub limit: ::core::option::Option<u32>,
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct BrowseCategoryResponse {
29 #[prost(message, repeated, tag = "1")]
30 pub categories: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Category>,
31}
32#[derive(Clone, PartialEq, ::prost::Message)]
33pub struct GetStationDetailsRequest {
34 #[prost(string, tag = "1")]
35 pub id: ::prost::alloc::string::String,
36 #[prost(string, optional, tag = "2")]
37 pub provider: ::core::option::Option<::prost::alloc::string::String>,
38}
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct GetStationDetailsResponse {
41 #[prost(message, optional, tag = "1")]
42 pub station_link_details:
43 ::core::option::Option<super::super::objects::v1alpha1::StationLinkDetails>,
44}
45#[derive(Clone, PartialEq, ::prost::Message)]
46pub struct SearchRequest {
47 #[prost(string, tag = "1")]
48 pub query: ::prost::alloc::string::String,
49 #[prost(string, optional, tag = "2")]
50 pub provider: ::core::option::Option<::prost::alloc::string::String>,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct SearchResponse {
54 #[prost(message, repeated, tag = "1")]
55 pub station: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Station>,
56}
57/// Generated client implementations.
58pub mod browse_service_client {
59 #![allow(
60 unused_variables,
61 dead_code,
62 missing_docs,
63 clippy::wildcard_imports,
64 clippy::let_unit_value
65 )]
66 use tonic::codegen::http::Uri;
67 use tonic::codegen::*;
68 #[derive(Debug, Clone)]
69 pub struct BrowseServiceClient<T> {
70 inner: tonic::client::Grpc<T>,
71 }
72 impl BrowseServiceClient<tonic::transport::Channel> {
73 /// Attempt to create a new client by connecting to a given endpoint.
74 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
75 where
76 D: TryInto<tonic::transport::Endpoint>,
77 D::Error: Into<StdError>,
78 {
79 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
80 Ok(Self::new(conn))
81 }
82 }
83 impl<T> BrowseServiceClient<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 ) -> BrowseServiceClient<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<http::Request<tonic::body::BoxBody>>>::Error:
112 Into<StdError> + std::marker::Send + std::marker::Sync,
113 {
114 BrowseServiceClient::new(InterceptedService::new(inner, interceptor))
115 }
116 /// Compress requests with the given encoding.
117 ///
118 /// This requires the server to support it otherwise it might respond with an
119 /// error.
120 #[must_use]
121 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
122 self.inner = self.inner.send_compressed(encoding);
123 self
124 }
125 /// Enable decompressing responses.
126 #[must_use]
127 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
128 self.inner = self.inner.accept_compressed(encoding);
129 self
130 }
131 /// Limits the maximum size of a decoded message.
132 ///
133 /// Default: `4MB`
134 #[must_use]
135 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
136 self.inner = self.inner.max_decoding_message_size(limit);
137 self
138 }
139 /// Limits the maximum size of an encoded message.
140 ///
141 /// Default: `usize::MAX`
142 #[must_use]
143 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
144 self.inner = self.inner.max_encoding_message_size(limit);
145 self
146 }
147 pub async fn get_categories(
148 &mut self,
149 request: impl tonic::IntoRequest<super::GetCategoriesRequest>,
150 ) -> std::result::Result<tonic::Response<super::GetCategoriesResponse>, tonic::Status>
151 {
152 self.inner.ready().await.map_err(|e| {
153 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
154 })?;
155 let codec = tonic::codec::ProstCodec::default();
156 let path = http::uri::PathAndQuery::from_static(
157 "/tunein.v1alpha1.BrowseService/GetCategories",
158 );
159 let mut req = request.into_request();
160 req.extensions_mut().insert(GrpcMethod::new(
161 "tunein.v1alpha1.BrowseService",
162 "GetCategories",
163 ));
164 self.inner.unary(req, path, codec).await
165 }
166 pub async fn browse_category(
167 &mut self,
168 request: impl tonic::IntoRequest<super::BrowseCategoryRequest>,
169 ) -> std::result::Result<tonic::Response<super::BrowseCategoryResponse>, tonic::Status>
170 {
171 self.inner.ready().await.map_err(|e| {
172 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
173 })?;
174 let codec = tonic::codec::ProstCodec::default();
175 let path = http::uri::PathAndQuery::from_static(
176 "/tunein.v1alpha1.BrowseService/BrowseCategory",
177 );
178 let mut req = request.into_request();
179 req.extensions_mut().insert(GrpcMethod::new(
180 "tunein.v1alpha1.BrowseService",
181 "BrowseCategory",
182 ));
183 self.inner.unary(req, path, codec).await
184 }
185 pub async fn get_station_details(
186 &mut self,
187 request: impl tonic::IntoRequest<super::GetStationDetailsRequest>,
188 ) -> std::result::Result<tonic::Response<super::GetStationDetailsResponse>, tonic::Status>
189 {
190 self.inner.ready().await.map_err(|e| {
191 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
192 })?;
193 let codec = tonic::codec::ProstCodec::default();
194 let path = http::uri::PathAndQuery::from_static(
195 "/tunein.v1alpha1.BrowseService/GetStationDetails",
196 );
197 let mut req = request.into_request();
198 req.extensions_mut().insert(GrpcMethod::new(
199 "tunein.v1alpha1.BrowseService",
200 "GetStationDetails",
201 ));
202 self.inner.unary(req, path, codec).await
203 }
204 pub async fn search(
205 &mut self,
206 request: impl tonic::IntoRequest<super::SearchRequest>,
207 ) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status> {
208 self.inner.ready().await.map_err(|e| {
209 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
210 })?;
211 let codec = tonic::codec::ProstCodec::default();
212 let path =
213 http::uri::PathAndQuery::from_static("/tunein.v1alpha1.BrowseService/Search");
214 let mut req = request.into_request();
215 req.extensions_mut()
216 .insert(GrpcMethod::new("tunein.v1alpha1.BrowseService", "Search"));
217 self.inner.unary(req, path, codec).await
218 }
219 }
220}
221/// Generated server implementations.
222pub mod browse_service_server {
223 #![allow(
224 unused_variables,
225 dead_code,
226 missing_docs,
227 clippy::wildcard_imports,
228 clippy::let_unit_value
229 )]
230 use tonic::codegen::*;
231 /// Generated trait containing gRPC methods that should be implemented for use with BrowseServiceServer.
232 #[async_trait]
233 pub trait BrowseService: std::marker::Send + std::marker::Sync + 'static {
234 async fn get_categories(
235 &self,
236 request: tonic::Request<super::GetCategoriesRequest>,
237 ) -> std::result::Result<tonic::Response<super::GetCategoriesResponse>, tonic::Status>;
238 async fn browse_category(
239 &self,
240 request: tonic::Request<super::BrowseCategoryRequest>,
241 ) -> std::result::Result<tonic::Response<super::BrowseCategoryResponse>, tonic::Status>;
242 async fn get_station_details(
243 &self,
244 request: tonic::Request<super::GetStationDetailsRequest>,
245 ) -> std::result::Result<tonic::Response<super::GetStationDetailsResponse>, tonic::Status>;
246 async fn search(
247 &self,
248 request: tonic::Request<super::SearchRequest>,
249 ) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status>;
250 }
251 #[derive(Debug)]
252 pub struct BrowseServiceServer<T> {
253 inner: Arc<T>,
254 accept_compression_encodings: EnabledCompressionEncodings,
255 send_compression_encodings: EnabledCompressionEncodings,
256 max_decoding_message_size: Option<usize>,
257 max_encoding_message_size: Option<usize>,
258 }
259 impl<T> BrowseServiceServer<T> {
260 pub fn new(inner: T) -> Self {
261 Self::from_arc(Arc::new(inner))
262 }
263 pub fn from_arc(inner: Arc<T>) -> Self {
264 Self {
265 inner,
266 accept_compression_encodings: Default::default(),
267 send_compression_encodings: Default::default(),
268 max_decoding_message_size: None,
269 max_encoding_message_size: None,
270 }
271 }
272 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
273 where
274 F: tonic::service::Interceptor,
275 {
276 InterceptedService::new(Self::new(inner), interceptor)
277 }
278 /// Enable decompressing requests with the given encoding.
279 #[must_use]
280 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
281 self.accept_compression_encodings.enable(encoding);
282 self
283 }
284 /// Compress responses with the given encoding, if the client supports it.
285 #[must_use]
286 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
287 self.send_compression_encodings.enable(encoding);
288 self
289 }
290 /// Limits the maximum size of a decoded message.
291 ///
292 /// Default: `4MB`
293 #[must_use]
294 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
295 self.max_decoding_message_size = Some(limit);
296 self
297 }
298 /// Limits the maximum size of an encoded message.
299 ///
300 /// Default: `usize::MAX`
301 #[must_use]
302 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
303 self.max_encoding_message_size = Some(limit);
304 self
305 }
306 }
307 impl<T, B> tonic::codegen::Service<http::Request<B>> for BrowseServiceServer<T>
308 where
309 T: BrowseService,
310 B: Body + std::marker::Send + 'static,
311 B::Error: Into<StdError> + std::marker::Send + 'static,
312 {
313 type Response = http::Response<tonic::body::BoxBody>;
314 type Error = std::convert::Infallible;
315 type Future = BoxFuture<Self::Response, Self::Error>;
316 fn poll_ready(
317 &mut self,
318 _cx: &mut Context<'_>,
319 ) -> Poll<std::result::Result<(), Self::Error>> {
320 Poll::Ready(Ok(()))
321 }
322 fn call(&mut self, req: http::Request<B>) -> Self::Future {
323 match req.uri().path() {
324 "/tunein.v1alpha1.BrowseService/GetCategories" => {
325 #[allow(non_camel_case_types)]
326 struct GetCategoriesSvc<T: BrowseService>(pub Arc<T>);
327 impl<T: BrowseService> tonic::server::UnaryService<super::GetCategoriesRequest>
328 for GetCategoriesSvc<T>
329 {
330 type Response = super::GetCategoriesResponse;
331 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
332 fn call(
333 &mut self,
334 request: tonic::Request<super::GetCategoriesRequest>,
335 ) -> Self::Future {
336 let inner = Arc::clone(&self.0);
337 let fut = async move {
338 <T as BrowseService>::get_categories(&inner, request).await
339 };
340 Box::pin(fut)
341 }
342 }
343 let accept_compression_encodings = self.accept_compression_encodings;
344 let send_compression_encodings = self.send_compression_encodings;
345 let max_decoding_message_size = self.max_decoding_message_size;
346 let max_encoding_message_size = self.max_encoding_message_size;
347 let inner = self.inner.clone();
348 let fut = async move {
349 let method = GetCategoriesSvc(inner);
350 let codec = tonic::codec::ProstCodec::default();
351 let mut grpc = tonic::server::Grpc::new(codec)
352 .apply_compression_config(
353 accept_compression_encodings,
354 send_compression_encodings,
355 )
356 .apply_max_message_size_config(
357 max_decoding_message_size,
358 max_encoding_message_size,
359 );
360 let res = grpc.unary(method, req).await;
361 Ok(res)
362 };
363 Box::pin(fut)
364 }
365 "/tunein.v1alpha1.BrowseService/BrowseCategory" => {
366 #[allow(non_camel_case_types)]
367 struct BrowseCategorySvc<T: BrowseService>(pub Arc<T>);
368 impl<T: BrowseService> tonic::server::UnaryService<super::BrowseCategoryRequest>
369 for BrowseCategorySvc<T>
370 {
371 type Response = super::BrowseCategoryResponse;
372 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
373 fn call(
374 &mut self,
375 request: tonic::Request<super::BrowseCategoryRequest>,
376 ) -> Self::Future {
377 let inner = Arc::clone(&self.0);
378 let fut = async move {
379 <T as BrowseService>::browse_category(&inner, request).await
380 };
381 Box::pin(fut)
382 }
383 }
384 let accept_compression_encodings = self.accept_compression_encodings;
385 let send_compression_encodings = self.send_compression_encodings;
386 let max_decoding_message_size = self.max_decoding_message_size;
387 let max_encoding_message_size = self.max_encoding_message_size;
388 let inner = self.inner.clone();
389 let fut = async move {
390 let method = BrowseCategorySvc(inner);
391 let codec = tonic::codec::ProstCodec::default();
392 let mut grpc = tonic::server::Grpc::new(codec)
393 .apply_compression_config(
394 accept_compression_encodings,
395 send_compression_encodings,
396 )
397 .apply_max_message_size_config(
398 max_decoding_message_size,
399 max_encoding_message_size,
400 );
401 let res = grpc.unary(method, req).await;
402 Ok(res)
403 };
404 Box::pin(fut)
405 }
406 "/tunein.v1alpha1.BrowseService/GetStationDetails" => {
407 #[allow(non_camel_case_types)]
408 struct GetStationDetailsSvc<T: BrowseService>(pub Arc<T>);
409 impl<T: BrowseService>
410 tonic::server::UnaryService<super::GetStationDetailsRequest>
411 for GetStationDetailsSvc<T>
412 {
413 type Response = super::GetStationDetailsResponse;
414 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
415 fn call(
416 &mut self,
417 request: tonic::Request<super::GetStationDetailsRequest>,
418 ) -> Self::Future {
419 let inner = Arc::clone(&self.0);
420 let fut = async move {
421 <T as BrowseService>::get_station_details(&inner, request).await
422 };
423 Box::pin(fut)
424 }
425 }
426 let accept_compression_encodings = self.accept_compression_encodings;
427 let send_compression_encodings = self.send_compression_encodings;
428 let max_decoding_message_size = self.max_decoding_message_size;
429 let max_encoding_message_size = self.max_encoding_message_size;
430 let inner = self.inner.clone();
431 let fut = async move {
432 let method = GetStationDetailsSvc(inner);
433 let codec = tonic::codec::ProstCodec::default();
434 let mut grpc = tonic::server::Grpc::new(codec)
435 .apply_compression_config(
436 accept_compression_encodings,
437 send_compression_encodings,
438 )
439 .apply_max_message_size_config(
440 max_decoding_message_size,
441 max_encoding_message_size,
442 );
443 let res = grpc.unary(method, req).await;
444 Ok(res)
445 };
446 Box::pin(fut)
447 }
448 "/tunein.v1alpha1.BrowseService/Search" => {
449 #[allow(non_camel_case_types)]
450 struct SearchSvc<T: BrowseService>(pub Arc<T>);
451 impl<T: BrowseService> tonic::server::UnaryService<super::SearchRequest> for SearchSvc<T> {
452 type Response = super::SearchResponse;
453 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
454 fn call(
455 &mut self,
456 request: tonic::Request<super::SearchRequest>,
457 ) -> Self::Future {
458 let inner = Arc::clone(&self.0);
459 let fut =
460 async move { <T as BrowseService>::search(&inner, request).await };
461 Box::pin(fut)
462 }
463 }
464 let accept_compression_encodings = self.accept_compression_encodings;
465 let send_compression_encodings = self.send_compression_encodings;
466 let max_decoding_message_size = self.max_decoding_message_size;
467 let max_encoding_message_size = self.max_encoding_message_size;
468 let inner = self.inner.clone();
469 let fut = async move {
470 let method = SearchSvc(inner);
471 let codec = tonic::codec::ProstCodec::default();
472 let mut grpc = tonic::server::Grpc::new(codec)
473 .apply_compression_config(
474 accept_compression_encodings,
475 send_compression_encodings,
476 )
477 .apply_max_message_size_config(
478 max_decoding_message_size,
479 max_encoding_message_size,
480 );
481 let res = grpc.unary(method, req).await;
482 Ok(res)
483 };
484 Box::pin(fut)
485 }
486 _ => Box::pin(async move {
487 let mut response = http::Response::new(empty_body());
488 let headers = response.headers_mut();
489 headers.insert(
490 tonic::Status::GRPC_STATUS,
491 (tonic::Code::Unimplemented as i32).into(),
492 );
493 headers.insert(
494 http::header::CONTENT_TYPE,
495 tonic::metadata::GRPC_CONTENT_TYPE,
496 );
497 Ok(response)
498 }),
499 }
500 }
501 }
502 impl<T> Clone for BrowseServiceServer<T> {
503 fn clone(&self) -> Self {
504 let inner = self.inner.clone();
505 Self {
506 inner,
507 accept_compression_encodings: self.accept_compression_encodings,
508 send_compression_encodings: self.send_compression_encodings,
509 max_decoding_message_size: self.max_decoding_message_size,
510 max_encoding_message_size: self.max_encoding_message_size,
511 }
512 }
513 }
514 /// Generated gRPC service name
515 pub const SERVICE_NAME: &str = "tunein.v1alpha1.BrowseService";
516 impl<T> tonic::server::NamedService for BrowseServiceServer<T> {
517 const NAME: &'static str = SERVICE_NAME;
518 }
519}
520#[derive(Clone, Copy, PartialEq, ::prost::Message)]
521pub struct PlayOrPauseRequest {}
522#[derive(Clone, Copy, PartialEq, ::prost::Message)]
523pub struct PlayOrPauseResponse {}
524#[derive(Clone, Copy, PartialEq, ::prost::Message)]
525pub struct StopRequest {}
526#[derive(Clone, Copy, PartialEq, ::prost::Message)]
527pub struct StopResponse {}
528#[derive(Clone, PartialEq, ::prost::Message)]
529pub struct PlayRequest {
530 #[prost(string, tag = "1")]
531 pub station_name_or_id: ::prost::alloc::string::String,
532 #[prost(string, optional, tag = "2")]
533 pub provider: ::core::option::Option<::prost::alloc::string::String>,
534}
535#[derive(Clone, Copy, PartialEq, ::prost::Message)]
536pub struct PlayResponse {}
537/// Generated client implementations.
538pub mod playback_service_client {
539 #![allow(
540 unused_variables,
541 dead_code,
542 missing_docs,
543 clippy::wildcard_imports,
544 clippy::let_unit_value
545 )]
546 use tonic::codegen::http::Uri;
547 use tonic::codegen::*;
548 #[derive(Debug, Clone)]
549 pub struct PlaybackServiceClient<T> {
550 inner: tonic::client::Grpc<T>,
551 }
552 impl PlaybackServiceClient<tonic::transport::Channel> {
553 /// Attempt to create a new client by connecting to a given endpoint.
554 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
555 where
556 D: TryInto<tonic::transport::Endpoint>,
557 D::Error: Into<StdError>,
558 {
559 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
560 Ok(Self::new(conn))
561 }
562 }
563 impl<T> PlaybackServiceClient<T>
564 where
565 T: tonic::client::GrpcService<tonic::body::BoxBody>,
566 T::Error: Into<StdError>,
567 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
568 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
569 {
570 pub fn new(inner: T) -> Self {
571 let inner = tonic::client::Grpc::new(inner);
572 Self { inner }
573 }
574 pub fn with_origin(inner: T, origin: Uri) -> Self {
575 let inner = tonic::client::Grpc::with_origin(inner, origin);
576 Self { inner }
577 }
578 pub fn with_interceptor<F>(
579 inner: T,
580 interceptor: F,
581 ) -> PlaybackServiceClient<InterceptedService<T, F>>
582 where
583 F: tonic::service::Interceptor,
584 T::ResponseBody: Default,
585 T: tonic::codegen::Service<
586 http::Request<tonic::body::BoxBody>,
587 Response = http::Response<
588 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
589 >,
590 >,
591 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
592 Into<StdError> + std::marker::Send + std::marker::Sync,
593 {
594 PlaybackServiceClient::new(InterceptedService::new(inner, interceptor))
595 }
596 /// Compress requests with the given encoding.
597 ///
598 /// This requires the server to support it otherwise it might respond with an
599 /// error.
600 #[must_use]
601 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
602 self.inner = self.inner.send_compressed(encoding);
603 self
604 }
605 /// Enable decompressing responses.
606 #[must_use]
607 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
608 self.inner = self.inner.accept_compressed(encoding);
609 self
610 }
611 /// Limits the maximum size of a decoded message.
612 ///
613 /// Default: `4MB`
614 #[must_use]
615 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
616 self.inner = self.inner.max_decoding_message_size(limit);
617 self
618 }
619 /// Limits the maximum size of an encoded message.
620 ///
621 /// Default: `usize::MAX`
622 #[must_use]
623 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
624 self.inner = self.inner.max_encoding_message_size(limit);
625 self
626 }
627 pub async fn play(
628 &mut self,
629 request: impl tonic::IntoRequest<super::PlayRequest>,
630 ) -> std::result::Result<tonic::Response<super::PlayResponse>, tonic::Status> {
631 self.inner.ready().await.map_err(|e| {
632 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
633 })?;
634 let codec = tonic::codec::ProstCodec::default();
635 let path =
636 http::uri::PathAndQuery::from_static("/tunein.v1alpha1.PlaybackService/Play");
637 let mut req = request.into_request();
638 req.extensions_mut()
639 .insert(GrpcMethod::new("tunein.v1alpha1.PlaybackService", "Play"));
640 self.inner.unary(req, path, codec).await
641 }
642 pub async fn stop(
643 &mut self,
644 request: impl tonic::IntoRequest<super::StopRequest>,
645 ) -> std::result::Result<tonic::Response<super::StopResponse>, tonic::Status> {
646 self.inner.ready().await.map_err(|e| {
647 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
648 })?;
649 let codec = tonic::codec::ProstCodec::default();
650 let path =
651 http::uri::PathAndQuery::from_static("/tunein.v1alpha1.PlaybackService/Stop");
652 let mut req = request.into_request();
653 req.extensions_mut()
654 .insert(GrpcMethod::new("tunein.v1alpha1.PlaybackService", "Stop"));
655 self.inner.unary(req, path, codec).await
656 }
657 pub async fn play_or_pause(
658 &mut self,
659 request: impl tonic::IntoRequest<super::PlayOrPauseRequest>,
660 ) -> std::result::Result<tonic::Response<super::PlayOrPauseResponse>, tonic::Status>
661 {
662 self.inner.ready().await.map_err(|e| {
663 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
664 })?;
665 let codec = tonic::codec::ProstCodec::default();
666 let path = http::uri::PathAndQuery::from_static(
667 "/tunein.v1alpha1.PlaybackService/PlayOrPause",
668 );
669 let mut req = request.into_request();
670 req.extensions_mut().insert(GrpcMethod::new(
671 "tunein.v1alpha1.PlaybackService",
672 "PlayOrPause",
673 ));
674 self.inner.unary(req, path, codec).await
675 }
676 }
677}
678/// Generated server implementations.
679pub mod playback_service_server {
680 #![allow(
681 unused_variables,
682 dead_code,
683 missing_docs,
684 clippy::wildcard_imports,
685 clippy::let_unit_value
686 )]
687 use tonic::codegen::*;
688 /// Generated trait containing gRPC methods that should be implemented for use with PlaybackServiceServer.
689 #[async_trait]
690 pub trait PlaybackService: std::marker::Send + std::marker::Sync + 'static {
691 async fn play(
692 &self,
693 request: tonic::Request<super::PlayRequest>,
694 ) -> std::result::Result<tonic::Response<super::PlayResponse>, tonic::Status>;
695 async fn stop(
696 &self,
697 request: tonic::Request<super::StopRequest>,
698 ) -> std::result::Result<tonic::Response<super::StopResponse>, tonic::Status>;
699 async fn play_or_pause(
700 &self,
701 request: tonic::Request<super::PlayOrPauseRequest>,
702 ) -> std::result::Result<tonic::Response<super::PlayOrPauseResponse>, tonic::Status>;
703 }
704 #[derive(Debug)]
705 pub struct PlaybackServiceServer<T> {
706 inner: Arc<T>,
707 accept_compression_encodings: EnabledCompressionEncodings,
708 send_compression_encodings: EnabledCompressionEncodings,
709 max_decoding_message_size: Option<usize>,
710 max_encoding_message_size: Option<usize>,
711 }
712 impl<T> PlaybackServiceServer<T> {
713 pub fn new(inner: T) -> Self {
714 Self::from_arc(Arc::new(inner))
715 }
716 pub fn from_arc(inner: Arc<T>) -> Self {
717 Self {
718 inner,
719 accept_compression_encodings: Default::default(),
720 send_compression_encodings: Default::default(),
721 max_decoding_message_size: None,
722 max_encoding_message_size: None,
723 }
724 }
725 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
726 where
727 F: tonic::service::Interceptor,
728 {
729 InterceptedService::new(Self::new(inner), interceptor)
730 }
731 /// Enable decompressing requests with the given encoding.
732 #[must_use]
733 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
734 self.accept_compression_encodings.enable(encoding);
735 self
736 }
737 /// Compress responses with the given encoding, if the client supports it.
738 #[must_use]
739 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
740 self.send_compression_encodings.enable(encoding);
741 self
742 }
743 /// Limits the maximum size of a decoded message.
744 ///
745 /// Default: `4MB`
746 #[must_use]
747 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
748 self.max_decoding_message_size = Some(limit);
749 self
750 }
751 /// Limits the maximum size of an encoded message.
752 ///
753 /// Default: `usize::MAX`
754 #[must_use]
755 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
756 self.max_encoding_message_size = Some(limit);
757 self
758 }
759 }
760 impl<T, B> tonic::codegen::Service<http::Request<B>> for PlaybackServiceServer<T>
761 where
762 T: PlaybackService,
763 B: Body + std::marker::Send + 'static,
764 B::Error: Into<StdError> + std::marker::Send + 'static,
765 {
766 type Response = http::Response<tonic::body::BoxBody>;
767 type Error = std::convert::Infallible;
768 type Future = BoxFuture<Self::Response, Self::Error>;
769 fn poll_ready(
770 &mut self,
771 _cx: &mut Context<'_>,
772 ) -> Poll<std::result::Result<(), Self::Error>> {
773 Poll::Ready(Ok(()))
774 }
775 fn call(&mut self, req: http::Request<B>) -> Self::Future {
776 match req.uri().path() {
777 "/tunein.v1alpha1.PlaybackService/Play" => {
778 #[allow(non_camel_case_types)]
779 struct PlaySvc<T: PlaybackService>(pub Arc<T>);
780 impl<T: PlaybackService> tonic::server::UnaryService<super::PlayRequest> for PlaySvc<T> {
781 type Response = super::PlayResponse;
782 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
783 fn call(
784 &mut self,
785 request: tonic::Request<super::PlayRequest>,
786 ) -> Self::Future {
787 let inner = Arc::clone(&self.0);
788 let fut =
789 async move { <T as PlaybackService>::play(&inner, request).await };
790 Box::pin(fut)
791 }
792 }
793 let accept_compression_encodings = self.accept_compression_encodings;
794 let send_compression_encodings = self.send_compression_encodings;
795 let max_decoding_message_size = self.max_decoding_message_size;
796 let max_encoding_message_size = self.max_encoding_message_size;
797 let inner = self.inner.clone();
798 let fut = async move {
799 let method = PlaySvc(inner);
800 let codec = tonic::codec::ProstCodec::default();
801 let mut grpc = tonic::server::Grpc::new(codec)
802 .apply_compression_config(
803 accept_compression_encodings,
804 send_compression_encodings,
805 )
806 .apply_max_message_size_config(
807 max_decoding_message_size,
808 max_encoding_message_size,
809 );
810 let res = grpc.unary(method, req).await;
811 Ok(res)
812 };
813 Box::pin(fut)
814 }
815 "/tunein.v1alpha1.PlaybackService/Stop" => {
816 #[allow(non_camel_case_types)]
817 struct StopSvc<T: PlaybackService>(pub Arc<T>);
818 impl<T: PlaybackService> tonic::server::UnaryService<super::StopRequest> for StopSvc<T> {
819 type Response = super::StopResponse;
820 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
821 fn call(
822 &mut self,
823 request: tonic::Request<super::StopRequest>,
824 ) -> Self::Future {
825 let inner = Arc::clone(&self.0);
826 let fut =
827 async move { <T as PlaybackService>::stop(&inner, request).await };
828 Box::pin(fut)
829 }
830 }
831 let accept_compression_encodings = self.accept_compression_encodings;
832 let send_compression_encodings = self.send_compression_encodings;
833 let max_decoding_message_size = self.max_decoding_message_size;
834 let max_encoding_message_size = self.max_encoding_message_size;
835 let inner = self.inner.clone();
836 let fut = async move {
837 let method = StopSvc(inner);
838 let codec = tonic::codec::ProstCodec::default();
839 let mut grpc = tonic::server::Grpc::new(codec)
840 .apply_compression_config(
841 accept_compression_encodings,
842 send_compression_encodings,
843 )
844 .apply_max_message_size_config(
845 max_decoding_message_size,
846 max_encoding_message_size,
847 );
848 let res = grpc.unary(method, req).await;
849 Ok(res)
850 };
851 Box::pin(fut)
852 }
853 "/tunein.v1alpha1.PlaybackService/PlayOrPause" => {
854 #[allow(non_camel_case_types)]
855 struct PlayOrPauseSvc<T: PlaybackService>(pub Arc<T>);
856 impl<T: PlaybackService> tonic::server::UnaryService<super::PlayOrPauseRequest>
857 for PlayOrPauseSvc<T>
858 {
859 type Response = super::PlayOrPauseResponse;
860 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
861 fn call(
862 &mut self,
863 request: tonic::Request<super::PlayOrPauseRequest>,
864 ) -> Self::Future {
865 let inner = Arc::clone(&self.0);
866 let fut = async move {
867 <T as PlaybackService>::play_or_pause(&inner, request).await
868 };
869 Box::pin(fut)
870 }
871 }
872 let accept_compression_encodings = self.accept_compression_encodings;
873 let send_compression_encodings = self.send_compression_encodings;
874 let max_decoding_message_size = self.max_decoding_message_size;
875 let max_encoding_message_size = self.max_encoding_message_size;
876 let inner = self.inner.clone();
877 let fut = async move {
878 let method = PlayOrPauseSvc(inner);
879 let codec = tonic::codec::ProstCodec::default();
880 let mut grpc = tonic::server::Grpc::new(codec)
881 .apply_compression_config(
882 accept_compression_encodings,
883 send_compression_encodings,
884 )
885 .apply_max_message_size_config(
886 max_decoding_message_size,
887 max_encoding_message_size,
888 );
889 let res = grpc.unary(method, req).await;
890 Ok(res)
891 };
892 Box::pin(fut)
893 }
894 _ => Box::pin(async move {
895 let mut response = http::Response::new(empty_body());
896 let headers = response.headers_mut();
897 headers.insert(
898 tonic::Status::GRPC_STATUS,
899 (tonic::Code::Unimplemented as i32).into(),
900 );
901 headers.insert(
902 http::header::CONTENT_TYPE,
903 tonic::metadata::GRPC_CONTENT_TYPE,
904 );
905 Ok(response)
906 }),
907 }
908 }
909 }
910 impl<T> Clone for PlaybackServiceServer<T> {
911 fn clone(&self) -> Self {
912 let inner = self.inner.clone();
913 Self {
914 inner,
915 accept_compression_encodings: self.accept_compression_encodings,
916 send_compression_encodings: self.send_compression_encodings,
917 max_decoding_message_size: self.max_decoding_message_size,
918 max_encoding_message_size: self.max_encoding_message_size,
919 }
920 }
921 }
922 /// Generated gRPC service name
923 pub const SERVICE_NAME: &str = "tunein.v1alpha1.PlaybackService";
924 impl<T> tonic::server::NamedService for PlaybackServiceServer<T> {
925 const NAME: &'static str = SERVICE_NAME;
926 }
927}