#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryGetRequest {
#[prost(string, repeated, tag = "1")]
pub product_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "2")]
pub variant_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "3")]
pub skus: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryGetResponse {
#[prost(oneof = "inventory_get_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<inventory_get_response::Response>,
}
pub mod inventory_get_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::InventoryGetResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryGetResponseData {
#[prost(message, repeated, tag = "1")]
pub items: ::prost::alloc::vec::Vec<InventoryItem>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryItem {
#[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 variant_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub sku: ::prost::alloc::string::String,
#[prost(uint32, tag = "5")]
pub quantity_total: u32,
#[prost(uint32, tag = "6")]
pub quantity_reserved: u32,
#[prost(uint32, tag = "7")]
pub quantity_available: u32,
#[prost(string, tag = "8")]
pub location_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "9")]
pub metadata: ::core::option::Option<super::super::shared::v1::Struct>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReleaseRequest {
#[prost(string, tag = "1")]
pub reservation_token: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReleaseResponse {
#[prost(oneof = "inventory_release_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<inventory_release_response::Response>,
}
pub mod inventory_release_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 InventoryReservationGetRequest {
#[prost(string, tag = "1")]
pub reservation_token: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReservationGetResponse {
#[prost(oneof = "inventory_reservation_get_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<inventory_reservation_get_response::Response>,
}
pub mod inventory_reservation_get_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::InventoryReservationGetResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReservationGetResponseData {
#[prost(string, tag = "1")]
pub reservation_token: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub order_id: ::prost::alloc::string::String,
#[prost(enumeration = "InventoryReservationStatus", tag = "3")]
pub status: i32,
#[prost(int64, tag = "4")]
pub expires_at: i64,
#[prost(message, repeated, tag = "5")]
pub items: ::prost::alloc::vec::Vec<InventoryReservationItem>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReservationItem {
#[prost(string, tag = "1")]
pub product_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub variant_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sku: ::prost::alloc::string::String,
#[prost(uint32, tag = "4")]
pub quantity_requested: u32,
#[prost(uint32, tag = "5")]
pub quantity_reserved: u32,
#[prost(enumeration = "InventoryReservationItemStatus", tag = "6")]
pub status: i32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InventoryReservationStatus {
Unspecified = 0,
Reserved = 1,
PartiallyReserved = 2,
NotReserved = 3,
Pending = 4,
Released = 5,
Fulfilled = 6,
}
impl InventoryReservationStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INVENTORY_RESERVATION_STATUS_UNSPECIFIED",
Self::Reserved => "INVENTORY_RESERVATION_STATUS_RESERVED",
Self::PartiallyReserved => "INVENTORY_RESERVATION_STATUS_PARTIALLY_RESERVED",
Self::NotReserved => "INVENTORY_RESERVATION_STATUS_NOT_RESERVED",
Self::Pending => "INVENTORY_RESERVATION_STATUS_PENDING",
Self::Released => "INVENTORY_RESERVATION_STATUS_RELEASED",
Self::Fulfilled => "INVENTORY_RESERVATION_STATUS_FULFILLED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVENTORY_RESERVATION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"INVENTORY_RESERVATION_STATUS_RESERVED" => Some(Self::Reserved),
"INVENTORY_RESERVATION_STATUS_PARTIALLY_RESERVED" => {
Some(Self::PartiallyReserved)
}
"INVENTORY_RESERVATION_STATUS_NOT_RESERVED" => Some(Self::NotReserved),
"INVENTORY_RESERVATION_STATUS_PENDING" => Some(Self::Pending),
"INVENTORY_RESERVATION_STATUS_RELEASED" => Some(Self::Released),
"INVENTORY_RESERVATION_STATUS_FULFILLED" => Some(Self::Fulfilled),
_ => None,
}
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InventoryReservationItemStatus {
Unspecified = 0,
Reserved = 1,
NotReserved = 2,
OutOfStock = 3,
}
impl InventoryReservationItemStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INVENTORY_RESERVATION_ITEM_STATUS_UNSPECIFIED",
Self::Reserved => "INVENTORY_RESERVATION_ITEM_STATUS_RESERVED",
Self::NotReserved => "INVENTORY_RESERVATION_ITEM_STATUS_NOT_RESERVED",
Self::OutOfStock => "INVENTORY_RESERVATION_ITEM_STATUS_OUT_OF_STOCK",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVENTORY_RESERVATION_ITEM_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"INVENTORY_RESERVATION_ITEM_STATUS_RESERVED" => Some(Self::Reserved),
"INVENTORY_RESERVATION_ITEM_STATUS_NOT_RESERVED" => Some(Self::NotReserved),
"INVENTORY_RESERVATION_ITEM_STATUS_OUT_OF_STOCK" => Some(Self::OutOfStock),
_ => None,
}
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReserveRequest {
#[prost(string, tag = "1")]
pub order_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub items: ::prost::alloc::vec::Vec<InventoryReserveRequestItem>,
#[prost(int64, tag = "3")]
pub ttl_seconds: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReserveRequestItem {
#[prost(string, tag = "1")]
pub product_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub variant_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sku: ::prost::alloc::string::String,
#[prost(uint32, tag = "4")]
pub quantity: u32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReserveResponse {
#[prost(oneof = "inventory_reserve_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<inventory_reserve_response::Response>,
}
pub mod inventory_reserve_response {
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Data(super::InventoryReserveResponseData),
#[prost(message, tag = "2")]
Error(super::super::super::shared::v1::AppError),
}
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryReserveResponseData {
#[prost(string, tag = "1")]
pub reservation_token: ::prost::alloc::string::String,
#[prost(enumeration = "InventoryReservationStatus", tag = "2")]
pub status: i32,
#[prost(message, repeated, tag = "3")]
pub items: ::prost::alloc::vec::Vec<InventoryReservationItem>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryUpdateRequest {
#[prost(message, repeated, tag = "1")]
pub items: ::prost::alloc::vec::Vec<InventoryUpdateItem>,
#[prost(string, tag = "2")]
pub reason: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryUpdateItem {
#[prost(string, tag = "1")]
pub product_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub variant_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub sku: ::prost::alloc::string::String,
#[prost(enumeration = "InventoryUpdateOperation", tag = "4")]
pub operation: i32,
#[prost(uint32, tag = "5")]
pub quantity: u32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InventoryUpdateResponse {
#[prost(oneof = "inventory_update_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<inventory_update_response::Response>,
}
pub mod inventory_update_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, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InventoryUpdateOperation {
Unspecified = 0,
Set = 1,
Add = 2,
Subtract = 3,
}
impl InventoryUpdateOperation {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INVENTORY_UPDATE_OPERATION_UNSPECIFIED",
Self::Set => "INVENTORY_UPDATE_OPERATION_SET",
Self::Add => "INVENTORY_UPDATE_OPERATION_ADD",
Self::Subtract => "INVENTORY_UPDATE_OPERATION_SUBTRACT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVENTORY_UPDATE_OPERATION_UNSPECIFIED" => Some(Self::Unspecified),
"INVENTORY_UPDATE_OPERATION_SET" => Some(Self::Set),
"INVENTORY_UPDATE_OPERATION_ADD" => Some(Self::Add),
"INVENTORY_UPDATE_OPERATION_SUBTRACT" => Some(Self::Subtract),
_ => None,
}
}
}
pub mod inventory_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 InventoryServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl InventoryServiceClient<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> InventoryServiceClient<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,
) -> InventoryServiceClient<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,
{
InventoryServiceClient::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 inventory_reserve(
&mut self,
request: impl tonic::IntoRequest<super::InventoryReserveRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReserveResponse>,
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(
"/inventory.v1.InventoryService/InventoryReserve",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("inventory.v1.InventoryService", "InventoryReserve"),
);
self.inner.unary(req, path, codec).await
}
pub async fn inventory_release(
&mut self,
request: impl tonic::IntoRequest<super::InventoryReleaseRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReleaseResponse>,
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(
"/inventory.v1.InventoryService/InventoryRelease",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("inventory.v1.InventoryService", "InventoryRelease"),
);
self.inner.unary(req, path, codec).await
}
pub async fn inventory_get(
&mut self,
request: impl tonic::IntoRequest<super::InventoryGetRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryGetResponse>,
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(
"/inventory.v1.InventoryService/InventoryGet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("inventory.v1.InventoryService", "InventoryGet"),
);
self.inner.unary(req, path, codec).await
}
pub async fn inventory_update(
&mut self,
request: impl tonic::IntoRequest<super::InventoryUpdateRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryUpdateResponse>,
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(
"/inventory.v1.InventoryService/InventoryUpdate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("inventory.v1.InventoryService", "InventoryUpdate"),
);
self.inner.unary(req, path, codec).await
}
pub async fn inventory_reservation_get(
&mut self,
request: impl tonic::IntoRequest<super::InventoryReservationGetRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReservationGetResponse>,
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(
"/inventory.v1.InventoryService/InventoryReservationGet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"inventory.v1.InventoryService",
"InventoryReservationGet",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod inventory_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait InventoryService: std::marker::Send + std::marker::Sync + 'static {
async fn inventory_reserve(
&self,
request: tonic::Request<super::InventoryReserveRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReserveResponse>,
tonic::Status,
>;
async fn inventory_release(
&self,
request: tonic::Request<super::InventoryReleaseRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReleaseResponse>,
tonic::Status,
>;
async fn inventory_get(
&self,
request: tonic::Request<super::InventoryGetRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryGetResponse>,
tonic::Status,
>;
async fn inventory_update(
&self,
request: tonic::Request<super::InventoryUpdateRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryUpdateResponse>,
tonic::Status,
>;
async fn inventory_reservation_get(
&self,
request: tonic::Request<super::InventoryReservationGetRequest>,
) -> std::result::Result<
tonic::Response<super::InventoryReservationGetResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct InventoryServiceServer<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> InventoryServiceServer<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 InventoryServiceServer<T>
where
T: InventoryService,
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() {
"/inventory.v1.InventoryService/InventoryReserve" => {
#[allow(non_camel_case_types)]
struct InventoryReserveSvc<T: InventoryService>(pub Arc<T>);
impl<
T: InventoryService,
> tonic::server::UnaryService<super::InventoryReserveRequest>
for InventoryReserveSvc<T> {
type Response = super::InventoryReserveResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InventoryReserveRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as InventoryService>::inventory_reserve(&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 = InventoryReserveSvc(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)
}
"/inventory.v1.InventoryService/InventoryRelease" => {
#[allow(non_camel_case_types)]
struct InventoryReleaseSvc<T: InventoryService>(pub Arc<T>);
impl<
T: InventoryService,
> tonic::server::UnaryService<super::InventoryReleaseRequest>
for InventoryReleaseSvc<T> {
type Response = super::InventoryReleaseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InventoryReleaseRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as InventoryService>::inventory_release(&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 = InventoryReleaseSvc(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)
}
"/inventory.v1.InventoryService/InventoryGet" => {
#[allow(non_camel_case_types)]
struct InventoryGetSvc<T: InventoryService>(pub Arc<T>);
impl<
T: InventoryService,
> tonic::server::UnaryService<super::InventoryGetRequest>
for InventoryGetSvc<T> {
type Response = super::InventoryGetResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InventoryGetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as InventoryService>::inventory_get(&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 = InventoryGetSvc(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)
}
"/inventory.v1.InventoryService/InventoryUpdate" => {
#[allow(non_camel_case_types)]
struct InventoryUpdateSvc<T: InventoryService>(pub Arc<T>);
impl<
T: InventoryService,
> tonic::server::UnaryService<super::InventoryUpdateRequest>
for InventoryUpdateSvc<T> {
type Response = super::InventoryUpdateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::InventoryUpdateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as InventoryService>::inventory_update(&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 = InventoryUpdateSvc(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)
}
"/inventory.v1.InventoryService/InventoryReservationGet" => {
#[allow(non_camel_case_types)]
struct InventoryReservationGetSvc<T: InventoryService>(pub Arc<T>);
impl<
T: InventoryService,
> tonic::server::UnaryService<super::InventoryReservationGetRequest>
for InventoryReservationGetSvc<T> {
type Response = super::InventoryReservationGetResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::InventoryReservationGetRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as InventoryService>::inventory_reservation_get(
&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 = InventoryReservationGetSvc(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 InventoryServiceServer<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 = "inventory.v1.InventoryService";
impl<T> tonic::server::NamedService for InventoryServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}