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

/// VaultCredentialAuthResourceMcpOauth : Public metadata for an OAuth credential; tokens and client secrets are never returned.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct VaultCredentialAuthResourceMcpOauth {
    /// The type of the object. Always `mcp_oauth`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The HTTPS MCP server URL authorized by this credential.
    #[serde(rename = "mcp_server_url")]
    pub mcp_server_url: String,
    /// When the OAuth access token expires, as an RFC 3339 timestamp, if known.
    #[serde(rename = "expires_at", deserialize_with = "Option::deserialize")]
    pub expires_at: Option<String>,
    #[serde(rename = "refresh", deserialize_with = "Option::deserialize")]
    pub refresh: Option<models::McpOauthRefreshResource>,
}

impl VaultCredentialAuthResourceMcpOauth {
    /// Public metadata for an OAuth credential; tokens and client secrets are never returned.
    pub fn new(
        r#type: Type,
        mcp_server_url: String,
        expires_at: Option<String>,
        refresh: Option<models::McpOauthRefreshResource>,
    ) -> VaultCredentialAuthResourceMcpOauth {
        VaultCredentialAuthResourceMcpOauth {
            r#type,
            mcp_server_url,
            expires_at,
            refresh,
        }
    }
}
/// The type of the object. Always `mcp_oauth`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "mcp_oauth")]
    McpOauth,
}

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

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