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

/// InlineCapabilitySourceParamBase64 : Provides ZIP bytes encoded with standard base64.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct InlineCapabilitySourceParamBase64 {
    /// The type of the object. Always `base64`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The archive media type, always `application/zip`.
    #[serde(rename = "media_type")]
    pub media_type: MediaType,
    /// Standard-base64 encoded ZIP archive bytes.
    #[serde(rename = "data")]
    pub data: String,
}

impl InlineCapabilitySourceParamBase64 {
    /// Provides ZIP bytes encoded with standard base64.
    pub fn new(
        r#type: Type,
        media_type: MediaType,
        data: String,
    ) -> InlineCapabilitySourceParamBase64 {
        InlineCapabilitySourceParamBase64 {
            r#type,
            media_type,
            data,
        }
    }
}
/// The type of the object. Always `base64`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "base64")]
    Base64,
}

impl Default for Type {
    fn default() -> Type {
        Self::Base64
    }
}
/// The archive media type, always `application/zip`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MediaType {
    #[serde(rename = "application/zip")]
    ApplicationSlashZip,
}

impl Default for MediaType {
    fn default() -> MediaType {
        Self::ApplicationSlashZip
    }
}

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