aws_sdk_geoplaces/operation/reverse_geocode/
_reverse_geocode_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 ReverseGeocodeOutput {
6    /// <p>The pricing bucket for which the query is charged at.</p>
7    /// <p>For more information on pricing, please visit <a href="https://aws.amazon.com/location/pricing/">Amazon Location Service Pricing</a>.</p>
8    pub pricing_bucket: ::std::string::String,
9    /// <p>List of places or results returned for a query.</p>
10    pub result_items: ::std::option::Option<::std::vec::Vec<crate::types::ReverseGeocodeResultItem>>,
11    _request_id: Option<String>,
12}
13impl ReverseGeocodeOutput {
14    /// <p>The pricing bucket for which the query is charged at.</p>
15    /// <p>For more information on pricing, please visit <a href="https://aws.amazon.com/location/pricing/">Amazon Location Service Pricing</a>.</p>
16    pub fn pricing_bucket(&self) -> &str {
17        use std::ops::Deref;
18        self.pricing_bucket.deref()
19    }
20    /// <p>List of places or results returned for a query.</p>
21    ///
22    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.result_items.is_none()`.
23    pub fn result_items(&self) -> &[crate::types::ReverseGeocodeResultItem] {
24        self.result_items.as_deref().unwrap_or_default()
25    }
26}
27impl ::aws_types::request_id::RequestId for ReverseGeocodeOutput {
28    fn request_id(&self) -> Option<&str> {
29        self._request_id.as_deref()
30    }
31}
32impl ReverseGeocodeOutput {
33    /// Creates a new builder-style object to manufacture [`ReverseGeocodeOutput`](crate::operation::reverse_geocode::ReverseGeocodeOutput).
34    pub fn builder() -> crate::operation::reverse_geocode::builders::ReverseGeocodeOutputBuilder {
35        crate::operation::reverse_geocode::builders::ReverseGeocodeOutputBuilder::default()
36    }
37}
38
39/// A builder for [`ReverseGeocodeOutput`](crate::operation::reverse_geocode::ReverseGeocodeOutput).
40#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
41#[non_exhaustive]
42pub struct ReverseGeocodeOutputBuilder {
43    pub(crate) pricing_bucket: ::std::option::Option<::std::string::String>,
44    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::ReverseGeocodeResultItem>>,
45    _request_id: Option<String>,
46}
47impl ReverseGeocodeOutputBuilder {
48    /// <p>The pricing bucket for which the query is charged at.</p>
49    /// <p>For more information on pricing, please visit <a href="https://aws.amazon.com/location/pricing/">Amazon Location Service Pricing</a>.</p>
50    /// This field is required.
51    pub fn pricing_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
52        self.pricing_bucket = ::std::option::Option::Some(input.into());
53        self
54    }
55    /// <p>The pricing bucket for which the query is charged at.</p>
56    /// <p>For more information on pricing, please visit <a href="https://aws.amazon.com/location/pricing/">Amazon Location Service Pricing</a>.</p>
57    pub fn set_pricing_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58        self.pricing_bucket = input;
59        self
60    }
61    /// <p>The pricing bucket for which the query is charged at.</p>
62    /// <p>For more information on pricing, please visit <a href="https://aws.amazon.com/location/pricing/">Amazon Location Service Pricing</a>.</p>
63    pub fn get_pricing_bucket(&self) -> &::std::option::Option<::std::string::String> {
64        &self.pricing_bucket
65    }
66    /// Appends an item to `result_items`.
67    ///
68    /// To override the contents of this collection use [`set_result_items`](Self::set_result_items).
69    ///
70    /// <p>List of places or results returned for a query.</p>
71    pub fn result_items(mut self, input: crate::types::ReverseGeocodeResultItem) -> Self {
72        let mut v = self.result_items.unwrap_or_default();
73        v.push(input);
74        self.result_items = ::std::option::Option::Some(v);
75        self
76    }
77    /// <p>List of places or results returned for a query.</p>
78    pub fn set_result_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReverseGeocodeResultItem>>) -> Self {
79        self.result_items = input;
80        self
81    }
82    /// <p>List of places or results returned for a query.</p>
83    pub fn get_result_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReverseGeocodeResultItem>> {
84        &self.result_items
85    }
86    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
87        self._request_id = Some(request_id.into());
88        self
89    }
90
91    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
92        self._request_id = request_id;
93        self
94    }
95    /// Consumes the builder and constructs a [`ReverseGeocodeOutput`](crate::operation::reverse_geocode::ReverseGeocodeOutput).
96    /// This method will fail if any of the following fields are not set:
97    /// - [`pricing_bucket`](crate::operation::reverse_geocode::builders::ReverseGeocodeOutputBuilder::pricing_bucket)
98    pub fn build(
99        self,
100    ) -> ::std::result::Result<crate::operation::reverse_geocode::ReverseGeocodeOutput, ::aws_smithy_types::error::operation::BuildError> {
101        ::std::result::Result::Ok(crate::operation::reverse_geocode::ReverseGeocodeOutput {
102            pricing_bucket: self.pricing_bucket.ok_or_else(|| {
103                ::aws_smithy_types::error::operation::BuildError::missing_field(
104                    "pricing_bucket",
105                    "pricing_bucket was not specified but it is required when building ReverseGeocodeOutput",
106                )
107            })?,
108            result_items: self.result_items,
109            _request_id: self._request_id,
110        })
111    }
112}