use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UsageFileSearchCallsResult {
#[serde(rename = "object")]
pub object: Object,
#[serde(rename = "num_requests")]
pub num_requests: i32,
#[serde(
rename = "project_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub project_id: Option<Option<String>>,
#[serde(
rename = "user_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub user_id: Option<Option<String>>,
#[serde(
rename = "api_key_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub api_key_id: Option<Option<String>>,
#[serde(
rename = "vector_store_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub vector_store_id: Option<Option<String>>,
}
impl UsageFileSearchCallsResult {
pub fn new(object: Object, num_requests: i32) -> UsageFileSearchCallsResult {
UsageFileSearchCallsResult {
object,
num_requests,
project_id: None,
user_id: None,
api_key_id: None,
vector_store_id: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
#[serde(rename = "organization.usage.file_searches.result")]
OrganizationUsageFileSearchesResult,
}
impl Default for Object {
fn default() -> Object {
Self::OrganizationUsageFileSearchesResult
}
}
impl std::fmt::Display for UsageFileSearchCallsResult {
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),
}
}
}