async-openai 0.34.0

Rust library for OpenAI
Documentation
use crate::{config::Config, Client, RequestOptions};

use super::{Speech, Transcriptions, Translations, VoiceConsents, Voices};

/// Turn audio into text or text into audio.
/// Related guide: [Speech to text](https://platform.openai.com/docs/guides/speech-to-text)
pub struct Audio<'c, C: Config> {
    client: &'c Client<C>,
    pub(crate) request_options: RequestOptions,
}

impl<'c, C: Config> Audio<'c, C> {
    pub fn new(client: &'c Client<C>) -> Self {
        Self {
            client,
            request_options: RequestOptions::new(),
        }
    }

    /// APIs in Speech group.
    pub fn speech(&self) -> Speech<'_, C> {
        Speech::new(self.client)
    }

    /// APIs in Transcription group.
    pub fn transcription(&self) -> Transcriptions<'_, C> {
        Transcriptions::new(self.client)
    }

    /// APIs in Translation group.
    pub fn translation(&self) -> Translations<'_, C> {
        Translations::new(self.client)
    }

    /// APIs in Voice Consents group.
    pub fn voice_consents(&self) -> VoiceConsents<'_, C> {
        VoiceConsents::new(self.client)
    }

    /// APIs in Voices group.
    pub fn voices(&self) -> Voices<'_, C> {
        Voices::new(self.client)
    }
}