zart_api/lib.rs
1//! Zart HTTP API — optional Axum server for external interaction with durable executions.
2//!
3//! # Endpoints
4//!
5//! ```text
6//! GET /api/v1/executions — List executions
7//! POST /api/v1/executions — Start a new execution
8//! GET /api/v1/executions/:execution_id — Get execution status
9//! POST /api/v1/executions/:execution_id/cancel — Cancel an execution
10//! GET /api/v1/executions/:execution_id/wait — Long-poll until completion
11//! GET /api/v1/stats — Aggregate execution counts by status
12//! POST /api/v1/events/:execution_id/:event_name — Deliver an event
13//! GET /healthz — Liveness probe
14//! GET /readyz — Readiness probe
15//! GET /metrics — Prometheus metrics
16//!
17//! GET /admin/v1/executions/:id/detail — Full execution detail with steps & attempts
18//! POST /admin/v1/executions/:id/retry-step — Retry a dead step
19//! POST /admin/v1/executions/:id/restart — Restart an execution
20//! POST /admin/v1/executions/:id/rerun — Selective step rerun
21//! GET /admin/v1/executions/:id/runs — List runs for an execution
22//! POST /admin/v1/pause — Create a pause rule
23//! GET /admin/v1/pause — List pause rules
24//! POST /admin/v1/pause/:rule_id — Resume (soft-delete) a pause rule
25//! DELETE /admin/v1/pause/:rule_id — Delete a pause rule
26//! ```
27//!
28//! # Usage
29//!
30//! ```rust,no_run
31//! use zart_api::ApiServer;
32//! use zart::{DurableScheduler, TaskRegistry, into_durable_api};
33//! use std::sync::Arc;
34//!
35//! # async fn example() {
36//! // let scheduler = Arc::new(/* PostgresScheduler */);
37//! // let durable = into_durable_api(DurableScheduler::new(scheduler));
38//! // ApiServer::new("0.0.0.0:8080", durable).serve().await.unwrap();
39//! # }
40//! ```
41
42pub mod admin_routes;
43pub mod models;
44pub mod routes;
45pub mod server;
46pub mod state;
47
48pub use admin_routes::admin_router;
49pub use server::ApiServer;
50pub use state::{AdminState, AppState};