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

/// CreateContainerBodyExpiresAfter : Container expiration time in seconds relative to the 'anchor' time.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateContainerBodyExpiresAfter {
    /// Time anchor for the expiration time. Currently only 'last_active_at' is supported.
    #[serde(rename = "anchor")]
    pub anchor: Anchor,
    #[serde(rename = "minutes")]
    pub minutes: i32,
}

impl CreateContainerBodyExpiresAfter {
    /// Container expiration time in seconds relative to the 'anchor' time.
    pub fn new(anchor: Anchor, minutes: i32) -> CreateContainerBodyExpiresAfter {
        CreateContainerBodyExpiresAfter { anchor, minutes }
    }
}
/// Time anchor for the expiration time. Currently only 'last_active_at' is supported.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Anchor {
    #[serde(rename = "last_active_at")]
    LastActiveAt,
}

impl Default for Anchor {
    fn default() -> Anchor {
        Self::LastActiveAt
    }
}

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