Skip to main content

onesignal_rust_api/models/
create_template_request.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 * The version of the OpenAPI document: 5.5.0
7 * Contact: devrel@onesignal.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct CreateTemplateRequest {
16    /// Your OneSignal App ID in UUID v4 format.
17    #[serde(rename = "app_id")]
18    pub app_id: String,
19    /// Name of the template.
20    #[serde(rename = "name")]
21    pub name: String,
22    #[serde(rename = "contents")]
23    pub contents: Box<crate::models::LanguageStringMap>,
24    #[serde(rename = "headings", skip_serializing_if = "Option::is_none")]
25    pub headings: Option<Box<crate::models::LanguageStringMap>>,
26    #[serde(rename = "subtitle", skip_serializing_if = "Option::is_none")]
27    pub subtitle: Option<Box<crate::models::LanguageStringMap>>,
28    /// Set true for an Email template.
29    #[serde(rename = "isEmail", skip_serializing_if = "Option::is_none")]
30    pub is_email: Option<bool>,
31    /// Subject of the email.
32    #[serde(rename = "email_subject", skip_serializing_if = "Option::is_none")]
33    pub email_subject: Option<String>,
34    /// Body of the email (HTML supported).
35    #[serde(rename = "email_body", skip_serializing_if = "Option::is_none")]
36    pub email_body: Option<String>,
37    /// BCC recipients for the email template. Maximum 5 addresses. Only supported when the email service provider is OneSignal Email.
38    #[serde(rename = "email_bcc", skip_serializing_if = "Option::is_none")]
39    pub email_bcc: Option<Vec<String>>,
40    /// Set true for an SMS template.
41    #[serde(rename = "isSMS", skip_serializing_if = "Option::is_none")]
42    pub is_sms: Option<bool>,
43    /// JSON string for dynamic content personalization.
44    #[serde(rename = "dynamic_content", skip_serializing_if = "Option::is_none")]
45    pub dynamic_content: Option<String>,
46}
47
48impl CreateTemplateRequest {
49    pub fn new(app_id: String, name: String, contents: crate::models::LanguageStringMap) -> CreateTemplateRequest {
50        CreateTemplateRequest {
51            app_id,
52            name,
53            contents: Box::new(contents),
54            headings: None,
55            subtitle: None,
56            is_email: None,
57            email_subject: None,
58            email_body: None,
59            email_bcc: None,
60            is_sms: None,
61            dynamic_content: None,
62        }
63    }
64}
65
66