1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Stedi Event Destinations
*
* The Stedi Events Service manages event destinations and event delivery. It supports destination CRUD operations, secret management for signature verification, event creation and management, and delivery tracking with resend capabilities.
*
* The version of the OpenAPI document: 2026-02-01
* Contact: healthcare@stedi.com
* Generated by: https://openapi-generator.tech
*/
use crate::event_destinations::models;
use serde::{Deserialize, Serialize};
/// V1EventPayload : A v1 thin event envelope that signals a state change. Consumers fetch current resource state via API using the resource reference. This is the exact payload delivered to webhook destinations.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V1EventPayload {
/// Stedi account identifier (UUID).
#[serde(rename = "account")]
pub account: String,
/// An ISO 8601 timestamp of when the event was created.
#[serde(rename = "created")]
pub created: chrono::DateTime<chrono::FixedOffset>,
/// The environment in which the event was produced.
#[serde(rename = "environment")]
pub environment: models::EventEnvironment,
/// An identifier for the event, formatted as `evt_{UUID}`.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Object type discriminator. Identifies the schema version of this payload.
#[serde(rename = "object")]
pub object: models::EventPayloadObjectType,
/// Other resources related to the event. Only present when there are related resources.
#[serde(rename = "relatedResources", skip_serializing_if = "Option::is_none")]
pub related_resources: Option<Vec<models::EventPayloadResourceRef>>,
/// Information about the resource that triggered the event. You can use this information to retrieve additional information about the resource.
#[serde(rename = "resource")]
pub resource: Box<models::EventPayloadResourceRef>,
/// The event type in dot notation, such as `enrollment.activated`.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
}
impl V1EventPayload {
/// A v1 thin event envelope that signals a state change. Consumers fetch current resource state via API using the resource reference. This is the exact payload delivered to webhook destinations.
pub fn new(account: String, created: chrono::DateTime<chrono::FixedOffset>, environment: models::EventEnvironment, object: models::EventPayloadObjectType, resource: models::EventPayloadResourceRef) -> V1EventPayload {
V1EventPayload {
account,
created,
environment,
id: None,
object,
related_resources: None,
resource: Box::new(resource),
r#type: None,
}
}
}