aws-sdk-ses 1.96.0

AWS SDK for Amazon Simple Email Service
Documentation
// 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).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
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,
        })
    }
}