openai-client-base 0.12.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};

/// ResponseWebSearchCallCompletedEvent : Emitted when a web search call is completed.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseWebSearchCallCompletedEvent {
    /// The type of the event. Always `response.web_search_call.completed`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The index of the output item that the web search call is associated with.
    #[serde(rename = "output_index")]
    pub output_index: i32,
    /// Unique ID for the output item associated with the web search call.
    #[serde(rename = "item_id")]
    pub item_id: String,
    /// The sequence number of the web search call being processed.
    #[serde(rename = "sequence_number")]
    pub sequence_number: i32,
}

impl ResponseWebSearchCallCompletedEvent {
    /// Emitted when a web search call is completed.
    pub fn new(
        r#type: Type,
        output_index: i32,
        item_id: String,
        sequence_number: i32,
    ) -> ResponseWebSearchCallCompletedEvent {
        ResponseWebSearchCallCompletedEvent {
            r#type,
            output_index,
            item_id,
            sequence_number,
        }
    }
}
/// The type of the event. Always `response.web_search_call.completed`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "response.web_search_call.completed")]
    ResponseWebSearchCallCompleted,
}

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

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