dodopayments_rust 2.2.1

Rust SDK for Dodo Payments API
Documentation
/*
 * public
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.87.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EventInput {
    /// customer_id of the customer whose usage needs to be tracked
    #[serde(rename = "customer_id")]
    pub customer_id: String,
    /// Event Id acts as an idempotency key. Any subsequent requests with the same event_id will be ignored
    #[serde(rename = "event_id")]
    pub event_id: String,
    /// Name of the event
    #[serde(rename = "event_name")]
    pub event_name: String,
    /// Custom metadata. Only key value pairs are accepted, objects or arrays submitted will be rejected.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, models::EventMetadataValue>>,
    /// Custom Timestamp. Defaults to current timestamp in UTC. Timestamps that are older that 1 hour or after 5 mins, from current timestamp, will be rejected.
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<String>,
}

impl EventInput {
    pub fn new(customer_id: String, event_id: String, event_name: String) -> EventInput {
        EventInput {
            customer_id,
            event_id,
            event_name,
            metadata: None,
            timestamp: None,
        }
    }
}