| 1 | use crate::Viewer; |
| 2 | use serde::{Deserialize, Serialize}; |
| 3 | |
| 4 | #[derive(Deserialize, Serialize)] |
| 5 | #[serde(rename_all = "camelCase")] |
| 6 | pub struct DeliveryInsightsArgs { |
| 7 | pub repo_ids: Vec<String>, |
| 8 | pub viewer: Viewer, |
| 9 | pub from: String, |
| 10 | pub until: String, |
| 11 | } |
| 12 | |
| 13 | /// One repository's delivery: counts over the period's UTC days, and what |
| 14 | /// waits now. `checking` and `failed` count each open pull request once, by |
| 15 | /// its head's checks (statuses, check runs and g1t Actions jobs) as its |
| 16 | /// page adds them up; one with no checks is in neither. |
| 17 | #[derive(Clone, Default, Deserialize, Serialize)] |
| 18 | #[serde(default, rename_all(serialize = "camelCase"))] |
| 19 | pub struct DeliveryMetrics { |
| 20 | pub repo_id: String, |
| 21 | pub opened: u32, |
| 22 | pub merged: u32, |
| 23 | pub active: u32, |
| 24 | pub unreviewed: u32, |
| 25 | pub checking: u32, |
| 26 | pub failed: u32, |
| 27 | pub queued: u32, |
| 28 | pub lead_seconds: f64, |
| 29 | pub review_seconds: f64, |
| 30 | pub reviewed: u32, |
| 31 | } |
| 32 | |
| 33 | #[derive(Serialize)] |
| 34 | #[serde(rename_all = "camelCase")] |
| 35 | pub struct DeliveryInsights { |
| 36 | pub projects: Vec<DeliveryMetrics>, |
| 37 | pub days: Vec<DeliveryDay>, |
| 38 | /// g1t Actions could not be read, so `checking` and `failed` are not known. |
| 39 | pub checks_unavailable: bool, |
| 40 | } |
| 41 | |
| 42 | #[derive(Deserialize, Serialize)] |
| 43 | pub struct DeliveryDay { |
| 44 | pub day: String, |
| 45 | pub merged: u32, |
| 46 | } |