#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCategoriesRequest {
#[prost(string, optional, tag = "1")]
pub provider: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "2")]
pub offset: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "3")]
pub limit: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCategoriesResponse {
#[prost(message, repeated, tag = "1")]
pub categories: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Category>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BrowseCategoryRequest {
#[prost(string, tag = "1")]
pub category_id: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub provider: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint32, optional, tag = "3")]
pub offset: ::core::option::Option<u32>,
#[prost(uint32, optional, tag = "4")]
pub limit: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BrowseCategoryResponse {
#[prost(message, repeated, tag = "1")]
pub categories: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Category>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetStationDetailsRequest {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub provider: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetStationDetailsResponse {
#[prost(message, optional, tag = "1")]
pub station_link_details:
::core::option::Option<super::super::objects::v1alpha1::StationLinkDetails>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchRequest {
#[prost(string, tag = "1")]
pub query: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub provider: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchResponse {
#[prost(message, repeated, tag = "1")]
pub station: ::prost::alloc::vec::Vec<super::super::objects::v1alpha1::Station>,
}
pub mod browse_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct BrowseServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BrowseServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BrowseServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> BrowseServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
BrowseServiceClient::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 get_categories(
&mut self,
request: impl tonic::IntoRequest<super::GetCategoriesRequest>,
) -> std::result::Result<tonic::Response<super::GetCategoriesResponse>, 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(
"/tunein.v1alpha1.BrowseService/GetCategories",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"tunein.v1alpha1.BrowseService",
"GetCategories",
));
self.inner.unary(req, path, codec).await
}
pub async fn browse_category(
&mut self,
request: impl tonic::IntoRequest<super::BrowseCategoryRequest>,
) -> std::result::Result<tonic::Response<super::BrowseCategoryResponse>, 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(
"/tunein.v1alpha1.BrowseService/BrowseCategory",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"tunein.v1alpha1.BrowseService",
"BrowseCategory",
));
self.inner.unary(req, path, codec).await
}
pub async fn get_station_details(
&mut self,
request: impl tonic::IntoRequest<super::GetStationDetailsRequest>,
) -> std::result::Result<tonic::Response<super::GetStationDetailsResponse>, 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(
"/tunein.v1alpha1.BrowseService/GetStationDetails",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"tunein.v1alpha1.BrowseService",
"GetStationDetails",
));
self.inner.unary(req, path, codec).await
}
pub async fn search(
&mut self,
request: impl tonic::IntoRequest<super::SearchRequest>,
) -> std::result::Result<tonic::Response<super::SearchResponse>, 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("/tunein.v1alpha1.BrowseService/Search");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("tunein.v1alpha1.BrowseService", "Search"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod browse_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait BrowseService: std::marker::Send + std::marker::Sync + 'static {
async fn get_categories(
&self,
request: tonic::Request<super::GetCategoriesRequest>,
) -> std::result::Result<tonic::Response<super::GetCategoriesResponse>, tonic::Status>;
async fn browse_category(
&self,
request: tonic::Request<super::BrowseCategoryRequest>,
) -> std::result::Result<tonic::Response<super::BrowseCategoryResponse>, tonic::Status>;
async fn get_station_details(
&self,
request: tonic::Request<super::GetStationDetailsRequest>,
) -> std::result::Result<tonic::Response<super::GetStationDetailsResponse>, tonic::Status>;
async fn search(
&self,
request: tonic::Request<super::SearchRequest>,
) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct BrowseServiceServer<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> BrowseServiceServer<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 BrowseServiceServer<T>
where
T: BrowseService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
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() {
"/tunein.v1alpha1.BrowseService/GetCategories" => {
#[allow(non_camel_case_types)]
struct GetCategoriesSvc<T: BrowseService>(pub Arc<T>);
impl<T: BrowseService> tonic::server::UnaryService<super::GetCategoriesRequest>
for GetCategoriesSvc<T>
{
type Response = super::GetCategoriesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetCategoriesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrowseService>::get_categories(&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 = GetCategoriesSvc(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)
}
"/tunein.v1alpha1.BrowseService/BrowseCategory" => {
#[allow(non_camel_case_types)]
struct BrowseCategorySvc<T: BrowseService>(pub Arc<T>);
impl<T: BrowseService> tonic::server::UnaryService<super::BrowseCategoryRequest>
for BrowseCategorySvc<T>
{
type Response = super::BrowseCategoryResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::BrowseCategoryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrowseService>::browse_category(&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 = BrowseCategorySvc(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)
}
"/tunein.v1alpha1.BrowseService/GetStationDetails" => {
#[allow(non_camel_case_types)]
struct GetStationDetailsSvc<T: BrowseService>(pub Arc<T>);
impl<T: BrowseService>
tonic::server::UnaryService<super::GetStationDetailsRequest>
for GetStationDetailsSvc<T>
{
type Response = super::GetStationDetailsResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetStationDetailsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BrowseService>::get_station_details(&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 = GetStationDetailsSvc(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)
}
"/tunein.v1alpha1.BrowseService/Search" => {
#[allow(non_camel_case_types)]
struct SearchSvc<T: BrowseService>(pub Arc<T>);
impl<T: BrowseService> tonic::server::UnaryService<super::SearchRequest> for SearchSvc<T> {
type Response = super::SearchResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SearchRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as BrowseService>::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 = SearchSvc(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(empty_body());
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 BrowseServiceServer<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 = "tunein.v1alpha1.BrowseService";
impl<T> tonic::server::NamedService for BrowseServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PlayOrPauseRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PlayOrPauseResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StopRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StopResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlayRequest {
#[prost(string, tag = "1")]
pub station_name_or_id: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub provider: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PlayResponse {}
pub mod playback_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct PlaybackServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl PlaybackServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> PlaybackServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> PlaybackServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
PlaybackServiceClient::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 play(
&mut self,
request: impl tonic::IntoRequest<super::PlayRequest>,
) -> std::result::Result<tonic::Response<super::PlayResponse>, 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("/tunein.v1alpha1.PlaybackService/Play");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("tunein.v1alpha1.PlaybackService", "Play"));
self.inner.unary(req, path, codec).await
}
pub async fn stop(
&mut self,
request: impl tonic::IntoRequest<super::StopRequest>,
) -> std::result::Result<tonic::Response<super::StopResponse>, 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("/tunein.v1alpha1.PlaybackService/Stop");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("tunein.v1alpha1.PlaybackService", "Stop"));
self.inner.unary(req, path, codec).await
}
pub async fn play_or_pause(
&mut self,
request: impl tonic::IntoRequest<super::PlayOrPauseRequest>,
) -> std::result::Result<tonic::Response<super::PlayOrPauseResponse>, 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(
"/tunein.v1alpha1.PlaybackService/PlayOrPause",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"tunein.v1alpha1.PlaybackService",
"PlayOrPause",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod playback_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait PlaybackService: std::marker::Send + std::marker::Sync + 'static {
async fn play(
&self,
request: tonic::Request<super::PlayRequest>,
) -> std::result::Result<tonic::Response<super::PlayResponse>, tonic::Status>;
async fn stop(
&self,
request: tonic::Request<super::StopRequest>,
) -> std::result::Result<tonic::Response<super::StopResponse>, tonic::Status>;
async fn play_or_pause(
&self,
request: tonic::Request<super::PlayOrPauseRequest>,
) -> std::result::Result<tonic::Response<super::PlayOrPauseResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct PlaybackServiceServer<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> PlaybackServiceServer<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 PlaybackServiceServer<T>
where
T: PlaybackService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
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() {
"/tunein.v1alpha1.PlaybackService/Play" => {
#[allow(non_camel_case_types)]
struct PlaySvc<T: PlaybackService>(pub Arc<T>);
impl<T: PlaybackService> tonic::server::UnaryService<super::PlayRequest> for PlaySvc<T> {
type Response = super::PlayResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::PlayRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as PlaybackService>::play(&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 = PlaySvc(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)
}
"/tunein.v1alpha1.PlaybackService/Stop" => {
#[allow(non_camel_case_types)]
struct StopSvc<T: PlaybackService>(pub Arc<T>);
impl<T: PlaybackService> tonic::server::UnaryService<super::StopRequest> for StopSvc<T> {
type Response = super::StopResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::StopRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as PlaybackService>::stop(&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 = StopSvc(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)
}
"/tunein.v1alpha1.PlaybackService/PlayOrPause" => {
#[allow(non_camel_case_types)]
struct PlayOrPauseSvc<T: PlaybackService>(pub Arc<T>);
impl<T: PlaybackService> tonic::server::UnaryService<super::PlayOrPauseRequest>
for PlayOrPauseSvc<T>
{
type Response = super::PlayOrPauseResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::PlayOrPauseRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as PlaybackService>::play_or_pause(&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 = PlayOrPauseSvc(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(empty_body());
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 PlaybackServiceServer<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 = "tunein.v1alpha1.PlaybackService";
impl<T> tonic::server::NamedService for PlaybackServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}