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

/// WebhookRealtimeCallIncomingData : Event data payload.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct WebhookRealtimeCallIncomingData {
    /// The ID of the pending SIP call. Pass this value unchanged when accepting or rejecting the call through the Realtime API. For the Live API, use the `session_id` from `live.transport.incoming` instead.
    #[serde(rename = "call_id")]
    pub call_id: String,
    #[serde(rename = "sip_media_security", skip_serializing_if = "Option::is_none")]
    pub sip_media_security: Option<Box<models::WebhookLiveCallIncomingDataSipMediaSecurity>>,
    /// Headers from the SIP INVITE, excluding SIP authorization headers. Retained names, values, repeated entries, and order are preserved. Treat these values as untrusted call metadata.
    #[serde(rename = "sip_headers")]
    pub sip_headers: Vec<models::WebhookLiveCallIncomingDataSipHeadersInner>,
}

impl WebhookRealtimeCallIncomingData {
    /// Event data payload.
    pub fn new(
        call_id: String,
        sip_headers: Vec<models::WebhookLiveCallIncomingDataSipHeadersInner>,
    ) -> WebhookRealtimeCallIncomingData {
        WebhookRealtimeCallIncomingData {
            call_id,
            sip_media_security: None,
            sip_headers,
        }
    }
}

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