aws_sdk_connect/operation/search_contacts/
_search_contacts_output.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 SearchContactsOutput {
6    /// <p>Information about the contacts.</p>
7    pub contacts: ::std::vec::Vec<crate::types::ContactSearchSummary>,
8    /// <p>If there are additional results, this is the token for the next set of results.</p>
9    pub next_token: ::std::option::Option<::std::string::String>,
10    /// <p>The total number of contacts which matched your search query.</p>
11    pub total_count: ::std::option::Option<i64>,
12    _request_id: Option<String>,
13}
14impl SearchContactsOutput {
15    /// <p>Information about the contacts.</p>
16    pub fn contacts(&self) -> &[crate::types::ContactSearchSummary] {
17        use std::ops::Deref;
18        self.contacts.deref()
19    }
20    /// <p>If there are additional results, this is the token for the next set of results.</p>
21    pub fn next_token(&self) -> ::std::option::Option<&str> {
22        self.next_token.as_deref()
23    }
24    /// <p>The total number of contacts which matched your search query.</p>
25    pub fn total_count(&self) -> ::std::option::Option<i64> {
26        self.total_count
27    }
28}
29impl ::aws_types::request_id::RequestId for SearchContactsOutput {
30    fn request_id(&self) -> Option<&str> {
31        self._request_id.as_deref()
32    }
33}
34impl SearchContactsOutput {
35    /// Creates a new builder-style object to manufacture [`SearchContactsOutput`](crate::operation::search_contacts::SearchContactsOutput).
36    pub fn builder() -> crate::operation::search_contacts::builders::SearchContactsOutputBuilder {
37        crate::operation::search_contacts::builders::SearchContactsOutputBuilder::default()
38    }
39}
40
41/// A builder for [`SearchContactsOutput`](crate::operation::search_contacts::SearchContactsOutput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct SearchContactsOutputBuilder {
45    pub(crate) contacts: ::std::option::Option<::std::vec::Vec<crate::types::ContactSearchSummary>>,
46    pub(crate) next_token: ::std::option::Option<::std::string::String>,
47    pub(crate) total_count: ::std::option::Option<i64>,
48    _request_id: Option<String>,
49}
50impl SearchContactsOutputBuilder {
51    /// Appends an item to `contacts`.
52    ///
53    /// To override the contents of this collection use [`set_contacts`](Self::set_contacts).
54    ///
55    /// <p>Information about the contacts.</p>
56    pub fn contacts(mut self, input: crate::types::ContactSearchSummary) -> Self {
57        let mut v = self.contacts.unwrap_or_default();
58        v.push(input);
59        self.contacts = ::std::option::Option::Some(v);
60        self
61    }
62    /// <p>Information about the contacts.</p>
63    pub fn set_contacts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ContactSearchSummary>>) -> Self {
64        self.contacts = input;
65        self
66    }
67    /// <p>Information about the contacts.</p>
68    pub fn get_contacts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ContactSearchSummary>> {
69        &self.contacts
70    }
71    /// <p>If there are additional results, this is the token for the next set of results.</p>
72    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73        self.next_token = ::std::option::Option::Some(input.into());
74        self
75    }
76    /// <p>If there are additional results, this is the token for the next set of results.</p>
77    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
78        self.next_token = input;
79        self
80    }
81    /// <p>If there are additional results, this is the token for the next set of results.</p>
82    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
83        &self.next_token
84    }
85    /// <p>The total number of contacts which matched your search query.</p>
86    pub fn total_count(mut self, input: i64) -> Self {
87        self.total_count = ::std::option::Option::Some(input);
88        self
89    }
90    /// <p>The total number of contacts which matched your search query.</p>
91    pub fn set_total_count(mut self, input: ::std::option::Option<i64>) -> Self {
92        self.total_count = input;
93        self
94    }
95    /// <p>The total number of contacts which matched your search query.</p>
96    pub fn get_total_count(&self) -> &::std::option::Option<i64> {
97        &self.total_count
98    }
99    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
100        self._request_id = Some(request_id.into());
101        self
102    }
103
104    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
105        self._request_id = request_id;
106        self
107    }
108    /// Consumes the builder and constructs a [`SearchContactsOutput`](crate::operation::search_contacts::SearchContactsOutput).
109    /// This method will fail if any of the following fields are not set:
110    /// - [`contacts`](crate::operation::search_contacts::builders::SearchContactsOutputBuilder::contacts)
111    pub fn build(
112        self,
113    ) -> ::std::result::Result<crate::operation::search_contacts::SearchContactsOutput, ::aws_smithy_types::error::operation::BuildError> {
114        ::std::result::Result::Ok(crate::operation::search_contacts::SearchContactsOutput {
115            contacts: self.contacts.ok_or_else(|| {
116                ::aws_smithy_types::error::operation::BuildError::missing_field(
117                    "contacts",
118                    "contacts was not specified but it is required when building SearchContactsOutput",
119                )
120            })?,
121            next_token: self.next_token,
122            total_count: self.total_count,
123            _request_id: self._request_id,
124        })
125    }
126}