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

/// BetaResponseShellCallOutputContentWsDone : A streaming event that indicated shell call output was completed.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaResponseShellCallOutputContentWsDone {
    /// The type of the event, always `response.shell_call_output_content.done`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The sequence number of the event that was emitted.
    #[serde(rename = "sequence_number")]
    pub sequence_number: i32,
    #[serde(rename = "agent", skip_serializing_if = "Option::is_none")]
    pub agent: Option<Box<models::BetaAgentTag>>,
    /// The ID of the output item that was updated.
    #[serde(rename = "item_id")]
    pub item_id: String,
    /// The index of the output item that was updated.
    #[serde(rename = "output_index")]
    pub output_index: i32,
    /// The index of the shell command that produced output.
    #[serde(rename = "command_index")]
    pub command_index: i32,
    /// The output contents emitted for the shell command.
    #[serde(rename = "output")]
    pub output: Vec<models::BetaFunctionShellCallOutputContent>,
    /// The WebSocket lane that emitted this event. This field is present when the originating `response.create` event supplied a `stream_id`.
    #[serde(rename = "stream_id", skip_serializing_if = "Option::is_none")]
    pub stream_id: Option<String>,
}

impl BetaResponseShellCallOutputContentWsDone {
    /// A streaming event that indicated shell call output was completed.
    pub fn new(
        r#type: Type,
        sequence_number: i32,
        item_id: String,
        output_index: i32,
        command_index: i32,
        output: Vec<models::BetaFunctionShellCallOutputContent>,
    ) -> BetaResponseShellCallOutputContentWsDone {
        BetaResponseShellCallOutputContentWsDone {
            r#type,
            sequence_number,
            agent: None,
            item_id,
            output_index,
            command_index,
            output,
            stream_id: None,
        }
    }
}
/// The type of the event, always `response.shell_call_output_content.done`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "response.shell_call_output_content.done")]
    ResponseShellCallOutputContentDone,
}

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

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