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

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct WebhookAgentSessionEnvelope {
    /// The unique ID of the event.
    #[serde(rename = "id")]
    pub id: String,
    /// The object type. Always `event`.
    #[serde(rename = "object")]
    pub object: Object,
    /// The Unix timestamp, in seconds, when the event was created.
    #[serde(rename = "created_at")]
    pub created_at: i32,
}

impl WebhookAgentSessionEnvelope {
    pub fn new(id: String, object: Object, created_at: i32) -> WebhookAgentSessionEnvelope {
        WebhookAgentSessionEnvelope {
            id,
            object,
            created_at,
        }
    }
}
/// The object type. Always `event`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "event")]
    Event,
}

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

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