pub struct RainEngineClient { /* private fields */ }Expand description
A client for the RainEngine Gateway.
Provides strongly-typed async methods for every ingress route exposed by the runtime HTTP server.
Implementations§
Source§impl RainEngineClient
impl RainEngineClient
Sourcepub fn new(base_url: &str) -> Result<Self, ClientError>
pub fn new(base_url: &str) -> Result<Self, ClientError>
Creates a new client connecting to the given base URL.
Sourcepub fn with_headers(
base_url: &str,
headers: HeaderMap,
) -> Result<Self, ClientError>
pub fn with_headers( base_url: &str, headers: HeaderMap, ) -> Result<Self, ClientError>
Creates a new client with custom request headers (e.g. for future auth).
Sourcepub async fn send_human_input(
&self,
actor_id: &str,
session_id: &str,
content: &str,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_human_input( &self, actor_id: &str, session_id: &str, content: &str, ) -> Result<RuntimeRunResult, ClientError>
Sends human input to a specific actor.
Route: POST /triggers/human/{actor_id}
Sourcepub async fn send_human_input_request(
&self,
actor_id: &str,
request: &HumanInputIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_human_input_request( &self, actor_id: &str, request: &HumanInputIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends a fully-specified human input request.
Route: POST /triggers/human/{actor_id}
Sourcepub async fn submit_approval(
&self,
session_id: &str,
resume_token: &str,
decision: ApprovalDecision,
metadata: Value,
) -> Result<RuntimeRunResult, ClientError>
pub async fn submit_approval( &self, session_id: &str, resume_token: &str, decision: ApprovalDecision, metadata: Value, ) -> Result<RuntimeRunResult, ClientError>
Submits an approval decision.
Route: POST /triggers/approval
Sourcepub async fn submit_approval_request(
&self,
request: &ApprovalIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn submit_approval_request( &self, request: &ApprovalIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Submits a fully-specified approval request.
Route: POST /triggers/approval
Sourcepub async fn send_webhook(
&self,
source: &str,
request: &WebhookIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_webhook( &self, source: &str, request: &WebhookIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends a webhook event from the given source.
Route: POST /triggers/webhook/{source}
Sourcepub async fn send_external_event(
&self,
source: &str,
request: &EventIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_external_event( &self, source: &str, request: &EventIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends an external event from the given source.
Route: POST /triggers/external/{source}
Sourcepub async fn send_system_observation(
&self,
source: &str,
request: &EventIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_system_observation( &self, source: &str, request: &EventIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends a system observation from the given source.
Route: POST /triggers/system/{source}
Sourcepub async fn send_scheduled_wake(
&self,
session_id: &str,
wake_id: &str,
due_at: i64,
reason: &str,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_scheduled_wake( &self, session_id: &str, wake_id: &str, due_at: i64, reason: &str, ) -> Result<RuntimeRunResult, ClientError>
Sends a scheduled wake event with simple args.
Route: POST /triggers/wake
Sourcepub async fn send_scheduled_wake_request(
&self,
request: &ScheduledWakeIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_scheduled_wake_request( &self, request: &ScheduledWakeIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends a fully-specified scheduled wake request.
Route: POST /triggers/wake
Sourcepub async fn send_delegation_result(
&self,
request: &DelegationResultIngressRequest,
) -> Result<RuntimeRunResult, ClientError>
pub async fn send_delegation_result( &self, request: &DelegationResultIngressRequest, ) -> Result<RuntimeRunResult, ClientError>
Sends a delegation result back to the engine.
Route: POST /triggers/delegation-result
Sourcepub async fn health(&self) -> Result<Value, ClientError>
pub async fn health(&self) -> Result<Value, ClientError>
Check the runtime health.
Route: GET /health
Sourcepub async fn list_sessions(&self) -> Result<Value, ClientError>
pub async fn list_sessions(&self) -> Result<Value, ClientError>
List all sessions.
Route: GET /sessions
Sourcepub async fn get_session(&self, session_id: &str) -> Result<Value, ClientError>
pub async fn get_session(&self, session_id: &str) -> Result<Value, ClientError>
Get a session snapshot by ID.
Route: GET /sessions/{session_id}
Sourcepub async fn list_records(
&self,
session_id: &str,
offset: usize,
limit: usize,
) -> Result<Value, ClientError>
pub async fn list_records( &self, session_id: &str, offset: usize, limit: usize, ) -> Result<Value, ClientError>
List records in a session with pagination.
Route: GET /sessions/{session_id}/records
Trait Implementations§
Source§impl Clone for RainEngineClient
impl Clone for RainEngineClient
Source§fn clone(&self) -> RainEngineClient
fn clone(&self) -> RainEngineClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RainEngineClient
impl !RefUnwindSafe for RainEngineClient
impl Send for RainEngineClient
impl Sync for RainEngineClient
impl Unpin for RainEngineClient
impl UnsafeUnpin for RainEngineClient
impl !UnwindSafe for RainEngineClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more