openai-types 0.1.3

Typed OpenAI API models — zero dependencies beyond serde
Documentation
// AUTO-GENERATED by py2rust — do not edit.
// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
// Domain: video

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoStatus {
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
}

/// Structured information describing a generated video job.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Video {
    /// Unique identifier for the video job.
    pub id: String,
    /// Unix timestamp (seconds) for when the job completed, if finished.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub completed_at: Option<i64>,
    /// Unix timestamp (seconds) for when the job was created.
    pub created_at: i64,
    /// Error payload that explains why generation failed, if applicable.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<VideoCreateError>,
    /// Unix timestamp (seconds) for when the downloadable assets expire, if set.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_at: Option<i64>,
    /// The video generation model that produced the job.
    pub model: VideoModel,
    /// The object type, which is always `video`.
    pub object: String,
    /// Approximate completion percentage for the generation task.
    pub progress: i64,
    /// The prompt that was used to generate the video.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt: Option<String>,
    /// Identifier of the source video if this video is a remix.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub remixed_from_video_id: Option<String>,
    /// Duration of the generated clip in seconds.
    pub seconds: String,
    /// The resolution of the generated video.
    pub size: VideoSize,
    /// Current lifecycle status of the video job.
    pub status: VideoStatus,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoCreateCharacterParams {
    /// Display name for this API character.
    pub name: String,
    /// Video file used to create a character.
    pub video: serde_json::Value,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoCreateCharacterResponse {
    /// Identifier for the character creation cameo.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// Unix timestamp (in seconds) when the character was created.
    pub created_at: i64,
    /// Display name for the character.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
}

/// An error that occurred while generating the response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoCreateError {
    /// A machine-readable error code that was returned.
    pub code: String,
    /// A human-readable description of the error that was returned.
    pub message: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoCreateParams {
    /// Text prompt that describes the video to generate.
    pub prompt: String,
    /// Optional reference asset upload or reference object that guides generation.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input_reference: Option<InputReference>,
    /// The video generation model to use (allowed values: sora-2, sora-2-pro).
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<serde_json::Value>,
    /// Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub seconds: Option<VideoSeconds>,
    /// Output resolution formatted as width x height (allowed values: 720x1280,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub size: Option<VideoSize>,
}

pub type InputReference = serde_json::Value;

/// Confirmation payload returned after deleting a video.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoDeleteResponse {
    /// Identifier of the deleted video.
    pub id: String,
    /// Indicates that the video resource was deleted.
    pub deleted: bool,
    /// The object type that signals the deletion response.
    pub object: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoDownloadContentParamsVariant {
    #[serde(rename = "video")]
    Video,
    #[serde(rename = "thumbnail")]
    Thumbnail,
    #[serde(rename = "spritesheet")]
    Spritesheet,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoDownloadContentParams {
    /// Which downloadable asset to return. Defaults to the MP4 video.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub variant: Option<VideoDownloadContentParamsVariant>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoEditParams {
    /// Text prompt that describes how to edit the source video.
    pub prompt: String,
    /// Reference to the completed video to edit.
    pub video: Video,
}

/// Reference to the completed video.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoVideoReferenceInputParam {
    /// The identifier of the completed video.
    pub id: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoExtendParams {
    /// Updated text prompt that directs the extension generation.
    pub prompt: String,
    /// Length of the newly generated extension segment in seconds (allowed values: 4,
    pub seconds: VideoSeconds,
    /// Reference to the completed video to extend.
    pub video: Video,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoGetCharacterResponse {
    /// Identifier for the character creation cameo.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// Unix timestamp (in seconds) when the character was created.
    pub created_at: i64,
    /// Display name for the character.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoListParamsOrder {
    #[serde(rename = "asc")]
    Asc,
    #[serde(rename = "desc")]
    Desc,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoListParams {
    /// Identifier for the last item from the previous pagination request
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub after: Option<String>,
    /// Number of items to retrieve
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub limit: Option<i64>,
    /// Sort order of results by timestamp.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub order: Option<VideoListParamsOrder>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoModel {
    #[serde(rename = "sora-2")]
    Sora2,
    #[serde(rename = "sora-2-pro")]
    Sora2Pro,
    #[serde(rename = "sora-2-2025-10-06")]
    Sora220251006,
    #[serde(rename = "sora-2-pro-2025-10-06")]
    Sora2Pro20251006,
    #[serde(rename = "sora-2-2025-12-08")]
    Sora220251208,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct VideoRemixParams {
    /// Updated text prompt that directs the remix generation.
    pub prompt: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoSeconds {
    #[serde(rename = "4")]
    V4,
    #[serde(rename = "8")]
    V8,
    #[serde(rename = "12")]
    V12,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum VideoSize {
    #[serde(rename = "720x1280")]
    V720x1280,
    #[serde(rename = "1280x720")]
    V1280x720,
    #[serde(rename = "1024x1792")]
    V1024x1792,
    #[serde(rename = "1792x1024")]
    V1792x1024,
}