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

/// ProjectSpendLimitResource : Represents a hard spend limit configured at the project level.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ProjectSpendLimitResource {
    /// The object type, which is always `project.spend_limit`.
    #[serde(rename = "object")]
    pub object: Object,
    /// The hard spend limit amount, in cents.
    #[serde(rename = "threshold_amount")]
    pub threshold_amount: i32,
    #[serde(rename = "currency")]
    pub currency: Box<models::SpendLimitCurrency>,
    #[serde(rename = "interval")]
    pub interval: Box<models::SpendLimitInterval>,
    #[serde(rename = "enforcement")]
    pub enforcement: Box<models::SpendLimitEnforcement>,
}

impl ProjectSpendLimitResource {
    /// Represents a hard spend limit configured at the project level.
    pub fn new(
        object: Object,
        threshold_amount: i32,
        currency: models::SpendLimitCurrency,
        interval: models::SpendLimitInterval,
        enforcement: models::SpendLimitEnforcement,
    ) -> ProjectSpendLimitResource {
        ProjectSpendLimitResource {
            object,
            threshold_amount,
            currency: Box::new(currency),
            interval: Box::new(interval),
            enforcement: Box::new(enforcement),
        }
    }
}
/// The object type, which is always `project.spend_limit`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "project.spend_limit")]
    ProjectSpendLimit,
}

impl Default for Object {
    fn default() -> Object {
        Self::ProjectSpendLimit
    }
}

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