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>The autocomplete operation speeds up and increases the accuracy of entering addresses by providing a list of address candidates matching a partially entered address. Results are sorted from most to least matching. Filtering and biasing can be used to increase the relevance of the results if additional search context is known</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>
112 pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 self.inner = self.inner.query_text(input.into());
114 self
115 }
116 /// <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>
117 pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118 self.inner = self.inner.set_query_text(input);
119 self
120 }
121 /// <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>
122 pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
123 self.inner.get_query_text()
124 }
125 /// <p>An optional limit for the number of results returned in a single call.</p>
126 pub fn max_results(mut self, input: i32) -> Self {
127 self.inner = self.inner.max_results(input);
128 self
129 }
130 /// <p>An optional limit for the number of results returned in a single call.</p>
131 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
132 self.inner = self.inner.set_max_results(input);
133 self
134 }
135 /// <p>An optional limit for the number of results returned in a single call.</p>
136 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
137 self.inner.get_max_results()
138 }
139 ///
140 /// Appends an item to `BiasPosition`.
141 ///
142 /// To override the contents of this collection use [`set_bias_position`](Self::set_bias_position).
143 ///
144 /// <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>
145 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
146 /// </note>
147 pub fn bias_position(mut self, input: f64) -> Self {
148 self.inner = self.inner.bias_position(input);
149 self
150 }
151 /// <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>
152 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
153 /// </note>
154 pub fn set_bias_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
155 self.inner = self.inner.set_bias_position(input);
156 self
157 }
158 /// <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>
159 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
160 /// </note>
161 pub fn get_bias_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
162 self.inner.get_bias_position()
163 }
164 /// <p>A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.</p>
165 pub fn filter(mut self, input: crate::types::AutocompleteFilter) -> Self {
166 self.inner = self.inner.filter(input);
167 self
168 }
169 /// <p>A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.</p>
170 pub fn set_filter(mut self, input: ::std::option::Option<crate::types::AutocompleteFilter>) -> Self {
171 self.inner = self.inner.set_filter(input);
172 self
173 }
174 /// <p>A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.</p>
175 pub fn get_filter(&self) -> &::std::option::Option<crate::types::AutocompleteFilter> {
176 self.inner.get_filter()
177 }
178 /// <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>cityLookup</code>, all cities in that postal code are returned.</p>
179 pub fn postal_code_mode(mut self, input: crate::types::PostalCodeMode) -> Self {
180 self.inner = self.inner.postal_code_mode(input);
181 self
182 }
183 /// <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>cityLookup</code>, all cities in that postal code are returned.</p>
184 pub fn set_postal_code_mode(mut self, input: ::std::option::Option<crate::types::PostalCodeMode>) -> Self {
185 self.inner = self.inner.set_postal_code_mode(input);
186 self
187 }
188 /// <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>cityLookup</code>, all cities in that postal code are returned.</p>
189 pub fn get_postal_code_mode(&self) -> &::std::option::Option<crate::types::PostalCodeMode> {
190 self.inner.get_postal_code_mode()
191 }
192 ///
193 /// Appends an item to `AdditionalFeatures`.
194 ///
195 /// To override the contents of this collection use [`set_additional_features`](Self::set_additional_features).
196 ///
197 /// <p>A list of optional additional parameters that can be requested for each result.</p>
198 pub fn additional_features(mut self, input: crate::types::AutocompleteAdditionalFeature) -> Self {
199 self.inner = self.inner.additional_features(input);
200 self
201 }
202 /// <p>A list of optional additional parameters that can be requested for each result.</p>
203 pub fn set_additional_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AutocompleteAdditionalFeature>>) -> Self {
204 self.inner = self.inner.set_additional_features(input);
205 self
206 }
207 /// <p>A list of optional additional parameters that can be requested for each result.</p>
208 pub fn get_additional_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AutocompleteAdditionalFeature>> {
209 self.inner.get_additional_features()
210 }
211 /// <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>
212 pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213 self.inner = self.inner.language(input.into());
214 self
215 }
216 /// <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>
217 pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
218 self.inner = self.inner.set_language(input);
219 self
220 }
221 /// <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>
222 pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
223 self.inner.get_language()
224 }
225 /// <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>
226 pub fn political_view(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
227 self.inner = self.inner.political_view(input.into());
228 self
229 }
230 /// <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>
231 pub fn set_political_view(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
232 self.inner = self.inner.set_political_view(input);
233 self
234 }
235 /// <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>
236 pub fn get_political_view(&self) -> &::std::option::Option<::std::string::String> {
237 self.inner.get_political_view()
238 }
239 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
240 pub fn intended_use(mut self, input: crate::types::AutocompleteIntendedUse) -> Self {
241 self.inner = self.inner.intended_use(input);
242 self
243 }
244 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
245 pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::AutocompleteIntendedUse>) -> Self {
246 self.inner = self.inner.set_intended_use(input);
247 self
248 }
249 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
250 pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::AutocompleteIntendedUse> {
251 self.inner.get_intended_use()
252 }
253 /// <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>
254 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
255 self.inner = self.inner.key(input.into());
256 self
257 }
258 /// <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>
259 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
260 self.inner = self.inner.set_key(input);
261 self
262 }
263 /// <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>
264 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
265 self.inner.get_key()
266 }
267}