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

/// BetaResponseConfigurationUpdateItemParam : An update to the conversation's response configuration. The configuration remains in effect for subsequent responses until it is replaced by another configuration update.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaResponseConfigurationUpdateItemParam {
    #[serde(
        rename = "agent",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub agent: Option<Option<Box<models::BetaAgentTagParam>>>,
    /// The unique ID of the configuration update item.
    #[serde(
        rename = "id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub id: Option<Option<String>>,
    /// The item type. Always `configuration_update`.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "reasoning", skip_serializing_if = "Option::is_none")]
    pub reasoning: Option<Box<models::BetaResponseConfigurationUpdateItemParamReasoning>>,
}

impl BetaResponseConfigurationUpdateItemParam {
    /// An update to the conversation's response configuration. The configuration remains in effect for subsequent responses until it is replaced by another configuration update.
    pub fn new(r#type: Type) -> BetaResponseConfigurationUpdateItemParam {
        BetaResponseConfigurationUpdateItemParam {
            agent: None,
            id: None,
            r#type,
            reasoning: None,
        }
    }
}
/// The item type. Always `configuration_update`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "configuration_update")]
    ConfigurationUpdate,
}

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

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