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: containers

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileCreateParams {
    /// The File object (not file name) to be uploaded.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file: Option<serde_json::Value>,
    /// Name of the file to create.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileCreateResponse {
    /// Unique identifier for the file.
    pub id: String,
    /// Size of the file in bytes.
    pub bytes: i64,
    /// The container this file belongs to.
    pub container_id: String,
    /// Unix timestamp (in seconds) when the file was created.
    pub created_at: i64,
    /// The type of this object (`container.file`).
    pub object: String,
    /// Path of the file in the container.
    pub path: String,
    /// Source of the file (e.g., `user`, `assistant`).
    pub source: String,
}

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

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileListParams {
    /// A cursor for use in pagination.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub after: Option<String>,
    /// A limit on the number of objects to be returned.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub limit: Option<i64>,
    /// Sort order by the `created_at` timestamp of the objects.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub order: Option<FileListParamsOrder>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileListResponse {
    /// Unique identifier for the file.
    pub id: String,
    /// Size of the file in bytes.
    pub bytes: i64,
    /// The container this file belongs to.
    pub container_id: String,
    /// Unix timestamp (in seconds) when the file was created.
    pub created_at: i64,
    /// The type of this object (`container.file`).
    pub object: String,
    /// Path of the file in the container.
    pub path: String,
    /// Source of the file (e.g., `user`, `assistant`).
    pub source: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileRetrieveResponse {
    /// Unique identifier for the file.
    pub id: String,
    /// Size of the file in bytes.
    pub bytes: i64,
    /// The container this file belongs to.
    pub container_id: String,
    /// Unix timestamp (in seconds) when the file was created.
    pub created_at: i64,
    /// The type of this object (`container.file`).
    pub object: String,
    /// Path of the file in the container.
    pub path: String,
    /// Source of the file (e.g., `user`, `assistant`).
    pub source: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ContainerCreateParamsMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerCreateParams {
    /// Name of the container to create.
    pub name: String,
    /// Container expiration time in seconds relative to the 'anchor' time.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_after: Option<ExpiresAfter>,
    /// IDs of files to copy to the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_ids: Option<serde_json::Value>,
    /// Optional memory limit for the container. Defaults to "1g".
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<ContainerCreateParamsMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<NetworkPolicy>,
    /// An optional list of skills referenced by id or inline data.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub skills: Option<Vec<Skill>>,
}

/// Container expiration time in seconds relative to the 'anchor' time.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ExpiresAfter {
    /// Time anchor for the expiration time.
    pub anchor: String,
    pub minutes: i64,
}

pub type NetworkPolicy = serde_json::Value;

pub type Skill = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum NetworkPolicyType {
    #[serde(rename = "allowlist")]
    Allowlist,
    #[serde(rename = "disabled")]
    Disabled,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ContainerCreateResponseMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerCreateResponse {
    /// Unique identifier for the container.
    pub id: String,
    /// Unix timestamp (in seconds) when the container was created.
    pub created_at: i64,
    /// Name of the container.
    pub name: String,
    /// The type of this object.
    pub object: String,
    /// Status of the container (e.g., active, deleted).
    pub status: String,
    /// The container will expire after this time period. The anchor is the reference
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_after: Option<ExpiresAfter>,
    /// Unix timestamp (in seconds) when the container was last active.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub last_active_at: Option<i64>,
    /// The memory limit configured for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<ContainerCreateResponseMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<NetworkPolicy>,
}

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

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerListParams {
    /// A cursor for use in pagination.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub after: Option<String>,
    /// A limit on the number of objects to be returned.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub limit: Option<i64>,
    /// Filter results by container name.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
    /// Sort order by the `created_at` timestamp of the objects.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub order: Option<ContainerListParamsOrder>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ContainerListResponseMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerListResponse {
    /// Unique identifier for the container.
    pub id: String,
    /// Unix timestamp (in seconds) when the container was created.
    pub created_at: i64,
    /// Name of the container.
    pub name: String,
    /// The type of this object.
    pub object: String,
    /// Status of the container (e.g., active, deleted).
    pub status: String,
    /// The container will expire after this time period. The anchor is the reference
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_after: Option<ExpiresAfter>,
    /// Unix timestamp (in seconds) when the container was last active.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub last_active_at: Option<i64>,
    /// The memory limit configured for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<ContainerListResponseMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<NetworkPolicy>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ContainerRetrieveResponseMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerRetrieveResponse {
    /// Unique identifier for the container.
    pub id: String,
    /// Unix timestamp (in seconds) when the container was created.
    pub created_at: i64,
    /// Name of the container.
    pub name: String,
    /// The type of this object.
    pub object: String,
    /// Status of the container (e.g., active, deleted).
    pub status: String,
    /// The container will expire after this time period. The anchor is the reference
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_after: Option<ExpiresAfter>,
    /// Unix timestamp (in seconds) when the container was last active.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub last_active_at: Option<i64>,
    /// The memory limit configured for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<ContainerRetrieveResponseMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<NetworkPolicy>,
}