openai-client-base 0.12.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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ContainerAutoParam {
    /// Automatically creates a container for this request
    #[serde(rename = "type")]
    pub r#type: Type,
    /// An optional list of uploaded files to make available to your code.
    #[serde(rename = "file_ids", skip_serializing_if = "Option::is_none")]
    pub file_ids: Option<Vec<String>>,
    #[serde(
        rename = "memory_limit",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub memory_limit: Option<Option<models::ContainerMemoryLimit>>,
    #[serde(rename = "network_policy", skip_serializing_if = "Option::is_none")]
    pub network_policy: Option<Box<models::CreateContainerBodyNetworkPolicy>>,
    /// An optional list of skills referenced by id or inline data.
    #[serde(rename = "skills", skip_serializing_if = "Option::is_none")]
    pub skills: Option<Vec<models::CreateContainerBodySkillsInner>>,
}

impl ContainerAutoParam {
    pub fn new(r#type: Type) -> ContainerAutoParam {
        ContainerAutoParam {
            r#type,
            file_ids: None,
            memory_limit: None,
            network_policy: None,
            skills: None,
        }
    }
}
/// Automatically creates a container for this request
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "container_auto")]
    ContainerAuto,
}

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

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