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

/// SessionEventAgentSessionTurnInProgress : Emitted when a turn starts running.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct SessionEventAgentSessionTurnInProgress {
    /// The type of the object. Always `agent.session.turn.in_progress`.
    #[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.
    #[serde(rename = "turn_id")]
    pub turn_id: String,
    #[serde(rename = "turn")]
    pub turn: models::TurnResource,
}

impl SessionEventAgentSessionTurnInProgress {
    /// Emitted when a turn starts running.
    pub fn new(
        r#type: Type,
        event_id: String,
        session_id: String,
        turn_id: String,
        turn: models::TurnResource,
    ) -> SessionEventAgentSessionTurnInProgress {
        SessionEventAgentSessionTurnInProgress {
            r#type,
            event_id,
            session_id,
            turn_id,
            turn,
        }
    }
}
/// The type of the object. Always `agent.session.turn.in_progress`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "agent.session.turn.in_progress")]
    AgentSessionTurnInProgress,
}

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

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