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};

/// PublicEnvironmentResource : Safe metadata for a first-class execution environment.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PublicEnvironmentResource {
    #[serde(rename = "type")]
    pub r#type: models::EnvironmentTypeResource,
    /// The ID of the environment.
    #[serde(rename = "id")]
    pub id: String,
    /// The object type. Always `agent.environment`.
    #[serde(rename = "object")]
    pub object: Object,
    #[serde(rename = "status")]
    pub status: models::EnvironmentStatusResource,
    /// Files installed in the environment, without their contents.
    #[serde(rename = "files")]
    pub files: Vec<models::HostedEnvironmentFileResource>,
    /// Skills installed in the environment, without their archive contents.
    #[serde(rename = "skills")]
    pub skills: Vec<models::HostedSkillResource>,
    /// Plugins installed in the environment, without their archive contents.
    #[serde(rename = "plugins")]
    pub plugins: Vec<models::HostedPluginResourceInline>,
}

impl PublicEnvironmentResource {
    /// Safe metadata for a first-class execution environment.
    pub fn new(
        r#type: models::EnvironmentTypeResource,
        id: String,
        object: Object,
        status: models::EnvironmentStatusResource,
        files: Vec<models::HostedEnvironmentFileResource>,
        skills: Vec<models::HostedSkillResource>,
        plugins: Vec<models::HostedPluginResourceInline>,
    ) -> PublicEnvironmentResource {
        PublicEnvironmentResource {
            r#type,
            id,
            object,
            status,
            files,
            skills,
            plugins,
        }
    }
}
/// The object type. Always `agent.environment`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "agent.environment")]
    AgentEnvironment,
}

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

impl std::fmt::Display for PublicEnvironmentResource {
    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),
        }
    }
}