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>The <code>Geocode</code> action allows you to obtain coordinates, addresses, and other information about places.</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>
103 pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104 self.inner = self.inner.query_text(input.into());
105 self
106 }
107 /// <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>
108 pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109 self.inner = self.inner.set_query_text(input);
110 self
111 }
112 /// <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>
113 pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
114 self.inner.get_query_text()
115 }
116 /// <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>
117 pub fn query_components(mut self, input: crate::types::GeocodeQueryComponents) -> Self {
118 self.inner = self.inner.query_components(input);
119 self
120 }
121 /// <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>
122 pub fn set_query_components(mut self, input: ::std::option::Option<crate::types::GeocodeQueryComponents>) -> Self {
123 self.inner = self.inner.set_query_components(input);
124 self
125 }
126 /// <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>
127 pub fn get_query_components(&self) -> &::std::option::Option<crate::types::GeocodeQueryComponents> {
128 self.inner.get_query_components()
129 }
130 /// <p>An optional limit for the number of results returned in a single call.</p>
131 pub fn max_results(mut self, input: i32) -> Self {
132 self.inner = self.inner.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 set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
137 self.inner = self.inner.set_max_results(input);
138 self
139 }
140 /// <p>An optional limit for the number of results returned in a single call.</p>
141 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
142 self.inner.get_max_results()
143 }
144 ///
145 /// Appends an item to `BiasPosition`.
146 ///
147 /// To override the contents of this collection use [`set_bias_position`](Self::set_bias_position).
148 ///
149 /// <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>
150 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
151 /// </note>
152 pub fn bias_position(mut self, input: f64) -> Self {
153 self.inner = self.inner.bias_position(input);
154 self
155 }
156 /// <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>
157 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
158 /// </note>
159 pub fn set_bias_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
160 self.inner = self.inner.set_bias_position(input);
161 self
162 }
163 /// <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>
164 /// <p>The fields <code>BiasPosition</code>, <code>FilterBoundingBox</code>, and <code>FilterCircle</code> are mutually exclusive.</p>
165 /// </note>
166 pub fn get_bias_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
167 self.inner.get_bias_position()
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 filter(mut self, input: crate::types::GeocodeFilter) -> Self {
171 self.inner = self.inner.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 set_filter(mut self, input: ::std::option::Option<crate::types::GeocodeFilter>) -> Self {
176 self.inner = self.inner.set_filter(input);
177 self
178 }
179 /// <p>A structure which contains a set of inclusion/exclusion properties that results must posses in order to be returned as a result.</p>
180 pub fn get_filter(&self) -> &::std::option::Option<crate::types::GeocodeFilter> {
181 self.inner.get_filter()
182 }
183 ///
184 /// Appends an item to `AdditionalFeatures`.
185 ///
186 /// To override the contents of this collection use [`set_additional_features`](Self::set_additional_features).
187 ///
188 /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
189 pub fn additional_features(mut self, input: crate::types::GeocodeAdditionalFeature) -> Self {
190 self.inner = self.inner.additional_features(input);
191 self
192 }
193 /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
194 pub fn set_additional_features(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>>) -> Self {
195 self.inner = self.inner.set_additional_features(input);
196 self
197 }
198 /// <p>A list of optional additional parameters, such as time zone, that can be requested for each result.</p>
199 pub fn get_additional_features(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GeocodeAdditionalFeature>> {
200 self.inner.get_additional_features()
201 }
202 /// <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>
203 pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204 self.inner = self.inner.language(input.into());
205 self
206 }
207 /// <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>
208 pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
209 self.inner = self.inner.set_language(input);
210 self
211 }
212 /// <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>
213 pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
214 self.inner.get_language()
215 }
216 /// <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>
217 pub fn political_view(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218 self.inner = self.inner.political_view(input.into());
219 self
220 }
221 /// <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>
222 pub fn set_political_view(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223 self.inner = self.inner.set_political_view(input);
224 self
225 }
226 /// <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>
227 pub fn get_political_view(&self) -> &::std::option::Option<::std::string::String> {
228 self.inner.get_political_view()
229 }
230 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
231 pub fn intended_use(mut self, input: crate::types::GeocodeIntendedUse) -> Self {
232 self.inner = self.inner.intended_use(input);
233 self
234 }
235 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
236 pub fn set_intended_use(mut self, input: ::std::option::Option<crate::types::GeocodeIntendedUse>) -> Self {
237 self.inner = self.inner.set_intended_use(input);
238 self
239 }
240 /// <p>Indicates if the results will be stored. Defaults to <code>SingleUse</code>, if left empty.</p>
241 pub fn get_intended_use(&self) -> &::std::option::Option<crate::types::GeocodeIntendedUse> {
242 self.inner.get_intended_use()
243 }
244 /// <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>
245 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.inner = self.inner.key(input.into());
247 self
248 }
249 /// <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>
250 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
251 self.inner = self.inner.set_key(input);
252 self
253 }
254 /// <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>
255 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
256 self.inner.get_key()
257 }
258}