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

/// LiveDataChannelConfigParam : Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveDataChannelConfigParam {
    #[serde(
        rename = "allowed_client_events",
        skip_serializing_if = "Option::is_none"
    )]
    pub allowed_client_events: Option<Box<models::LiveDataChannelConfigParamAllowedClientEvents>>,
    #[serde(
        rename = "allowed_server_events",
        skip_serializing_if = "Option::is_none"
    )]
    pub allowed_server_events: Option<Box<models::LiveDataChannelConfigParamAllowedServerEvents>>,
}

impl LiveDataChannelConfigParam {
    /// Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections.
    pub fn new() -> LiveDataChannelConfigParam {
        LiveDataChannelConfigParam {
            allowed_client_events: None,
            allowed_server_events: None,
        }
    }
}

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