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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* OneSignal
*
* A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
*
* Contact: devrel@onesignal.com
* Generated by: https://openapi-generator.tech
*/
/// JourneyCondition : A branch condition. The kind field selects which other fields apply.
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct JourneyCondition {
/// Condition kind. Selects which other fields apply.
#[serde(rename = "kind")]
pub kind: KindType,
/// segment_membership conditions: Segment UUIDs the user must belong to.
#[serde(rename = "included_segment_ids", skip_serializing_if = "Option::is_none")]
pub included_segment_ids: Option<Vec<String>>,
/// segment_membership conditions: Segment UUIDs the user must not belong to.
#[serde(rename = "excluded_segment_ids", skip_serializing_if = "Option::is_none")]
pub excluded_segment_ids: Option<Vec<String>>,
/// on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel.
#[serde(rename = "action", skip_serializing_if = "Option::is_none")]
pub action: Option<ActionType>,
/// on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write.
#[serde(rename = "sending_node_id", skip_serializing_if = "Option::is_none")]
pub sending_node_id: Option<String>,
/// on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id.
#[serde(rename = "client_node_id", skip_serializing_if = "Option::is_none")]
pub client_node_id: Option<String>,
/// event_trigger conditions: event name, up to 255 characters.
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected.
#[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
pub attributes: Option<Vec<Vec<crate::models::JourneyEventAttribute>>>,
/// event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys.
#[serde(rename = "entry_event_match_attributes", skip_serializing_if = "Option::is_none")]
pub entry_event_match_attributes: Option<Vec<serde_json::Value>>,
}
impl JourneyCondition {
/// A branch condition. The kind field selects which other fields apply.
pub fn new(kind: KindType) -> JourneyCondition {
JourneyCondition {
kind,
included_segment_ids: None,
excluded_segment_ids: None,
action: None,
sending_node_id: None,
client_node_id: None,
name: None,
attributes: None,
entry_event_match_attributes: None,
}
}
}
/// Condition kind. Selects which other fields apply.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KindType {
#[serde(rename = "segment_membership")]
SegmentMembership,
#[serde(rename = "on_notification_action")]
OnNotificationAction,
#[serde(rename = "event_trigger")]
EventTrigger,
}
impl Default for KindType {
fn default() -> KindType {
Self::SegmentMembership
}
}
/// on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ActionType {
#[serde(rename = "received")]
Received,
#[serde(rename = "clicked")]
Clicked,
#[serde(rename = "opened")]
Opened,
}
impl Default for ActionType {
fn default() -> ActionType {
Self::Received
}
}