autogen-stedi 0.3.2

Auto-generated, strongly-typed Rust client for the Stedi APIs
Documentation
/*
 * 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,
        }
    }
}