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

/// LocalShellToolCallOutput : The output of a local shell tool call.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LocalShellToolCallOutput {
    /// The type of the local shell tool call output. Always `local_shell_call_output`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the local shell tool call generated by the model.
    #[serde(rename = "id")]
    pub id: String,
    /// A JSON string of the output of the local shell tool call.
    #[serde(rename = "output")]
    pub output: String,
    /// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
    #[serde(
        rename = "status",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub status: Option<Option<Status>>,
}

impl LocalShellToolCallOutput {
    /// The output of a local shell tool call.
    pub fn new(r#type: Type, id: String, output: String) -> LocalShellToolCallOutput {
        LocalShellToolCallOutput {
            r#type,
            id,
            output,
            status: None,
        }
    }
}
/// The type of the local shell tool call output. Always `local_shell_call_output`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "local_shell_call_output")]
    LocalShellCallOutput,
}

impl Default for Type {
    fn default() -> Type {
        Self::LocalShellCallOutput
    }
}
/// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

impl Default for Status {
    fn default() -> Status {
        Self::InProgress
    }
}

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