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

/// LiveResponsesDelegationParam : Delegate tasks to a Responses model managed by the Live session.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveResponsesDelegationParam {
    /// The delegation owner. Always `responses` for tasks handled by the Responses API.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "responses")]
    pub responses: Box<models::LiveResponsesDelegationSettingsInputParam>,
}

impl LiveResponsesDelegationParam {
    /// Delegate tasks to a Responses model managed by the Live session.
    pub fn new(
        r#type: Type,
        responses: models::LiveResponsesDelegationSettingsInputParam,
    ) -> LiveResponsesDelegationParam {
        LiveResponsesDelegationParam {
            r#type,
            responses: Box::new(responses),
        }
    }
}
/// The delegation owner. Always `responses` for tasks handled by the Responses API.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "responses")]
    Responses,
}

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

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