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

/// EnvironmentResourceOpenaiHosted : An environment hosted by OpenAI.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct EnvironmentResourceOpenaiHosted {
    /// The type of the object. Always `openai_hosted`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The public ID of the environment.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(
        rename = "container_size",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub container_size: Option<Option<models::ContainerSizeResource>>,
    #[serde(rename = "packages")]
    pub packages: models::EnvironmentPackagesResource,
    #[serde(rename = "network")]
    pub network: models::NetworkPolicyResource,
    #[serde(rename = "desktop")]
    pub desktop: models::DesktopResource,
    /// Directories that contain capabilities exposed to the agent.
    #[serde(rename = "capability_directories")]
    pub capability_directories: Vec<String>,
    /// Skills installed in the environment, excluding their archive contents.
    #[serde(rename = "skills")]
    pub skills: Vec<models::HostedSkillResource>,
    /// Plugins installed in the environment, excluding their archive contents.
    #[serde(rename = "plugins")]
    pub plugins: Vec<models::HostedPluginResourceInline>,
    /// Files available in the environment, excluding their contents.
    #[serde(rename = "files")]
    pub files: Vec<models::HostedEnvironmentFileResource>,
}

impl EnvironmentResourceOpenaiHosted {
    /// An environment hosted by OpenAI.
    pub fn new(
        r#type: Type,
        id: String,
        packages: models::EnvironmentPackagesResource,
        network: models::NetworkPolicyResource,
        desktop: models::DesktopResource,
        capability_directories: Vec<String>,
        skills: Vec<models::HostedSkillResource>,
        plugins: Vec<models::HostedPluginResourceInline>,
        files: Vec<models::HostedEnvironmentFileResource>,
    ) -> EnvironmentResourceOpenaiHosted {
        EnvironmentResourceOpenaiHosted {
            r#type,
            id,
            container_size: None,
            packages,
            network,
            desktop,
            capability_directories,
            skills,
            plugins,
            files,
        }
    }
}
/// The type of the object. Always `openai_hosted`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "openai_hosted")]
    OpenaiHosted,
}

impl Default for Type {
    fn default() -> Type {
        Self::OpenaiHosted
    }
}

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