use serde::Deserialize;
use serde_json::Value;
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct EventResponse {
#[serde(default)]
pub event_id: Option<String>,
#[serde(default)]
pub merchant_id: Option<String>,
#[serde(default)]
pub profile_id: Option<String>,
#[serde(default)]
pub event_type: Option<String>,
#[serde(default)]
pub event_class: Option<String>,
#[serde(default)]
pub object_id: Option<String>,
#[serde(default)]
pub initial_attempt_id: Option<String>,
#[serde(default)]
pub delivery_attempt: Option<WebhookDeliveryAttempt>,
#[serde(default)]
pub is_delivery_successful: Option<bool>,
#[serde(default)]
pub attempt_delivered: Option<bool>,
#[serde(default)]
pub delivery_terminal_reason: Option<String>,
#[serde(default)]
pub test_mode: Option<bool>,
#[serde(default)]
pub created: Option<String>,
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
pub type WebhookDeliveryAttempt = String;
pub type EventType = String;
pub type ManualTriggerEventType = String;
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct EventListResponse {
#[serde(default = "Vec::new")]
pub events: Vec<EventResponse>,
#[serde(default)]
pub total_count: Option<i64>,
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct EventDetailResponse {
#[serde(flatten)]
pub event: EventResponse,
#[serde(default)]
pub request: Option<Value>,
#[serde(default)]
pub response: Option<Value>,
#[serde(default)]
pub withheld: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct EventManualTriggerResponse {
#[serde(flatten)]
pub event: EventDetailResponse,
#[serde(default)]
pub object_status: Option<String>,
#[serde(default)]
pub status_overridden: Option<bool>,
}
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct EventDeliveryAttemptResponse {
#[serde(default)]
pub attempt_id: Option<String>,
#[serde(default)]
pub status: Option<String>,
#[serde(default)]
pub created_at: Option<String>,
#[serde(default)]
pub response_status_code: Option<i64>,
#[serde(default)]
pub response_headers: Option<Value>,
#[serde(default)]
pub response_body: Option<String>,
#[serde(default)]
pub error_message: Option<String>,
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}