pub struct StatsHistoryQuery {
pub workflow: Option<String>,
pub period: Option<HistoryPeriod>,
pub granularity: Option<HistoryGranularity>,
pub status: Option<RunStatus>,
pub has_steps: Option<bool>,
pub label: Option<String>,
pub created_by: Option<Uuid>,
}Expand description
Query parameters for GET /api/v1/stats/history.
§Examples
use ironflow_api::entities::StatsHistoryQuery;Fields§
§workflow: Option<String>Filter by workflow name (case-insensitive substring match, same as
GET /api/v1/runs). Omit to aggregate all workflows.
period: Option<HistoryPeriod>Time period to query. Defaults to 7d.
granularity: Option<HistoryGranularity>Bucket granularity. Auto-derived from period when omitted.
status: Option<RunStatus>Filter by run status.
has_steps: Option<bool>Filter by step presence (only applies to completed/cancelled runs).
Non-terminal runs (pending, running, etc.) are always included.
When true, only count completed/cancelled runs that have steps.
When false, only count completed/cancelled runs without steps.
label: Option<String>Filter by labels. Comma-separated key:value pairs.
created_by: Option<Uuid>Filter by author: the user ID that triggered the run.
Also matches runs triggered by one of that user’s API keys.
Implementations§
Source§impl StatsHistoryQuery
impl StatsHistoryQuery
Sourcepub fn parse_labels(&self) -> Option<HashMap<String, String>>
pub fn parse_labels(&self) -> Option<HashMap<String, String>>
Parse the comma-separated label param into a HashMap.
§Examples
use ironflow_api::entities::StatsHistoryQuery;
let query = StatsHistoryQuery {
workflow: None,
period: None,
granularity: None,
status: None,
has_steps: None,
label: Some("env:prod,team:core".to_string()),
created_by: None,
};
let labels = query.parse_labels().unwrap_or_default();
assert_eq!(labels.get("env").map(String::as_str), Some("prod"));
assert_eq!(labels.len(), 2);