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
 */

/// UpdateJourneyNodeRequest : Node fields to change, merged onto the current node. Send only the fields you want to change. The node's kind and id cannot be changed. Send null to clear a nullable field. Which other fields apply depends on the node's kind, matching JourneyNode.



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct UpdateJourneyNodeRequest {
    /// Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads.
    #[serde(rename = "client_node_id", skip_serializing_if = "Option::is_none")]
    pub client_node_id: Option<String>,
    /// Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior.
    #[serde(rename = "annotation", skip_serializing_if = "Option::is_none")]
    pub annotation: Option<String>,
    /// wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year).
    #[serde(rename = "duration_seconds", skip_serializing_if = "Option::is_none")]
    pub duration_seconds: Option<i32>,
    /// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time.
    #[serde(rename = "relative_to", skip_serializing_if = "Option::is_none")]
    pub relative_to: Option<RelativeToType>,
    /// time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time.
    #[serde(rename = "windows", skip_serializing_if = "Option::is_none")]
    pub windows: Option<Vec<crate::models::JourneyTimeWindow>>,
    /// time_window nodes: IANA timezone identifier used when the user's timezone is unavailable.
    #[serde(rename = "time_zone", skip_serializing_if = "Option::is_none")]
    pub time_zone: Option<String>,
    /// time_window nodes: when true, uses the user's timezone if available.
    #[serde(rename = "use_user_time_zone", skip_serializing_if = "Option::is_none")]
    pub use_user_time_zone: Option<bool>,
    /// send_push, send_email, and send_sms nodes: UUID of the template to send.
    #[serde(rename = "template_id", skip_serializing_if = "Option::is_none")]
    pub template_id: Option<String>,
    /// send_iam nodes: UUID of the in-app message to send.
    #[serde(rename = "iam_id", skip_serializing_if = "Option::is_none")]
    pub iam_id: Option<String>,
    /// send_iam nodes: optional time-to-live for the in-app message, in seconds.
    #[serde(rename = "user_ttl_seconds", skip_serializing_if = "Option::is_none")]
    pub user_ttl_seconds: Option<i32>,
    /// send_webhook nodes: UUID of the webhook to send.
    #[serde(rename = "webhook_id", skip_serializing_if = "Option::is_none")]
    pub webhook_id: Option<String>,
    /// tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024.
    #[serde(rename = "assignments", skip_serializing_if = "Option::is_none")]
    pub assignments: Option<::std::collections::HashMap<String, String>>,
    /// split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false.
    #[serde(rename = "randomize_on_entry", skip_serializing_if = "Option::is_none")]
    pub randomize_on_entry: Option<bool>,
    /// Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches.
    #[serde(rename = "branches", skip_serializing_if = "Option::is_none")]
    pub branches: Option<Vec<crate::models::JourneyBranch>>,
    #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")]
    pub expiration: Option<Box<crate::models::JourneyWaitUntilExpiration>>,
    /// Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. It is not merged onto the node.
    #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")]
    pub concurrency_key: Option<String>,
}

impl UpdateJourneyNodeRequest {
    /// Node fields to change, merged onto the current node. Send only the fields you want to change. The node's kind and id cannot be changed. Send null to clear a nullable field. Which other fields apply depends on the node's kind, matching JourneyNode.
    pub fn new() -> UpdateJourneyNodeRequest {
        UpdateJourneyNodeRequest {
            client_node_id: None,
            annotation: None,
            duration_seconds: None,
            relative_to: None,
            windows: None,
            time_zone: None,
            use_user_time_zone: None,
            template_id: None,
            iam_id: None,
            user_ttl_seconds: None,
            webhook_id: None,
            assignments: None,
            randomize_on_entry: None,
            branches: None,
            expiration: None,
            concurrency_key: None,
        }
    }
}

/// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RelativeToType {
    #[serde(rename = "schedule_in_timezone")]
    ScheduleInTimezone,
    #[serde(rename = "last_active_time")]
    LastActiveTime,
}

impl Default for RelativeToType {
    fn default() -> RelativeToType {
        Self::ScheduleInTimezone
    }
}