1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! Implement Campaign Content Types
//!
use super::link::LinkType;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
///
/// Use this template to generate the HTML content for the campaign.
///
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TemplateContent {
/// The id of the template to use.
#[serde(default)]
pub id: String,
/// Content for the sections of the template. Each key should be
/// the unique mc:edit area name from the template.
#[serde(default)]
pub sections: HashMap<String, String>,
}
impl Default for TemplateContent {
fn default() -> Self {
TemplateContent {
id: "".to_string(),
sections: HashMap::new(),
}
}
}
///
/// Use this template to generate the HTML content for the campaign.
///
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct UploadArchive {
/// The base64-encoded representation of the archive file.
#[serde(default)]
pub archive_content: String,
/// The type of encoded file. Defaults to zip.
/// Possible Values: zip tar.gz tar.bz2 tar tgz tbz
#[serde(default)]
pub archive_type: String,
}
impl Default for UploadArchive {
fn default() -> Self {
UploadArchive {
archive_content: "".to_string(),
archive_type: "".to_string(),
}
}
}
///
/// Variate Content
///
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VariateContent {
/// Label used to identify the content option.
#[serde(default)]
pub content_label: String,
/// The plain-text portion of the campaign. If left unspecified,
/// we’ll generate this automatically.
#[serde(default)]
pub plain_text: String,
/// The raw HTML for the campaign.
#[serde(default)]
pub html: String,
/// When importing a campaign, the URL for the HTML.
#[serde(default)]
pub url: String,
/// Use this template to generate the HTML content for the campaign.
#[serde(default)]
pub template: TemplateContent,
/// Available when uploading an archive to create campaign content.
/// The archive should include all campaign content and images. Learn more.
#[serde(default)]
pub archive: UploadArchive,
}
impl Default for VariateContent {
fn default() -> Self {
VariateContent {
content_label: String::new(),
plain_text: String::new(),
html: String::new(),
url: "".to_string(),
template: TemplateContent::default(),
archive: UploadArchive::default(),
}
}
}
///
/// Campaign Content Type
///
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CampaignContentType {
/// Content options for multivariate campaigns.
#[serde(default)]
pub variate_contents: Vec<VariateContent>,
/// The plain-text portion of the campaign. If left unspecified, we’ll generate this automatically.
#[serde(default)]
pub plain_text: String,
/// The raw HTML for the campaign.
#[serde(default)]
pub html: String,
/// The Archive HTML for the campaign.
#[serde(default)]
pub archive_html: String,
/// A list of link types and descriptions for the API schema documents.
#[serde(default)]
pub _links: Vec<LinkType>,
}
///
/// Campaign Content Param
///
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CampaignContentParam {
/// The plain-text portion of the campaign. If left unspecified, we’ll generate this automatically.
#[serde(default)]
pub plain_text: String,
/// The raw HTML for the campaign.
#[serde(default)]
pub html: String,
/// When importing a campaign, the URL where the HTML lives.
#[serde(default)]
pub url: String,
/// Use this template to generate the HTML content of the campaign
#[serde(default)]
pub template: TemplateContent,
/// Available when uploading an archive to create campaign content.
/// The archive should include all campaign content and images. Learn more.
#[serde(default)]
pub archive: UploadArchive,
/// Content options for Multivariate Campaigns. Each content option must
/// provide HTML content and may optionally provide plain text. For campaigns
/// not testing content, only one object should be provided.
#[serde(default)]
pub variate_contents: Vec<VariateContent>,
}