aws_sdk_location/operation/search_place_index_for_position/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::search_place_index_for_position::_search_place_index_for_position_input::SearchPlaceIndexForPositionInputBuilder;
3
4pub use crate::operation::search_place_index_for_position::_search_place_index_for_position_output::SearchPlaceIndexForPositionOutputBuilder;
5
6impl crate::operation::search_place_index_for_position::builders::SearchPlaceIndexForPositionInputBuilder {
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::search_place_index_for_position::SearchPlaceIndexForPositionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.search_place_index_for_position();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `SearchPlaceIndexForPosition`.
24///
25/// <important>
26/// <p>This operation is no longer current and may be deprecated in the future. We recommend you upgrade to <a href="/location/latest/APIReference/API_geoplaces_ReverseGeocode.html"> <code>ReverseGeocode</code> </a> or <a href="/location/latest/APIReference/API_geoplaces_SearchNearby.html"> <code>SearchNearby</code> </a> unless you require Grab data.</p>
27/// <ul>
28/// <li>
29/// <p><code>SearchPlaceIndexForPosition</code> is part of a previous Amazon Location Service Places API (version 1) which has been superseded by a more intuitive, powerful, and complete API (version 2).</p></li>
30/// <li>
31/// <p>The version 2 <code>ReverseGeocode</code> operation gives better results in the address reverse-geocoding use case, while the version 2 <code>SearchNearby</code> operation gives better results when searching for businesses and points of interest near a specific location.</p></li>
32/// <li>
33/// <p>If you are using an Amazon Web Services SDK or the Amazon Web Services CLI, note that the Places API version 2 is found under <code>geo-places</code> or <code>geo_places</code>, not under <code>location</code>.</p></li>
34/// <li>
35/// <p>Since Grab is not yet fully supported in Places API version 2, we recommend you continue using API version 1 when using Grab.</p></li>
36/// </ul>
37/// </important>
38/// <p>Reverse geocodes a given coordinate and returns a legible address. Allows you to search for Places or points of interest near a given position.</p>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct SearchPlaceIndexForPositionFluentBuilder {
41 handle: ::std::sync::Arc<crate::client::Handle>,
42 inner: crate::operation::search_place_index_for_position::builders::SearchPlaceIndexForPositionInputBuilder,
43 config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46 crate::client::customize::internal::CustomizableSend<
47 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionOutput,
48 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionError,
49 > for SearchPlaceIndexForPositionFluentBuilder
50{
51 fn send(
52 self,
53 config_override: crate::config::Builder,
54 ) -> crate::client::customize::internal::BoxFuture<
55 crate::client::customize::internal::SendResult<
56 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionOutput,
57 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionError,
58 >,
59 > {
60 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61 }
62}
63impl SearchPlaceIndexForPositionFluentBuilder {
64 /// Creates a new `SearchPlaceIndexForPositionFluentBuilder`.
65 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66 Self {
67 handle,
68 inner: ::std::default::Default::default(),
69 config_override: ::std::option::Option::None,
70 }
71 }
72 /// Access the SearchPlaceIndexForPosition as a reference.
73 pub fn as_input(&self) -> &crate::operation::search_place_index_for_position::builders::SearchPlaceIndexForPositionInputBuilder {
74 &self.inner
75 }
76 /// Sends the request and returns the response.
77 ///
78 /// If an error occurs, an `SdkError` will be returned with additional details that
79 /// can be matched against.
80 ///
81 /// By default, any retryable failures will be retried twice. Retry behavior
82 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83 /// set when configuring the client.
84 pub async fn send(
85 self,
86 ) -> ::std::result::Result<
87 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionOutput,
88 ::aws_smithy_runtime_api::client::result::SdkError<
89 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionError,
90 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91 >,
92 > {
93 let input = self
94 .inner
95 .build()
96 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97 let runtime_plugins = crate::operation::search_place_index_for_position::SearchPlaceIndexForPosition::operation_runtime_plugins(
98 self.handle.runtime_plugins.clone(),
99 &self.handle.conf,
100 self.config_override,
101 );
102 crate::operation::search_place_index_for_position::SearchPlaceIndexForPosition::orchestrate(&runtime_plugins, input).await
103 }
104
105 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106 pub fn customize(
107 self,
108 ) -> crate::client::customize::CustomizableOperation<
109 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionOutput,
110 crate::operation::search_place_index_for_position::SearchPlaceIndexForPositionError,
111 Self,
112 > {
113 crate::client::customize::CustomizableOperation::new(self)
114 }
115 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116 self.set_config_override(::std::option::Option::Some(config_override.into()));
117 self
118 }
119
120 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121 self.config_override = config_override;
122 self
123 }
124 /// <p>The name of the place index resource you want to use for the search.</p>
125 pub fn index_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.inner = self.inner.index_name(input.into());
127 self
128 }
129 /// <p>The name of the place index resource you want to use for the search.</p>
130 pub fn set_index_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_index_name(input);
132 self
133 }
134 /// <p>The name of the place index resource you want to use for the search.</p>
135 pub fn get_index_name(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_index_name()
137 }
138 ///
139 /// Appends an item to `Position`.
140 ///
141 /// To override the contents of this collection use [`set_position`](Self::set_position).
142 ///
143 /// <p>Specifies the longitude and latitude of the position to query.</p>
144 /// <p>This parameter must contain a pair of numbers. The first number represents the X coordinate, or longitude; the second number represents the Y coordinate, or latitude.</p>
145 /// <p>For example, <code>\[-123.1174, 49.2847\]</code> represents a position with longitude <code>-123.1174</code> and latitude <code>49.2847</code>.</p>
146 pub fn position(mut self, input: f64) -> Self {
147 self.inner = self.inner.position(input);
148 self
149 }
150 /// <p>Specifies the longitude and latitude of the position to query.</p>
151 /// <p>This parameter must contain a pair of numbers. The first number represents the X coordinate, or longitude; the second number represents the Y coordinate, or latitude.</p>
152 /// <p>For example, <code>\[-123.1174, 49.2847\]</code> represents a position with longitude <code>-123.1174</code> and latitude <code>49.2847</code>.</p>
153 pub fn set_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
154 self.inner = self.inner.set_position(input);
155 self
156 }
157 /// <p>Specifies the longitude and latitude of the position to query.</p>
158 /// <p>This parameter must contain a pair of numbers. The first number represents the X coordinate, or longitude; the second number represents the Y coordinate, or latitude.</p>
159 /// <p>For example, <code>\[-123.1174, 49.2847\]</code> represents a position with longitude <code>-123.1174</code> and latitude <code>49.2847</code>.</p>
160 pub fn get_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
161 self.inner.get_position()
162 }
163 /// <p>An optional parameter. The maximum number of results returned per request.</p>
164 /// <p>Default value: <code>50</code></p>
165 pub fn max_results(mut self, input: i32) -> Self {
166 self.inner = self.inner.max_results(input);
167 self
168 }
169 /// <p>An optional parameter. The maximum number of results returned per request.</p>
170 /// <p>Default value: <code>50</code></p>
171 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
172 self.inner = self.inner.set_max_results(input);
173 self
174 }
175 /// <p>An optional parameter. The maximum number of results returned per request.</p>
176 /// <p>Default value: <code>50</code></p>
177 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
178 self.inner.get_max_results()
179 }
180 /// <p>The preferred language used to return results. The value must be a valid <a href="https://tools.ietf.org/search/bcp47">BCP 47</a> language tag, for example, <code>en</code> for English.</p>
181 /// <p>This setting affects the languages used in the results, but not the results themselves. If no language is specified, or not supported for a particular result, the partner automatically chooses a language for the result.</p>
182 /// <p>For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the <code>language</code> parameter set to <code>en</code>. The <code>city</code> in the results will most likely be returned as <code>Athens</code>.</p>
183 /// <p>If you set the <code>language</code> parameter to <code>el</code>, for Greek, then the <code>city</code> in the results will more likely be returned as <code>Αθήνα</code>.</p>
184 /// <p>If the data provider does not have a value for Greek, the result will be in a language that the provider does support.</p>
185 pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.inner = self.inner.language(input.into());
187 self
188 }
189 /// <p>The preferred language used to return results. The value must be a valid <a href="https://tools.ietf.org/search/bcp47">BCP 47</a> language tag, for example, <code>en</code> for English.</p>
190 /// <p>This setting affects the languages used in the results, but not the results themselves. If no language is specified, or not supported for a particular result, the partner automatically chooses a language for the result.</p>
191 /// <p>For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the <code>language</code> parameter set to <code>en</code>. The <code>city</code> in the results will most likely be returned as <code>Athens</code>.</p>
192 /// <p>If you set the <code>language</code> parameter to <code>el</code>, for Greek, then the <code>city</code> in the results will more likely be returned as <code>Αθήνα</code>.</p>
193 /// <p>If the data provider does not have a value for Greek, the result will be in a language that the provider does support.</p>
194 pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195 self.inner = self.inner.set_language(input);
196 self
197 }
198 /// <p>The preferred language used to return results. The value must be a valid <a href="https://tools.ietf.org/search/bcp47">BCP 47</a> language tag, for example, <code>en</code> for English.</p>
199 /// <p>This setting affects the languages used in the results, but not the results themselves. If no language is specified, or not supported for a particular result, the partner automatically chooses a language for the result.</p>
200 /// <p>For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the <code>language</code> parameter set to <code>en</code>. The <code>city</code> in the results will most likely be returned as <code>Athens</code>.</p>
201 /// <p>If you set the <code>language</code> parameter to <code>el</code>, for Greek, then the <code>city</code> in the results will more likely be returned as <code>Αθήνα</code>.</p>
202 /// <p>If the data provider does not have a value for Greek, the result will be in a language that the provider does support.</p>
203 pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
204 self.inner.get_language()
205 }
206 /// <p>The optional <a href="https://docs.aws.amazon.com/location/previous/developerguide/using-apikeys.html">API key</a> to authorize the request.</p>
207 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
208 self.inner = self.inner.key(input.into());
209 self
210 }
211 /// <p>The optional <a href="https://docs.aws.amazon.com/location/previous/developerguide/using-apikeys.html">API key</a> to authorize the request.</p>
212 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
213 self.inner = self.inner.set_key(input);
214 self
215 }
216 /// <p>The optional <a href="https://docs.aws.amazon.com/location/previous/developerguide/using-apikeys.html">API key</a> to authorize the request.</p>
217 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
218 self.inner.get_key()
219 }
220}