aws_sdk_geoplaces/operation/geocode/
_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 GeocodeOutput {
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::GeocodeResultItem>>,
11    _request_id: Option<String>,
12}
13impl GeocodeOutput {
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::GeocodeResultItem] {
24        self.result_items.as_deref().unwrap_or_default()
25    }
26}
27impl ::aws_types::request_id::RequestId for GeocodeOutput {
28    fn request_id(&self) -> Option<&str> {
29        self._request_id.as_deref()
30    }
31}
32impl GeocodeOutput {
33    /// Creates a new builder-style object to manufacture [`GeocodeOutput`](crate::operation::geocode::GeocodeOutput).
34    pub fn builder() -> crate::operation::geocode::builders::GeocodeOutputBuilder {
35        crate::operation::geocode::builders::GeocodeOutputBuilder::default()
36    }
37}
38
39/// A builder for [`GeocodeOutput`](crate::operation::geocode::GeocodeOutput).
40#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
41#[non_exhaustive]
42pub struct GeocodeOutputBuilder {
43    pub(crate) pricing_bucket: ::std::option::Option<::std::string::String>,
44    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::GeocodeResultItem>>,
45    _request_id: Option<String>,
46}
47impl GeocodeOutputBuilder {
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::GeocodeResultItem) -> 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::GeocodeResultItem>>) -> 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::GeocodeResultItem>> {
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 [`GeocodeOutput`](crate::operation::geocode::GeocodeOutput).
96    /// This method will fail if any of the following fields are not set:
97    /// - [`pricing_bucket`](crate::operation::geocode::builders::GeocodeOutputBuilder::pricing_bucket)
98    pub fn build(self) -> ::std::result::Result<crate::operation::geocode::GeocodeOutput, ::aws_smithy_types::error::operation::BuildError> {
99        ::std::result::Result::Ok(crate::operation::geocode::GeocodeOutput {
100            pricing_bucket: self.pricing_bucket.ok_or_else(|| {
101                ::aws_smithy_types::error::operation::BuildError::missing_field(
102                    "pricing_bucket",
103                    "pricing_bucket was not specified but it is required when building GeocodeOutput",
104                )
105            })?,
106            result_items: self.result_items,
107            _request_id: self._request_id,
108        })
109    }
110}