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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CertificateCertificateDetails {
    /// The Unix timestamp (in seconds) of when the certificate becomes valid.
    #[serde(rename = "valid_at", skip_serializing_if = "Option::is_none")]
    pub valid_at: Option<i32>,
    /// The Unix timestamp (in seconds) of when the certificate expires.
    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<i32>,
    /// The content of the certificate in PEM format.
    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
    pub content: Option<String>,
}

impl CertificateCertificateDetails {
    pub fn new() -> CertificateCertificateDetails {
        CertificateCertificateDetails {
            valid_at: None,
            expires_at: None,
            content: None,
        }
    }
}

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