pub type OwnedGetFlowByIdRequestView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowByIdRequestView<'static>,
>;
pub type OwnedGetFlowResponseView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowResponseView<'static>,
>;
pub type OwnedListFlowsRequestView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsRequestView<'static>,
>;
pub type OwnedListFlowsResponseView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsResponseView<'static>,
>;
pub type OwnedListFlowsByTxRequestView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxRequestView<'static>,
>;
pub type OwnedListFlowsByTxResponseView = ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxResponseView<'static>,
>;
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::GetFlowResponse>
for crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowResponseView<'_> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self, codec)
}
}
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::GetFlowResponse>
for ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowResponseView<'static>,
> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
}
}
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::ListFlowsResponse>
for crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsResponseView<'_> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self, codec)
}
}
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::ListFlowsResponse>
for ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsResponseView<'static>,
> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
}
}
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::ListFlowsByTxResponse>
for crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxResponseView<'_> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self, codec)
}
}
impl ::connectrpc::Encodable<crate::proto::chain::lifecycle::v1::ListFlowsByTxResponse>
for ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxResponseView<'static>,
> {
fn encode(
&self,
codec: ::connectrpc::CodecFormat,
) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
}
}
pub const LIFECYCLE_READ_SERVICE_SERVICE_NAME: &str = "chain.lifecycle.v1.LifecycleReadService";
pub const LIFECYCLE_READ_SERVICE_GET_FLOW_BY_ID_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
"/chain.lifecycle.v1.LifecycleReadService/GetFlowById",
::connectrpc::StreamType::Unary,
)
.with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
pub const LIFECYCLE_READ_SERVICE_LIST_FLOWS_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
"/chain.lifecycle.v1.LifecycleReadService/ListFlows",
::connectrpc::StreamType::Unary,
)
.with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
pub const LIFECYCLE_READ_SERVICE_LIST_FLOWS_BY_TX_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
"/chain.lifecycle.v1.LifecycleReadService/ListFlowsByTx",
::connectrpc::StreamType::Unary,
)
.with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
#[allow(clippy::type_complexity)]
pub trait LifecycleReadService: Send + Sync + 'static {
fn get_flow_by_id<'a>(
&'a self,
ctx: ::connectrpc::RequestContext,
request: ::connectrpc::ServiceRequest<
'_,
crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
>,
) -> impl ::std::future::Future<
Output = ::connectrpc::ServiceResult<
impl ::connectrpc::Encodable<
crate::proto::chain::lifecycle::v1::GetFlowResponse,
> + Send + use<'a, Self>,
>,
> + Send;
fn list_flows<'a>(
&'a self,
ctx: ::connectrpc::RequestContext,
request: ::connectrpc::ServiceRequest<
'_,
crate::proto::chain::lifecycle::v1::ListFlowsRequest,
>,
) -> impl ::std::future::Future<
Output = ::connectrpc::ServiceResult<
impl ::connectrpc::Encodable<
crate::proto::chain::lifecycle::v1::ListFlowsResponse,
> + Send + use<'a, Self>,
>,
> + Send;
fn list_flows_by_tx<'a>(
&'a self,
ctx: ::connectrpc::RequestContext,
request: ::connectrpc::ServiceRequest<
'_,
crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
>,
) -> impl ::std::future::Future<
Output = ::connectrpc::ServiceResult<
impl ::connectrpc::Encodable<
crate::proto::chain::lifecycle::v1::ListFlowsByTxResponse,
> + Send + use<'a, Self>,
>,
> + Send;
}
pub trait LifecycleReadServiceExt: LifecycleReadService {
fn register(
self: ::std::sync::Arc<Self>,
router: ::connectrpc::Router,
) -> ::connectrpc::Router;
}
impl<S: LifecycleReadService> LifecycleReadServiceExt for S {
fn register(
self: ::std::sync::Arc<Self>,
router: ::connectrpc::Router,
) -> ::connectrpc::Router {
router
.route_view(
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"GetFlowById",
{
let svc = ::std::sync::Arc::clone(&self);
::connectrpc::view_handler_fn(move |
ctx,
req: ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowByIdRequestView<
'static,
>,
>,
format|
{
let svc = ::std::sync::Arc::clone(&svc);
async move {
let sreq = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
>::from_parts(req.reborrow(), req.bytes());
svc.get_flow_by_id(ctx, sreq)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::GetFlowResponse,
>(format)
}
})
},
)
.with_spec(LIFECYCLE_READ_SERVICE_GET_FLOW_BY_ID_SPEC)
.route_view(
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"ListFlows",
{
let svc = ::std::sync::Arc::clone(&self);
::connectrpc::view_handler_fn(move |
ctx,
req: ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsRequestView<
'static,
>,
>,
format|
{
let svc = ::std::sync::Arc::clone(&svc);
async move {
let sreq = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::ListFlowsRequest,
>::from_parts(req.reborrow(), req.bytes());
svc.list_flows(ctx, sreq)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::ListFlowsResponse,
>(format)
}
})
},
)
.with_spec(LIFECYCLE_READ_SERVICE_LIST_FLOWS_SPEC)
.route_view(
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"ListFlowsByTx",
{
let svc = ::std::sync::Arc::clone(&self);
::connectrpc::view_handler_fn(move |
ctx,
req: ::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxRequestView<
'static,
>,
>,
format|
{
let svc = ::std::sync::Arc::clone(&svc);
async move {
let sreq = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
>::from_parts(req.reborrow(), req.bytes());
svc.list_flows_by_tx(ctx, sreq)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::ListFlowsByTxResponse,
>(format)
}
})
},
)
.with_spec(LIFECYCLE_READ_SERVICE_LIST_FLOWS_BY_TX_SPEC)
}
}
#[doc(hidden)]
pub struct LifecycleReadServiceRegisterMarker;
impl<
S: LifecycleReadService,
> ::connectrpc::ServiceRegister<LifecycleReadServiceRegisterMarker>
for ::std::sync::Arc<S> {
fn register_service(self, router: ::connectrpc::Router) -> ::connectrpc::Router {
<S as LifecycleReadServiceExt>::register(self, router)
}
}
pub struct LifecycleReadServiceServer<T> {
inner: ::std::sync::Arc<T>,
}
impl<T: LifecycleReadService> LifecycleReadServiceServer<T> {
pub fn new(service: T) -> Self {
Self {
inner: ::std::sync::Arc::new(service),
}
}
pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
Self { inner }
}
}
impl<T> Clone for LifecycleReadServiceServer<T> {
fn clone(&self) -> Self {
Self {
inner: ::std::sync::Arc::clone(&self.inner),
}
}
}
impl<T: LifecycleReadService> ::connectrpc::Dispatcher
for LifecycleReadServiceServer<T> {
#[inline]
fn lookup(
&self,
path: &str,
) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
let method = path.strip_prefix("chain.lifecycle.v1.LifecycleReadService/")?;
match method {
"GetFlowById" => {
Some(
::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
.with_spec(LIFECYCLE_READ_SERVICE_GET_FLOW_BY_ID_SPEC),
)
}
"ListFlows" => {
Some(
::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
.with_spec(LIFECYCLE_READ_SERVICE_LIST_FLOWS_SPEC),
)
}
"ListFlowsByTx" => {
Some(
::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
.with_spec(LIFECYCLE_READ_SERVICE_LIST_FLOWS_BY_TX_SPEC),
)
}
_ => None,
}
}
fn call_unary(
&self,
path: &str,
ctx: ::connectrpc::RequestContext,
request: ::connectrpc::Payload,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::UnaryResult {
let Some(method) = path.strip_prefix("chain.lifecycle.v1.LifecycleReadService/")
else {
return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
};
let _ = (&ctx, &request, &format);
match method {
"GetFlowById" => {
let svc = ::std::sync::Arc::clone(&self.inner);
Box::pin(async move {
let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
>(request.encoded()?, format)?;
let req: crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowByIdRequestView<
'_,
> = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
&body,
)?;
let req = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
>::from_parts(&req, &body);
svc.get_flow_by_id(ctx, req)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::GetFlowResponse,
>(format)
})
}
"ListFlows" => {
let svc = ::std::sync::Arc::clone(&self.inner);
Box::pin(async move {
let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
crate::proto::chain::lifecycle::v1::ListFlowsRequest,
>(request.encoded()?, format)?;
let req: crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsRequestView<
'_,
> = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
&body,
)?;
let req = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::ListFlowsRequest,
>::from_parts(&req, &body);
svc.list_flows(ctx, req)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::ListFlowsResponse,
>(format)
})
}
"ListFlowsByTx" => {
let svc = ::std::sync::Arc::clone(&self.inner);
Box::pin(async move {
let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
>(request.encoded()?, format)?;
let req: crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxRequestView<
'_,
> = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
&body,
)?;
let req = ::connectrpc::ServiceRequest::<
crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
>::from_parts(&req, &body);
svc.list_flows_by_tx(ctx, req)
.await?
.encode::<
crate::proto::chain::lifecycle::v1::ListFlowsByTxResponse,
>(format)
})
}
_ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
}
}
fn call_server_streaming(
&self,
path: &str,
ctx: ::connectrpc::RequestContext,
request: ::buffa::bytes::Bytes,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::StreamingResult {
let Some(method) = path.strip_prefix("chain.lifecycle.v1.LifecycleReadService/")
else {
return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
};
let _ = (&ctx, &request, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
}
}
fn call_client_streaming(
&self,
path: &str,
ctx: ::connectrpc::RequestContext,
requests: ::connectrpc::dispatcher::codegen::RequestStream,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::UnaryResult {
let Some(method) = path.strip_prefix("chain.lifecycle.v1.LifecycleReadService/")
else {
return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
};
let _ = (&ctx, &requests, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
}
}
fn call_bidi_streaming(
&self,
path: &str,
ctx: ::connectrpc::RequestContext,
requests: ::connectrpc::dispatcher::codegen::RequestStream,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::StreamingResult {
let Some(method) = path.strip_prefix("chain.lifecycle.v1.LifecycleReadService/")
else {
return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
};
let _ = (&ctx, &requests, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
}
}
}
#[derive(Clone)]
pub struct LifecycleReadServiceClient<T> {
transport: T,
config: ::connectrpc::client::ClientConfig,
}
impl<T> LifecycleReadServiceClient<T>
where
T: ::connectrpc::client::ClientTransport,
<T::ResponseBody as ::connectrpc::http_body::Body>::Error: ::std::fmt::Display,
{
pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
Self { transport, config }
}
pub fn config(&self) -> &::connectrpc::client::ClientConfig {
&self.config
}
pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
&mut self.config
}
pub async fn get_flow_by_id(
&self,
request: crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
self.get_flow_by_id_with_options(
request,
::connectrpc::client::CallOptions::default(),
)
.await
}
pub async fn get_flow_by_id_with_options(
&self,
request: crate::proto::chain::lifecycle::v1::GetFlowByIdRequest,
options: ::connectrpc::client::CallOptions,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::GetFlowResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
::connectrpc::client::call_unary(
&self.transport,
&self.config,
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"GetFlowById",
request,
options,
)
.await
}
pub async fn list_flows(
&self,
request: crate::proto::chain::lifecycle::v1::ListFlowsRequest,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
self.list_flows_with_options(
request,
::connectrpc::client::CallOptions::default(),
)
.await
}
pub async fn list_flows_with_options(
&self,
request: crate::proto::chain::lifecycle::v1::ListFlowsRequest,
options: ::connectrpc::client::CallOptions,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
::connectrpc::client::call_unary(
&self.transport,
&self.config,
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"ListFlows",
request,
options,
)
.await
}
pub async fn list_flows_by_tx(
&self,
request: crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
self.list_flows_by_tx_with_options(
request,
::connectrpc::client::CallOptions::default(),
)
.await
}
pub async fn list_flows_by_tx_with_options(
&self,
request: crate::proto::chain::lifecycle::v1::ListFlowsByTxRequest,
options: ::connectrpc::client::CallOptions,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<
crate::proto::chain::lifecycle::v1::__buffa::view::ListFlowsByTxResponseView<
'static,
>,
>,
>,
::connectrpc::ConnectError,
> {
::connectrpc::client::call_unary(
&self.transport,
&self.config,
LIFECYCLE_READ_SERVICE_SERVICE_NAME,
"ListFlowsByTx",
request,
options,
)
.await
}
}