aws_sdk_connectcases/operation/search_cases/
_search_cases_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 SearchCasesOutput {
6    /// <p>The token for the next set of results. This is null if there are no more results to return.</p>
7    pub next_token: ::std::option::Option<::std::string::String>,
8    /// <p>A list of case documents where each case contains the properties <code>CaseId</code> and <code>Fields</code> where each field is a complex union structure.</p>
9    pub cases: ::std::vec::Vec<::std::option::Option<crate::types::SearchCasesResponseItem>>,
10    _request_id: Option<String>,
11}
12impl SearchCasesOutput {
13    /// <p>The token for the next set of results. This is null if there are no more results to return.</p>
14    pub fn next_token(&self) -> ::std::option::Option<&str> {
15        self.next_token.as_deref()
16    }
17    /// <p>A list of case documents where each case contains the properties <code>CaseId</code> and <code>Fields</code> where each field is a complex union structure.</p>
18    pub fn cases(&self) -> &[::std::option::Option<crate::types::SearchCasesResponseItem>] {
19        use std::ops::Deref;
20        self.cases.deref()
21    }
22}
23impl ::aws_types::request_id::RequestId for SearchCasesOutput {
24    fn request_id(&self) -> Option<&str> {
25        self._request_id.as_deref()
26    }
27}
28impl SearchCasesOutput {
29    /// Creates a new builder-style object to manufacture [`SearchCasesOutput`](crate::operation::search_cases::SearchCasesOutput).
30    pub fn builder() -> crate::operation::search_cases::builders::SearchCasesOutputBuilder {
31        crate::operation::search_cases::builders::SearchCasesOutputBuilder::default()
32    }
33}
34
35/// A builder for [`SearchCasesOutput`](crate::operation::search_cases::SearchCasesOutput).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct SearchCasesOutputBuilder {
39    pub(crate) next_token: ::std::option::Option<::std::string::String>,
40    pub(crate) cases: ::std::option::Option<::std::vec::Vec<::std::option::Option<crate::types::SearchCasesResponseItem>>>,
41    _request_id: Option<String>,
42}
43impl SearchCasesOutputBuilder {
44    /// <p>The token for the next set of results. This is null if there are no more results to return.</p>
45    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.next_token = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>The token for the next set of results. This is null if there are no more results to return.</p>
50    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.next_token = input;
52        self
53    }
54    /// <p>The token for the next set of results. This is null if there are no more results to return.</p>
55    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
56        &self.next_token
57    }
58    /// Appends an item to `cases`.
59    ///
60    /// To override the contents of this collection use [`set_cases`](Self::set_cases).
61    ///
62    /// <p>A list of case documents where each case contains the properties <code>CaseId</code> and <code>Fields</code> where each field is a complex union structure.</p>
63    pub fn cases(mut self, input: ::std::option::Option<crate::types::SearchCasesResponseItem>) -> Self {
64        let mut v = self.cases.unwrap_or_default();
65        v.push(input);
66        self.cases = ::std::option::Option::Some(v);
67        self
68    }
69    /// <p>A list of case documents where each case contains the properties <code>CaseId</code> and <code>Fields</code> where each field is a complex union structure.</p>
70    pub fn set_cases(mut self, input: ::std::option::Option<::std::vec::Vec<::std::option::Option<crate::types::SearchCasesResponseItem>>>) -> Self {
71        self.cases = input;
72        self
73    }
74    /// <p>A list of case documents where each case contains the properties <code>CaseId</code> and <code>Fields</code> where each field is a complex union structure.</p>
75    pub fn get_cases(&self) -> &::std::option::Option<::std::vec::Vec<::std::option::Option<crate::types::SearchCasesResponseItem>>> {
76        &self.cases
77    }
78    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
79        self._request_id = Some(request_id.into());
80        self
81    }
82
83    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
84        self._request_id = request_id;
85        self
86    }
87    /// Consumes the builder and constructs a [`SearchCasesOutput`](crate::operation::search_cases::SearchCasesOutput).
88    /// This method will fail if any of the following fields are not set:
89    /// - [`cases`](crate::operation::search_cases::builders::SearchCasesOutputBuilder::cases)
90    pub fn build(self) -> ::std::result::Result<crate::operation::search_cases::SearchCasesOutput, ::aws_smithy_types::error::operation::BuildError> {
91        ::std::result::Result::Ok(crate::operation::search_cases::SearchCasesOutput {
92            next_token: self.next_token,
93            cases: self.cases.ok_or_else(|| {
94                ::aws_smithy_types::error::operation::BuildError::missing_field(
95                    "cases",
96                    "cases was not specified but it is required when building SearchCasesOutput",
97                )
98            })?,
99            _request_id: self._request_id,
100        })
101    }
102}