openai-client-base 0.12.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};

/// UsageVectorStoresResult : The aggregated vector stores usage details of the specific time bucket.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UsageVectorStoresResult {
    #[serde(rename = "object")]
    pub object: Object,
    /// The vector stores usage in bytes.
    #[serde(rename = "usage_bytes")]
    pub usage_bytes: i32,
    /// When `group_by=project_id`, this field provides the project ID of the grouped usage result.
    #[serde(
        rename = "project_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub project_id: Option<Option<String>>,
}

impl UsageVectorStoresResult {
    /// The aggregated vector stores usage details of the specific time bucket.
    pub fn new(object: Object, usage_bytes: i32) -> UsageVectorStoresResult {
        UsageVectorStoresResult {
            object,
            usage_bytes,
            project_id: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "organization.usage.vector_stores.result")]
    OrganizationUsageVectorStoresResult,
}

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

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