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

/// PersistedAgentToolResourceMcp : Tools provided by a remote MCP server without stored credentials.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PersistedAgentToolResourceMcp {
    /// The type of the object. Always `mcp`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// A label used to identify the MCP server in tool calls.
    #[serde(rename = "server_label")]
    pub server_label: String,
    /// The vault credential selected for this MCP server, if any.
    #[serde(rename = "credential_id")]
    pub credential_id: String,
    #[serde(rename = "transport")]
    pub transport: Box<models::PersistedMcpTransportResource>,
    /// Metadata included with requests to this MCP server.
    #[serde(rename = "request_metadata")]
    pub request_metadata: std::collections::HashMap<String, serde_json::Value>,
    /// The MCP tools the agent may call, or null when all server tools are allowed.
    #[serde(rename = "allowed_tools")]
    pub allowed_tools: Vec<String>,
    /// Whether this MCP server must initialize before the first turn.
    #[serde(rename = "required")]
    pub required: bool,
    #[serde(rename = "connection_origin")]
    pub connection_origin: models::McpConnectionOriginResource,
}

impl PersistedAgentToolResourceMcp {
    /// Tools provided by a remote MCP server without stored credentials.
    pub fn new(
        r#type: Type,
        server_label: String,
        credential_id: String,
        transport: models::PersistedMcpTransportResource,
        request_metadata: std::collections::HashMap<String, serde_json::Value>,
        allowed_tools: Vec<String>,
        required: bool,
        connection_origin: models::McpConnectionOriginResource,
    ) -> PersistedAgentToolResourceMcp {
        PersistedAgentToolResourceMcp {
            r#type,
            server_label,
            credential_id,
            transport: Box::new(transport),
            request_metadata,
            allowed_tools,
            required,
            connection_origin,
        }
    }
}
/// The type of the object. Always `mcp`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "mcp")]
    Mcp,
}

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

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