onesignal-rust-api 5.14.0

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
Documentation
/*
 * 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
 */

/// JourneyAudience : The journey entry audience. The kind field selects which other fields apply.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct JourneyAudience {
    /// Audience kind. Selects which other fields apply.
    #[serde(rename = "kind")]
    pub kind: KindType,
    /// segment audiences: Segment UUIDs whose users enter the journey.
    #[serde(rename = "included_segment_ids", skip_serializing_if = "Option::is_none")]
    pub included_segment_ids: Option<Vec<String>>,
    /// segment audiences: Segment UUIDs whose users are excluded.
    #[serde(rename = "excluded_segment_ids", skip_serializing_if = "Option::is_none")]
    pub excluded_segment_ids: Option<Vec<String>>,
    /// segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false.
    #[serde(rename = "future_additions_only", skip_serializing_if = "Option::is_none")]
    pub future_additions_only: Option<bool>,
    /// event_trigger audiences: event name that triggers entry, 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>>>,
}

impl JourneyAudience {
    /// The journey entry audience. The kind field selects which other fields apply.
    pub fn new(kind: KindType) -> JourneyAudience {
        JourneyAudience {
            kind,
            included_segment_ids: None,
            excluded_segment_ids: None,
            future_additions_only: None,
            name: None,
            attributes: None,
        }
    }
}

/// Audience kind. Selects which other fields apply.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum KindType {
    #[serde(rename = "segment")]
    Segment,
    #[serde(rename = "event_trigger")]
    EventTrigger,
}

impl Default for KindType {
    fn default() -> KindType {
        Self::Segment
    }
}