aws_sdk_geoplaces/operation/geocode/
_geocode_input.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)]
5pub struct GeocodeInput {
6    /// <p>The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.</p><note>
7    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
8    /// </note>
9    pub query_text: ::std::option::Option<::std::string::String>,
10    /// <p>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
11    pub query_components: ::std::option::Option<crate::types::GeocodeQueryComponents>,
12    /// <p>An optional limit for the number of results returned in a single call.</p>
13    pub max_results: ::std::option::Option<i32>,
14    /// <p>The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in <code>\[lng, lat\]</code> and in the WSG84 format.</p><note>
15    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
16    /// </note>
17    pub bias_position: ::std::option::Option<::std::vec::Vec<f64>>,
18    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
19    pub filter: ::std::option::Option<crate::types::GeocodeFilter>,
20    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
21    pub additional_features: ::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>>,
22    /// <p>A list of <a href="https://en.wikipedia.org/wiki/IETF_language_tag">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.</p>
23    pub language: ::std::option::Option<::std::string::String>,
24    /// <p>The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.</p>
25    pub political_view: ::std::option::Option<::std::string::String>,
26    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
27    /// <p>Storing the response of an Geocode query is required to comply with service terms, but charged at a higher cost per request. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p>
28    /// </note>
29    pub intended_use: ::std::option::Option<crate::types::GeocodeIntendedUse>,
30    /// <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
31    pub key: ::std::option::Option<::std::string::String>,
32}
33impl GeocodeInput {
34    /// <p>The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.</p><note>
35    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
36    /// </note>
37    pub fn query_text(&self) -> ::std::option::Option<&str> {
38        self.query_text.as_deref()
39    }
40    /// <p>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
41    pub fn query_components(&self) -> ::std::option::Option<&crate::types::GeocodeQueryComponents> {
42        self.query_components.as_ref()
43    }
44    /// <p>An optional limit for the number of results returned in a single call.</p>
45    pub fn max_results(&self) -> ::std::option::Option<i32> {
46        self.max_results
47    }
48    /// <p>The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in <code>\[lng, lat\]</code> and in the WSG84 format.</p><note>
49    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
50    /// </note>
51    ///
52    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.bias_position.is_none()`.
53    pub fn bias_position(&self) -> &[f64] {
54        self.bias_position.as_deref().unwrap_or_default()
55    }
56    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
57    pub fn filter(&self) -> ::std::option::Option<&crate::types::GeocodeFilter> {
58        self.filter.as_ref()
59    }
60    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
61    ///
62    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.additional_features.is_none()`.
63    pub fn additional_features(&self) -> &[crate::types::GeocodeAdditionalFeature] {
64        self.additional_features.as_deref().unwrap_or_default()
65    }
66    /// <p>A list of <a href="https://en.wikipedia.org/wiki/IETF_language_tag">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.</p>
67    pub fn language(&self) -> ::std::option::Option<&str> {
68        self.language.as_deref()
69    }
70    /// <p>The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.</p>
71    pub fn political_view(&self) -> ::std::option::Option<&str> {
72        self.political_view.as_deref()
73    }
74    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
75    /// <p>Storing the response of an Geocode query is required to comply with service terms, but charged at a higher cost per request. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p>
76    /// </note>
77    pub fn intended_use(&self) -> ::std::option::Option<&crate::types::GeocodeIntendedUse> {
78        self.intended_use.as_ref()
79    }
80    /// <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
81    pub fn key(&self) -> ::std::option::Option<&str> {
82        self.key.as_deref()
83    }
84}
85impl ::std::fmt::Debug for GeocodeInput {
86    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
87        let mut formatter = f.debug_struct("GeocodeInput");
88        formatter.field("query_text", &"*** Sensitive Data Redacted ***");
89        formatter.field("query_components", &self.query_components);
90        formatter.field("max_results", &self.max_results);
91        formatter.field("bias_position", &"*** Sensitive Data Redacted ***");
92        formatter.field("filter", &self.filter);
93        formatter.field("additional_features", &self.additional_features);
94        formatter.field("language", &self.language);
95        formatter.field("political_view", &"*** Sensitive Data Redacted ***");
96        formatter.field("intended_use", &self.intended_use);
97        formatter.field("key", &"*** Sensitive Data Redacted ***");
98        formatter.finish()
99    }
100}
101impl GeocodeInput {
102    /// Creates a new builder-style object to manufacture [`GeocodeInput`](crate::operation::geocode::GeocodeInput).
103    pub fn builder() -> crate::operation::geocode::builders::GeocodeInputBuilder {
104        crate::operation::geocode::builders::GeocodeInputBuilder::default()
105    }
106}
107
108/// A builder for [`GeocodeInput`](crate::operation::geocode::GeocodeInput).
109#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
110#[non_exhaustive]
111pub struct GeocodeInputBuilder {
112    pub(crate) query_text: ::std::option::Option<::std::string::String>,
113    pub(crate) query_components: ::std::option::Option<crate::types::GeocodeQueryComponents>,
114    pub(crate) max_results: ::std::option::Option<i32>,
115    pub(crate) bias_position: ::std::option::Option<::std::vec::Vec<f64>>,
116    pub(crate) filter: ::std::option::Option<crate::types::GeocodeFilter>,
117    pub(crate) additional_features: ::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>>,
118    pub(crate) language: ::std::option::Option<::std::string::String>,
119    pub(crate) political_view: ::std::option::Option<::std::string::String>,
120    pub(crate) intended_use: ::std::option::Option<crate::types::GeocodeIntendedUse>,
121    pub(crate) key: ::std::option::Option<::std::string::String>,
122}
123impl GeocodeInputBuilder {
124    /// <p>The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.</p><note>
125    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
126    /// </note>
127    pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.query_text = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.</p><note>
132    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
133    /// </note>
134    pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.query_text = input;
136        self
137    }
138    /// <p>The free-form text query to match addresses against. This is usually a partially typed address from an end user in an address box or form.</p><note>
139    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
140    /// </note>
141    pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
142        &self.query_text
143    }
144    /// <p>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
145    pub fn query_components(mut self, input: crate::types::GeocodeQueryComponents) -> Self {
146        self.query_components = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
150    pub fn set_query_components(mut self, input: ::std::option::Option<crate::types::GeocodeQueryComponents>) -> Self {
151        self.query_components = input;
152        self
153    }
154    /// <p>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
155    pub fn get_query_components(&self) -> &::std::option::Option<crate::types::GeocodeQueryComponents> {
156        &self.query_components
157    }
158    /// <p>An optional limit for the number of results returned in a single call.</p>
159    pub fn max_results(mut self, input: i32) -> Self {
160        self.max_results = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>An optional limit for the number of results returned in a single call.</p>
164    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
165        self.max_results = input;
166        self
167    }
168    /// <p>An optional limit for the number of results returned in a single call.</p>
169    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
170        &self.max_results
171    }
172    /// Appends an item to `bias_position`.
173    ///
174    /// To override the contents of this collection use [`set_bias_position`](Self::set_bias_position).
175    ///
176    /// <p>The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in <code>\[lng, lat\]</code> and in the WSG84 format.</p><note>
177    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
178    /// </note>
179    pub fn bias_position(mut self, input: f64) -> Self {
180        let mut v = self.bias_position.unwrap_or_default();
181        v.push(input);
182        self.bias_position = ::std::option::Option::Some(v);
183        self
184    }
185    /// <p>The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in <code>\[lng, lat\]</code> and in the WSG84 format.</p><note>
186    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
187    /// </note>
188    pub fn set_bias_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
189        self.bias_position = input;
190        self
191    }
192    /// <p>The position, in longitude and latitude, that the results should be close to. Typically, place results returned are ranked higher the closer they are to this position. Stored in <code>\[lng, lat\]</code> and in the WSG84 format.</p><note>
193    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
194    /// </note>
195    pub fn get_bias_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
196        &self.bias_position
197    }
198    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
199    pub fn filter(mut self, input: crate::types::GeocodeFilter) -> Self {
200        self.filter = ::std::option::Option::Some(input);
201        self
202    }
203    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
204    pub fn set_filter(mut self, input: ::std::option::Option<crate::types::GeocodeFilter>) -> Self {
205        self.filter = input;
206        self
207    }
208    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
209    pub fn get_filter(&self) -> &::std::option::Option<crate::types::GeocodeFilter> {
210        &self.filter
211    }
212    /// Appends an item to `additional_features`.
213    ///
214    /// To override the contents of this collection use [`set_additional_features`](Self::set_additional_features).
215    ///
216    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
217    pub fn additional_features(mut self, input: crate::types::GeocodeAdditionalFeature) -> Self {
218        let mut v = self.additional_features.unwrap_or_default();
219        v.push(input);
220        self.additional_features = ::std::option::Option::Some(v);
221        self
222    }
223    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
224    pub fn set_additional_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>>) -> Self {
225        self.additional_features = input;
226        self
227    }
228    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
229    pub fn get_additional_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>> {
230        &self.additional_features
231    }
232    /// <p>A list of <a href="https://en.wikipedia.org/wiki/IETF_language_tag">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.</p>
233    pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
234        self.language = ::std::option::Option::Some(input.into());
235        self
236    }
237    /// <p>A list of <a href="https://en.wikipedia.org/wiki/IETF_language_tag">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.</p>
238    pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
239        self.language = input;
240        self
241    }
242    /// <p>A list of <a href="https://en.wikipedia.org/wiki/IETF_language_tag">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry.</p>
243    pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
244        &self.language
245    }
246    /// <p>The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.</p>
247    pub fn political_view(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
248        self.political_view = ::std::option::Option::Some(input.into());
249        self
250    }
251    /// <p>The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.</p>
252    pub fn set_political_view(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
253        self.political_view = input;
254        self
255    }
256    /// <p>The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country.</p>
257    pub fn get_political_view(&self) -> &::std::option::Option<::std::string::String> {
258        &self.political_view
259    }
260    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
261    /// <p>Storing the response of an Geocode query is required to comply with service terms, but charged at a higher cost per request. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p>
262    /// </note>
263    pub fn intended_use(mut self, input: crate::types::GeocodeIntendedUse) -> Self {
264        self.intended_use = ::std::option::Option::Some(input);
265        self
266    }
267    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
268    /// <p>Storing the response of an Geocode query is required to comply with service terms, but charged at a higher cost per request. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p>
269    /// </note>
270    pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::GeocodeIntendedUse>) -> Self {
271        self.intended_use = input;
272        self
273    }
274    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
275    /// <p>Storing the response of an Geocode query is required to comply with service terms, but charged at a higher cost per request. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p>
276    /// </note>
277    pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::GeocodeIntendedUse> {
278        &self.intended_use
279    }
280    /// <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
281    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
282        self.key = ::std::option::Option::Some(input.into());
283        self
284    }
285    /// <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
286    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
287        self.key = input;
288        self
289    }
290    /// <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
291    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
292        &self.key
293    }
294    /// Consumes the builder and constructs a [`GeocodeInput`](crate::operation::geocode::GeocodeInput).
295    pub fn build(self) -> ::std::result::Result<crate::operation::geocode::GeocodeInput, ::aws_smithy_types::error::operation::BuildError> {
296        ::std::result::Result::Ok(crate::operation::geocode::GeocodeInput {
297            query_text: self.query_text,
298            query_components: self.query_components,
299            max_results: self.max_results,
300            bias_position: self.bias_position,
301            filter: self.filter,
302            additional_features: self.additional_features,
303            language: self.language,
304            political_view: self.political_view,
305            intended_use: self.intended_use,
306            key: self.key,
307        })
308    }
309}
310impl ::std::fmt::Debug for GeocodeInputBuilder {
311    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
312        let mut formatter = f.debug_struct("GeocodeInputBuilder");
313        formatter.field("query_text", &"*** Sensitive Data Redacted ***");
314        formatter.field("query_components", &self.query_components);
315        formatter.field("max_results", &self.max_results);
316        formatter.field("bias_position", &"*** Sensitive Data Redacted ***");
317        formatter.field("filter", &self.filter);
318        formatter.field("additional_features", &self.additional_features);
319        formatter.field("language", &self.language);
320        formatter.field("political_view", &"*** Sensitive Data Redacted ***");
321        formatter.field("intended_use", &self.intended_use);
322        formatter.field("key", &"*** Sensitive Data Redacted ***");
323        formatter.finish()
324    }
325}