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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Specifies the content and settings for a push notification that's sent to recipients of a campaign.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Message {
/// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
/// <ul>
/// <li><p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
/// <li><p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
/// <li><p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
/// </ul>
pub action: ::std::option::Option<crate::types::Action>,
/// <p>The body of the notification message. The maximum number of characters is 200.</p>
pub body: ::std::option::Option<::std::string::String>,
/// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
pub image_icon_url: ::std::option::Option<::std::string::String>,
/// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
pub image_small_icon_url: ::std::option::Option<::std::string::String>,
/// <p>The URL of an image to display in the push notification.</p>
pub image_url: ::std::option::Option<::std::string::String>,
/// <p>The JSON payload to use for a silent push notification.</p>
pub json_body: ::std::option::Option<::std::string::String>,
/// <p>The URL of the image or video to display in the push notification.</p>
pub media_url: ::std::option::Option<::std::string::String>,
/// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
pub raw_content: ::std::option::Option<::std::string::String>,
/// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
pub silent_push: ::std::option::Option<bool>,
/// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
/// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
pub time_to_live: ::std::option::Option<i32>,
/// <p>The title to display above the notification message on a recipient's device.</p>
pub title: ::std::option::Option<::std::string::String>,
/// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
pub url: ::std::option::Option<::std::string::String>,
}
impl Message {
/// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
/// <ul>
/// <li><p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
/// <li><p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
/// <li><p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
/// </ul>
pub fn action(&self) -> ::std::option::Option<&crate::types::Action> {
self.action.as_ref()
}
/// <p>The body of the notification message. The maximum number of characters is 200.</p>
pub fn body(&self) -> ::std::option::Option<&str> {
self.body.as_deref()
}
/// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
pub fn image_icon_url(&self) -> ::std::option::Option<&str> {
self.image_icon_url.as_deref()
}
/// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
pub fn image_small_icon_url(&self) -> ::std::option::Option<&str> {
self.image_small_icon_url.as_deref()
}
/// <p>The URL of an image to display in the push notification.</p>
pub fn image_url(&self) -> ::std::option::Option<&str> {
self.image_url.as_deref()
}
/// <p>The JSON payload to use for a silent push notification.</p>
pub fn json_body(&self) -> ::std::option::Option<&str> {
self.json_body.as_deref()
}
/// <p>The URL of the image or video to display in the push notification.</p>
pub fn media_url(&self) -> ::std::option::Option<&str> {
self.media_url.as_deref()
}
/// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
pub fn raw_content(&self) -> ::std::option::Option<&str> {
self.raw_content.as_deref()
}
/// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
pub fn silent_push(&self) -> ::std::option::Option<bool> {
self.silent_push
}
/// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
/// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
pub fn time_to_live(&self) -> ::std::option::Option<i32> {
self.time_to_live
}
/// <p>The title to display above the notification message on a recipient's device.</p>
pub fn title(&self) -> ::std::option::Option<&str> {
self.title.as_deref()
}
/// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
pub fn url(&self) -> ::std::option::Option<&str> {
self.url.as_deref()
}
}
impl Message {
/// Creates a new builder-style object to manufacture [`Message`](crate::types::Message).
pub fn builder() -> crate::types::builders::MessageBuilder {
crate::types::builders::MessageBuilder::default()
}
}
/// A builder for [`Message`](crate::types::Message).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct MessageBuilder {
pub(crate) action: ::std::option::Option<crate::types::Action>,
pub(crate) body: ::std::option::Option<::std::string::String>,
pub(crate) image_icon_url: ::std::option::Option<::std::string::String>,
pub(crate) image_small_icon_url: ::std::option::Option<::std::string::String>,
pub(crate) image_url: ::std::option::Option<::std::string::String>,
pub(crate) json_body: ::std::option::Option<::std::string::String>,
pub(crate) media_url: ::std::option::Option<::std::string::String>,
pub(crate) raw_content: ::std::option::Option<::std::string::String>,
pub(crate) silent_push: ::std::option::Option<bool>,
pub(crate) time_to_live: ::std::option::Option<i32>,
pub(crate) title: ::std::option::Option<::std::string::String>,
pub(crate) url: ::std::option::Option<::std::string::String>,
}
impl MessageBuilder {
/// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
/// <ul>
/// <li><p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
/// <li><p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
/// <li><p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
/// </ul>
pub fn action(mut self, input: crate::types::Action) -> Self {
self.action = ::std::option::Option::Some(input);
self
}
/// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
/// <ul>
/// <li><p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
/// <li><p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
/// <li><p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
/// </ul>
pub fn set_action(mut self, input: ::std::option::Option<crate::types::Action>) -> Self {
self.action = input;
self
}
/// <p>The action to occur if a recipient taps the push notification. Valid values are:</p>
/// <ul>
/// <li><p>OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default action.</p></li>
/// <li><p>DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the deep-linking features of iOS and Android.</p></li>
/// <li><p>URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you specify.</p></li>
/// </ul>
pub fn get_action(&self) -> &::std::option::Option<crate::types::Action> {
&self.action
}
/// <p>The body of the notification message. The maximum number of characters is 200.</p>
pub fn body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.body = ::std::option::Option::Some(input.into());
self
}
/// <p>The body of the notification message. The maximum number of characters is 200.</p>
pub fn set_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.body = input;
self
}
/// <p>The body of the notification message. The maximum number of characters is 200.</p>
pub fn get_body(&self) -> &::std::option::Option<::std::string::String> {
&self.body
}
/// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
pub fn image_icon_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.image_icon_url = ::std::option::Option::Some(input.into());
self
}
/// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
pub fn set_image_icon_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.image_icon_url = input;
self
}
/// <p>The URL of the image to display as the push-notification icon, such as the icon for the app.</p>
pub fn get_image_icon_url(&self) -> &::std::option::Option<::std::string::String> {
&self.image_icon_url
}
/// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
pub fn image_small_icon_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.image_small_icon_url = ::std::option::Option::Some(input.into());
self
}
/// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
pub fn set_image_small_icon_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.image_small_icon_url = input;
self
}
/// <p>The URL of the image to display as the small, push-notification icon, such as a small version of the icon for the app.</p>
pub fn get_image_small_icon_url(&self) -> &::std::option::Option<::std::string::String> {
&self.image_small_icon_url
}
/// <p>The URL of an image to display in the push notification.</p>
pub fn image_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.image_url = ::std::option::Option::Some(input.into());
self
}
/// <p>The URL of an image to display in the push notification.</p>
pub fn set_image_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.image_url = input;
self
}
/// <p>The URL of an image to display in the push notification.</p>
pub fn get_image_url(&self) -> &::std::option::Option<::std::string::String> {
&self.image_url
}
/// <p>The JSON payload to use for a silent push notification.</p>
pub fn json_body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.json_body = ::std::option::Option::Some(input.into());
self
}
/// <p>The JSON payload to use for a silent push notification.</p>
pub fn set_json_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.json_body = input;
self
}
/// <p>The JSON payload to use for a silent push notification.</p>
pub fn get_json_body(&self) -> &::std::option::Option<::std::string::String> {
&self.json_body
}
/// <p>The URL of the image or video to display in the push notification.</p>
pub fn media_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.media_url = ::std::option::Option::Some(input.into());
self
}
/// <p>The URL of the image or video to display in the push notification.</p>
pub fn set_media_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.media_url = input;
self
}
/// <p>The URL of the image or video to display in the push notification.</p>
pub fn get_media_url(&self) -> &::std::option::Option<::std::string::String> {
&self.media_url
}
/// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
pub fn raw_content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.raw_content = ::std::option::Option::Some(input.into());
self
}
/// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
pub fn set_raw_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.raw_content = input;
self
}
/// <p>The raw, JSON-formatted string to use as the payload for the notification message. If specified, this value overrides all other content for the message.</p>
pub fn get_raw_content(&self) -> &::std::option::Option<::std::string::String> {
&self.raw_content
}
/// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
pub fn silent_push(mut self, input: bool) -> Self {
self.silent_push = ::std::option::Option::Some(input);
self
}
/// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
pub fn set_silent_push(mut self, input: ::std::option::Option<bool>) -> Self {
self.silent_push = input;
self
}
/// <p>Specifies whether the notification is a silent push notification, which is a push notification that doesn't display on a recipient's device. Silent push notifications can be used for cases such as updating an app's configuration, displaying messages in an in-app message center, or supporting phone home functionality.</p>
pub fn get_silent_push(&self) -> &::std::option::Option<bool> {
&self.silent_push
}
/// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
/// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
pub fn time_to_live(mut self, input: i32) -> Self {
self.time_to_live = ::std::option::Option::Some(input);
self
}
/// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
/// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
pub fn set_time_to_live(mut self, input: ::std::option::Option<i32>) -> Self {
self.time_to_live = input;
self
}
/// <p>The number of seconds that the push-notification service should keep the message, if the service is unable to deliver the notification the first time. This value is converted to an expiration value when it's sent to a push-notification service. If this value is 0, the service treats the notification as if it expires immediately and the service doesn't store or try to deliver the notification again.</p>
/// <p>This value doesn't apply to messages that are sent through the Amazon Device Messaging (ADM) service.</p>
pub fn get_time_to_live(&self) -> &::std::option::Option<i32> {
&self.time_to_live
}
/// <p>The title to display above the notification message on a recipient's device.</p>
pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.title = ::std::option::Option::Some(input.into());
self
}
/// <p>The title to display above the notification message on a recipient's device.</p>
pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.title = input;
self
}
/// <p>The title to display above the notification message on a recipient's device.</p>
pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
&self.title
}
/// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
pub fn url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.url = ::std::option::Option::Some(input.into());
self
}
/// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
pub fn set_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.url = input;
self
}
/// <p>The URL to open in a recipient's default mobile browser, if a recipient taps the push notification and the value of the Action property is URL.</p>
pub fn get_url(&self) -> &::std::option::Option<::std::string::String> {
&self.url
}
/// Consumes the builder and constructs a [`Message`](crate::types::Message).
pub fn build(self) -> crate::types::Message {
crate::types::Message {
action: self.action,
body: self.body,
image_icon_url: self.image_icon_url,
image_small_icon_url: self.image_small_icon_url,
image_url: self.image_url,
json_body: self.json_body,
media_url: self.media_url,
raw_content: self.raw_content,
silent_push: self.silent_push,
time_to_live: self.time_to_live,
title: self.title,
url: self.url,
}
}
}