openai-client-base 0.16.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// EnvironmentFileResource : A live file in an execution environment.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct EnvironmentFileResource {
    /// The object type. Always `agent.environment.file`.
    #[serde(rename = "object")]
    pub object: Object,
    /// The ID of the environment containing this file.
    #[serde(rename = "environment_id")]
    pub environment_id: String,
    /// The absolute file path inside the environment's workspace.
    #[serde(rename = "path")]
    pub path: String,
    /// The file size in bytes.
    #[serde(rename = "size_bytes")]
    pub size_bytes: i64,
}

impl EnvironmentFileResource {
    /// A live file in an execution environment.
    pub fn new(
        object: Object,
        environment_id: String,
        path: String,
        size_bytes: i64,
    ) -> EnvironmentFileResource {
        EnvironmentFileResource {
            object,
            environment_id,
            path,
            size_bytes,
        }
    }
}
/// The object type. Always `agent.environment.file`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "agent.environment.file")]
    AgentEnvironmentFile,
}

impl Default for Object {
    fn default() -> Object {
        Self::AgentEnvironmentFile
    }
}

impl std::fmt::Display for EnvironmentFileResource {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}