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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ImageGenToolCallModerationDetails {
    /// The stage where moderation blocked the image generation call.
    #[serde(rename = "moderation_stage")]
    pub moderation_stage: ModerationStage,
    /// Public moderation categories. New category values may be added over time.
    #[serde(rename = "categories")]
    pub categories: Vec<String>,
}

impl ImageGenToolCallModerationDetails {
    pub fn new(
        moderation_stage: ModerationStage,
        categories: Vec<String>,
    ) -> ImageGenToolCallModerationDetails {
        ImageGenToolCallModerationDetails {
            moderation_stage,
            categories,
        }
    }
}
/// The stage where moderation blocked the image generation call.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ModerationStage {
    #[serde(rename = "input")]
    Input,
    #[serde(rename = "output")]
    Output,
    #[serde(rename = "unknown")]
    Unknown,
}

impl Default for ModerationStage {
    fn default() -> ModerationStage {
        Self::Input
    }
}

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