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

/// ComputerUseApprovalRequestResultItemResource : A credential-free record of an admitted response, not proof of completion.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ComputerUseApprovalRequestResultItemResource {
    /// The stable history item ID.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The ID of the turn that contains this item.
    #[serde(rename = "turn_id")]
    pub turn_id: String,
    /// The registered request answered by this item.
    #[serde(rename = "request_id")]
    pub request_id: String,
    #[serde(rename = "response")]
    pub response: Box<models::ComputerUseApprovalResponseKindResource>,
}

impl ComputerUseApprovalRequestResultItemResource {
    /// A credential-free record of an admitted response, not proof of completion.
    pub fn new(
        id: String,
        r#type: Type,
        turn_id: String,
        request_id: String,
        response: models::ComputerUseApprovalResponseKindResource,
    ) -> ComputerUseApprovalRequestResultItemResource {
        ComputerUseApprovalRequestResultItemResource {
            id,
            r#type,
            turn_id,
            request_id,
            response: Box::new(response),
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "computer_use_approval_request_result")]
    ComputerUseApprovalRequestResult,
}

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

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