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

/// SessionEventAgentSessionTurnOutputTextDone : Emitted when an output text content part is complete.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct SessionEventAgentSessionTurnOutputTextDone {
    /// The type of the object. Always `agent.session.turn.output_text.done`.
    #[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>,
    /// The ID of the message item.
    #[serde(rename = "item_id")]
    pub item_id: String,
    /// The index of the item in the turn output.
    #[serde(rename = "output_index")]
    pub output_index: i64,
    /// The index of the content part in the message.
    #[serde(rename = "content_index")]
    pub content_index: i64,
    /// The complete output text.
    #[serde(rename = "text")]
    pub text: String,
}

impl SessionEventAgentSessionTurnOutputTextDone {
    /// Emitted when an output text content part is complete.
    pub fn new(
        r#type: Type,
        event_id: String,
        session_id: String,
        turn_id: Option<String>,
        item_id: String,
        output_index: i64,
        content_index: i64,
        text: String,
    ) -> SessionEventAgentSessionTurnOutputTextDone {
        SessionEventAgentSessionTurnOutputTextDone {
            r#type,
            event_id,
            session_id,
            turn_id,
            item_id,
            output_index,
            content_index,
            text,
        }
    }
}
/// The type of the object. Always `agent.session.turn.output_text.done`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "agent.session.turn.output_text.done")]
    AgentSessionTurnOutputTextDone,
}

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

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