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

/// CreateEnvironmentTemplateParams : Parameters for creating a reusable, project-scoped OpenAI-hosted environment template.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateEnvironmentTemplateParams {
    #[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>>>,
    /// An optional human-readable display name for the template.
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
}

impl CreateEnvironmentTemplateParams {
    /// Parameters for creating a reusable, project-scoped OpenAI-hosted environment template.
    pub fn new() -> CreateEnvironmentTemplateParams {
        CreateEnvironmentTemplateParams {
            packages: None,
            setup_commands: None,
            network: None,
            desktop: None,
            env: None,
            capability_directories: None,
            skills: None,
            plugins: None,
            files: None,
            name: None,
        }
    }
}

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