openai-types 0.1.3

Typed OpenAI API models — zero dependencies beyond serde
Documentation
// AUTO-GENERATED by py2rust — do not edit.
// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
// Domain: webhooks

use serde::{Deserialize, Serialize};

/// Event data payload.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Data {
    /// The unique ID of the batch API request.
    pub id: String,
}

/// Sent when a batch API request has been cancelled.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct BatchCancelledWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the batch API request was cancelled.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `batch.cancelled`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a batch API request has been completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct BatchCompletedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the batch API request was completed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `batch.completed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a batch API request has expired.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct BatchExpiredWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the batch API request expired.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `batch.expired`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a batch API request has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct BatchFailedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the batch API request failed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `batch.failed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when an eval run has been canceled.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct EvalRunCanceledWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the eval run was canceled.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `eval.run.canceled`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when an eval run has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct EvalRunFailedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the eval run failed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `eval.run.failed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when an eval run has succeeded.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct EvalRunSucceededWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the eval run succeeded.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `eval.run.succeeded`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a fine-tuning job has been cancelled.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FineTuningJobCancelledWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `fine_tuning.job.cancelled`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a fine-tuning job has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FineTuningJobFailedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the fine-tuning job failed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `fine_tuning.job.failed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a fine-tuning job has succeeded.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FineTuningJobSucceededWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the fine-tuning job succeeded.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `fine_tuning.job.succeeded`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// A header from the SIP Invite.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct DataSipHeader {
    /// Name of the SIP Header.
    pub name: String,
    /// Value of the SIP Header.
    pub value: String,
}

/// Sent when Realtime API Receives a incoming SIP call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct RealtimeCallIncomingWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the model response was completed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `realtime.call.incoming`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a background response has been cancelled.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCancelledWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the model response was cancelled.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `response.cancelled`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a background response has been completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCompletedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the model response was completed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `response.completed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a background response has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFailedWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the model response failed.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `response.failed`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

/// Sent when a background response has been interrupted.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseIncompleteWebhookEvent {
    /// The unique ID of the event.
    pub id: String,
    /// The Unix timestamp (in seconds) of when the model response was interrupted.
    pub created_at: i64,
    /// Event data payload.
    pub data: Data,
    /// The type of the event. Always `response.incomplete`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The object of the event. Always `event`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub object: Option<String>,
}

pub type UnwrapWebhookEvent = serde_json::Value;