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