aws_sdk_sesv2/operation/create_contact/
_create_contact_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateContactInput {
6    /// <p>The name of the contact list to which the contact should be added.</p>
7    pub contact_list_name: ::std::option::Option<::std::string::String>,
8    /// <p>The contact's email address.</p>
9    pub email_address: ::std::option::Option<::std::string::String>,
10    /// <p>The contact's preferences for being opted-in to or opted-out of topics.</p>
11    pub topic_preferences: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>,
12    /// <p>A boolean value status noting if the contact is unsubscribed from all contact list topics.</p>
13    pub unsubscribe_all: ::std::option::Option<bool>,
14    /// <p>The attribute data attached to a contact.</p>
15    pub attributes_data: ::std::option::Option<::std::string::String>,
16}
17impl CreateContactInput {
18    /// <p>The name of the contact list to which the contact should be added.</p>
19    pub fn contact_list_name(&self) -> ::std::option::Option<&str> {
20        self.contact_list_name.as_deref()
21    }
22    /// <p>The contact's email address.</p>
23    pub fn email_address(&self) -> ::std::option::Option<&str> {
24        self.email_address.as_deref()
25    }
26    /// <p>The contact's preferences for being opted-in to or opted-out of topics.</p>
27    ///
28    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.topic_preferences.is_none()`.
29    pub fn topic_preferences(&self) -> &[crate::types::TopicPreference] {
30        self.topic_preferences.as_deref().unwrap_or_default()
31    }
32    /// <p>A boolean value status noting if the contact is unsubscribed from all contact list topics.</p>
33    pub fn unsubscribe_all(&self) -> ::std::option::Option<bool> {
34        self.unsubscribe_all
35    }
36    /// <p>The attribute data attached to a contact.</p>
37    pub fn attributes_data(&self) -> ::std::option::Option<&str> {
38        self.attributes_data.as_deref()
39    }
40}
41impl CreateContactInput {
42    /// Creates a new builder-style object to manufacture [`CreateContactInput`](crate::operation::create_contact::CreateContactInput).
43    pub fn builder() -> crate::operation::create_contact::builders::CreateContactInputBuilder {
44        crate::operation::create_contact::builders::CreateContactInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateContactInput`](crate::operation::create_contact::CreateContactInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateContactInputBuilder {
52    pub(crate) contact_list_name: ::std::option::Option<::std::string::String>,
53    pub(crate) email_address: ::std::option::Option<::std::string::String>,
54    pub(crate) topic_preferences: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>,
55    pub(crate) unsubscribe_all: ::std::option::Option<bool>,
56    pub(crate) attributes_data: ::std::option::Option<::std::string::String>,
57}
58impl CreateContactInputBuilder {
59    /// <p>The name of the contact list to which the contact should be added.</p>
60    /// This field is required.
61    pub fn contact_list_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.contact_list_name = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The name of the contact list to which the contact should be added.</p>
66    pub fn set_contact_list_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.contact_list_name = input;
68        self
69    }
70    /// <p>The name of the contact list to which the contact should be added.</p>
71    pub fn get_contact_list_name(&self) -> &::std::option::Option<::std::string::String> {
72        &self.contact_list_name
73    }
74    /// <p>The contact's email address.</p>
75    /// This field is required.
76    pub fn email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.email_address = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>The contact's email address.</p>
81    pub fn set_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.email_address = input;
83        self
84    }
85    /// <p>The contact's email address.</p>
86    pub fn get_email_address(&self) -> &::std::option::Option<::std::string::String> {
87        &self.email_address
88    }
89    /// Appends an item to `topic_preferences`.
90    ///
91    /// To override the contents of this collection use [`set_topic_preferences`](Self::set_topic_preferences).
92    ///
93    /// <p>The contact's preferences for being opted-in to or opted-out of topics.</p>
94    pub fn topic_preferences(mut self, input: crate::types::TopicPreference) -> Self {
95        let mut v = self.topic_preferences.unwrap_or_default();
96        v.push(input);
97        self.topic_preferences = ::std::option::Option::Some(v);
98        self
99    }
100    /// <p>The contact's preferences for being opted-in to or opted-out of topics.</p>
101    pub fn set_topic_preferences(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>) -> Self {
102        self.topic_preferences = input;
103        self
104    }
105    /// <p>The contact's preferences for being opted-in to or opted-out of topics.</p>
106    pub fn get_topic_preferences(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>> {
107        &self.topic_preferences
108    }
109    /// <p>A boolean value status noting if the contact is unsubscribed from all contact list topics.</p>
110    pub fn unsubscribe_all(mut self, input: bool) -> Self {
111        self.unsubscribe_all = ::std::option::Option::Some(input);
112        self
113    }
114    /// <p>A boolean value status noting if the contact is unsubscribed from all contact list topics.</p>
115    pub fn set_unsubscribe_all(mut self, input: ::std::option::Option<bool>) -> Self {
116        self.unsubscribe_all = input;
117        self
118    }
119    /// <p>A boolean value status noting if the contact is unsubscribed from all contact list topics.</p>
120    pub fn get_unsubscribe_all(&self) -> &::std::option::Option<bool> {
121        &self.unsubscribe_all
122    }
123    /// <p>The attribute data attached to a contact.</p>
124    pub fn attributes_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.attributes_data = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>The attribute data attached to a contact.</p>
129    pub fn set_attributes_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.attributes_data = input;
131        self
132    }
133    /// <p>The attribute data attached to a contact.</p>
134    pub fn get_attributes_data(&self) -> &::std::option::Option<::std::string::String> {
135        &self.attributes_data
136    }
137    /// Consumes the builder and constructs a [`CreateContactInput`](crate::operation::create_contact::CreateContactInput).
138    pub fn build(
139        self,
140    ) -> ::std::result::Result<crate::operation::create_contact::CreateContactInput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::create_contact::CreateContactInput {
142            contact_list_name: self.contact_list_name,
143            email_address: self.email_address,
144            topic_preferences: self.topic_preferences,
145            unsubscribe_all: self.unsubscribe_all,
146            attributes_data: self.attributes_data,
147        })
148    }
149}