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

/// WebhookAgentSessionIdle : Sent when an agent session becomes idle.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct WebhookAgentSessionIdle {
    /// 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,
    /// The event type. Always `agent.session.idle`.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "data")]
    pub data: models::AgentSessionEnvironmentPayloadResource,
}

impl WebhookAgentSessionIdle {
    /// Sent when an agent session becomes idle.
    pub fn new(
        id: String,
        object: Object,
        created_at: i32,
        r#type: Type,
        data: models::AgentSessionEnvironmentPayloadResource,
    ) -> WebhookAgentSessionIdle {
        WebhookAgentSessionIdle {
            id,
            object,
            created_at,
            r#type,
            data,
        }
    }
}
/// 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
    }
}
/// The event type. Always `agent.session.idle`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "agent.session.idle")]
    AgentSessionIdle,
}

impl Default for Type {
    fn default() -> Type {
        Self::AgentSessionIdle
    }
}

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