Skip to main content

openai_types/video/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: video
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
9#[non_exhaustive]
10pub enum VideoStatus {
11    #[serde(rename = "queued")]
12    Queued,
13    #[serde(rename = "in_progress")]
14    InProgress,
15    #[serde(rename = "completed")]
16    Completed,
17    #[serde(rename = "failed")]
18    Failed,
19}
20
21/// Structured information describing a generated video job.
22#[derive(Debug, Clone, Serialize, Deserialize)]
23#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
24pub struct Video {
25    /// Unique identifier for the video job.
26    pub id: String,
27    /// Unix timestamp (seconds) for when the job completed, if finished.
28    #[serde(skip_serializing_if = "Option::is_none", default)]
29    pub completed_at: Option<i64>,
30    /// Unix timestamp (seconds) for when the job was created.
31    pub created_at: i64,
32    /// Error payload that explains why generation failed, if applicable.
33    #[serde(skip_serializing_if = "Option::is_none", default)]
34    pub error: Option<VideoCreateError>,
35    /// Unix timestamp (seconds) for when the downloadable assets expire, if set.
36    #[serde(skip_serializing_if = "Option::is_none", default)]
37    pub expires_at: Option<i64>,
38    /// The video generation model that produced the job.
39    pub model: VideoModel,
40    /// The object type, which is always `video`.
41    pub object: String,
42    /// Approximate completion percentage for the generation task.
43    pub progress: i64,
44    /// The prompt that was used to generate the video.
45    #[serde(skip_serializing_if = "Option::is_none", default)]
46    pub prompt: Option<String>,
47    /// Identifier of the source video if this video is a remix.
48    #[serde(skip_serializing_if = "Option::is_none", default)]
49    pub remixed_from_video_id: Option<String>,
50    /// Duration of the generated clip in seconds.
51    pub seconds: String,
52    /// The resolution of the generated video.
53    pub size: VideoSize,
54    /// Current lifecycle status of the video job.
55    pub status: VideoStatus,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
60pub struct VideoCreateCharacterParams {
61    /// Display name for this API character.
62    pub name: String,
63    /// Video file used to create a character.
64    pub video: serde_json::Value,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
69pub struct VideoCreateCharacterResponse {
70    /// Identifier for the character creation cameo.
71    #[serde(skip_serializing_if = "Option::is_none", default)]
72    pub id: Option<String>,
73    /// Unix timestamp (in seconds) when the character was created.
74    pub created_at: i64,
75    /// Display name for the character.
76    #[serde(skip_serializing_if = "Option::is_none", default)]
77    pub name: Option<String>,
78}
79
80/// An error that occurred while generating the response.
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
83pub struct VideoCreateError {
84    /// A machine-readable error code that was returned.
85    pub code: String,
86    /// A human-readable description of the error that was returned.
87    pub message: String,
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
92pub struct VideoCreateParams {
93    /// Text prompt that describes the video to generate.
94    pub prompt: String,
95    /// Optional reference asset upload or reference object that guides generation.
96    #[serde(skip_serializing_if = "Option::is_none", default)]
97    pub input_reference: Option<InputReference>,
98    /// The video generation model to use (allowed values: sora-2, sora-2-pro).
99    #[serde(skip_serializing_if = "Option::is_none", default)]
100    pub model: Option<serde_json::Value>,
101    /// Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.
102    #[serde(skip_serializing_if = "Option::is_none", default)]
103    pub seconds: Option<VideoSeconds>,
104    /// Output resolution formatted as width x height (allowed values: 720x1280,
105    #[serde(skip_serializing_if = "Option::is_none", default)]
106    pub size: Option<VideoSize>,
107}
108
109pub type InputReference = serde_json::Value;
110
111/// Confirmation payload returned after deleting a video.
112#[derive(Debug, Clone, Serialize, Deserialize)]
113#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
114pub struct VideoDeleteResponse {
115    /// Identifier of the deleted video.
116    pub id: String,
117    /// Indicates that the video resource was deleted.
118    pub deleted: bool,
119    /// The object type that signals the deletion response.
120    pub object: String,
121}
122
123#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
124#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
125#[non_exhaustive]
126pub enum VideoDownloadContentParamsVariant {
127    #[serde(rename = "video")]
128    Video,
129    #[serde(rename = "thumbnail")]
130    Thumbnail,
131    #[serde(rename = "spritesheet")]
132    Spritesheet,
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
137pub struct VideoDownloadContentParams {
138    /// Which downloadable asset to return. Defaults to the MP4 video.
139    #[serde(skip_serializing_if = "Option::is_none", default)]
140    pub variant: Option<VideoDownloadContentParamsVariant>,
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
144#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
145pub struct VideoEditParams {
146    /// Text prompt that describes how to edit the source video.
147    pub prompt: String,
148    /// Reference to the completed video to edit.
149    pub video: Video,
150}
151
152/// Reference to the completed video.
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
155pub struct VideoVideoReferenceInputParam {
156    /// The identifier of the completed video.
157    pub id: String,
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
162pub struct VideoExtendParams {
163    /// Updated text prompt that directs the extension generation.
164    pub prompt: String,
165    /// Length of the newly generated extension segment in seconds (allowed values: 4,
166    pub seconds: VideoSeconds,
167    /// Reference to the completed video to extend.
168    pub video: Video,
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
172#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
173pub struct VideoGetCharacterResponse {
174    /// Identifier for the character creation cameo.
175    #[serde(skip_serializing_if = "Option::is_none", default)]
176    pub id: Option<String>,
177    /// Unix timestamp (in seconds) when the character was created.
178    pub created_at: i64,
179    /// Display name for the character.
180    #[serde(skip_serializing_if = "Option::is_none", default)]
181    pub name: Option<String>,
182}
183
184#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
185#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
186#[non_exhaustive]
187pub enum VideoListParamsOrder {
188    #[serde(rename = "asc")]
189    Asc,
190    #[serde(rename = "desc")]
191    Desc,
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
196pub struct VideoListParams {
197    /// Identifier for the last item from the previous pagination request
198    #[serde(skip_serializing_if = "Option::is_none", default)]
199    pub after: Option<String>,
200    /// Number of items to retrieve
201    #[serde(skip_serializing_if = "Option::is_none", default)]
202    pub limit: Option<i64>,
203    /// Sort order of results by timestamp.
204    #[serde(skip_serializing_if = "Option::is_none", default)]
205    pub order: Option<VideoListParamsOrder>,
206}
207
208#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
209#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
210#[non_exhaustive]
211pub enum VideoModel {
212    #[serde(rename = "sora-2")]
213    Sora2,
214    #[serde(rename = "sora-2-pro")]
215    Sora2Pro,
216    #[serde(rename = "sora-2-2025-10-06")]
217    Sora220251006,
218    #[serde(rename = "sora-2-pro-2025-10-06")]
219    Sora2Pro20251006,
220    #[serde(rename = "sora-2-2025-12-08")]
221    Sora220251208,
222}
223
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
226pub struct VideoRemixParams {
227    /// Updated text prompt that directs the remix generation.
228    pub prompt: String,
229}
230
231#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
232#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
233#[non_exhaustive]
234pub enum VideoSeconds {
235    #[serde(rename = "4")]
236    V4,
237    #[serde(rename = "8")]
238    V8,
239    #[serde(rename = "12")]
240    V12,
241}
242
243#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
244#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
245#[non_exhaustive]
246pub enum VideoSize {
247    #[serde(rename = "720x1280")]
248    V720x1280,
249    #[serde(rename = "1280x720")]
250    V1280x720,
251    #[serde(rename = "1024x1792")]
252    V1024x1792,
253    #[serde(rename = "1792x1024")]
254    V1792x1024,
255}