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

/// CreateEnvironmentParamOpenaiHosted : Provision an OpenAI-hosted environment from inline configuration or a template.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateEnvironmentParamOpenaiHosted {
    /// The type of the object. Always `openai_hosted`.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(
        rename = "packages",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub packages: Option<Option<models::EnvironmentPackagesParam>>,
    /// Ordered, confidential setup commands. Command bodies are never returned.
    #[serde(
        rename = "setup_commands",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub setup_commands: Option<Option<Vec<models::SetupCommandParam>>>,
    #[serde(
        rename = "network",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub network: Option<Option<models::NetworkPolicyParam>>,
    #[serde(
        rename = "desktop",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub desktop: Option<Option<models::DesktopParam>>,
    /// Environment variables made available to the agent.
    #[serde(rename = "env", skip_serializing_if = "Option::is_none")]
    pub env: Option<std::collections::HashMap<String, String>>,
    /// Directories that contain capabilities exposed to the agent. Defaults to an empty list.
    #[serde(
        rename = "capability_directories",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub capability_directories: Option<Option<Vec<String>>>,
    /// Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.
    #[serde(
        rename = "skills",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub skills: Option<Option<Vec<models::HostedSkillParam>>>,
    /// Plugins provided as inline ZIP archives. Defaults to an empty list.
    #[serde(
        rename = "plugins",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub plugins: Option<Option<Vec<models::HostedPluginParamInline>>>,
    /// Files available before the agent starts. Defaults to an empty list.
    #[serde(
        rename = "files",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub files: Option<Option<Vec<models::HostedEnvironmentFileParam>>>,
    /// A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.
    #[serde(
        rename = "environment_template_id",
        skip_serializing_if = "Option::is_none"
    )]
    pub environment_template_id: Option<String>,
}

impl CreateEnvironmentParamOpenaiHosted {
    /// Provision an OpenAI-hosted environment from inline configuration or a template.
    pub fn new(r#type: Type) -> CreateEnvironmentParamOpenaiHosted {
        CreateEnvironmentParamOpenaiHosted {
            r#type,
            packages: None,
            setup_commands: None,
            network: None,
            desktop: None,
            env: None,
            capability_directories: None,
            skills: None,
            plugins: None,
            files: None,
            environment_template_id: None,
        }
    }
}
/// 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 CreateEnvironmentParamOpenaiHosted {
    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),
        }
    }
}