Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Typed client for the cloacina-server REST API + delivery WebSocket. Cheap to clone (everything behind one Arc).

Implementations§

Source§

impl Client

Source

pub fn server(&self) -> &str

Server base URL this client talks to.

Source

pub fn tenant_segment(&self) -> &str

Default tenant segment for tenant-scoped routes — --tenant value or public.

Source

pub async fn get_json<T: DeserializeOwned>( &self, path: &str, ) -> Result<T, ClientError>

Typed GET of an arbitrary path.

Source

pub async fn post_json<B: Serialize + ?Sized, T: DeserializeOwned>( &self, path: &str, body: &B, ) -> Result<T, ClientError>

Typed POST (JSON body) to an arbitrary path.

Source

pub async fn delete_path(&self, path: &str) -> Result<(), ClientError>

DELETE an arbitrary path, discarding any response body.

Source

pub async fn health(&self) -> Result<Value, ClientError>

Source

pub async fn ready(&self) -> Result<(u16, Value), ClientError>

Raw readiness response — 503 is a meaningful state, not an error.

Source

pub async fn create_key( &self, name: &str, role: KeyRole, ) -> Result<KeyCreatedResponse, ClientError>

Source

pub async fn list_keys(&self) -> Result<ListResponse<KeyInfo>, ClientError>

Source

pub async fn revoke_key( &self, key_id: &str, ) -> Result<KeyRevokedResponse, ClientError>

Source

pub async fn create_tenant_key( &self, name: &str, role: KeyRole, tenant: Option<&str>, ) -> Result<KeyCreatedResponse, ClientError>

Source

pub async fn list_tenant_keys( &self, tenant: Option<&str>, ) -> Result<ListResponse<KeyInfo>, ClientError>

List the keys scoped to one tenant — tenant-admin self-service (CLOACI-T-0784).

Source

pub async fn revoke_tenant_key( &self, key_id: &str, tenant: Option<&str>, ) -> Result<KeyRevokedResponse, ClientError>

Revoke a key owned by one tenant — tenant-admin self-service (CLOACI-T-0784). A cross-tenant or unknown id is reported as not-found.

Source

pub async fn create_ws_ticket(&self) -> Result<WsTicketResponse, ClientError>

Mint a single-use, short-lived WebSocket ticket.

Source

pub async fn local_login( &self, username: &str, password: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>

Username/password login — returns a minted bearer key (the JSON body carries key, tenant_id, role, expires_at).

Source

pub async fn refresh(&self) -> Result<Value, ClientError>

Silently re-mint the caller’s short-TTL key before it expires.

Source

pub async fn logout(&self) -> Result<Value, ClientError>

Revoke the caller’s key + forget any refresh session.

Source

pub async fn whoami(&self) -> Result<Value, ClientError>

The caller’s own tenant + role + admin flag.

Source

pub async fn list_accounts( &self, tenant: Option<&str>, ) -> Result<Value, ClientError>

List a tenant’s local accounts (never the password hash).

Source

pub async fn create_account( &self, username: &str, password: &str, role: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>

Create a local account in a tenant.

Source

pub async fn disable_account( &self, account_id: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>

Disable (not hard-delete) a local account, preserving history.

Source

pub async fn reset_password( &self, account_id: &str, password: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>

Admin-reset a local account’s password.

Source

pub async fn create_tenant( &self, request: &CreateTenantRequest, ) -> Result<TenantCreatedResponse, ClientError>

Source

pub async fn list_tenants( &self, ) -> Result<ListResponse<TenantSummary>, ClientError>

Source

pub async fn remove_tenant( &self, schema_name: &str, ) -> Result<TenantRemovedResponse, ClientError>

Source

pub async fn upload_workflow( &self, package: Vec<u8>, tenant: Option<&str>, ) -> Result<WorkflowUploadedResponse, ClientError>

Upload a .cloacina package (multipart).

Source

pub async fn list_workflows( &self, tenant: Option<&str>, ) -> Result<TenantListResponse<WorkflowSummary>, ClientError>

Source

pub async fn get_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowDetail, ClientError>

Source

pub async fn delete_workflow( &self, name: &str, version: &str, tenant: Option<&str>, ) -> Result<WorkflowDeletedResponse, ClientError>

Source

pub async fn list_triggers( &self, limit: Option<i64>, offset: Option<i64>, tenant: Option<&str>, ) -> Result<TenantListResponse<TriggerScheduleSummary>, ClientError>

Source

pub async fn get_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerDetailResponse, ClientError>

Source

pub async fn execute_workflow( &self, name: &str, context: Value, ) -> Result<ExecuteResponse, ClientError>

Source

pub async fn list_executions( &self, query: &ListExecutionsQuery, tenant: Option<&str>, ) -> Result<TenantListResponse<ExecutionSummary>, ClientError>

Source

pub async fn get_execution( &self, exec_id: &str, tenant: Option<&str>, ) -> Result<ExecutionDetail, ClientError>

Source

pub async fn get_execution_events( &self, exec_id: &str, tenant: Option<&str>, ) -> Result<ExecutionEventsResponse, ClientError>

Source

pub async fn get_execution_tasks( &self, tenant_id: &str, exec_id: &str, ) -> Result<ExecutionTasksResponse, ClientError>

Source

pub async fn list_accumulators( &self, ) -> Result<ListResponse<AccumulatorStatus>, ClientError>

Source

pub async fn list_graphs( &self, ) -> Result<ListResponse<GraphStatus>, ClientError>

Source

pub async fn get_graph(&self, name: &str) -> Result<GraphStatus, ClientError>

Source

pub async fn list_reactors( &self, ) -> Result<ListResponse<ReactorStatus>, ClientError>

Source

pub async fn fire_reactor( &self, name: &str, request: &FireReactorRequest, ) -> Result<FireReactorResponse, ClientError>

Source

pub async fn list_reactor_fires( &self, name: &str, ) -> Result<ListResponse<ReactorFire>, ClientError>

Source

pub async fn reactor_fire_timeseries( &self, name: &str, ) -> Result<ReactorFireTimeseries, ClientError>

Source

pub async fn reactor_interface( &self, name: &str, ) -> Result<DeclaredSurface, ClientError>

Source

pub async fn accumulator_interface( &self, name: &str, ) -> Result<DeclaredSurface, ClientError>

Source

pub async fn inject_accumulator( &self, name: &str, request: &InjectAccumulatorRequest, ) -> Result<InjectAccumulatorResponse, ClientError>

Source

pub async fn pause_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowPauseResponse, ClientError>

Source

pub async fn resume_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowPauseResponse, ClientError>

Source

pub async fn get_workflow_source( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowSourceResponse, ClientError>

Source

pub async fn pause_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerPauseResponse, ClientError>

Source

pub async fn fire_trigger( &self, name: &str, request: &FireTriggerRequest, tenant: Option<&str>, ) -> Result<FireTriggerResponse, ClientError>

Manually fire a trigger — fans out to every subscribed workflow (CLOACI-T-0777).

Source

pub async fn trigger_interface( &self, name: &str, tenant: Option<&str>, ) -> Result<DeclaredSurface, ClientError>

A trigger’s declared pass-through interface — the union of its subscribers’ declared params (CLOACI-T-0777).

Source

pub async fn resume_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerPauseResponse, ClientError>

Source

pub async fn list_agents(&self) -> Result<ListResponse<AgentInfo>, ClientError>

Source

pub async fn compiler_status(&self) -> Result<CompilerStatus, ClientError>

Source

pub fn subscribe_delivery( &self, recipient: &str, options: SubscribeOptions, ) -> impl Stream<Item = Result<DeliveryPush, ClientError>> + '_

Subscribe to the substrate delivery stream for a recipient. Yields each push exactly once (dedup on row id), acking after yield; reconnects with exponential backoff. See ws::SubscribeOptions.

Source

pub fn follow_execution_events( &self, execution_id: &str, ) -> impl Stream<Item = Result<Value, ClientError>> + '_

Stream the JSON events of one workflow execution — recipient convention exec_events:<execution_id>, the same stream cloacinactl execution follow renders.

Source

pub fn follow_execution_events_with( &self, execution_id: &str, options: SubscribeOptions, ) -> impl Stream<Item = Result<Value, ClientError>> + '_

follow_execution_events with explicit subscription options (reconnect policy, backoff).

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more