aws_sdk_geoplaces/operation/geocode/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::geocode::_geocode_output::GeocodeOutputBuilder;
3
4pub use crate::operation::geocode::_geocode_input::GeocodeInputBuilder;
5
6impl crate::operation::geocode::builders::GeocodeInputBuilder {
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::geocode::GeocodeOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::geocode::GeocodeError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.geocode();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `Geocode`.
24///
25/// <p><code>Geocode</code> converts a textual address or place into geographic coordinates. You can obtain geographic coordinates, address component, and other related information. It supports flexible queries, including free-form text or structured queries with components like street names, postal codes, and regions. The Geocode API can also provide additional features such as time zone information and the inclusion of political views.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct GeocodeFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::geocode::builders::GeocodeInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::geocode::GeocodeOutput, crate::operation::geocode::GeocodeError>
33    for GeocodeFluentBuilder
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::geocode::GeocodeOutput, crate::operation::geocode::GeocodeError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl GeocodeFluentBuilder {
45    /// Creates a new `GeocodeFluentBuilder`.
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 Geocode as a reference.
54    pub fn as_input(&self) -> &crate::operation::geocode::builders::GeocodeInputBuilder {
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::geocode::GeocodeOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::geocode::GeocodeError,
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::geocode::Geocode::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::geocode::Geocode::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::geocode::GeocodeOutput, crate::operation::geocode::GeocodeError, 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>A structured free text query allows you to search for places by the name or text representation of specific properties of the place.</p>
123    pub fn query_components(mut self, input: crate::types::GeocodeQueryComponents) -> Self {
124        self.inner = self.inner.query_components(input);
125        self
126    }
127    /// <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>
128    pub fn set_query_components(mut self, input: ::std::option::Option<crate::types::GeocodeQueryComponents>) -> Self {
129        self.inner = self.inner.set_query_components(input);
130        self
131    }
132    /// <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>
133    pub fn get_query_components(&self) -> &::std::option::Option<crate::types::GeocodeQueryComponents> {
134        self.inner.get_query_components()
135    }
136    /// <p>An optional limit for the number of results returned in a single call.</p>
137    pub fn max_results(mut self, input: i32) -> Self {
138        self.inner = self.inner.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 set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
143        self.inner = self.inner.set_max_results(input);
144        self
145    }
146    /// <p>An optional limit for the number of results returned in a single call.</p>
147    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
148        self.inner.get_max_results()
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::GeocodeFilter) -> 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::GeocodeFilter>) -> 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::GeocodeFilter> {
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::GeocodeAdditionalFeature) -> 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::GeocodeAdditionalFeature>>) -> 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::GeocodeAdditionalFeature>> {
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><note>
237    /// <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>
238    /// </note>
239    pub fn intended_use(mut self, input: crate::types::GeocodeIntendedUse) -> Self {
240        self.inner = self.inner.intended_use(input);
241        self
242    }
243    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
244    /// <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>
245    /// </note>
246    pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::GeocodeIntendedUse>) -> Self {
247        self.inner = self.inner.set_intended_use(input);
248        self
249    }
250    /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p><note>
251    /// <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>
252    /// </note>
253    pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::GeocodeIntendedUse> {
254        self.inner.get_intended_use()
255    }
256    /// <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>
257    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
258        self.inner = self.inner.key(input.into());
259        self
260    }
261    /// <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>
262    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
263        self.inner = self.inner.set_key(input);
264        self
265    }
266    /// <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>
267    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
268        self.inner.get_key()
269    }
270}