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
impl Client
Sourcepub fn tenant_segment(&self) -> &str
pub fn tenant_segment(&self) -> &str
Default tenant segment for tenant-scoped routes — --tenant value
or public.
Sourcepub async fn get_json<T: DeserializeOwned>(
&self,
path: &str,
) -> Result<T, ClientError>
pub async fn get_json<T: DeserializeOwned>( &self, path: &str, ) -> Result<T, ClientError>
Typed GET of an arbitrary path.
Sourcepub async fn post_json<B: Serialize + ?Sized, T: DeserializeOwned>(
&self,
path: &str,
body: &B,
) -> Result<T, ClientError>
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.
Sourcepub async fn delete_path(&self, path: &str) -> Result<(), ClientError>
pub async fn delete_path(&self, path: &str) -> Result<(), ClientError>
DELETE an arbitrary path, discarding any response body.
pub async fn health(&self) -> Result<Value, ClientError>
Sourcepub async fn ready(&self) -> Result<(u16, Value), ClientError>
pub async fn ready(&self) -> Result<(u16, Value), ClientError>
Raw readiness response — 503 is a meaningful state, not an error.
pub async fn create_key( &self, name: &str, role: KeyRole, ) -> Result<KeyCreatedResponse, ClientError>
pub async fn list_keys(&self) -> Result<ListResponse<KeyInfo>, ClientError>
pub async fn revoke_key( &self, key_id: &str, ) -> Result<KeyRevokedResponse, ClientError>
pub async fn create_tenant_key( &self, name: &str, role: KeyRole, tenant: Option<&str>, ) -> Result<KeyCreatedResponse, ClientError>
Sourcepub async fn list_tenant_keys(
&self,
tenant: Option<&str>,
) -> Result<ListResponse<KeyInfo>, ClientError>
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).
Sourcepub async fn revoke_tenant_key(
&self,
key_id: &str,
tenant: Option<&str>,
) -> Result<KeyRevokedResponse, ClientError>
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.
Sourcepub async fn create_ws_ticket(&self) -> Result<WsTicketResponse, ClientError>
pub async fn create_ws_ticket(&self) -> Result<WsTicketResponse, ClientError>
Mint a single-use, short-lived WebSocket ticket.
Sourcepub async fn local_login(
&self,
username: &str,
password: &str,
tenant: Option<&str>,
) -> Result<Value, ClientError>
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).
Sourcepub async fn refresh(&self) -> Result<Value, ClientError>
pub async fn refresh(&self) -> Result<Value, ClientError>
Silently re-mint the caller’s short-TTL key before it expires.
Sourcepub async fn logout(&self) -> Result<Value, ClientError>
pub async fn logout(&self) -> Result<Value, ClientError>
Revoke the caller’s key + forget any refresh session.
Sourcepub async fn whoami(&self) -> Result<Value, ClientError>
pub async fn whoami(&self) -> Result<Value, ClientError>
The caller’s own tenant + role + admin flag.
Sourcepub async fn list_accounts(
&self,
tenant: Option<&str>,
) -> Result<Value, ClientError>
pub async fn list_accounts( &self, tenant: Option<&str>, ) -> Result<Value, ClientError>
List a tenant’s local accounts (never the password hash).
Sourcepub async fn create_account(
&self,
username: &str,
password: &str,
role: &str,
tenant: Option<&str>,
) -> Result<Value, ClientError>
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.
Sourcepub async fn disable_account(
&self,
account_id: &str,
tenant: Option<&str>,
) -> Result<Value, ClientError>
pub async fn disable_account( &self, account_id: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>
Disable (not hard-delete) a local account, preserving history.
Sourcepub async fn reset_password(
&self,
account_id: &str,
password: &str,
tenant: Option<&str>,
) -> Result<Value, ClientError>
pub async fn reset_password( &self, account_id: &str, password: &str, tenant: Option<&str>, ) -> Result<Value, ClientError>
Admin-reset a local account’s password.
pub async fn create_tenant( &self, request: &CreateTenantRequest, ) -> Result<TenantCreatedResponse, ClientError>
pub async fn list_tenants( &self, ) -> Result<ListResponse<TenantSummary>, ClientError>
pub async fn remove_tenant( &self, schema_name: &str, ) -> Result<TenantRemovedResponse, ClientError>
Sourcepub async fn upload_workflow(
&self,
package: Vec<u8>,
tenant: Option<&str>,
) -> Result<WorkflowUploadedResponse, ClientError>
pub async fn upload_workflow( &self, package: Vec<u8>, tenant: Option<&str>, ) -> Result<WorkflowUploadedResponse, ClientError>
Upload a .cloacina package (multipart).
pub async fn list_workflows( &self, tenant: Option<&str>, ) -> Result<TenantListResponse<WorkflowSummary>, ClientError>
pub async fn get_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowDetail, ClientError>
pub async fn delete_workflow( &self, name: &str, version: &str, tenant: Option<&str>, ) -> Result<WorkflowDeletedResponse, ClientError>
pub async fn list_triggers( &self, limit: Option<i64>, offset: Option<i64>, tenant: Option<&str>, ) -> Result<TenantListResponse<TriggerScheduleSummary>, ClientError>
pub async fn get_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerDetailResponse, ClientError>
pub async fn execute_workflow( &self, name: &str, context: Value, ) -> Result<ExecuteResponse, ClientError>
pub async fn list_executions( &self, query: &ListExecutionsQuery, tenant: Option<&str>, ) -> Result<TenantListResponse<ExecutionSummary>, ClientError>
pub async fn get_execution( &self, exec_id: &str, tenant: Option<&str>, ) -> Result<ExecutionDetail, ClientError>
pub async fn get_execution_events( &self, exec_id: &str, tenant: Option<&str>, ) -> Result<ExecutionEventsResponse, ClientError>
pub async fn get_execution_tasks( &self, tenant_id: &str, exec_id: &str, ) -> Result<ExecutionTasksResponse, ClientError>
pub async fn list_accumulators( &self, ) -> Result<ListResponse<AccumulatorStatus>, ClientError>
pub async fn list_graphs( &self, ) -> Result<ListResponse<GraphStatus>, ClientError>
pub async fn get_graph(&self, name: &str) -> Result<GraphStatus, ClientError>
pub async fn list_reactors( &self, ) -> Result<ListResponse<ReactorStatus>, ClientError>
pub async fn fire_reactor( &self, name: &str, request: &FireReactorRequest, ) -> Result<FireReactorResponse, ClientError>
pub async fn list_reactor_fires( &self, name: &str, ) -> Result<ListResponse<ReactorFire>, ClientError>
pub async fn reactor_fire_timeseries( &self, name: &str, ) -> Result<ReactorFireTimeseries, ClientError>
pub async fn reactor_interface( &self, name: &str, ) -> Result<DeclaredSurface, ClientError>
pub async fn accumulator_interface( &self, name: &str, ) -> Result<DeclaredSurface, ClientError>
pub async fn inject_accumulator( &self, name: &str, request: &InjectAccumulatorRequest, ) -> Result<InjectAccumulatorResponse, ClientError>
pub async fn pause_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowPauseResponse, ClientError>
pub async fn resume_workflow( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowPauseResponse, ClientError>
pub async fn get_workflow_source( &self, name: &str, tenant: Option<&str>, ) -> Result<WorkflowSourceResponse, ClientError>
pub async fn pause_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerPauseResponse, ClientError>
Sourcepub async fn fire_trigger(
&self,
name: &str,
request: &FireTriggerRequest,
tenant: Option<&str>,
) -> Result<FireTriggerResponse, ClientError>
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).
Sourcepub async fn trigger_interface(
&self,
name: &str,
tenant: Option<&str>,
) -> Result<DeclaredSurface, ClientError>
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).
pub async fn resume_trigger( &self, name: &str, tenant: Option<&str>, ) -> Result<TriggerPauseResponse, ClientError>
pub async fn list_agents(&self) -> Result<ListResponse<AgentInfo>, ClientError>
pub async fn compiler_status(&self) -> Result<CompilerStatus, ClientError>
Sourcepub fn subscribe_delivery(
&self,
recipient: &str,
options: SubscribeOptions,
) -> impl Stream<Item = Result<DeliveryPush, ClientError>> + '_
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.
Sourcepub fn follow_execution_events(
&self,
execution_id: &str,
) -> impl Stream<Item = Result<Value, ClientError>> + '_
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.
Sourcepub fn follow_execution_events_with(
&self,
execution_id: &str,
options: SubscribeOptions,
) -> impl Stream<Item = Result<Value, ClientError>> + '_
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).