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

/// RealtimeMcpListTools : A Realtime item listing tools available on an MCP server.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct RealtimeMcpListTools {
    /// The type of the item. Always `mcp_list_tools`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the list.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The label of the MCP server.
    #[serde(rename = "server_label")]
    pub server_label: String,
    /// The tools available on the server.
    #[serde(rename = "tools")]
    pub tools: Vec<models::McpListToolsTool>,
}

impl RealtimeMcpListTools {
    /// A Realtime item listing tools available on an MCP server.
    pub fn new(
        r#type: Type,
        server_label: String,
        tools: Vec<models::McpListToolsTool>,
    ) -> RealtimeMcpListTools {
        RealtimeMcpListTools {
            r#type,
            id: None,
            server_label,
            tools,
        }
    }
}
/// The type of the item. Always `mcp_list_tools`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "mcp_list_tools")]
    McpListTools,
}

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

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