lago_types/responses/
event.rs

1use serde::{Deserialize, Serialize};
2
3use crate::models::Event;
4
5/// Response for retrieving a single event.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct GetEventResponse {
8    pub event: Event,
9}
10
11/// Response for creating an event.
12///
13/// Note: The create event endpoint returns a minimal response with just the
14/// event wrapper, as events are processed asynchronously.
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct CreateEventResponse {
17    pub event: EventCreated,
18}
19
20/// The created event acknowledgment.
21///
22/// When an event is created, Lago returns a minimal response containing
23/// the transaction_id, external_customer_id, and code to confirm receipt.
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct EventCreated {
26    /// The transaction ID of the created event
27    pub transaction_id: String,
28    /// The external customer ID (if provided)
29    pub external_customer_id: Option<String>,
30    /// The external subscription ID (if provided)
31    pub external_subscription_id: Option<String>,
32    /// The billable metric code
33    pub code: String,
34}