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

/// PcmAudioFormat : The PCM audio format. Only a 24kHz sample rate is supported.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PcmAudioFormat {
    /// The audio format. Always `audio/pcm`.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
    /// The sample rate of the audio. Always `24000`.
    #[serde(rename = "rate", skip_serializing_if = "Option::is_none")]
    pub rate: Option<Rate>,
}

impl PcmAudioFormat {
    /// The PCM audio format. Only a 24kHz sample rate is supported.
    pub fn new() -> PcmAudioFormat {
        PcmAudioFormat {
            r#type: None,
            rate: None,
        }
    }
}
/// The audio format. Always `audio/pcm`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "audio/pcm")]
    AudioSlashPcm,
}

impl Default for Type {
    fn default() -> Type {
        Self::AudioSlashPcm
    }
}
/// The sample rate of the audio. Always `24000`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Rate {
    #[serde(rename = "24000")]
    Variant24000,
}

impl Default for Rate {
    fn default() -> Rate {
        Self::Variant24000
    }
}

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