Skip to main content

openai_types/uploads/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: uploads
4#![allow(unused_imports)]
5
6use serde::{Deserialize, Serialize};
7use super::*;
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
11pub struct PartCreateParams {
12    /// The chunk of bytes for this Part.
13    pub data: serde_json::Value,
14}
15
16/// The upload Part represents a chunk of bytes we can add to an Upload object.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
19pub struct UploadPart {
20    /// The upload Part unique identifier, which can be referenced in API endpoints.
21    pub id: String,
22    /// The Unix timestamp (in seconds) for when the Part was created.
23    pub created_at: i64,
24    /// The object type, which is always `upload.part`.
25    pub object: String,
26    /// The ID of the Upload object that this Part was added to.
27    pub upload_id: String,
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
32pub struct UploadCompleteParams {
33    /// The ordered list of Part IDs.
34    pub part_ids: serde_json::Value,
35    /// The optional md5 checksum for the file contents to verify if the bytes uploaded
36    #[serde(skip_serializing_if = "Option::is_none", default)]
37    pub md5: Option<String>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
42pub struct UploadCreateParams {
43    /// The number of bytes in the file you are uploading.
44    pub bytes: i64,
45    /// The name of the file to upload.
46    pub filename: String,
47    /// The MIME type of the file.
48    pub mime_type: String,
49    /// The intended purpose of the uploaded file.
50    pub purpose: serde_json::Value,
51    /// The expiration policy for a file.
52    #[serde(skip_serializing_if = "Option::is_none", default)]
53    pub expires_after: Option<ExpiresAfter>,
54}
55
56/// The expiration policy for a file.
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
59pub struct ExpiresAfter {
60    /// Anchor timestamp after which the expiration policy applies.
61    pub anchor: String,
62    /// The number of seconds after the anchor time that the file will expire.
63    pub seconds: i64,
64}