Skip to main content

onesignal_rust_api/models/
custom_event.rs

1/*
2 * OneSignal
3 *
4 * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5 *
6 * The version of the OpenAPI document: 5.3.0
7 * Contact: devrel@onesignal.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct CustomEvent {
16    /// The identifier or name of the event. Maximum 128 characters.
17    #[serde(rename = "name")]
18    pub name: String,
19    /// The external ID of the user targeted for the event. Either the user's External ID or OneSignal ID is required.
20    #[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
21    pub external_id: Option<String>,
22    /// The OneSignal ID of the user targeted for the event. Either the user's External ID or OneSignal ID is required.
23    #[serde(rename = "onesignal_id", skip_serializing_if = "Option::is_none")]
24    pub onesignal_id: Option<String>,
25    /// Time the event occurred as an ISO8601 formatted string. Defaults to now if not included or past date provided.
26    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
27    pub timestamp: Option<String>,
28    /// Properties or data related to the event, like {\"geography\": \"USA\"}
29    #[serde(rename = "payload", skip_serializing_if = "Option::is_none")]
30    pub payload: Option<::std::collections::HashMap<String, serde_json::Value>>,
31}
32
33impl CustomEvent {
34    pub fn new(name: String) -> CustomEvent {
35        CustomEvent {
36            name,
37            external_id: None,
38            onesignal_id: None,
39            timestamp: None,
40            payload: None,
41        }
42    }
43}
44
45