enbbox 1.0.1

Notification infrastructure API — open-source alternative to Novu/Courier
Documentation
/*
 * enbbox API
 *
 * Notification infrastructure API — open-source alternative to Novu/Courier
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CreateSubscriber : Create or upsert a subscriber (notification recipient). The `subscriber_id` is your unique key for this user.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateSubscriber {
    /// URL to the subscriber's avatar image.
    #[serde(rename = "avatar", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avatar: Option<Option<String>>,
    /// Arbitrary key-value metadata attached to this subscriber.
    #[serde(rename = "data")]
    pub data: serde_json::Value,
    /// Subscriber's email address, used for email channel delivery.
    #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub email: Option<Option<String>>,
    /// Subscriber's first (given) name.
    #[serde(rename = "first_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub first_name: Option<Option<String>>,
    /// Subscriber's last (family) name.
    #[serde(rename = "last_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_name: Option<Option<String>>,
    /// IETF BCP 47 locale tag for localized content delivery.
    #[serde(rename = "locale", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub locale: Option<Option<String>>,
    /// Subscriber's phone number in E.164 format, used for SMS channel delivery.
    #[serde(rename = "phone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub phone: Option<Option<String>>,
    /// Unique identifier for this subscriber in your system (e.g. user ID).
    #[serde(rename = "subscriber_id")]
    pub subscriber_id: String,
    /// IANA timezone identifier for time-aware scheduling.
    #[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub timezone: Option<Option<String>>,
}

impl CreateSubscriber {
    /// Create or upsert a subscriber (notification recipient). The `subscriber_id` is your unique key for this user.
    pub fn new(data: serde_json::Value, subscriber_id: String) -> CreateSubscriber {
        CreateSubscriber {
            avatar: None,
            data,
            email: None,
            first_name: None,
            last_name: None,
            locale: None,
            phone: None,
            subscriber_id,
            timezone: None,
        }
    }
}