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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The content of the email, composed of a subject line and either an HTML part or a text-only part.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Template {
/// <p>The name of the template. You use this name when you send email using the <code>SendTemplatedEmail</code> or <code>SendBulkTemplatedEmail</code> operations.</p>
pub template_name: ::std::string::String,
/// <p>The subject line of the email.</p>
pub subject_part: ::std::option::Option<::std::string::String>,
/// <p>The email body that is visible to recipients whose email clients do not display HTML content.</p>
pub text_part: ::std::option::Option<::std::string::String>,
/// <p>The HTML body of the email.</p>
pub html_part: ::std::option::Option<::std::string::String>,
}
impl Template {
/// <p>The name of the template. You use this name when you send email using the <code>SendTemplatedEmail</code> or <code>SendBulkTemplatedEmail</code> operations.</p>
pub fn template_name(&self) -> &str {
use std::ops::Deref;
self.template_name.deref()
}
/// <p>The subject line of the email.</p>
pub fn subject_part(&self) -> ::std::option::Option<&str> {
self.subject_part.as_deref()
}
/// <p>The email body that is visible to recipients whose email clients do not display HTML content.</p>
pub fn text_part(&self) -> ::std::option::Option<&str> {
self.text_part.as_deref()
}
/// <p>The HTML body of the email.</p>
pub fn html_part(&self) -> ::std::option::Option<&str> {
self.html_part.as_deref()
}
}
impl Template {
/// Creates a new builder-style object to manufacture [`Template`](crate::types::Template).
pub fn builder() -> crate::types::builders::TemplateBuilder {
crate::types::builders::TemplateBuilder::default()
}
}
/// A builder for [`Template`](crate::types::Template).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct TemplateBuilder {
pub(crate) template_name: ::std::option::Option<::std::string::String>,
pub(crate) subject_part: ::std::option::Option<::std::string::String>,
pub(crate) text_part: ::std::option::Option<::std::string::String>,
pub(crate) html_part: ::std::option::Option<::std::string::String>,
}
impl TemplateBuilder {
/// <p>The name of the template. You use this name when you send email using the <code>SendTemplatedEmail</code> or <code>SendBulkTemplatedEmail</code> operations.</p>
/// This field is required.
pub fn template_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.template_name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the template. You use this name when you send email using the <code>SendTemplatedEmail</code> or <code>SendBulkTemplatedEmail</code> operations.</p>
pub fn set_template_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.template_name = input;
self
}
/// <p>The name of the template. You use this name when you send email using the <code>SendTemplatedEmail</code> or <code>SendBulkTemplatedEmail</code> operations.</p>
pub fn get_template_name(&self) -> &::std::option::Option<::std::string::String> {
&self.template_name
}
/// <p>The subject line of the email.</p>
pub fn subject_part(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.subject_part = ::std::option::Option::Some(input.into());
self
}
/// <p>The subject line of the email.</p>
pub fn set_subject_part(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.subject_part = input;
self
}
/// <p>The subject line of the email.</p>
pub fn get_subject_part(&self) -> &::std::option::Option<::std::string::String> {
&self.subject_part
}
/// <p>The email body that is visible to recipients whose email clients do not display HTML content.</p>
pub fn text_part(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.text_part = ::std::option::Option::Some(input.into());
self
}
/// <p>The email body that is visible to recipients whose email clients do not display HTML content.</p>
pub fn set_text_part(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text_part = input;
self
}
/// <p>The email body that is visible to recipients whose email clients do not display HTML content.</p>
pub fn get_text_part(&self) -> &::std::option::Option<::std::string::String> {
&self.text_part
}
/// <p>The HTML body of the email.</p>
pub fn html_part(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.html_part = ::std::option::Option::Some(input.into());
self
}
/// <p>The HTML body of the email.</p>
pub fn set_html_part(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.html_part = input;
self
}
/// <p>The HTML body of the email.</p>
pub fn get_html_part(&self) -> &::std::option::Option<::std::string::String> {
&self.html_part
}
/// Consumes the builder and constructs a [`Template`](crate::types::Template).
/// This method will fail if any of the following fields are not set:
/// - [`template_name`](crate::types::builders::TemplateBuilder::template_name)
pub fn build(self) -> ::std::result::Result<crate::types::Template, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Template {
template_name: self.template_name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"template_name",
"template_name was not specified but it is required when building Template",
)
})?,
subject_part: self.subject_part,
text_part: self.text_part,
html_part: self.html_part,
})
}
}