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

/// LiveSipTransport : Place an outbound SIP call using your provider's trunk. Outbound SIP calling must be enabled for your organization. The trunk must support TLS signaling, Opus audio, and SDES-SRTP media. See [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveSipTransport {
    /// The transport used for the Live session. Always `sip`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Phone number to call in E.164 format. SIP URI destinations are not supported.
    #[serde(rename = "destination")]
    pub destination: String,
    #[serde(rename = "trunk")]
    pub trunk: models::LiveSipTrunk,
}

impl LiveSipTransport {
    /// Place an outbound SIP call using your provider's trunk. Outbound SIP calling must be enabled for your organization. The trunk must support TLS signaling, Opus audio, and SDES-SRTP media. See [Telephony and SIP](https://developers.openai.com/api/docs/guides/voice-sip?api=live#place-an-outbound-call).
    pub fn new(r#type: Type, destination: String, trunk: models::LiveSipTrunk) -> LiveSipTransport {
        LiveSipTransport {
            r#type,
            destination,
            trunk,
        }
    }
}
/// The transport used for the Live session. Always `sip`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "sip")]
    Sip,
}

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

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