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

/// BetaResponseSteerFailedEventError : Information about why the input could not be committed.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaResponseSteerFailedEventError {
    /// The error type. Always `invalid_request_error`.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "code")]
    pub code: Box<models::BetaResponseSteerErrorCode>,
    /// A human-readable description of the error.
    #[serde(rename = "message")]
    pub message: String,
}

impl BetaResponseSteerFailedEventError {
    /// Information about why the input could not be committed.
    pub fn new(
        r#type: Type,
        code: models::BetaResponseSteerErrorCode,
        message: String,
    ) -> BetaResponseSteerFailedEventError {
        BetaResponseSteerFailedEventError {
            r#type,
            code: Box::new(code),
            message,
        }
    }
}
/// The error type. Always `invalid_request_error`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "invalid_request_error")]
    InvalidRequestError,
}

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

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