1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! # ironflow-api
//!
//! REST API crate for the **ironflow** workflow engine. Provides endpoints for
//! querying workflow runs, managing their lifecycle, and viewing aggregate statistics.
//!
//! # Architecture
//!
//! - `entities/` — DTOs and query parameter types (public API contract)
//! - `routes/` — One file per route handler
//! - `error.rs` — Typed API errors mapped to HTTP status codes
//! - `response.rs` — Standard response envelope
//! - `state.rs` — Shared application state
//!
//! # API Endpoints
//!
//! ## Health check
//! - `GET /api/v1/health-check` — Liveness probe, always returns 200 OK
//!
//! ## Runs
//! - `GET /api/v1/runs` — List runs with optional filtering and pagination
//! - `POST /api/v1/runs` — Trigger a workflow
//! - `GET /api/v1/runs/:id` — Get run details and steps
//! - `POST /api/v1/runs/:id/cancel` — Cancel a pending or running run
//! - `POST /api/v1/runs/:id/retry` — Retry a failed run (creates new run)
//!
//! ## Workflows
//! - `GET /api/v1/workflows` — List registered workflows
//!
//! ## Statistics
//! - `GET /api/v1/stats` — Aggregate statistics (total runs, success rate, cost, etc.)
//!
//! ## Events (SSE)
//! - `GET /api/v1/events` — Server-Sent Events stream for real-time updates
//!
//! # Quick start
//!
//! ```no_run
//! use ironflow_api::prelude::*;
//! use ironflow_api::routes::{RouterConfig, create_router};
//! use ironflow_store::prelude::*;
//! use ironflow_store::api_key_store::ApiKeyStore;
//! use ironflow_engine::engine::Engine;
//! use ironflow_core::providers::claude::ClaudeCodeProvider;
//! use ironflow_auth::jwt::JwtConfig;
//! use std::sync::Arc;
//!
//! # async fn example() {
//! let store = Arc::new(InMemoryStore::new());
//! let user_store: Arc<dyn ironflow_store::user_store::UserStore> = Arc::new(InMemoryStore::new());
//! let api_key_store: Arc<dyn ApiKeyStore> = Arc::new(InMemoryStore::new());
//! let provider = Arc::new(ClaudeCodeProvider::new());
//! let engine = Arc::new(Engine::new(store.clone(), provider));
//! let jwt_config = Arc::new(JwtConfig {
//! secret: "your-secret-key".to_string(),
//! access_token_ttl_secs: 900,
//! refresh_token_ttl_secs: 604800,
//! cookie_domain: None,
//! cookie_secure: false,
//! });
//! let broadcaster = ironflow_api::sse::SseBroadcaster::new();
//! let state = AppState::new(store, user_store, api_key_store, engine, jwt_config, "token".to_string(), broadcaster.sender());
//! let app = create_router(state, RouterConfig::default());
//!
//! let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
//! .await
//! .unwrap();
//! axum::serve(listener, app).await.unwrap();
//! # }
//! ```
/// Convenience re-exports for common API usage.
pub use ;
pub use AppState;