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