#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductCreateTag {
#[prost(uint32, optional, tag = "1")]
pub id: ::core::option::Option<u32>,
#[prost(string, optional, tag = "2")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductCreateRequest {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sku: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub price: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub currency_code: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "6")]
pub tags: ::prost::alloc::vec::Vec<ProductCreateTag>,
#[prost(bool, tag = "7")]
pub ar_enabled: bool,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductCreateResponse {
#[prost(oneof = "product_create_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<product_create_response::Response>,
}
pub mod product_create_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::super::super::shared::v1::SuccessResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductTag {
#[prost(uint32, optional, tag = "1")]
pub id: ::core::option::Option<u32>,
#[prost(string, optional, tag = "2")]
pub name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductTags {
#[prost(message, repeated, tag = "1")]
pub tags: ::prost::alloc::vec::Vec<ProductTag>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProductMetadata {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Product {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sku: ::prost::alloc::string::String,
#[prost(uint32, tag = "4")]
pub version: u32,
#[prost(string, tag = "5")]
pub status: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub slug: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub price: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub currency_code: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "11")]
pub tags: ::prost::alloc::vec::Vec<ProductTag>,
#[prost(message, optional, tag = "12")]
pub metadata: ::core::option::Option<ProductMetadata>,
#[prost(bool, tag = "13")]
pub ar_enabled: bool,
#[prost(uint64, tag = "14")]
pub created_at: u64,
#[prost(uint64, optional, tag = "15")]
pub published_at: ::core::option::Option<u64>,
#[prost(uint64, optional, tag = "16")]
pub updated_at: ::core::option::Option<u64>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Category {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub image: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub translations: ::prost::alloc::vec::Vec<CategoryTranslations>,
#[prost(message, repeated, tag = "5")]
pub subcategories: ::prost::alloc::vec::Vec<Subcategory>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CategoryTranslations {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub language: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub version: i32,
#[prost(map = "string, message", tag = "4")]
pub subcategories: ::std::collections::HashMap<
::prost::alloc::string::String,
SubcategoryTranslations,
>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubcategoryTranslations {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "2")]
pub attributes: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(map = "string, message", tag = "3")]
pub data: ::std::collections::HashMap<
::prost::alloc::string::String,
super::super::shared::v1::StringMap,
>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subcategory {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub version: i32,
#[prost(string, tag = "4")]
pub created_at: ::prost::alloc::string::String,
#[prost(map = "string, message", tag = "5")]
pub attributes: ::std::collections::HashMap<
::prost::alloc::string::String,
SubcategoryAttribute,
>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubcategoryAttribute {
#[prost(bool, tag = "1")]
pub required: bool,
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub include_in_variants: bool,
#[prost(string, optional, tag = "4")]
pub reference: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "5")]
pub string_array: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, optional, tag = "6")]
pub is_multiple: ::core::option::Option<bool>,
#[prost(message, optional, tag = "7")]
pub validation: ::core::option::Option<super::super::shared::v1::ValidationField>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductDataResponseData {
#[prost(message, optional, tag = "1")]
pub subcategory: ::core::option::Option<ProductDataResponseSubcategory>,
#[prost(message, optional, tag = "2")]
pub tags: ::core::option::Option<ProductTags>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductDataResponseSubcategory {
#[prost(message, optional, tag = "1")]
pub data: ::core::option::Option<Subcategory>,
#[prost(message, optional, tag = "2")]
pub translations: ::core::option::Option<SubcategoryTranslations>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductDataRequest {
#[prost(message, optional, tag = "1")]
pub subcategory: ::core::option::Option<ProductDataRequestCategory>,
#[prost(bool, optional, tag = "2")]
pub get_tags: ::core::option::Option<bool>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductDataRequestCategory {
#[prost(string, tag = "1")]
pub category: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subcategory: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductDataResponse {
#[prost(oneof = "product_data_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<product_data_response::Response>,
}
pub mod product_data_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::ProductDataResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductPrice {
#[prost(float, tag = "1")]
pub amount: f32,
#[prost(string, tag = "2")]
pub formatted: ::prost::alloc::string::String,
#[prost(float, optional, tag = "3")]
pub discount_price: ::core::option::Option<f32>,
#[prost(string, optional, tag = "4")]
pub save_amount: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "5")]
pub save_percentage: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductShippingInfo {
#[prost(bool, tag = "1")]
pub free: bool,
#[prost(enumeration = "ProductShippingMethod", tag = "2")]
pub method: i32,
#[prost(string, tag = "3")]
pub origin: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub min_estimated_days: i32,
#[prost(int32, tag = "5")]
pub max_estimated_days: i32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductItemMetadata {
#[prost(enumeration = "ProductItemMetadataType", tag = "1")]
pub r#type: i32,
#[prost(string, tag = "2")]
pub label: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductItem {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub image: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub price: ::core::option::Option<ProductPrice>,
#[prost(float, optional, tag = "5")]
pub rating: ::core::option::Option<f32>,
#[prost(int32, optional, tag = "6")]
pub sold: ::core::option::Option<i32>,
#[prost(message, repeated, tag = "7")]
pub meta: ::prost::alloc::vec::Vec<ProductItemMetadata>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductListItem {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_id: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub slug: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub price: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub currency_code: ::prost::alloc::string::String,
#[prost(bool, tag = "13")]
pub ar_enabled: bool,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductListRequest {
#[prost(uint32, tag = "1")]
pub page: u32,
#[prost(string, tag = "2")]
pub last_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub order_price: ::core::option::Option<super::super::shared::v1::OrderDirection>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductListResponse {
#[prost(oneof = "product_list_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<product_list_response::Response>,
}
pub mod product_list_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::ProductListResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductListResponseData {
#[prost(message, repeated, tag = "1")]
pub data: ::prost::alloc::vec::Vec<ProductListItem>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProductShippingMethod {
Standard = 0,
Express = 1,
}
impl ProductShippingMethod {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Standard => "STANDARD",
Self::Express => "EXPRESS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STANDARD" => Some(Self::Standard),
"EXPRESS" => Some(Self::Express),
_ => None,
}
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ProductItemMetadataType {
Cupon = 0,
NewShopper = 1,
Bundle = 2,
}
impl ProductItemMetadataType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Cupon => "CUPON",
Self::NewShopper => "NEW_SHOPPER",
Self::Bundle => "BUNDLE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CUPON" => Some(Self::Cupon),
"NEW_SHOPPER" => Some(Self::NewShopper),
"BUNDLE" => Some(Self::Bundle),
_ => None,
}
}
}
pub mod products_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ProductsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ProductsServiceClient<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> ProductsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> ProductsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ProductsServiceClient::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 product_create(
&mut self,
request: impl tonic::IntoRequest<super::ProductCreateRequest>,
) -> std::result::Result<
tonic::Response<super::ProductCreateResponse>,
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(
"/products.v1.ProductsService/ProductCreate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("products.v1.ProductsService", "ProductCreate"));
self.inner.unary(req, path, codec).await
}
pub async fn product_data(
&mut self,
request: impl tonic::IntoRequest<super::ProductDataRequest>,
) -> std::result::Result<
tonic::Response<super::ProductDataResponse>,
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(
"/products.v1.ProductsService/ProductData",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("products.v1.ProductsService", "ProductData"));
self.inner.unary(req, path, codec).await
}
pub async fn product_list(
&mut self,
request: impl tonic::IntoRequest<super::ProductListRequest>,
) -> std::result::Result<
tonic::Response<super::ProductListResponse>,
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(
"/products.v1.ProductsService/ProductList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("products.v1.ProductsService", "ProductList"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod products_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait ProductsService: std::marker::Send + std::marker::Sync + 'static {
async fn product_create(
&self,
request: tonic::Request<super::ProductCreateRequest>,
) -> std::result::Result<
tonic::Response<super::ProductCreateResponse>,
tonic::Status,
>;
async fn product_data(
&self,
request: tonic::Request<super::ProductDataRequest>,
) -> std::result::Result<
tonic::Response<super::ProductDataResponse>,
tonic::Status,
>;
async fn product_list(
&self,
request: tonic::Request<super::ProductListRequest>,
) -> std::result::Result<
tonic::Response<super::ProductListResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ProductsServiceServer<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> ProductsServiceServer<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 ProductsServiceServer<T>
where
T: ProductsService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
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() {
"/products.v1.ProductsService/ProductCreate" => {
#[allow(non_camel_case_types)]
struct ProductCreateSvc<T: ProductsService>(pub Arc<T>);
impl<
T: ProductsService,
> tonic::server::UnaryService<super::ProductCreateRequest>
for ProductCreateSvc<T> {
type Response = super::ProductCreateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProductCreateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProductsService>::product_create(&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 = ProductCreateSvc(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)
}
"/products.v1.ProductsService/ProductData" => {
#[allow(non_camel_case_types)]
struct ProductDataSvc<T: ProductsService>(pub Arc<T>);
impl<
T: ProductsService,
> tonic::server::UnaryService<super::ProductDataRequest>
for ProductDataSvc<T> {
type Response = super::ProductDataResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProductDataRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProductsService>::product_data(&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 = ProductDataSvc(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)
}
"/products.v1.ProductsService/ProductList" => {
#[allow(non_camel_case_types)]
struct ProductListSvc<T: ProductsService>(pub Arc<T>);
impl<
T: ProductsService,
> tonic::server::UnaryService<super::ProductListRequest>
for ProductListSvc<T> {
type Response = super::ProductListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProductListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as ProductsService>::product_list(&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 = ProductListSvc(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(
tonic::body::Body::default(),
);
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 ProductsServiceServer<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 = "products.v1.ProductsService";
impl<T> tonic::server::NamedService for ProductsServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChangeFeed {
#[prost(message, optional, tag = "1")]
pub after: ::core::option::Option<ProductOutbox>,
#[prost(message, optional, tag = "2")]
pub before: ::core::option::Option<ProductOutbox>,
#[prost(int64, tag = "3")]
pub updated: i64,
#[prost(int64, tag = "4")]
pub resolved: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductOutbox {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub product_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub r#type: ::prost::alloc::string::String,
#[prost(int64, optional, tag = "4")]
pub processed_at: ::core::option::Option<i64>,
#[prost(uint32, tag = "5")]
pub processing_attempts: u32,
#[prost(string, optional, tag = "6")]
pub last_error: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, tag = "7")]
pub created_at: i64,
#[prost(int64, tag = "8")]
pub updated_at: i64,
#[prost(oneof = "product_outbox::Payload", tags = "9, 10, 11")]
pub payload: ::core::option::Option<product_outbox::Payload>,
}
pub mod product_outbox {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Payload {
#[prost(message, tag = "9")]
Created(super::ProductCreatedEvent),
#[prost(message, tag = "10")]
Updated(super::ProductUpdatedEvent),
#[prost(message, tag = "11")]
Deleted(super::ProductDeletedEvent),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductCreatedEvent {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductUpdatedEvent {
#[prost(string, optional, tag = "1")]
pub title: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "2")]
pub description: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ProductDeletedEvent {}