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