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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An object that represents the content of the email, and optionally a character set specification.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Content {
/// <p>The content of the message itself.</p>
pub data: ::std::string::String,
/// <p>The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify <code>UTF-8</code>, <code>ISO-8859-1</code>, or <code>Shift_JIS</code>.</p>
pub charset: ::std::option::Option<::std::string::String>,
}
impl Content {
/// <p>The content of the message itself.</p>
pub fn data(&self) -> &str {
use std::ops::Deref;
self.data.deref()
}
/// <p>The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify <code>UTF-8</code>, <code>ISO-8859-1</code>, or <code>Shift_JIS</code>.</p>
pub fn charset(&self) -> ::std::option::Option<&str> {
self.charset.as_deref()
}
}
impl Content {
/// Creates a new builder-style object to manufacture [`Content`](crate::types::Content).
pub fn builder() -> crate::types::builders::ContentBuilder {
crate::types::builders::ContentBuilder::default()
}
}
/// A builder for [`Content`](crate::types::Content).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ContentBuilder {
pub(crate) data: ::std::option::Option<::std::string::String>,
pub(crate) charset: ::std::option::Option<::std::string::String>,
}
impl ContentBuilder {
/// <p>The content of the message itself.</p>
/// This field is required.
pub fn data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.data = ::std::option::Option::Some(input.into());
self
}
/// <p>The content of the message itself.</p>
pub fn set_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.data = input;
self
}
/// <p>The content of the message itself.</p>
pub fn get_data(&self) -> &::std::option::Option<::std::string::String> {
&self.data
}
/// <p>The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify <code>UTF-8</code>, <code>ISO-8859-1</code>, or <code>Shift_JIS</code>.</p>
pub fn charset(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.charset = ::std::option::Option::Some(input.into());
self
}
/// <p>The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify <code>UTF-8</code>, <code>ISO-8859-1</code>, or <code>Shift_JIS</code>.</p>
pub fn set_charset(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.charset = input;
self
}
/// <p>The character set for the content. Because of the constraints of the SMTP protocol, Amazon Pinpoint uses 7-bit ASCII by default. If the text includes characters outside of the ASCII range, you have to specify a character set. For example, you could specify <code>UTF-8</code>, <code>ISO-8859-1</code>, or <code>Shift_JIS</code>.</p>
pub fn get_charset(&self) -> &::std::option::Option<::std::string::String> {
&self.charset
}
/// Consumes the builder and constructs a [`Content`](crate::types::Content).
/// This method will fail if any of the following fields are not set:
/// - [`data`](crate::types::builders::ContentBuilder::data)
pub fn build(self) -> ::std::result::Result<crate::types::Content, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Content {
data: self.data.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"data",
"data was not specified but it is required when building Content",
)
})?,
charset: self.charset,
})
}
}