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

/// ApplyPatchToolCallOutputItemParam : The streamed output emitted by an apply patch tool call.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ApplyPatchToolCallOutputItemParam {
    /// The type of the item. Always `apply_patch_call_output`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the apply patch tool call output. Populated when this item is returned via API.
    #[serde(
        rename = "id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub id: Option<Option<String>>,
    /// The unique ID of the apply patch tool call generated by the model.
    #[serde(rename = "call_id")]
    pub call_id: String,
    #[serde(rename = "status")]
    pub status: models::ApplyPatchCallOutputStatusParam,
    /// Optional human-readable log text from the apply patch tool (e.g., patch results or errors).
    #[serde(
        rename = "output",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub output: Option<Option<String>>,
}

impl ApplyPatchToolCallOutputItemParam {
    /// The streamed output emitted by an apply patch tool call.
    pub fn new(
        r#type: Type,
        call_id: String,
        status: models::ApplyPatchCallOutputStatusParam,
    ) -> ApplyPatchToolCallOutputItemParam {
        ApplyPatchToolCallOutputItemParam {
            r#type,
            id: None,
            call_id,
            status,
            output: None,
        }
    }
}
/// The type of the item. Always `apply_patch_call_output`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "apply_patch_call_output")]
    ApplyPatchCallOutput,
}

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

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