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

/// SessionEventAgentSessionEnvironmentPending : Emitted while a session environment is being prepared.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct SessionEventAgentSessionEnvironmentPending {
    /// The type of the object. Always `agent.session.environment.pending`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the event.
    #[serde(rename = "event_id")]
    pub event_id: String,
    /// The ID of the session associated with the event.
    #[serde(rename = "session_id")]
    pub session_id: String,
    /// The ID of the turn associated with the event, when applicable.
    #[serde(rename = "turn_id", deserialize_with = "Option::deserialize")]
    pub turn_id: Option<String>,
    #[serde(rename = "environment")]
    pub environment: models::SessionEnvironmentStateResource,
}

impl SessionEventAgentSessionEnvironmentPending {
    /// Emitted while a session environment is being prepared.
    pub fn new(
        r#type: Type,
        event_id: String,
        session_id: String,
        turn_id: Option<String>,
        environment: models::SessionEnvironmentStateResource,
    ) -> SessionEventAgentSessionEnvironmentPending {
        SessionEventAgentSessionEnvironmentPending {
            r#type,
            event_id,
            session_id,
            turn_id,
            environment,
        }
    }
}
/// The type of the object. Always `agent.session.environment.pending`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "agent.session.environment.pending")]
    AgentSessionEnvironmentPending,
}

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

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