diff --git a/crates/api_clients/seedance2pro_client/src/requests/poll_orders/poll_orders.rs b/crates/api_clients/seedance2pro_client/src/requests/poll_orders/poll_orders.rs index 96f3242669..46d38b2d17 100644 --- a/crates/api_clients/seedance2pro_client/src/requests/poll_orders/poll_orders.rs +++ b/crates/api_clients/seedance2pro_client/src/requests/poll_orders/poll_orders.rs @@ -35,6 +35,41 @@ pub struct PollOrdersResponse { // --- Public types --- +/// The status of one order (one generation task — video or image). +#[derive(Debug, Clone)] +pub struct OrderStatus { + pub order_id: String, + + pub task_status: TaskStatus, + + /// Top-level result URL (video file for video orders, the first image of + /// the 4-image grid for Midjourney image orders). Populated when + /// `task_status` is `Completed`. + pub result_url: Option, + + /// Detailed result entries. One entry per video frame (video orders), or + /// four entries per Midjourney task (image orders). + pub results: Vec, + + /// Structured failure reason. Populated when `task_status` is `Failed` or `fail_reason` is present. + pub fail_reason: Option, + + /// ISO 8601 creation timestamp (e.g. `"2026-02-19T01:20:50.398Z"`). + pub created_at: String, + + /// Parsed `created_at` as a `DateTime`. `None` if the raw string could not be parsed. + pub created_at_utc: Option>, + + /// Whether this order produced an image or a video. `None` for older + /// polling responses that didn't include the field — those came from the + /// video-only era and can be treated as video by callers that need to. + pub media_type: Option, + + /// The Kinovi credits charged for the order (the API's `totalCredits`). + /// `None` for older polling responses that didn't include the field. + pub total_credits: Option, +} + /// The lifecycle status of a video generation task. #[derive(Debug, Clone, PartialEq)] pub enum TaskStatus { @@ -104,41 +139,6 @@ impl OrderMediaType { pub fn is_video(&self) -> bool { matches!(self, Self::Video) } } -/// The status of one order (one generation task — video or image). -#[derive(Debug, Clone)] -pub struct OrderStatus { - pub order_id: String, - - pub task_status: TaskStatus, - - /// Top-level result URL (video file for video orders, the first image of - /// the 4-image grid for Midjourney image orders). Populated when - /// `task_status` is `Completed`. - pub result_url: Option, - - /// Detailed result entries. One entry per video frame (video orders), or - /// four entries per Midjourney task (image orders). - pub results: Vec, - - /// Structured failure reason. Populated when `task_status` is `Failed` or `fail_reason` is present. - pub fail_reason: Option, - - /// ISO 8601 creation timestamp (e.g. `"2026-02-19T01:20:50.398Z"`). - pub created_at: String, - - /// Parsed `created_at` as a `DateTime`. `None` if the raw string could not be parsed. - pub created_at_utc: Option>, - - /// Whether this order produced an image or a video. `None` for older - /// polling responses that didn't include the field — those came from the - /// video-only era and can be treated as video by callers that need to. - pub media_type: Option, - - /// The Kinovi credits charged for the order (the API's `totalCredits`). - /// `None` for older polling responses that didn't include the field. - pub total_credits: Option, -} - // --- Implementation --- pub async fn poll_orders(args: PollOrdersArgs<'_>) -> Result {