aws_sdk_geoplaces/operation/autocomplete/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::autocomplete::_autocomplete_output::AutocompleteOutputBuilder;
3
4pub use crate::operation::autocomplete::_autocomplete_input::AutocompleteInputBuilder;
5
6impl crate::operation::autocomplete::builders::AutocompleteInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::autocomplete::AutocompleteOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::autocomplete::AutocompleteError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.autocomplete();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `Autocomplete`.
24///
25/// <p><code>Autocomplete</code> completes potential places and addresses as the user types, based on the partial input. The API enhances the efficiency and accuracy of address by completing query based on a few entered keystrokes. It helps you by completing partial queries with valid address completion. Also, the API supports the filtering of results based on geographic location, country, or specific place types, and can be tailored using optional parameters like language and political views.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct AutocompleteFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::autocomplete::builders::AutocompleteInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::autocomplete::AutocompleteOutput,
35        crate::operation::autocomplete::AutocompleteError,
36    > for AutocompleteFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::autocomplete::AutocompleteOutput,
44            crate::operation::autocomplete::AutocompleteError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl AutocompleteFluentBuilder {
51    /// Creates a new `AutocompleteFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the Autocomplete as a reference.
60    pub fn as_input(&self) -> &crate::operation::autocomplete::builders::AutocompleteInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::autocomplete::AutocompleteOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::autocomplete::AutocompleteError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::autocomplete::Autocomplete::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::autocomplete::Autocomplete::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::autocomplete::AutocompleteOutput,
97        crate::operation::autocomplete::AutocompleteError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <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>
112    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
113    /// </note>
114    pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.query_text(input.into());
116        self
117    }
118    /// <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>
119    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
120    /// </note>
121    pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_query_text(input);
123        self
124    }
125    /// <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>
126    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
127    /// </note>
128    pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_query_text()
130    }
131    /// <p>An optional limit for the number of results returned in a single call.</p>
132    pub fn max_results(mut self, input: i32) -> Self {
133        self.inner = self.inner.max_results(input);
134        self
135    }
136    /// <p>An optional limit for the number of results returned in a single call.</p>
137    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
138        self.inner = self.inner.set_max_results(input);
139        self
140    }
141    /// <p>An optional limit for the number of results returned in a single call.</p>
142    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
143        self.inner.get_max_results()
144    }
145    ///
146    /// Appends an item to `BiasPosition`.
147    ///
148    /// To override the contents of this collection use [`set_bias_position`](Self::set_bias_position).
149    ///
150    /// <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>
151    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
152    /// </note>
153    pub fn bias_position(mut self, input: f64) -> Self {
154        self.inner = self.inner.bias_position(input);
155        self
156    }
157    /// <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>
158    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
159    /// </note>
160    pub fn set_bias_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
161        self.inner = self.inner.set_bias_position(input);
162        self
163    }
164    /// <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>
165    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
166    /// </note>
167    pub fn get_bias_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
168        self.inner.get_bias_position()
169    }
170    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
171    pub fn filter(mut self, input: crate::types::AutocompleteFilter) -> Self {
172        self.inner = self.inner.filter(input);
173        self
174    }
175    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
176    pub fn set_filter(mut self, input: ::std::option::Option<crate::types::AutocompleteFilter>) -> Self {
177        self.inner = self.inner.set_filter(input);
178        self
179    }
180    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
181    pub fn get_filter(&self) -> &::std::option::Option<crate::types::AutocompleteFilter> {
182        self.inner.get_filter()
183    }
184    /// <p>The <code>PostalCodeMode</code> affects how postal code results are returned. If a postal code spans multiple localities and this value is empty, partial district or locality information may be returned under a single postal code result entry. If it's populated with the value <code>EnumerateSpannedLocalities</code>, all cities in that postal code are returned.</p>
185    pub fn postal_code_mode(mut self, input: crate::types::PostalCodeMode) -> Self {
186        self.inner = self.inner.postal_code_mode(input);
187        self
188    }
189    /// <p>The <code>PostalCodeMode</code> affects how postal code results are returned. If a postal code spans multiple localities and this value is empty, partial district or locality information may be returned under a single postal code result entry. If it's populated with the value <code>EnumerateSpannedLocalities</code>, all cities in that postal code are returned.</p>
190    pub fn set_postal_code_mode(mut self, input: ::std::option::Option<crate::types::PostalCodeMode>) -> Self {
191        self.inner = self.inner.set_postal_code_mode(input);
192        self
193    }
194    /// <p>The <code>PostalCodeMode</code> affects how postal code results are returned. If a postal code spans multiple localities and this value is empty, partial district or locality information may be returned under a single postal code result entry. If it's populated with the value <code>EnumerateSpannedLocalities</code>, all cities in that postal code are returned.</p>
195    pub fn get_postal_code_mode(&self) -> &::std::option::Option<crate::types::PostalCodeMode> {
196        self.inner.get_postal_code_mode()
197    }
198    ///
199    /// Appends an item to `AdditionalFeatures`.
200    ///
201    /// To override the contents of this collection use [`set_additional_features`](Self::set_additional_features).
202    ///
203    /// <p>A list of optional additional parameters that can be requested for each result.</p>
204    pub fn additional_features(mut self, input: crate::types::AutocompleteAdditionalFeature) -> Self {
205        self.inner = self.inner.additional_features(input);
206        self
207    }
208    /// <p>A list of optional additional parameters that can be requested for each result.</p>
209    pub fn set_additional_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AutocompleteAdditionalFeature>>) -> Self {
210        self.inner = self.inner.set_additional_features(input);
211        self
212    }
213    /// <p>A list of optional additional parameters that can be requested for each result.</p>
214    pub fn get_additional_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AutocompleteAdditionalFeature>> {
215        self.inner.get_additional_features()
216    }
217    /// <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>
218    pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219        self.inner = self.inner.language(input.into());
220        self
221    }
222    /// <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>
223    pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224        self.inner = self.inner.set_language(input);
225        self
226    }
227    /// <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>
228    pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
229        self.inner.get_language()
230    }
231    /// <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>
232    /// <p>The following political views are currently supported:</p>
233    /// <ul>
234    /// <li>
235    /// <p><code>ARG</code>: Argentina's view on the Southern Patagonian Ice Field and Tierra Del Fuego, including the Falkland Islands, South Georgia, and South Sandwich Islands</p></li>
236    /// <li>
237    /// <p><code>EGY</code>: Egypt's view on Bir Tawil</p></li>
238    /// <li>
239    /// <p><code>IND</code>: India's view on Gilgit-Baltistan</p></li>
240    /// <li>
241    /// <p><code>KEN</code>: Kenya's view on the Ilemi Triangle</p></li>
242    /// <li>
243    /// <p><code>MAR</code>: Morocco's view on Western Sahara</p></li>
244    /// <li>
245    /// <p><code>RUS</code>: Russia's view on Crimea</p></li>
246    /// <li>
247    /// <p><code>SDN</code>: Sudan's view on the Halaib Triangle</p></li>
248    /// <li>
249    /// <p><code>SRB</code>: Serbia's view on Kosovo, Vukovar, and Sarengrad Islands</p></li>
250    /// <li>
251    /// <p><code>SUR</code>: Suriname's view on the Courantyne Headwaters and Lawa Headwaters</p></li>
252    /// <li>
253    /// <p><code>SYR</code>: Syria's view on the Golan Heights</p></li>
254    /// <li>
255    /// <p><code>TUR</code>: Turkey's view on Cyprus and Northern Cyprus</p></li>
256    /// <li>
257    /// <p><code>TZA</code>: Tanzania's view on Lake Malawi</p></li>
258    /// <li>
259    /// <p><code>URY</code>: Uruguay's view on Rincon de Artigas</p></li>
260    /// <li>
261    /// <p><code>VNM</code>: Vietnam's view on the Paracel Islands and Spratly Islands</p></li>
262    /// </ul>
263    pub fn political_view(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264        self.inner = self.inner.political_view(input.into());
265        self
266    }
267    /// <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>
268    /// <p>The following political views are currently supported:</p>
269    /// <ul>
270    /// <li>
271    /// <p><code>ARG</code>: Argentina's view on the Southern Patagonian Ice Field and Tierra Del Fuego, including the Falkland Islands, South Georgia, and South Sandwich Islands</p></li>
272    /// <li>
273    /// <p><code>EGY</code>: Egypt's view on Bir Tawil</p></li>
274    /// <li>
275    /// <p><code>IND</code>: India's view on Gilgit-Baltistan</p></li>
276    /// <li>
277    /// <p><code>KEN</code>: Kenya's view on the Ilemi Triangle</p></li>
278    /// <li>
279    /// <p><code>MAR</code>: Morocco's view on Western Sahara</p></li>
280    /// <li>
281    /// <p><code>RUS</code>: Russia's view on Crimea</p></li>
282    /// <li>
283    /// <p><code>SDN</code>: Sudan's view on the Halaib Triangle</p></li>
284    /// <li>
285    /// <p><code>SRB</code>: Serbia's view on Kosovo, Vukovar, and Sarengrad Islands</p></li>
286    /// <li>
287    /// <p><code>SUR</code>: Suriname's view on the Courantyne Headwaters and Lawa Headwaters</p></li>
288    /// <li>
289    /// <p><code>SYR</code>: Syria's view on the Golan Heights</p></li>
290    /// <li>
291    /// <p><code>TUR</code>: Turkey's view on Cyprus and Northern Cyprus</p></li>
292    /// <li>
293    /// <p><code>TZA</code>: Tanzania's view on Lake Malawi</p></li>
294    /// <li>
295    /// <p><code>URY</code>: Uruguay's view on Rincon de Artigas</p></li>
296    /// <li>
297    /// <p><code>VNM</code>: Vietnam's view on the Paracel Islands and Spratly Islands</p></li>
298    /// </ul>
299    pub fn set_political_view(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
300        self.inner = self.inner.set_political_view(input);
301        self
302    }
303    /// <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>
304    /// <p>The following political views are currently supported:</p>
305    /// <ul>
306    /// <li>
307    /// <p><code>ARG</code>: Argentina's view on the Southern Patagonian Ice Field and Tierra Del Fuego, including the Falkland Islands, South Georgia, and South Sandwich Islands</p></li>
308    /// <li>
309    /// <p><code>EGY</code>: Egypt's view on Bir Tawil</p></li>
310    /// <li>
311    /// <p><code>IND</code>: India's view on Gilgit-Baltistan</p></li>
312    /// <li>
313    /// <p><code>KEN</code>: Kenya's view on the Ilemi Triangle</p></li>
314    /// <li>
315    /// <p><code>MAR</code>: Morocco's view on Western Sahara</p></li>
316    /// <li>
317    /// <p><code>RUS</code>: Russia's view on Crimea</p></li>
318    /// <li>
319    /// <p><code>SDN</code>: Sudan's view on the Halaib Triangle</p></li>
320    /// <li>
321    /// <p><code>SRB</code>: Serbia's view on Kosovo, Vukovar, and Sarengrad Islands</p></li>
322    /// <li>
323    /// <p><code>SUR</code>: Suriname's view on the Courantyne Headwaters and Lawa Headwaters</p></li>
324    /// <li>
325    /// <p><code>SYR</code>: Syria's view on the Golan Heights</p></li>
326    /// <li>
327    /// <p><code>TUR</code>: Turkey's view on Cyprus and Northern Cyprus</p></li>
328    /// <li>
329    /// <p><code>TZA</code>: Tanzania's view on Lake Malawi</p></li>
330    /// <li>
331    /// <p><code>URY</code>: Uruguay's view on Rincon de Artigas</p></li>
332    /// <li>
333    /// <p><code>VNM</code>: Vietnam's view on the Paracel Islands and Spratly Islands</p></li>
334    /// </ul>
335    pub fn get_political_view(&self) -> &::std::option::Option<::std::string::String> {
336        self.inner.get_political_view()
337    }
338    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
339    pub fn intended_use(mut self, input: crate::types::AutocompleteIntendedUse) -> Self {
340        self.inner = self.inner.intended_use(input);
341        self
342    }
343    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
344    pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::AutocompleteIntendedUse>) -> Self {
345        self.inner = self.inner.set_intended_use(input);
346        self
347    }
348    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
349    pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::AutocompleteIntendedUse> {
350        self.inner.get_intended_use()
351    }
352    /// <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>
353    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
354        self.inner = self.inner.key(input.into());
355        self
356    }
357    /// <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>
358    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
359        self.inner = self.inner.set_key(input);
360        self
361    }
362    /// <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>
363    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
364        self.inner.get_key()
365    }
366}