aws_sdk_geoplaces/operation/suggest/
_suggest_output.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct SuggestOutput {
6    pub pricing_bucket: ::std::string::String,
9    pub result_items: ::std::option::Option<::std::vec::Vec<crate::types::SuggestResultItem>>,
11    pub query_refinements: ::std::option::Option<::std::vec::Vec<crate::types::QueryRefinement>>,
13    _request_id: Option<String>,
14}
15impl SuggestOutput {
16    pub fn pricing_bucket(&self) -> &str {
19        use std::ops::Deref;
20        self.pricing_bucket.deref()
21    }
22    pub fn result_items(&self) -> &[crate::types::SuggestResultItem] {
26        self.result_items.as_deref().unwrap_or_default()
27    }
28    pub fn query_refinements(&self) -> &[crate::types::QueryRefinement] {
32        self.query_refinements.as_deref().unwrap_or_default()
33    }
34}
35impl ::aws_types::request_id::RequestId for SuggestOutput {
36    fn request_id(&self) -> Option<&str> {
37        self._request_id.as_deref()
38    }
39}
40impl SuggestOutput {
41    pub fn builder() -> crate::operation::suggest::builders::SuggestOutputBuilder {
43        crate::operation::suggest::builders::SuggestOutputBuilder::default()
44    }
45}
46
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct SuggestOutputBuilder {
51    pub(crate) pricing_bucket: ::std::option::Option<::std::string::String>,
52    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::SuggestResultItem>>,
53    pub(crate) query_refinements: ::std::option::Option<::std::vec::Vec<crate::types::QueryRefinement>>,
54    _request_id: Option<String>,
55}
56impl SuggestOutputBuilder {
57    pub fn pricing_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.pricing_bucket = ::std::option::Option::Some(input.into());
62        self
63    }
64    pub fn set_pricing_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.pricing_bucket = input;
68        self
69    }
70    pub fn get_pricing_bucket(&self) -> &::std::option::Option<::std::string::String> {
73        &self.pricing_bucket
74    }
75    pub fn result_items(mut self, input: crate::types::SuggestResultItem) -> Self {
81        let mut v = self.result_items.unwrap_or_default();
82        v.push(input);
83        self.result_items = ::std::option::Option::Some(v);
84        self
85    }
86    pub fn set_result_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SuggestResultItem>>) -> Self {
88        self.result_items = input;
89        self
90    }
91    pub fn get_result_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SuggestResultItem>> {
93        &self.result_items
94    }
95    pub fn query_refinements(mut self, input: crate::types::QueryRefinement) -> Self {
101        let mut v = self.query_refinements.unwrap_or_default();
102        v.push(input);
103        self.query_refinements = ::std::option::Option::Some(v);
104        self
105    }
106    pub fn set_query_refinements(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::QueryRefinement>>) -> Self {
108        self.query_refinements = input;
109        self
110    }
111    pub fn get_query_refinements(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::QueryRefinement>> {
113        &self.query_refinements
114    }
115    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
116        self._request_id = Some(request_id.into());
117        self
118    }
119
120    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
121        self._request_id = request_id;
122        self
123    }
124    pub fn build(self) -> ::std::result::Result<crate::operation::suggest::SuggestOutput, ::aws_smithy_types::error::operation::BuildError> {
128        ::std::result::Result::Ok(crate::operation::suggest::SuggestOutput {
129            pricing_bucket: self.pricing_bucket.ok_or_else(|| {
130                ::aws_smithy_types::error::operation::BuildError::missing_field(
131                    "pricing_bucket",
132                    "pricing_bucket was not specified but it is required when building SuggestOutput",
133                )
134            })?,
135            result_items: self.result_items,
136            query_refinements: self.query_refinements,
137            _request_id: self._request_id,
138        })
139    }
140}