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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ContainerFileResource {
    /// Unique identifier for the file.
    #[serde(rename = "id")]
    pub id: String,
    /// The type of this object (`container.file`).
    #[serde(rename = "object")]
    pub object: String,
    /// The container this file belongs to.
    #[serde(rename = "container_id")]
    pub container_id: String,
    /// Unix timestamp (in seconds) when the file was created.
    #[serde(rename = "created_at")]
    pub created_at: i32,
    /// Size of the file in bytes.
    #[serde(rename = "bytes")]
    pub bytes: i32,
    /// Path of the file in the container.
    #[serde(rename = "path")]
    pub path: String,
    /// Source of the file (e.g., `user`, `assistant`).
    #[serde(rename = "source")]
    pub source: String,
}

impl ContainerFileResource {
    pub fn new(
        id: String,
        object: String,
        container_id: String,
        created_at: i32,
        bytes: i32,
        path: String,
        source: String,
    ) -> ContainerFileResource {
        ContainerFileResource {
            id,
            object,
            container_id,
            created_at,
            bytes,
            path,
            source,
        }
    }
}

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