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

/// CreateAgentEnvironmentParams : Parameters for creating an execution environment before its sessions.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateAgentEnvironmentParams {
    #[serde(rename = "environment")]
    pub environment: models::CreateEnvironmentParamOpenaiHosted,
    /// The IDs of up to 10 vaults made available to an OpenAI-hosted environment.
    #[serde(
        rename = "vault_ids",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub vault_ids: Option<Option<Vec<String>>>,
}

impl CreateAgentEnvironmentParams {
    /// Parameters for creating an execution environment before its sessions.
    pub fn new(
        environment: models::CreateEnvironmentParamOpenaiHosted,
    ) -> CreateAgentEnvironmentParams {
        CreateAgentEnvironmentParams {
            environment,
            vault_ids: None,
        }
    }
}

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