aws_sdk_geoplaces/operation/suggest/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::suggest::_suggest_output::SuggestOutputBuilder;
3
4pub use crate::operation::suggest::_suggest_input::SuggestInputBuilder;
5
6impl crate::operation::suggest::builders::SuggestInputBuilder {
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::suggest::SuggestOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::suggest::SuggestError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.suggest();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `Suggest`.
24///
25/// <p><code>Suggest</code> provides intelligent predictions or recommendations based on the user's input or context, such as relevant places, points of interest, query terms or search category. It is designed to help users find places or point of interests candidates or identify a follow on query based on incomplete or misspelled queries. It returns a list of possible matches or refinements that can be used to formulate a more accurate query. Users can select the most appropriate suggestion and use it for further searching. The API provides options for filtering results by location and other attributes, and allows for additional features like phonemes and timezones. The response includes refined query terms and detailed place information.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct SuggestFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::suggest::builders::SuggestInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::suggest::SuggestOutput, crate::operation::suggest::SuggestError>
33    for SuggestFluentBuilder
34{
35    fn send(
36        self,
37        config_override: crate::config::Builder,
38    ) -> crate::client::customize::internal::BoxFuture<
39        crate::client::customize::internal::SendResult<crate::operation::suggest::SuggestOutput, crate::operation::suggest::SuggestError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl SuggestFluentBuilder {
45    /// Creates a new `SuggestFluentBuilder`.
46    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47        Self {
48            handle,
49            inner: ::std::default::Default::default(),
50            config_override: ::std::option::Option::None,
51        }
52    }
53    /// Access the Suggest as a reference.
54    pub fn as_input(&self) -> &crate::operation::suggest::builders::SuggestInputBuilder {
55        &self.inner
56    }
57    /// Sends the request and returns the response.
58    ///
59    /// If an error occurs, an `SdkError` will be returned with additional details that
60    /// can be matched against.
61    ///
62    /// By default, any retryable failures will be retried twice. Retry behavior
63    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
64    /// set when configuring the client.
65    pub async fn send(
66        self,
67    ) -> ::std::result::Result<
68        crate::operation::suggest::SuggestOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::suggest::SuggestError,
71            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72        >,
73    > {
74        let input = self
75            .inner
76            .build()
77            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78        let runtime_plugins = crate::operation::suggest::Suggest::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::suggest::Suggest::orchestrate(&runtime_plugins, input).await
84    }
85
86    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
87    pub fn customize(
88        self,
89    ) -> crate::client::customize::CustomizableOperation<crate::operation::suggest::SuggestOutput, crate::operation::suggest::SuggestError, Self>
90    {
91        crate::client::customize::CustomizableOperation::new(self)
92    }
93    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
94        self.set_config_override(::std::option::Option::Some(config_override.into()));
95        self
96    }
97
98    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
99        self.config_override = config_override;
100        self
101    }
102    /// <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>
103    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
104    /// </note>
105    pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106        self.inner = self.inner.query_text(input.into());
107        self
108    }
109    /// <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>
110    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
111    /// </note>
112    pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113        self.inner = self.inner.set_query_text(input);
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><note>
117    /// <p>The fields <code>QueryText</code>, and <code>QueryID</code> are mutually exclusive.</p>
118    /// </note>
119    pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
120        self.inner.get_query_text()
121    }
122    /// <p>An optional limit for the number of results returned in a single call.</p>
123    pub fn max_results(mut self, input: i32) -> Self {
124        self.inner = self.inner.max_results(input);
125        self
126    }
127    /// <p>An optional limit for the number of results returned in a single call.</p>
128    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
129        self.inner = self.inner.set_max_results(input);
130        self
131    }
132    /// <p>An optional limit for the number of results returned in a single call.</p>
133    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
134        self.inner.get_max_results()
135    }
136    /// <p>Maximum number of query terms to be returned for use with a search text query.</p>
137    pub fn max_query_refinements(mut self, input: i32) -> Self {
138        self.inner = self.inner.max_query_refinements(input);
139        self
140    }
141    /// <p>Maximum number of query terms to be returned for use with a search text query.</p>
142    pub fn set_max_query_refinements(mut self, input: ::std::option::Option<i32>) -> Self {
143        self.inner = self.inner.set_max_query_refinements(input);
144        self
145    }
146    /// <p>Maximum number of query terms to be returned for use with a search text query.</p>
147    pub fn get_max_query_refinements(&self) -> &::std::option::Option<i32> {
148        self.inner.get_max_query_refinements()
149    }
150    ///
151    /// Appends an item to `BiasPosition`.
152    ///
153    /// To override the contents of this collection use [`set_bias_position`](Self::set_bias_position).
154    ///
155    /// <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>
156    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
157    /// </note>
158    pub fn bias_position(mut self, input: f64) -> Self {
159        self.inner = self.inner.bias_position(input);
160        self
161    }
162    /// <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>
163    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
164    /// </note>
165    pub fn set_bias_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
166        self.inner = self.inner.set_bias_position(input);
167        self
168    }
169    /// <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>
170    /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
171    /// </note>
172    pub fn get_bias_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
173        self.inner.get_bias_position()
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 filter(mut self, input: crate::types::SuggestFilter) -> Self {
177        self.inner = self.inner.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 set_filter(mut self, input: ::std::option::Option<crate::types::SuggestFilter>) -> Self {
182        self.inner = self.inner.set_filter(input);
183        self
184    }
185    /// <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
186    pub fn get_filter(&self) -> &::std::option::Option<crate::types::SuggestFilter> {
187        self.inner.get_filter()
188    }
189    ///
190    /// Appends an item to `AdditionalFeatures`.
191    ///
192    /// To override the contents of this collection use [`set_additional_features`](Self::set_additional_features).
193    ///
194    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
195    pub fn additional_features(mut self, input: crate::types::SuggestAdditionalFeature) -> Self {
196        self.inner = self.inner.additional_features(input);
197        self
198    }
199    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
200    pub fn set_additional_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SuggestAdditionalFeature>>) -> Self {
201        self.inner = self.inner.set_additional_features(input);
202        self
203    }
204    /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
205    pub fn get_additional_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SuggestAdditionalFeature>> {
206        self.inner.get_additional_features()
207    }
208    /// <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>
209    pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
210        self.inner = self.inner.language(input.into());
211        self
212    }
213    /// <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>
214    pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
215        self.inner = self.inner.set_language(input);
216        self
217    }
218    /// <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>
219    pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
220        self.inner.get_language()
221    }
222    /// <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>
223    pub fn political_view(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
224        self.inner = self.inner.political_view(input.into());
225        self
226    }
227    /// <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>
228    pub fn set_political_view(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
229        self.inner = self.inner.set_political_view(input);
230        self
231    }
232    /// <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>
233    pub fn get_political_view(&self) -> &::std::option::Option<::std::string::String> {
234        self.inner.get_political_view()
235    }
236    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
237    pub fn intended_use(mut self, input: crate::types::SuggestIntendedUse) -> Self {
238        self.inner = self.inner.intended_use(input);
239        self
240    }
241    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
242    pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::SuggestIntendedUse>) -> Self {
243        self.inner = self.inner.set_intended_use(input);
244        self
245    }
246    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
247    pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::SuggestIntendedUse> {
248        self.inner.get_intended_use()
249    }
250    /// <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>
251    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
252        self.inner = self.inner.key(input.into());
253        self
254    }
255    /// <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>
256    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
257        self.inner = self.inner.set_key(input);
258        self
259    }
260    /// <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>
261    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
262        self.inner.get_key()
263    }
264}