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.3.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    /// Set true for an Email template.
25    #[serde(rename = "isEmail", skip_serializing_if = "Option::is_none")]
26    pub is_email: Option<bool>,
27    /// Subject of the email.
28    #[serde(rename = "email_subject", skip_serializing_if = "Option::is_none")]
29    pub email_subject: Option<String>,
30    /// Body of the email (HTML supported).
31    #[serde(rename = "email_body", skip_serializing_if = "Option::is_none")]
32    pub email_body: Option<String>,
33    /// Set true for an SMS template.
34    #[serde(rename = "isSMS", skip_serializing_if = "Option::is_none")]
35    pub is_sms: Option<bool>,
36    /// JSON string for dynamic content personalization.
37    #[serde(rename = "dynamic_content", skip_serializing_if = "Option::is_none")]
38    pub dynamic_content: Option<String>,
39}
40
41impl CreateTemplateRequest {
42    pub fn new(app_id: String, name: String, contents: crate::models::LanguageStringMap) -> CreateTemplateRequest {
43        CreateTemplateRequest {
44            app_id,
45            name,
46            contents: Box::new(contents),
47            is_email: None,
48            email_subject: None,
49            email_body: None,
50            is_sms: None,
51            dynamic_content: None,
52        }
53    }
54}
55
56