1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/pinpoint/model/EmailTemplateResponse.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace Pinpoint
17 {
18 namespace Model
19 {
20
EmailTemplateResponse()21 EmailTemplateResponse::EmailTemplateResponse() :
22 m_arnHasBeenSet(false),
23 m_creationDateHasBeenSet(false),
24 m_defaultSubstitutionsHasBeenSet(false),
25 m_htmlPartHasBeenSet(false),
26 m_lastModifiedDateHasBeenSet(false),
27 m_recommenderIdHasBeenSet(false),
28 m_subjectHasBeenSet(false),
29 m_tagsHasBeenSet(false),
30 m_templateDescriptionHasBeenSet(false),
31 m_templateNameHasBeenSet(false),
32 m_templateType(TemplateType::NOT_SET),
33 m_templateTypeHasBeenSet(false),
34 m_textPartHasBeenSet(false),
35 m_versionHasBeenSet(false)
36 {
37 }
38
EmailTemplateResponse(JsonView jsonValue)39 EmailTemplateResponse::EmailTemplateResponse(JsonView jsonValue) :
40 m_arnHasBeenSet(false),
41 m_creationDateHasBeenSet(false),
42 m_defaultSubstitutionsHasBeenSet(false),
43 m_htmlPartHasBeenSet(false),
44 m_lastModifiedDateHasBeenSet(false),
45 m_recommenderIdHasBeenSet(false),
46 m_subjectHasBeenSet(false),
47 m_tagsHasBeenSet(false),
48 m_templateDescriptionHasBeenSet(false),
49 m_templateNameHasBeenSet(false),
50 m_templateType(TemplateType::NOT_SET),
51 m_templateTypeHasBeenSet(false),
52 m_textPartHasBeenSet(false),
53 m_versionHasBeenSet(false)
54 {
55 *this = jsonValue;
56 }
57
operator =(JsonView jsonValue)58 EmailTemplateResponse& EmailTemplateResponse::operator =(JsonView jsonValue)
59 {
60 if(jsonValue.ValueExists("Arn"))
61 {
62 m_arn = jsonValue.GetString("Arn");
63
64 m_arnHasBeenSet = true;
65 }
66
67 if(jsonValue.ValueExists("CreationDate"))
68 {
69 m_creationDate = jsonValue.GetString("CreationDate");
70
71 m_creationDateHasBeenSet = true;
72 }
73
74 if(jsonValue.ValueExists("DefaultSubstitutions"))
75 {
76 m_defaultSubstitutions = jsonValue.GetString("DefaultSubstitutions");
77
78 m_defaultSubstitutionsHasBeenSet = true;
79 }
80
81 if(jsonValue.ValueExists("HtmlPart"))
82 {
83 m_htmlPart = jsonValue.GetString("HtmlPart");
84
85 m_htmlPartHasBeenSet = true;
86 }
87
88 if(jsonValue.ValueExists("LastModifiedDate"))
89 {
90 m_lastModifiedDate = jsonValue.GetString("LastModifiedDate");
91
92 m_lastModifiedDateHasBeenSet = true;
93 }
94
95 if(jsonValue.ValueExists("RecommenderId"))
96 {
97 m_recommenderId = jsonValue.GetString("RecommenderId");
98
99 m_recommenderIdHasBeenSet = true;
100 }
101
102 if(jsonValue.ValueExists("Subject"))
103 {
104 m_subject = jsonValue.GetString("Subject");
105
106 m_subjectHasBeenSet = true;
107 }
108
109 if(jsonValue.ValueExists("tags"))
110 {
111 Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
112 for(auto& tagsItem : tagsJsonMap)
113 {
114 m_tags[tagsItem.first] = tagsItem.second.AsString();
115 }
116 m_tagsHasBeenSet = true;
117 }
118
119 if(jsonValue.ValueExists("TemplateDescription"))
120 {
121 m_templateDescription = jsonValue.GetString("TemplateDescription");
122
123 m_templateDescriptionHasBeenSet = true;
124 }
125
126 if(jsonValue.ValueExists("TemplateName"))
127 {
128 m_templateName = jsonValue.GetString("TemplateName");
129
130 m_templateNameHasBeenSet = true;
131 }
132
133 if(jsonValue.ValueExists("TemplateType"))
134 {
135 m_templateType = TemplateTypeMapper::GetTemplateTypeForName(jsonValue.GetString("TemplateType"));
136
137 m_templateTypeHasBeenSet = true;
138 }
139
140 if(jsonValue.ValueExists("TextPart"))
141 {
142 m_textPart = jsonValue.GetString("TextPart");
143
144 m_textPartHasBeenSet = true;
145 }
146
147 if(jsonValue.ValueExists("Version"))
148 {
149 m_version = jsonValue.GetString("Version");
150
151 m_versionHasBeenSet = true;
152 }
153
154 return *this;
155 }
156
Jsonize() const157 JsonValue EmailTemplateResponse::Jsonize() const
158 {
159 JsonValue payload;
160
161 if(m_arnHasBeenSet)
162 {
163 payload.WithString("Arn", m_arn);
164
165 }
166
167 if(m_creationDateHasBeenSet)
168 {
169 payload.WithString("CreationDate", m_creationDate);
170
171 }
172
173 if(m_defaultSubstitutionsHasBeenSet)
174 {
175 payload.WithString("DefaultSubstitutions", m_defaultSubstitutions);
176
177 }
178
179 if(m_htmlPartHasBeenSet)
180 {
181 payload.WithString("HtmlPart", m_htmlPart);
182
183 }
184
185 if(m_lastModifiedDateHasBeenSet)
186 {
187 payload.WithString("LastModifiedDate", m_lastModifiedDate);
188
189 }
190
191 if(m_recommenderIdHasBeenSet)
192 {
193 payload.WithString("RecommenderId", m_recommenderId);
194
195 }
196
197 if(m_subjectHasBeenSet)
198 {
199 payload.WithString("Subject", m_subject);
200
201 }
202
203 if(m_tagsHasBeenSet)
204 {
205 JsonValue tagsJsonMap;
206 for(auto& tagsItem : m_tags)
207 {
208 tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
209 }
210 payload.WithObject("tags", std::move(tagsJsonMap));
211
212 }
213
214 if(m_templateDescriptionHasBeenSet)
215 {
216 payload.WithString("TemplateDescription", m_templateDescription);
217
218 }
219
220 if(m_templateNameHasBeenSet)
221 {
222 payload.WithString("TemplateName", m_templateName);
223
224 }
225
226 if(m_templateTypeHasBeenSet)
227 {
228 payload.WithString("TemplateType", TemplateTypeMapper::GetNameForTemplateType(m_templateType));
229 }
230
231 if(m_textPartHasBeenSet)
232 {
233 payload.WithString("TextPart", m_textPart);
234
235 }
236
237 if(m_versionHasBeenSet)
238 {
239 payload.WithString("Version", m_version);
240
241 }
242
243 return payload;
244 }
245
246 } // namespace Model
247 } // namespace Pinpoint
248 } // namespace Aws
249