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

/// ResponseSteerAcceptedEvent : Emitted when steering input has been validated and queued. Acceptance means the server owns the input, not that it has been applied. The successor's `response.created` event is the commit point. If accepted input cannot be committed, `response.steer.failed` returns it with the same steering ID.  When the response stops for client-owned tool output or approval, the input remains queued and `response.steer.pending` is emitted after `response.completed`. Fill the pending event's `required_input` stubs with saved results and send one matching explicit `response.create` per parent. Do not resend accepted input while it is still queued.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseSteerAcceptedEvent {
    /// The event discriminator. Always `response.steer.accepted`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The sequence number for this event.
    #[serde(rename = "sequence_number")]
    pub sequence_number: i32,
    #[serde(rename = "steer")]
    pub steer: Box<models::ResponseSteerAcceptedEventSteer>,
    /// The WebSocket lane that emitted this event. This field is present when the target response's `response.create` event supplied a `stream_id`.
    #[serde(rename = "stream_id", skip_serializing_if = "Option::is_none")]
    pub stream_id: Option<String>,
}

impl ResponseSteerAcceptedEvent {
    /// Emitted when steering input has been validated and queued. Acceptance means the server owns the input, not that it has been applied. The successor's `response.created` event is the commit point. If accepted input cannot be committed, `response.steer.failed` returns it with the same steering ID.  When the response stops for client-owned tool output or approval, the input remains queued and `response.steer.pending` is emitted after `response.completed`. Fill the pending event's `required_input` stubs with saved results and send one matching explicit `response.create` per parent. Do not resend accepted input while it is still queued.
    pub fn new(
        r#type: Type,
        sequence_number: i32,
        steer: models::ResponseSteerAcceptedEventSteer,
    ) -> ResponseSteerAcceptedEvent {
        ResponseSteerAcceptedEvent {
            r#type,
            sequence_number,
            steer: Box::new(steer),
            stream_id: None,
        }
    }
}
/// The event discriminator. Always `response.steer.accepted`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "response.steer.accepted")]
    ResponseSteerAccepted,
}

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

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