google_places1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18
19    /// Private Service: https://www.googleapis.com/auth/maps-platform.places
20    MapPlatformPlace,
21
22    /// Private Service: https://www.googleapis.com/auth/maps-platform.places.autocomplete
23    MapPlatformPlaceAutocomplete,
24
25    /// Private Service: https://www.googleapis.com/auth/maps-platform.places.details
26    MapPlatformPlaceDetail,
27
28    /// Private Service: https://www.googleapis.com/auth/maps-platform.places.getphotomedia
29    MapPlatformPlaceGetphotomedia,
30
31    /// Private Service: https://www.googleapis.com/auth/maps-platform.places.nearbysearch
32    MapPlatformPlaceNearbysearch,
33
34    /// Private Service: https://www.googleapis.com/auth/maps-platform.places.textsearch
35    MapPlatformPlaceTextsearch,
36}
37
38impl AsRef<str> for Scope {
39    fn as_ref(&self) -> &str {
40        match *self {
41            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
42            Scope::MapPlatformPlace => "https://www.googleapis.com/auth/maps-platform.places",
43            Scope::MapPlatformPlaceAutocomplete => {
44                "https://www.googleapis.com/auth/maps-platform.places.autocomplete"
45            }
46            Scope::MapPlatformPlaceDetail => {
47                "https://www.googleapis.com/auth/maps-platform.places.details"
48            }
49            Scope::MapPlatformPlaceGetphotomedia => {
50                "https://www.googleapis.com/auth/maps-platform.places.getphotomedia"
51            }
52            Scope::MapPlatformPlaceNearbysearch => {
53                "https://www.googleapis.com/auth/maps-platform.places.nearbysearch"
54            }
55            Scope::MapPlatformPlaceTextsearch => {
56                "https://www.googleapis.com/auth/maps-platform.places.textsearch"
57            }
58        }
59    }
60}
61
62#[allow(clippy::derivable_impls)]
63impl Default for Scope {
64    fn default() -> Scope {
65        Scope::CloudPlatform
66    }
67}
68
69// ########
70// HUB ###
71// ######
72
73/// Central instance to access all MapsPlaces related resource activities
74///
75/// # Examples
76///
77/// Instantiate a new hub
78///
79/// ```test_harness,no_run
80/// extern crate hyper;
81/// extern crate hyper_rustls;
82/// extern crate google_places1 as places1;
83/// use places1::{Result, Error};
84/// # async fn dox() {
85/// use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
86///
87/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
88/// // `client_secret`, among other things.
89/// let secret: yup_oauth2::ApplicationSecret = Default::default();
90/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
91/// // unless you replace  `None` with the desired Flow.
92/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
93/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
94/// // retrieve them from storage.
95/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
96///     .with_native_roots()
97///     .unwrap()
98///     .https_only()
99///     .enable_http2()
100///     .build();
101///
102/// let executor = hyper_util::rt::TokioExecutor::new();
103/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
104///     secret,
105///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
106///     yup_oauth2::client::CustomHyperClientBuilder::from(
107///         hyper_util::client::legacy::Client::builder(executor).build(connector),
108///     ),
109/// ).build().await.unwrap();
110///
111/// let client = hyper_util::client::legacy::Client::builder(
112///     hyper_util::rt::TokioExecutor::new()
113/// )
114/// .build(
115///     hyper_rustls::HttpsConnectorBuilder::new()
116///         .with_native_roots()
117///         .unwrap()
118///         .https_or_http()
119///         .enable_http2()
120///         .build()
121/// );
122/// let mut hub = MapsPlaces::new(client, auth);
123/// // You can configure optional parameters by calling the respective setters at will, and
124/// // execute the final call using `doit()`.
125/// // Values shown here are possibly random and not representative !
126/// let result = hub.places().get("name")
127///              .session_token("takimata")
128///              .region_code("amet.")
129///              .language_code("duo")
130///              .doit().await;
131///
132/// match result {
133///     Err(e) => match e {
134///         // The Error enum provides details about what exactly happened.
135///         // You can also just use its `Debug`, `Display` or `Error` traits
136///          Error::HttpError(_)
137///         |Error::Io(_)
138///         |Error::MissingAPIKey
139///         |Error::MissingToken(_)
140///         |Error::Cancelled
141///         |Error::UploadSizeLimitExceeded(_, _)
142///         |Error::Failure(_)
143///         |Error::BadRequest(_)
144///         |Error::FieldClash(_)
145///         |Error::JsonDecodeError(_, _) => println!("{}", e),
146///     },
147///     Ok(res) => println!("Success: {:?}", res),
148/// }
149/// # }
150/// ```
151#[derive(Clone)]
152pub struct MapsPlaces<C> {
153    pub client: common::Client<C>,
154    pub auth: Box<dyn common::GetToken>,
155    _user_agent: String,
156    _base_url: String,
157    _root_url: String,
158}
159
160impl<C> common::Hub for MapsPlaces<C> {}
161
162impl<'a, C> MapsPlaces<C> {
163    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> MapsPlaces<C> {
164        MapsPlaces {
165            client,
166            auth: Box::new(auth),
167            _user_agent: "google-api-rust-client/7.0.0".to_string(),
168            _base_url: "https://places.googleapis.com/".to_string(),
169            _root_url: "https://places.googleapis.com/".to_string(),
170        }
171    }
172
173    pub fn places(&'a self) -> PlaceMethods<'a, C> {
174        PlaceMethods { hub: self }
175    }
176
177    /// Set the user-agent header field to use in all requests to the server.
178    /// It defaults to `google-api-rust-client/7.0.0`.
179    ///
180    /// Returns the previously set user-agent.
181    pub fn user_agent(&mut self, agent_name: String) -> String {
182        std::mem::replace(&mut self._user_agent, agent_name)
183    }
184
185    /// Set the base url to use in all requests to the server.
186    /// It defaults to `https://places.googleapis.com/`.
187    ///
188    /// Returns the previously set base url.
189    pub fn base_url(&mut self, new_base_url: String) -> String {
190        std::mem::replace(&mut self._base_url, new_base_url)
191    }
192
193    /// Set the root url to use in all requests to the server.
194    /// It defaults to `https://places.googleapis.com/`.
195    ///
196    /// Returns the previously set root url.
197    pub fn root_url(&mut self, new_root_url: String) -> String {
198        std::mem::replace(&mut self._root_url, new_root_url)
199    }
200}
201
202// ############
203// SCHEMAS ###
204// ##########
205/// A latitude-longitude viewport, represented as two diagonally opposite `low` and `high` points. A viewport is considered a closed region, i.e. it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive. Various cases include: - If `low` = `high`, the viewport consists of that single point. - If `low.longitude` > `high.longitude`, the longitude range is inverted (the viewport crosses the 180 degree longitude line). - If `low.longitude` = -180 degrees and `high.longitude` = 180 degrees, the viewport includes all longitudes. - If `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, the longitude range is empty. - If `low.latitude` > `high.latitude`, the latitude range is empty. Both `low` and `high` must be populated, and the represented box cannot be empty (as specified by the definitions above). An empty viewport will result in an error. For example, this viewport fully encloses New York City: { "low": { "latitude": 40.477398, "longitude": -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } }
206///
207/// This type is not used in any activity, and only used as *part* of another schema.
208///
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct GoogleGeoTypeViewport {
213    /// Required. The high point of the viewport.
214    pub high: Option<GoogleTypeLatLng>,
215    /// Required. The low point of the viewport.
216    pub low: Option<GoogleTypeLatLng>,
217}
218
219impl common::Part for GoogleGeoTypeViewport {}
220
221/// A relational description of a location. Includes a ranked set of nearby landmarks and precise containing areas and their relationship to the target location.
222///
223/// This type is not used in any activity, and only used as *part* of another schema.
224///
225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
226#[serde_with::serde_as]
227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
228pub struct GoogleMapsPlacesV1AddressDescriptor {
229    /// A ranked list of containing or adjacent areas. The most recognizable and precise areas are ranked first.
230    pub areas: Option<Vec<GoogleMapsPlacesV1AddressDescriptorArea>>,
231    /// A ranked list of nearby landmarks. The most recognizable and nearby landmarks are ranked first.
232    pub landmarks: Option<Vec<GoogleMapsPlacesV1AddressDescriptorLandmark>>,
233}
234
235impl common::Part for GoogleMapsPlacesV1AddressDescriptor {}
236
237/// Area information and the area's relationship with the target location. Areas includes precise sublocality, neighborhoods, and large compounds that are useful for describing a location.
238///
239/// This type is not used in any activity, and only used as *part* of another schema.
240///
241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
242#[serde_with::serde_as]
243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
244pub struct GoogleMapsPlacesV1AddressDescriptorArea {
245    /// Defines the spatial relationship between the target location and the area.
246    pub containment: Option<String>,
247    /// The area's display name.
248    #[serde(rename = "displayName")]
249    pub display_name: Option<GoogleTypeLocalizedText>,
250    /// The area's resource name.
251    pub name: Option<String>,
252    /// The area's place id.
253    #[serde(rename = "placeId")]
254    pub place_id: Option<String>,
255}
256
257impl common::Part for GoogleMapsPlacesV1AddressDescriptorArea {}
258
259/// Basic landmark information and the landmark's relationship with the target location. Landmarks are prominent places that can be used to describe a location.
260///
261/// This type is not used in any activity, and only used as *part* of another schema.
262///
263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
264#[serde_with::serde_as]
265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
266pub struct GoogleMapsPlacesV1AddressDescriptorLandmark {
267    /// The landmark's display name.
268    #[serde(rename = "displayName")]
269    pub display_name: Option<GoogleTypeLocalizedText>,
270    /// The landmark's resource name.
271    pub name: Option<String>,
272    /// The landmark's place id.
273    #[serde(rename = "placeId")]
274    pub place_id: Option<String>,
275    /// Defines the spatial relationship between the target location and the landmark.
276    #[serde(rename = "spatialRelationship")]
277    pub spatial_relationship: Option<String>,
278    /// The straight line distance, in meters, between the center point of the target and the center point of the landmark. In some situations, this value can be longer than `travel_distance_meters`.
279    #[serde(rename = "straightLineDistanceMeters")]
280    pub straight_line_distance_meters: Option<f32>,
281    /// The travel distance, in meters, along the road network from the target to the landmark, if known. This value does not take into account the mode of transportation, such as walking, driving, or biking.
282    #[serde(rename = "travelDistanceMeters")]
283    pub travel_distance_meters: Option<f32>,
284    /// A set of type tags for this landmark. For a complete list of possible values, see https://developers.google.com/maps/documentation/places/web-service/place-types.
285    pub types: Option<Vec<String>>,
286}
287
288impl common::Part for GoogleMapsPlacesV1AddressDescriptorLandmark {}
289
290/// Information about the author of the UGC data. Used in Photo, and Review.
291///
292/// This type is not used in any activity, and only used as *part* of another schema.
293///
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct GoogleMapsPlacesV1AuthorAttribution {
298    /// Name of the author of the Photo or Review.
299    #[serde(rename = "displayName")]
300    pub display_name: Option<String>,
301    /// Profile photo URI of the author of the Photo or Review.
302    #[serde(rename = "photoUri")]
303    pub photo_uri: Option<String>,
304    /// URI of the author of the Photo or Review.
305    pub uri: Option<String>,
306}
307
308impl common::Part for GoogleMapsPlacesV1AuthorAttribution {}
309
310/// Request proto for AutocompletePlaces.
311///
312/// # Activities
313///
314/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
315/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
316///
317/// * [autocomplete places](PlaceAutocompleteCall) (request)
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct GoogleMapsPlacesV1AutocompletePlacesRequest {
322    /// Optional. Include pure service area businesses if the field is set to true. Pure service area business is a business that visits or delivers to customers directly but does not serve customers at their business address. For example, businesses like cleaning services or plumbers. Those businesses do not have a physical address or location on Google Maps. Places will not return fields including `location`, `plus_code`, and other location related fields for these businesses.
323    #[serde(rename = "includePureServiceAreaBusinesses")]
324    pub include_pure_service_area_businesses: Option<bool>,
325    /// Optional. If true, the response will include both Place and query predictions. Otherwise the response will only return Place predictions.
326    #[serde(rename = "includeQueryPredictions")]
327    pub include_query_predictions: Option<bool>,
328    /// Optional. Included primary Place type (for example, "restaurant" or "gas_station") in Place Types (https://developers.google.com/maps/documentation/places/web-service/place-types), or only `(regions)`, or only `(cities)`. A Place is only returned if its primary type is included in this list. Up to 5 values can be specified. If no types are specified, all Place types are returned.
329    #[serde(rename = "includedPrimaryTypes")]
330    pub included_primary_types: Option<Vec<String>>,
331    /// Optional. Only include results in the specified regions, specified as up to 15 CLDR two-character region codes. An empty set will not restrict the results. If both `location_restriction` and `included_region_codes` are set, the results will be located in the area of intersection.
332    #[serde(rename = "includedRegionCodes")]
333    pub included_region_codes: Option<Vec<String>>,
334    /// Required. The text string on which to search.
335    pub input: Option<String>,
336    /// Optional. A zero-based Unicode character offset of `input` indicating the cursor position in `input`. The cursor position may influence what predictions are returned. If empty, defaults to the length of `input`.
337    #[serde(rename = "inputOffset")]
338    pub input_offset: Option<i32>,
339    /// Optional. The language in which to return results. Defaults to en-US. The results may be in mixed languages if the language used in `input` is different from `language_code` or if the returned Place does not have a translation from the local language to `language_code`.
340    #[serde(rename = "languageCode")]
341    pub language_code: Option<String>,
342    /// Optional. Bias results to a specified location. At most one of `location_bias` or `location_restriction` should be set. If neither are set, the results will be biased by IP address, meaning the IP address will be mapped to an imprecise location and used as a biasing signal.
343    #[serde(rename = "locationBias")]
344    pub location_bias: Option<GoogleMapsPlacesV1AutocompletePlacesRequestLocationBias>,
345    /// Optional. Restrict results to a specified location. At most one of `location_bias` or `location_restriction` should be set. If neither are set, the results will be biased by IP address, meaning the IP address will be mapped to an imprecise location and used as a biasing signal.
346    #[serde(rename = "locationRestriction")]
347    pub location_restriction:
348        Option<GoogleMapsPlacesV1AutocompletePlacesRequestLocationRestriction>,
349    /// Optional. The origin point from which to calculate geodesic distance to the destination (returned as `distance_meters`). If this value is omitted, geodesic distance will not be returned.
350    pub origin: Option<GoogleTypeLatLng>,
351    /// Optional. The region code, specified as a CLDR two-character region code. This affects address formatting, result ranking, and may influence what results are returned. This does not restrict results to the specified region. To restrict results to a region, use `region_code_restriction`.
352    #[serde(rename = "regionCode")]
353    pub region_code: Option<String>,
354    /// Optional. A string which identifies an Autocomplete session for billing purposes. Must be a URL and filename safe base64 string with at most 36 ASCII characters in length. Otherwise an INVALID_ARGUMENT error is returned. The session begins when the user starts typing a query, and concludes when they select a place and a call to Place Details or Address Validation is made. Each session can have multiple queries, followed by one Place Details or Address Validation request. The credentials used for each request within a session must belong to the same Google Cloud Console project. Once a session has concluded, the token is no longer valid; your app must generate a fresh token for each session. If the `session_token` parameter is omitted, or if you reuse a session token, the session is charged as if no session token was provided (each request is billed separately). We recommend the following guidelines: * Use session tokens for all Place Autocomplete calls. * Generate a fresh token for each session. Using a version 4 UUID is recommended. * Ensure that the credentials used for all Place Autocomplete, Place Details, and Address Validation requests within a session belong to the same Cloud Console project. * Be sure to pass a unique session token for each new session. Using the same token for more than one session will result in each request being billed individually.
355    #[serde(rename = "sessionToken")]
356    pub session_token: Option<String>,
357}
358
359impl common::RequestValue for GoogleMapsPlacesV1AutocompletePlacesRequest {}
360
361/// The region to search. The results may be biased around the specified region.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct GoogleMapsPlacesV1AutocompletePlacesRequestLocationBias {
369    /// A circle defined by a center point and radius.
370    pub circle: Option<GoogleMapsPlacesV1Circle>,
371    /// A viewport defined by a northeast and a southwest corner.
372    pub rectangle: Option<GoogleGeoTypeViewport>,
373}
374
375impl common::Part for GoogleMapsPlacesV1AutocompletePlacesRequestLocationBias {}
376
377/// The region to search. The results will be restricted to the specified region.
378///
379/// This type is not used in any activity, and only used as *part* of another schema.
380///
381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
382#[serde_with::serde_as]
383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
384pub struct GoogleMapsPlacesV1AutocompletePlacesRequestLocationRestriction {
385    /// A circle defined by a center point and radius.
386    pub circle: Option<GoogleMapsPlacesV1Circle>,
387    /// A viewport defined by a northeast and a southwest corner.
388    pub rectangle: Option<GoogleGeoTypeViewport>,
389}
390
391impl common::Part for GoogleMapsPlacesV1AutocompletePlacesRequestLocationRestriction {}
392
393/// Response proto for AutocompletePlaces.
394///
395/// # Activities
396///
397/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
398/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
399///
400/// * [autocomplete places](PlaceAutocompleteCall) (response)
401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
402#[serde_with::serde_as]
403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
404pub struct GoogleMapsPlacesV1AutocompletePlacesResponse {
405    /// Contains a list of suggestions, ordered in descending order of relevance.
406    pub suggestions: Option<Vec<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestion>>,
407}
408
409impl common::ResponseResult for GoogleMapsPlacesV1AutocompletePlacesResponse {}
410
411/// An Autocomplete suggestion result.
412///
413/// This type is not used in any activity, and only used as *part* of another schema.
414///
415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
416#[serde_with::serde_as]
417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
418pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestion {
419    /// A prediction for a Place.
420    #[serde(rename = "placePrediction")]
421    pub place_prediction:
422        Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionPlacePrediction>,
423    /// A prediction for a query.
424    #[serde(rename = "queryPrediction")]
425    pub query_prediction:
426        Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionQueryPrediction>,
427}
428
429impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestion {}
430
431/// Text representing a Place or query prediction. The text may be used as is or formatted.
432///
433/// This type is not used in any activity, and only used as *part* of another schema.
434///
435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
436#[serde_with::serde_as]
437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
438pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText {
439    /// A list of string ranges identifying where the input request matched in `text`. The ranges can be used to format specific parts of `text`. The substrings may not be exact matches of `input` if the matching was determined by criteria other than string matching (for example, spell corrections or transliterations). These values are Unicode character offsets of `text`. The ranges are guaranteed to be ordered in increasing offset values.
440    pub matches: Option<Vec<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStringRange>>,
441    /// Text that may be used as is or formatted with `matches`.
442    pub text: Option<String>,
443}
444
445impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText {}
446
447/// Prediction results for a Place Autocomplete prediction.
448///
449/// This type is not used in any activity, and only used as *part* of another schema.
450///
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionPlacePrediction {
455    /// The length of the geodesic in meters from `origin` if `origin` is specified. Certain predictions such as routes may not populate this field.
456    #[serde(rename = "distanceMeters")]
457    pub distance_meters: Option<i32>,
458    /// The resource name of the suggested Place. This name can be used in other APIs that accept Place names.
459    pub place: Option<String>,
460    /// The unique identifier of the suggested Place. This identifier can be used in other APIs that accept Place IDs.
461    #[serde(rename = "placeId")]
462    pub place_id: Option<String>,
463    /// A breakdown of the Place prediction into main text containing the name of the Place and secondary text containing additional disambiguating features (such as a city or region). `structured_format` is recommended for developers who wish to show two separate, but related, UI elements. Developers who wish to show a single UI element may want to use `text` instead. They are two different ways to represent a Place prediction. Users should not try to parse `structured_format` into `text` or vice versa.
464    #[serde(rename = "structuredFormat")]
465    pub structured_format:
466        Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat>,
467    /// Contains the human-readable name for the returned result. For establishment results, this is usually the business name and address. `text` is recommended for developers who wish to show a single UI element. Developers who wish to show two separate, but related, UI elements may want to use `structured_format` instead. They are two different ways to represent a Place prediction. Users should not try to parse `structured_format` into `text` or vice versa. This text may be different from the `display_name` returned by GetPlace. May be in mixed languages if the request `input` and `language_code` are in different languages or if the Place does not have a translation from the local language to `language_code`.
468    pub text: Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText>,
469    /// List of types that apply to this Place from Table A or Table B in https://developers.google.com/maps/documentation/places/web-service/place-types. A type is a categorization of a Place. Places with shared types will share similar characteristics.
470    pub types: Option<Vec<String>>,
471}
472
473impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionPlacePrediction {}
474
475/// Prediction results for a Query Autocomplete prediction.
476///
477/// This type is not used in any activity, and only used as *part* of another schema.
478///
479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
480#[serde_with::serde_as]
481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
482pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionQueryPrediction {
483    /// A breakdown of the query prediction into main text containing the query and secondary text containing additional disambiguating features (such as a city or region). `structured_format` is recommended for developers who wish to show two separate, but related, UI elements. Developers who wish to show a single UI element may want to use `text` instead. They are two different ways to represent a query prediction. Users should not try to parse `structured_format` into `text` or vice versa.
484    #[serde(rename = "structuredFormat")]
485    pub structured_format:
486        Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat>,
487    /// The predicted text. This text does not represent a Place, but rather a text query that could be used in a search endpoint (for example, Text Search). `text` is recommended for developers who wish to show a single UI element. Developers who wish to show two separate, but related, UI elements may want to use `structured_format` instead. They are two different ways to represent a query prediction. Users should not try to parse `structured_format` into `text` or vice versa. May be in mixed languages if the request `input` and `language_code` are in different languages or if part of the query does not have a translation from the local language to `language_code`.
488    pub text: Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText>,
489}
490
491impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionQueryPrediction {}
492
493/// Identifies a substring within a given text.
494///
495/// This type is not used in any activity, and only used as *part* of another schema.
496///
497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
498#[serde_with::serde_as]
499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
500pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStringRange {
501    /// Zero-based offset of the last Unicode character (exclusive).
502    #[serde(rename = "endOffset")]
503    pub end_offset: Option<i32>,
504    /// Zero-based offset of the first Unicode character of the string (inclusive).
505    #[serde(rename = "startOffset")]
506    pub start_offset: Option<i32>,
507}
508
509impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStringRange {}
510
511/// Contains a breakdown of a Place or query prediction into main text and secondary text. For Place predictions, the main text contains the specific name of the Place. For query predictions, the main text contains the query. The secondary text contains additional disambiguating features (such as a city or region) to further identify the Place or refine the query.
512///
513/// This type is not used in any activity, and only used as *part* of another schema.
514///
515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
516#[serde_with::serde_as]
517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
518pub struct GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat {
519    /// Represents the name of the Place or query.
520    #[serde(rename = "mainText")]
521    pub main_text: Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText>,
522    /// Represents additional disambiguating features (such as a city or region) to further identify the Place or refine the query.
523    #[serde(rename = "secondaryText")]
524    pub secondary_text:
525        Option<GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionFormattableText>,
526}
527
528impl common::Part for GoogleMapsPlacesV1AutocompletePlacesResponseSuggestionStructuredFormat {}
529
530/// Circle with a LatLng as center and radius.
531///
532/// This type is not used in any activity, and only used as *part* of another schema.
533///
534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
535#[serde_with::serde_as]
536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
537pub struct GoogleMapsPlacesV1Circle {
538    /// Required. Center latitude and longitude. The range of latitude must be within [-90.0, 90.0]. The range of the longitude must be within [-180.0, 180.0].
539    pub center: Option<GoogleTypeLatLng>,
540    /// Required. Radius measured in meters. The radius must be within [0.0, 50000.0].
541    pub radius: Option<f64>,
542}
543
544impl common::Part for GoogleMapsPlacesV1Circle {}
545
546/// A block of content that can be served individually.
547///
548/// This type is not used in any activity, and only used as *part* of another schema.
549///
550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
551#[serde_with::serde_as]
552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
553pub struct GoogleMapsPlacesV1ContentBlock {
554    /// Content related to the topic.
555    pub content: Option<GoogleTypeLocalizedText>,
556    /// The list of resource names of the referenced places. This name can be used in other APIs that accept Place resource names.
557    #[serde(rename = "referencedPlaces")]
558    pub referenced_places: Option<Vec<String>>,
559}
560
561impl common::Part for GoogleMapsPlacesV1ContentBlock {}
562
563/// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. Content that is contextual to the place query.
564///
565/// This type is not used in any activity, and only used as *part* of another schema.
566///
567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
568#[serde_with::serde_as]
569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
570pub struct GoogleMapsPlacesV1ContextualContent {
571    /// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. Justifications for the place.
572    pub justifications: Option<Vec<GoogleMapsPlacesV1ContextualContentJustification>>,
573    /// Information (including references) about photos of this place, contexual to the place query.
574    pub photos: Option<Vec<GoogleMapsPlacesV1Photo>>,
575    /// List of reviews about this place, contexual to the place query.
576    pub reviews: Option<Vec<GoogleMapsPlacesV1Review>>,
577}
578
579impl common::Part for GoogleMapsPlacesV1ContextualContent {}
580
581/// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. Justifications for the place. Justifications answers the question of why a place could interest an end user.
582///
583/// This type is not used in any activity, and only used as *part* of another schema.
584///
585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
586#[serde_with::serde_as]
587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
588pub struct GoogleMapsPlacesV1ContextualContentJustification {
589    /// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details.
590    #[serde(rename = "businessAvailabilityAttributesJustification")]
591    pub business_availability_attributes_justification: Option<
592        GoogleMapsPlacesV1ContextualContentJustificationBusinessAvailabilityAttributesJustification,
593    >,
594    /// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details.
595    #[serde(rename = "reviewJustification")]
596    pub review_justification:
597        Option<GoogleMapsPlacesV1ContextualContentJustificationReviewJustification>,
598}
599
600impl common::Part for GoogleMapsPlacesV1ContextualContentJustification {}
601
602/// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. BusinessAvailabilityAttributes justifications. This shows some attributes a business has that could interest an end user.
603///
604/// This type is not used in any activity, and only used as *part* of another schema.
605///
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct GoogleMapsPlacesV1ContextualContentJustificationBusinessAvailabilityAttributesJustification
610{
611    /// If a place provides delivery.
612    pub delivery: Option<bool>,
613    /// If a place provides dine-in.
614    #[serde(rename = "dineIn")]
615    pub dine_in: Option<bool>,
616    /// If a place provides takeout.
617    pub takeout: Option<bool>,
618}
619
620impl common::Part
621    for GoogleMapsPlacesV1ContextualContentJustificationBusinessAvailabilityAttributesJustification
622{
623}
624
625/// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. User review justifications. This highlights a section of the user review that would interest an end user. For instance, if the search query is "firewood pizza", the review justification highlights the text relevant to the search query.
626///
627/// This type is not used in any activity, and only used as *part* of another schema.
628///
629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
630#[serde_with::serde_as]
631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
632pub struct GoogleMapsPlacesV1ContextualContentJustificationReviewJustification {
633    /// no description provided
634    #[serde(rename = "highlightedText")]
635    pub highlighted_text:
636        Option<GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedText>,
637    /// The review that the highlighted text is generated from.
638    pub review: Option<GoogleMapsPlacesV1Review>,
639}
640
641impl common::Part for GoogleMapsPlacesV1ContextualContentJustificationReviewJustification {}
642
643/// The text highlighted by the justification. This is a subset of the review itself. The exact word to highlight is marked by the HighlightedTextRange. There could be several words in the text being highlighted.
644///
645/// This type is not used in any activity, and only used as *part* of another schema.
646///
647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
648#[serde_with::serde_as]
649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
650pub struct GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedText {
651    /// The list of the ranges of the highlighted text.
652    #[serde(rename="highlightedTextRanges")]
653        pub highlighted_text_ranges: Option<Vec<GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedTextHighlightedTextRange>>,
654    /// no description provided
655        pub text: Option<String>,
656}
657
658impl common::Part
659    for GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedText
660{
661}
662
663/// The range of highlighted text.
664///
665/// This type is not used in any activity, and only used as *part* of another schema.
666///
667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
668#[serde_with::serde_as]
669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
670pub struct GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedTextHighlightedTextRange
671{
672    /// no description provided
673    #[serde(rename = "endIndex")]
674    pub end_index: Option<i32>,
675    /// no description provided
676    #[serde(rename = "startIndex")]
677    pub start_index: Option<i32>,
678}
679
680impl common::Part for GoogleMapsPlacesV1ContextualContentJustificationReviewJustificationHighlightedTextHighlightedTextRange {}
681
682/// Information about the EV Charge Station hosted in Place. Terminology follows https://afdc.energy.gov/fuels/electricity_infrastructure.html One port could charge one car at a time. One port has one or more connectors. One station has one or more ports.
683///
684/// This type is not used in any activity, and only used as *part* of another schema.
685///
686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
687#[serde_with::serde_as]
688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
689pub struct GoogleMapsPlacesV1EVChargeOptions {
690    /// A list of EV charging connector aggregations that contain connectors of the same type and same charge rate.
691    #[serde(rename = "connectorAggregation")]
692    pub connector_aggregation: Option<Vec<GoogleMapsPlacesV1EVChargeOptionsConnectorAggregation>>,
693    /// Number of connectors at this station. However, because some ports can have multiple connectors but only be able to charge one car at a time (e.g.) the number of connectors may be greater than the total number of cars which can charge simultaneously.
694    #[serde(rename = "connectorCount")]
695    pub connector_count: Option<i32>,
696}
697
698impl common::Part for GoogleMapsPlacesV1EVChargeOptions {}
699
700/// EV charging information grouped by [type, max_charge_rate_kw]. Shows EV charge aggregation of connectors that have the same type and max charge rate in kw.
701///
702/// This type is not used in any activity, and only used as *part* of another schema.
703///
704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
705#[serde_with::serde_as]
706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
707pub struct GoogleMapsPlacesV1EVChargeOptionsConnectorAggregation {
708    /// The timestamp when the connector availability information in this aggregation was last updated.
709    #[serde(rename = "availabilityLastUpdateTime")]
710    pub availability_last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
711    /// Number of connectors in this aggregation that are currently available.
712    #[serde(rename = "availableCount")]
713    pub available_count: Option<i32>,
714    /// Number of connectors in this aggregation.
715    pub count: Option<i32>,
716    /// The static max charging rate in kw of each connector in the aggregation.
717    #[serde(rename = "maxChargeRateKw")]
718    pub max_charge_rate_kw: Option<f64>,
719    /// Number of connectors in this aggregation that are currently out of service.
720    #[serde(rename = "outOfServiceCount")]
721    pub out_of_service_count: Option<i32>,
722    /// The connector type of this aggregation.
723    #[serde(rename = "type")]
724    pub type_: Option<String>,
725}
726
727impl common::Part for GoogleMapsPlacesV1EVChargeOptionsConnectorAggregation {}
728
729/// The most recent information about fuel options in a gas station. This information is updated regularly.
730///
731/// This type is not used in any activity, and only used as *part* of another schema.
732///
733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
734#[serde_with::serde_as]
735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
736pub struct GoogleMapsPlacesV1FuelOptions {
737    /// The last known fuel price for each type of fuel this station has. There is one entry per fuel type this station has. Order is not important.
738    #[serde(rename = "fuelPrices")]
739    pub fuel_prices: Option<Vec<GoogleMapsPlacesV1FuelOptionsFuelPrice>>,
740}
741
742impl common::Part for GoogleMapsPlacesV1FuelOptions {}
743
744/// Fuel price information for a given type.
745///
746/// This type is not used in any activity, and only used as *part* of another schema.
747///
748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
749#[serde_with::serde_as]
750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
751pub struct GoogleMapsPlacesV1FuelOptionsFuelPrice {
752    /// The price of the fuel.
753    pub price: Option<GoogleTypeMoney>,
754    /// The type of fuel.
755    #[serde(rename = "type")]
756    pub type_: Option<String>,
757    /// The time the fuel price was last updated.
758    #[serde(rename = "updateTime")]
759    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
760}
761
762impl common::Part for GoogleMapsPlacesV1FuelOptionsFuelPrice {}
763
764/// Information about a photo of a place.
765///
766/// This type is not used in any activity, and only used as *part* of another schema.
767///
768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
769#[serde_with::serde_as]
770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
771pub struct GoogleMapsPlacesV1Photo {
772    /// This photo's authors.
773    #[serde(rename = "authorAttributions")]
774    pub author_attributions: Option<Vec<GoogleMapsPlacesV1AuthorAttribution>>,
775    /// A link where users can flag a problem with the photo.
776    #[serde(rename = "flagContentUri")]
777    pub flag_content_uri: Option<String>,
778    /// A link to show the photo on Google Maps.
779    #[serde(rename = "googleMapsUri")]
780    pub google_maps_uri: Option<String>,
781    /// The maximum available height, in pixels.
782    #[serde(rename = "heightPx")]
783    pub height_px: Option<i32>,
784    /// Identifier. A reference representing this place photo which may be used to look up this place photo again (also called the API "resource" name: `places/{place_id}/photos/{photo}`).
785    pub name: Option<String>,
786    /// The maximum available width, in pixels.
787    #[serde(rename = "widthPx")]
788    pub width_px: Option<i32>,
789}
790
791impl common::Part for GoogleMapsPlacesV1Photo {}
792
793/// A photo media from Places API.
794///
795/// # Activities
796///
797/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
798/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
799///
800/// * [photos get media places](PlacePhotoGetMediaCall) (response)
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct GoogleMapsPlacesV1PhotoMedia {
805    /// The resource name of a photo media in the format: `places/{place_id}/photos/{photo_reference}/media`.
806    pub name: Option<String>,
807    /// A short-lived uri that can be used to render the photo.
808    #[serde(rename = "photoUri")]
809    pub photo_uri: Option<String>,
810}
811
812impl common::ResponseResult for GoogleMapsPlacesV1PhotoMedia {}
813
814/// All the information representing a Place.
815///
816/// # Activities
817///
818/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
819/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
820///
821/// * [get places](PlaceGetCall) (response)
822#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
823#[serde_with::serde_as]
824#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
825pub struct GoogleMapsPlacesV1Place {
826    /// Information about the accessibility options a place offers.
827    #[serde(rename = "accessibilityOptions")]
828    pub accessibility_options: Option<GoogleMapsPlacesV1PlaceAccessibilityOptions>,
829    /// Repeated components for each locality level. Note the following facts about the address_components[] array: - The array of address components may contain more components than the formatted_address. - The array does not necessarily include all the political entities that contain an address, apart from those included in the formatted_address. To retrieve all the political entities that contain a specific address, you should use reverse geocoding, passing the latitude/longitude of the address as a parameter to the request. - The format of the response is not guaranteed to remain the same between requests. In particular, the number of address_components varies based on the address requested and can change over time for the same address. A component can change position in the array. The type of the component can change. A particular component may be missing in a later response.
830    #[serde(rename = "addressComponents")]
831    pub address_components: Option<Vec<GoogleMapsPlacesV1PlaceAddressComponent>>,
832    /// The address descriptor of the place. Address descriptors include additional information that help describe a location using landmarks and areas. See address descriptor regional coverage in https://developers.google.com/maps/documentation/geocoding/address-descriptors/coverage.
833    #[serde(rename = "addressDescriptor")]
834    pub address_descriptor: Option<GoogleMapsPlacesV1AddressDescriptor>,
835    /// The place's address in adr microformat: http://microformats.org/wiki/adr.
836    #[serde(rename = "adrFormatAddress")]
837    pub adr_format_address: Option<String>,
838    /// Place allows dogs.
839    #[serde(rename = "allowsDogs")]
840    pub allows_dogs: Option<bool>,
841    /// A set of data provider that must be shown with this result.
842    pub attributions: Option<Vec<GoogleMapsPlacesV1PlaceAttribution>>,
843    /// The business status for the place.
844    #[serde(rename = "businessStatus")]
845    pub business_status: Option<String>,
846    /// The consumer alert message for the place when we detect suspicious review activity on a business or a business violates our policies.
847    #[serde(rename = "consumerAlert")]
848    pub consumer_alert: Option<GoogleMapsPlacesV1PlaceConsumerAlert>,
849    /// List of places in which the current place is located.
850    #[serde(rename = "containingPlaces")]
851    pub containing_places: Option<Vec<GoogleMapsPlacesV1PlaceContainingPlace>>,
852    /// Specifies if the business supports curbside pickup.
853    #[serde(rename = "curbsidePickup")]
854    pub curbside_pickup: Option<bool>,
855    /// The hours of operation for the next seven days (including today). The time period starts at midnight on the date of the request and ends at 11:59 pm six days later. This field includes the special_days subfield of all hours, set for dates that have exceptional hours.
856    #[serde(rename = "currentOpeningHours")]
857    pub current_opening_hours: Option<GoogleMapsPlacesV1PlaceOpeningHours>,
858    /// Contains an array of entries for the next seven days including information about secondary hours of a business. Secondary hours are different from a business's main hours. For example, a restaurant can specify drive through hours or delivery hours as its secondary hours. This field populates the type subfield, which draws from a predefined list of opening hours types (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the place. This field includes the special_days subfield of all hours, set for dates that have exceptional hours.
859    #[serde(rename = "currentSecondaryOpeningHours")]
860    pub current_secondary_opening_hours: Option<Vec<GoogleMapsPlacesV1PlaceOpeningHours>>,
861    /// Specifies if the business supports delivery.
862    pub delivery: Option<bool>,
863    /// Specifies if the business supports indoor or outdoor seating options.
864    #[serde(rename = "dineIn")]
865    pub dine_in: Option<bool>,
866    /// The localized name of the place, suitable as a short human-readable description. For example, "Google Sydney", "Starbucks", "Pyrmont", etc.
867    #[serde(rename = "displayName")]
868    pub display_name: Option<GoogleTypeLocalizedText>,
869    /// Contains a summary of the place. A summary is comprised of a textual overview, and also includes the language code for these if applicable. Summary text must be presented as-is and can not be modified or altered.
870    #[serde(rename = "editorialSummary")]
871    pub editorial_summary: Option<GoogleTypeLocalizedText>,
872    /// The summary of amenities near the EV charging station.
873    #[serde(rename = "evChargeAmenitySummary")]
874    pub ev_charge_amenity_summary: Option<GoogleMapsPlacesV1PlaceEvChargeAmenitySummary>,
875    /// Information of ev charging options.
876    #[serde(rename = "evChargeOptions")]
877    pub ev_charge_options: Option<GoogleMapsPlacesV1EVChargeOptions>,
878    /// A full, human-readable address for this place.
879    #[serde(rename = "formattedAddress")]
880    pub formatted_address: Option<String>,
881    /// The most recent information about fuel options in a gas station. This information is updated regularly.
882    #[serde(rename = "fuelOptions")]
883    pub fuel_options: Option<GoogleMapsPlacesV1FuelOptions>,
884    /// AI-generated summary of the place.
885    #[serde(rename = "generativeSummary")]
886    pub generative_summary: Option<GoogleMapsPlacesV1PlaceGenerativeSummary>,
887    /// Place is good for children.
888    #[serde(rename = "goodForChildren")]
889    pub good_for_children: Option<bool>,
890    /// Place accommodates groups.
891    #[serde(rename = "goodForGroups")]
892    pub good_for_groups: Option<bool>,
893    /// Place is suitable for watching sports.
894    #[serde(rename = "goodForWatchingSports")]
895    pub good_for_watching_sports: Option<bool>,
896    /// Links to trigger different Google Maps actions.
897    #[serde(rename = "googleMapsLinks")]
898    pub google_maps_links: Option<GoogleMapsPlacesV1PlaceGoogleMapsLinks>,
899    /// A URL providing more information about this place.
900    #[serde(rename = "googleMapsUri")]
901    pub google_maps_uri: Option<String>,
902    /// Background color for icon_mask in hex format, e.g. #909CE1.
903    #[serde(rename = "iconBackgroundColor")]
904    pub icon_background_color: Option<String>,
905    /// A truncated URL to an icon mask. User can access different icon type by appending type suffix to the end (eg, ".svg" or ".png").
906    #[serde(rename = "iconMaskBaseUri")]
907    pub icon_mask_base_uri: Option<String>,
908    /// The unique identifier of a place.
909    pub id: Option<String>,
910    /// A human-readable phone number for the place, in international format.
911    #[serde(rename = "internationalPhoneNumber")]
912    pub international_phone_number: Option<String>,
913    /// Place provides live music.
914    #[serde(rename = "liveMusic")]
915    pub live_music: Option<bool>,
916    /// The position of this place.
917    pub location: Option<GoogleTypeLatLng>,
918    /// Place has a children's menu.
919    #[serde(rename = "menuForChildren")]
920    pub menu_for_children: Option<bool>,
921    /// If this Place is permanently closed and has moved to a new Place, this field contains the new Place's resource name, in `places/{place_id}` format. If this Place moved multiple times, this field will represent the first moved place. This field will not be populated if this Place has not moved.
922    #[serde(rename = "movedPlace")]
923    pub moved_place: Option<String>,
924    /// If this Place is permanently closed and has moved to a new Place, this field contains the new Place's place ID. If this Place moved multiple times, this field will represent the first moved Place. This field will not be populated if this Place has not moved.
925    #[serde(rename = "movedPlaceId")]
926    pub moved_place_id: Option<String>,
927    /// This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place.
928    pub name: Option<String>,
929    /// A human-readable phone number for the place, in national format.
930    #[serde(rename = "nationalPhoneNumber")]
931    pub national_phone_number: Option<String>,
932    /// A summary of points of interest near the place.
933    #[serde(rename = "neighborhoodSummary")]
934    pub neighborhood_summary: Option<GoogleMapsPlacesV1PlaceNeighborhoodSummary>,
935    /// Place provides outdoor seating.
936    #[serde(rename = "outdoorSeating")]
937    pub outdoor_seating: Option<bool>,
938    /// Options of parking provided by the place.
939    #[serde(rename = "parkingOptions")]
940    pub parking_options: Option<GoogleMapsPlacesV1PlaceParkingOptions>,
941    /// Payment options the place accepts. If a payment option data is not available, the payment option field will be unset.
942    #[serde(rename = "paymentOptions")]
943    pub payment_options: Option<GoogleMapsPlacesV1PlacePaymentOptions>,
944    /// Information (including references) about photos of this place. A maximum of 10 photos can be returned.
945    pub photos: Option<Vec<GoogleMapsPlacesV1Photo>>,
946    /// Plus code of the place location lat/long.
947    #[serde(rename = "plusCode")]
948    pub plus_code: Option<GoogleMapsPlacesV1PlacePlusCode>,
949    /// The address in postal address format.
950    #[serde(rename = "postalAddress")]
951    pub postal_address: Option<GoogleTypePostalAddress>,
952    /// Price level of the place.
953    #[serde(rename = "priceLevel")]
954    pub price_level: Option<String>,
955    /// The price range associated with a Place.
956    #[serde(rename = "priceRange")]
957    pub price_range: Option<GoogleMapsPlacesV1PriceRange>,
958    /// The primary type of the given result. This type must be one of the Places API supported types. For example, "restaurant", "cafe", "airport", etc. A place can only have a single primary type. For the complete list of possible values, see Table A and Table B at https://developers.google.com/maps/documentation/places/web-service/place-types. The primary type may be missing if the place's primary type is not a supported type. When a primary type is present, it is always one of the types in the `types` field.
959    #[serde(rename = "primaryType")]
960    pub primary_type: Option<String>,
961    /// The display name of the primary type, localized to the request language if applicable. For the complete list of possible values, see Table A and Table B at https://developers.google.com/maps/documentation/places/web-service/place-types. The primary type may be missing if the place's primary type is not a supported type.
962    #[serde(rename = "primaryTypeDisplayName")]
963    pub primary_type_display_name: Option<GoogleTypeLocalizedText>,
964    /// Indicates whether the place is a pure service area business. Pure service area business is a business that visits or delivers to customers directly but does not serve customers at their business address. For example, businesses like cleaning services or plumbers. Those businesses may not have a physical address or location on Google Maps.
965    #[serde(rename = "pureServiceAreaBusiness")]
966    pub pure_service_area_business: Option<bool>,
967    /// A rating between 1.0 and 5.0, based on user reviews of this place.
968    pub rating: Option<f64>,
969    /// The regular hours of operation. Note that if a place is always open (24 hours), the `close` field will not be set. Clients can rely on always open (24 hours) being represented as an [`open`](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/places#Period) period containing [`day`](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/places#Point) with value `0`, [`hour`](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/places#Point) with value `0`, and [`minute`](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/places#Point) with value `0`.
970    #[serde(rename = "regularOpeningHours")]
971    pub regular_opening_hours: Option<GoogleMapsPlacesV1PlaceOpeningHours>,
972    /// Contains an array of entries for information about regular secondary hours of a business. Secondary hours are different from a business's main hours. For example, a restaurant can specify drive through hours or delivery hours as its secondary hours. This field populates the type subfield, which draws from a predefined list of opening hours types (such as DRIVE_THROUGH, PICKUP, or TAKEOUT) based on the types of the place.
973    #[serde(rename = "regularSecondaryOpeningHours")]
974    pub regular_secondary_opening_hours: Option<Vec<GoogleMapsPlacesV1PlaceOpeningHours>>,
975    /// Specifies if the place supports reservations.
976    pub reservable: Option<bool>,
977    /// Place has restroom.
978    pub restroom: Option<bool>,
979    /// AI-generated summary of the place using user reviews.
980    #[serde(rename = "reviewSummary")]
981    pub review_summary: Option<GoogleMapsPlacesV1PlaceReviewSummary>,
982    /// List of reviews about this place, sorted by relevance. A maximum of 5 reviews can be returned.
983    pub reviews: Option<Vec<GoogleMapsPlacesV1Review>>,
984    /// Specifies if the place serves beer.
985    #[serde(rename = "servesBeer")]
986    pub serves_beer: Option<bool>,
987    /// Specifies if the place serves breakfast.
988    #[serde(rename = "servesBreakfast")]
989    pub serves_breakfast: Option<bool>,
990    /// Specifies if the place serves brunch.
991    #[serde(rename = "servesBrunch")]
992    pub serves_brunch: Option<bool>,
993    /// Place serves cocktails.
994    #[serde(rename = "servesCocktails")]
995    pub serves_cocktails: Option<bool>,
996    /// Place serves coffee.
997    #[serde(rename = "servesCoffee")]
998    pub serves_coffee: Option<bool>,
999    /// Place serves dessert.
1000    #[serde(rename = "servesDessert")]
1001    pub serves_dessert: Option<bool>,
1002    /// Specifies if the place serves dinner.
1003    #[serde(rename = "servesDinner")]
1004    pub serves_dinner: Option<bool>,
1005    /// Specifies if the place serves lunch.
1006    #[serde(rename = "servesLunch")]
1007    pub serves_lunch: Option<bool>,
1008    /// Specifies if the place serves vegetarian food.
1009    #[serde(rename = "servesVegetarianFood")]
1010    pub serves_vegetarian_food: Option<bool>,
1011    /// Specifies if the place serves wine.
1012    #[serde(rename = "servesWine")]
1013    pub serves_wine: Option<bool>,
1014    /// A short, human-readable address for this place.
1015    #[serde(rename = "shortFormattedAddress")]
1016    pub short_formatted_address: Option<String>,
1017    /// A list of sub-destinations related to the place.
1018    #[serde(rename = "subDestinations")]
1019    pub sub_destinations: Option<Vec<GoogleMapsPlacesV1PlaceSubDestination>>,
1020    /// Specifies if the business supports takeout.
1021    pub takeout: Option<bool>,
1022    /// IANA Time Zone Database time zone. For example "America/New_York".
1023    #[serde(rename = "timeZone")]
1024    pub time_zone: Option<GoogleTypeTimeZone>,
1025    /// A set of type tags for this result. For example, "political" and "locality". For the complete list of possible values, see Table A and Table B at https://developers.google.com/maps/documentation/places/web-service/place-types
1026    pub types: Option<Vec<String>>,
1027    /// The total number of reviews (with or without text) for this place.
1028    #[serde(rename = "userRatingCount")]
1029    pub user_rating_count: Option<i32>,
1030    /// Number of minutes this place's timezone is currently offset from UTC. This is expressed in minutes to support timezones that are offset by fractions of an hour, e.g. X hours and 15 minutes.
1031    #[serde(rename = "utcOffsetMinutes")]
1032    pub utc_offset_minutes: Option<i32>,
1033    /// A viewport suitable for displaying the place on an average-sized map. This viewport should not be used as the physical boundary or the service area of the business.
1034    pub viewport: Option<GoogleGeoTypeViewport>,
1035    /// The authoritative website for this place, e.g. a business' homepage. Note that for places that are part of a chain (e.g. an IKEA store), this will usually be the website for the individual store, not the overall chain.
1036    #[serde(rename = "websiteUri")]
1037    pub website_uri: Option<String>,
1038}
1039
1040impl common::ResponseResult for GoogleMapsPlacesV1Place {}
1041
1042/// Information about the accessibility options a place offers.
1043///
1044/// This type is not used in any activity, and only used as *part* of another schema.
1045///
1046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1047#[serde_with::serde_as]
1048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1049pub struct GoogleMapsPlacesV1PlaceAccessibilityOptions {
1050    /// Places has wheelchair accessible entrance.
1051    #[serde(rename = "wheelchairAccessibleEntrance")]
1052    pub wheelchair_accessible_entrance: Option<bool>,
1053    /// Place offers wheelchair accessible parking.
1054    #[serde(rename = "wheelchairAccessibleParking")]
1055    pub wheelchair_accessible_parking: Option<bool>,
1056    /// Place has wheelchair accessible restroom.
1057    #[serde(rename = "wheelchairAccessibleRestroom")]
1058    pub wheelchair_accessible_restroom: Option<bool>,
1059    /// Place has wheelchair accessible seating.
1060    #[serde(rename = "wheelchairAccessibleSeating")]
1061    pub wheelchair_accessible_seating: Option<bool>,
1062}
1063
1064impl common::Part for GoogleMapsPlacesV1PlaceAccessibilityOptions {}
1065
1066/// The structured components that form the formatted address, if this information is available.
1067///
1068/// This type is not used in any activity, and only used as *part* of another schema.
1069///
1070#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1071#[serde_with::serde_as]
1072#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1073pub struct GoogleMapsPlacesV1PlaceAddressComponent {
1074    /// The language used to format this components, in CLDR notation.
1075    #[serde(rename = "languageCode")]
1076    pub language_code: Option<String>,
1077    /// The full text description or name of the address component. For example, an address component for the country Australia may have a long_name of "Australia".
1078    #[serde(rename = "longText")]
1079    pub long_text: Option<String>,
1080    /// An abbreviated textual name for the address component, if available. For example, an address component for the country of Australia may have a short_name of "AU".
1081    #[serde(rename = "shortText")]
1082    pub short_text: Option<String>,
1083    /// An array indicating the type(s) of the address component.
1084    pub types: Option<Vec<String>>,
1085}
1086
1087impl common::Part for GoogleMapsPlacesV1PlaceAddressComponent {}
1088
1089/// Information about data providers of this place.
1090///
1091/// This type is not used in any activity, and only used as *part* of another schema.
1092///
1093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1094#[serde_with::serde_as]
1095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1096pub struct GoogleMapsPlacesV1PlaceAttribution {
1097    /// Name of the Place's data provider.
1098    pub provider: Option<String>,
1099    /// URI to the Place's data provider.
1100    #[serde(rename = "providerUri")]
1101    pub provider_uri: Option<String>,
1102}
1103
1104impl common::Part for GoogleMapsPlacesV1PlaceAttribution {}
1105
1106/// The consumer alert message for the place when we detect suspicious review activity on a business or a business violates our policies.
1107///
1108/// This type is not used in any activity, and only used as *part* of another schema.
1109///
1110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1111#[serde_with::serde_as]
1112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1113pub struct GoogleMapsPlacesV1PlaceConsumerAlert {
1114    /// The details of the consumer alert message.
1115    pub details: Option<GoogleMapsPlacesV1PlaceConsumerAlertDetails>,
1116    /// The language code of the consumer alert message. This is a BCP 47 language code.
1117    #[serde(rename = "languageCode")]
1118    pub language_code: Option<String>,
1119    /// The overview of the consumer alert message.
1120    pub overview: Option<String>,
1121}
1122
1123impl common::Part for GoogleMapsPlacesV1PlaceConsumerAlert {}
1124
1125/// The details of the consumer alert message.
1126///
1127/// This type is not used in any activity, and only used as *part* of another schema.
1128///
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct GoogleMapsPlacesV1PlaceConsumerAlertDetails {
1133    /// The link to show together with the description to provide more information.
1134    #[serde(rename = "aboutLink")]
1135    pub about_link: Option<GoogleMapsPlacesV1PlaceConsumerAlertDetailsLink>,
1136    /// The description of the consumer alert message.
1137    pub description: Option<String>,
1138    /// The title to show together with the description.
1139    pub title: Option<String>,
1140}
1141
1142impl common::Part for GoogleMapsPlacesV1PlaceConsumerAlertDetails {}
1143
1144/// The link to show together with the description to provide more information.
1145///
1146/// This type is not used in any activity, and only used as *part* of another schema.
1147///
1148#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1149#[serde_with::serde_as]
1150#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1151pub struct GoogleMapsPlacesV1PlaceConsumerAlertDetailsLink {
1152    /// The title to show for the link.
1153    pub title: Option<String>,
1154    /// The uri of the link.
1155    pub uri: Option<String>,
1156}
1157
1158impl common::Part for GoogleMapsPlacesV1PlaceConsumerAlertDetailsLink {}
1159
1160/// Info about the place in which this place is located.
1161///
1162/// This type is not used in any activity, and only used as *part* of another schema.
1163///
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct GoogleMapsPlacesV1PlaceContainingPlace {
1168    /// The place id of the place in which this place is located.
1169    pub id: Option<String>,
1170    /// The resource name of the place in which this place is located.
1171    pub name: Option<String>,
1172}
1173
1174impl common::Part for GoogleMapsPlacesV1PlaceContainingPlace {}
1175
1176/// The summary of amenities near the EV charging station. This only applies to places with type `electric_vehicle_charging_station`. The `overview` field is guaranteed to be provided while the other fields are optional.
1177///
1178/// This type is not used in any activity, and only used as *part* of another schema.
1179///
1180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1181#[serde_with::serde_as]
1182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1183pub struct GoogleMapsPlacesV1PlaceEvChargeAmenitySummary {
1184    /// A summary of the nearby coffee options.
1185    pub coffee: Option<GoogleMapsPlacesV1ContentBlock>,
1186    /// The AI disclosure message "Summarized with Gemini" (and its localized variants). This will be in the language specified in the request if available.
1187    #[serde(rename = "disclosureText")]
1188    pub disclosure_text: Option<GoogleTypeLocalizedText>,
1189    /// A link where users can flag a problem with the summary.
1190    #[serde(rename = "flagContentUri")]
1191    pub flag_content_uri: Option<String>,
1192    /// An overview of the available amenities. This is guaranteed to be provided.
1193    pub overview: Option<GoogleMapsPlacesV1ContentBlock>,
1194    /// A summary of the nearby restaurants.
1195    pub restaurant: Option<GoogleMapsPlacesV1ContentBlock>,
1196    /// A summary of the nearby stores.
1197    pub store: Option<GoogleMapsPlacesV1ContentBlock>,
1198}
1199
1200impl common::Part for GoogleMapsPlacesV1PlaceEvChargeAmenitySummary {}
1201
1202/// AI-generated summary of the place.
1203///
1204/// This type is not used in any activity, and only used as *part* of another schema.
1205///
1206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1207#[serde_with::serde_as]
1208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1209pub struct GoogleMapsPlacesV1PlaceGenerativeSummary {
1210    /// The AI disclosure message "Summarized with Gemini" (and its localized variants). This will be in the language specified in the request if available.
1211    #[serde(rename = "disclosureText")]
1212    pub disclosure_text: Option<GoogleTypeLocalizedText>,
1213    /// The overview of the place.
1214    pub overview: Option<GoogleTypeLocalizedText>,
1215    /// A link where users can flag a problem with the overview summary.
1216    #[serde(rename = "overviewFlagContentUri")]
1217    pub overview_flag_content_uri: Option<String>,
1218}
1219
1220impl common::Part for GoogleMapsPlacesV1PlaceGenerativeSummary {}
1221
1222/// Links to trigger different Google Maps actions.
1223///
1224/// This type is not used in any activity, and only used as *part* of another schema.
1225///
1226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1227#[serde_with::serde_as]
1228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1229pub struct GoogleMapsPlacesV1PlaceGoogleMapsLinks {
1230    /// A link to show the directions to the place. The link only populates the destination location and uses the default travel mode `DRIVE`.
1231    #[serde(rename = "directionsUri")]
1232    pub directions_uri: Option<String>,
1233    /// A link to show photos of this place on Google Maps.
1234    #[serde(rename = "photosUri")]
1235    pub photos_uri: Option<String>,
1236    /// A link to show this place.
1237    #[serde(rename = "placeUri")]
1238    pub place_uri: Option<String>,
1239    /// A link to show reviews of this place on Google Maps.
1240    #[serde(rename = "reviewsUri")]
1241    pub reviews_uri: Option<String>,
1242    /// A link to write a review for this place on Google Maps.
1243    #[serde(rename = "writeAReviewUri")]
1244    pub write_a_review_uri: Option<String>,
1245}
1246
1247impl common::Part for GoogleMapsPlacesV1PlaceGoogleMapsLinks {}
1248
1249/// A summary of points of interest near the place.
1250///
1251/// This type is not used in any activity, and only used as *part* of another schema.
1252///
1253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1254#[serde_with::serde_as]
1255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1256pub struct GoogleMapsPlacesV1PlaceNeighborhoodSummary {
1257    /// A detailed description of the neighborhood.
1258    pub description: Option<GoogleMapsPlacesV1ContentBlock>,
1259    /// The AI disclosure message "Summarized with Gemini" (and its localized variants). This will be in the language specified in the request if available.
1260    #[serde(rename = "disclosureText")]
1261    pub disclosure_text: Option<GoogleTypeLocalizedText>,
1262    /// A link where users can flag a problem with the summary.
1263    #[serde(rename = "flagContentUri")]
1264    pub flag_content_uri: Option<String>,
1265    /// An overview summary of the neighborhood.
1266    pub overview: Option<GoogleMapsPlacesV1ContentBlock>,
1267}
1268
1269impl common::Part for GoogleMapsPlacesV1PlaceNeighborhoodSummary {}
1270
1271/// Information about business hour of the place.
1272///
1273/// This type is not used in any activity, and only used as *part* of another schema.
1274///
1275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1276#[serde_with::serde_as]
1277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1278pub struct GoogleMapsPlacesV1PlaceOpeningHours {
1279    /// The next time the current opening hours period ends up to 7 days in the future. This field is only populated if the opening hours period is active at the time of serving the request.
1280    #[serde(rename = "nextCloseTime")]
1281    pub next_close_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1282    /// The next time the current opening hours period starts up to 7 days in the future. This field is only populated if the opening hours period is not active at the time of serving the request.
1283    #[serde(rename = "nextOpenTime")]
1284    pub next_open_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1285    /// Whether the opening hours period is currently active. For regular opening hours and current opening hours, this field means whether the place is open. For secondary opening hours and current secondary opening hours, this field means whether the secondary hours of this place is active.
1286    #[serde(rename = "openNow")]
1287    pub open_now: Option<bool>,
1288    /// The periods that this place is open during the week. The periods are in chronological order, in the place-local timezone. An empty (but not absent) value indicates a place that is never open, e.g. because it is closed temporarily for renovations. The starting day of `periods` is NOT fixed and should not be assumed to be Sunday. The API determines the start day based on a variety of factors. For example, for a 24/7 business, the first period may begin on the day of the request. For other businesses, it might be the first day of the week that they are open. NOTE: The ordering of the `periods` array is independent of the ordering of the `weekday_descriptions` array. Do not assume they will begin on the same day.
1289    pub periods: Option<Vec<GoogleMapsPlacesV1PlaceOpeningHoursPeriod>>,
1290    /// A type string used to identify the type of secondary hours.
1291    #[serde(rename = "secondaryHoursType")]
1292    pub secondary_hours_type: Option<String>,
1293    /// Structured information for special days that fall within the period that the returned opening hours cover. Special days are days that could impact the business hours of a place, e.g. Christmas day. Set for current_opening_hours and current_secondary_opening_hours if there are exceptional hours.
1294    #[serde(rename = "specialDays")]
1295    pub special_days: Option<Vec<GoogleMapsPlacesV1PlaceOpeningHoursSpecialDay>>,
1296    /// Localized strings describing the opening hours of this place, one string for each day of the week. NOTE: The order of the days and the start of the week is determined by the locale (language and region). The ordering of the `periods` array is independent of the ordering of the `weekday_descriptions` array. Do not assume they will begin on the same day. Will be empty if the hours are unknown or could not be converted to localized text. Example: "Sun: 18:00–06:00"
1297    #[serde(rename = "weekdayDescriptions")]
1298    pub weekday_descriptions: Option<Vec<String>>,
1299}
1300
1301impl common::Part for GoogleMapsPlacesV1PlaceOpeningHours {}
1302
1303/// A period the place remains in open_now status.
1304///
1305/// This type is not used in any activity, and only used as *part* of another schema.
1306///
1307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1308#[serde_with::serde_as]
1309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1310pub struct GoogleMapsPlacesV1PlaceOpeningHoursPeriod {
1311    /// The time that the place starts to be closed.
1312    pub close: Option<GoogleMapsPlacesV1PlaceOpeningHoursPeriodPoint>,
1313    /// The time that the place starts to be open.
1314    pub open: Option<GoogleMapsPlacesV1PlaceOpeningHoursPeriodPoint>,
1315}
1316
1317impl common::Part for GoogleMapsPlacesV1PlaceOpeningHoursPeriod {}
1318
1319/// Status changing points.
1320///
1321/// This type is not used in any activity, and only used as *part* of another schema.
1322///
1323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1324#[serde_with::serde_as]
1325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1326pub struct GoogleMapsPlacesV1PlaceOpeningHoursPeriodPoint {
1327    /// Date in the local timezone for the place.
1328    pub date: Option<GoogleTypeDate>,
1329    /// A day of the week, as an integer in the range 0-6. 0 is Sunday, 1 is Monday, etc.
1330    pub day: Option<i32>,
1331    /// The hour in 24 hour format. Ranges from 0 to 23.
1332    pub hour: Option<i32>,
1333    /// The minute. Ranges from 0 to 59.
1334    pub minute: Option<i32>,
1335    /// Whether or not this endpoint was truncated. Truncation occurs when the real hours are outside the times we are willing to return hours between, so we truncate the hours back to these boundaries. This ensures that at most 24 * 7 hours from midnight of the day of the request are returned.
1336    pub truncated: Option<bool>,
1337}
1338
1339impl common::Part for GoogleMapsPlacesV1PlaceOpeningHoursPeriodPoint {}
1340
1341/// Structured information for special days that fall within the period that the returned opening hours cover. Special days are days that could impact the business hours of a place, e.g. Christmas day.
1342///
1343/// This type is not used in any activity, and only used as *part* of another schema.
1344///
1345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1346#[serde_with::serde_as]
1347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1348pub struct GoogleMapsPlacesV1PlaceOpeningHoursSpecialDay {
1349    /// The date of this special day.
1350    pub date: Option<GoogleTypeDate>,
1351}
1352
1353impl common::Part for GoogleMapsPlacesV1PlaceOpeningHoursSpecialDay {}
1354
1355/// Information about parking options for the place. A parking lot could support more than one option at the same time.
1356///
1357/// This type is not used in any activity, and only used as *part* of another schema.
1358///
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct GoogleMapsPlacesV1PlaceParkingOptions {
1363    /// Place offers free garage parking.
1364    #[serde(rename = "freeGarageParking")]
1365    pub free_garage_parking: Option<bool>,
1366    /// Place offers free parking lots.
1367    #[serde(rename = "freeParkingLot")]
1368    pub free_parking_lot: Option<bool>,
1369    /// Place offers free street parking.
1370    #[serde(rename = "freeStreetParking")]
1371    pub free_street_parking: Option<bool>,
1372    /// Place offers paid garage parking.
1373    #[serde(rename = "paidGarageParking")]
1374    pub paid_garage_parking: Option<bool>,
1375    /// Place offers paid parking lots.
1376    #[serde(rename = "paidParkingLot")]
1377    pub paid_parking_lot: Option<bool>,
1378    /// Place offers paid street parking.
1379    #[serde(rename = "paidStreetParking")]
1380    pub paid_street_parking: Option<bool>,
1381    /// Place offers valet parking.
1382    #[serde(rename = "valetParking")]
1383    pub valet_parking: Option<bool>,
1384}
1385
1386impl common::Part for GoogleMapsPlacesV1PlaceParkingOptions {}
1387
1388/// Payment options the place accepts.
1389///
1390/// This type is not used in any activity, and only used as *part* of another schema.
1391///
1392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1393#[serde_with::serde_as]
1394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1395pub struct GoogleMapsPlacesV1PlacePaymentOptions {
1396    /// Place accepts cash only as payment. Places with this attribute may still accept other payment methods.
1397    #[serde(rename = "acceptsCashOnly")]
1398    pub accepts_cash_only: Option<bool>,
1399    /// Place accepts credit cards as payment.
1400    #[serde(rename = "acceptsCreditCards")]
1401    pub accepts_credit_cards: Option<bool>,
1402    /// Place accepts debit cards as payment.
1403    #[serde(rename = "acceptsDebitCards")]
1404    pub accepts_debit_cards: Option<bool>,
1405    /// Place accepts NFC payments.
1406    #[serde(rename = "acceptsNfc")]
1407    pub accepts_nfc: Option<bool>,
1408}
1409
1410impl common::Part for GoogleMapsPlacesV1PlacePaymentOptions {}
1411
1412/// Plus code (http://plus.codes) is a location reference with two formats: global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle, and compound code, replacing the prefix with a reference location.
1413///
1414/// This type is not used in any activity, and only used as *part* of another schema.
1415///
1416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1417#[serde_with::serde_as]
1418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1419pub struct GoogleMapsPlacesV1PlacePlusCode {
1420    /// Place's compound code, such as "33GV+HQ, Ramberg, Norway", containing the suffix of the global code and replacing the prefix with a formatted name of a reference entity.
1421    #[serde(rename = "compoundCode")]
1422    pub compound_code: Option<String>,
1423    /// Place's global (full) code, such as "9FWM33GV+HQ", representing an 1/8000 by 1/8000 degree area (~14 by 14 meters).
1424    #[serde(rename = "globalCode")]
1425    pub global_code: Option<String>,
1426}
1427
1428impl common::Part for GoogleMapsPlacesV1PlacePlusCode {}
1429
1430/// AI-generated summary of the place using user reviews.
1431///
1432/// This type is not used in any activity, and only used as *part* of another schema.
1433///
1434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1435#[serde_with::serde_as]
1436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1437pub struct GoogleMapsPlacesV1PlaceReviewSummary {
1438    /// The AI disclosure message "Summarized with Gemini" (and its localized variants). This will be in the language specified in the request if available.
1439    #[serde(rename = "disclosureText")]
1440    pub disclosure_text: Option<GoogleTypeLocalizedText>,
1441    /// A link where users can flag a problem with the summary.
1442    #[serde(rename = "flagContentUri")]
1443    pub flag_content_uri: Option<String>,
1444    /// A link to show reviews of this place on Google Maps.
1445    #[serde(rename = "reviewsUri")]
1446    pub reviews_uri: Option<String>,
1447    /// The summary of user reviews.
1448    pub text: Option<GoogleTypeLocalizedText>,
1449}
1450
1451impl common::Part for GoogleMapsPlacesV1PlaceReviewSummary {}
1452
1453/// Sub-destinations are specific places associated with a main place. These provide more specific destinations for users who are searching within a large or complex place, like an airport, national park, university, or stadium. For example, sub-destinations at an airport might include associated terminals and parking lots. Sub-destinations return the place ID and place resource name, which can be used in subsequent Place Details (New) requests to fetch richer details, including the sub-destination's display name and location.
1454///
1455/// This type is not used in any activity, and only used as *part* of another schema.
1456///
1457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1458#[serde_with::serde_as]
1459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1460pub struct GoogleMapsPlacesV1PlaceSubDestination {
1461    /// The place id of the sub-destination.
1462    pub id: Option<String>,
1463    /// The resource name of the sub-destination.
1464    pub name: Option<String>,
1465}
1466
1467impl common::Part for GoogleMapsPlacesV1PlaceSubDestination {}
1468
1469/// A route polyline. Only supports an [encoded polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm), which can be passed as a string and includes compression with minimal lossiness. This is the Routes API default output.
1470///
1471/// This type is not used in any activity, and only used as *part* of another schema.
1472///
1473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1474#[serde_with::serde_as]
1475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1476pub struct GoogleMapsPlacesV1Polyline {
1477    /// An [encoded polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm), as returned by the [Routes API by default](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#polylineencoding). See the [encoder](https://developers.google.com/maps/documentation/utilities/polylineutility) and [decoder](https://developers.google.com/maps/documentation/routes/polylinedecoder) tools.
1478    #[serde(rename = "encodedPolyline")]
1479    pub encoded_polyline: Option<String>,
1480}
1481
1482impl common::Part for GoogleMapsPlacesV1Polyline {}
1483
1484/// The price range associated with a Place. `end_price` could be unset, which indicates a range without upper bound (e.g. "More than $100").
1485///
1486/// This type is not used in any activity, and only used as *part* of another schema.
1487///
1488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1489#[serde_with::serde_as]
1490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1491pub struct GoogleMapsPlacesV1PriceRange {
1492    /// The high end of the price range (exclusive). Price should be lower than this amount.
1493    #[serde(rename = "endPrice")]
1494    pub end_price: Option<GoogleTypeMoney>,
1495    /// The low end of the price range (inclusive). Price should be at or above this amount.
1496    #[serde(rename = "startPrice")]
1497    pub start_price: Option<GoogleTypeMoney>,
1498}
1499
1500impl common::Part for GoogleMapsPlacesV1PriceRange {}
1501
1502/// Information about a review of a place.
1503///
1504/// This type is not used in any activity, and only used as *part* of another schema.
1505///
1506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1507#[serde_with::serde_as]
1508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1509pub struct GoogleMapsPlacesV1Review {
1510    /// This review's author.
1511    #[serde(rename = "authorAttribution")]
1512    pub author_attribution: Option<GoogleMapsPlacesV1AuthorAttribution>,
1513    /// A link where users can flag a problem with the review.
1514    #[serde(rename = "flagContentUri")]
1515    pub flag_content_uri: Option<String>,
1516    /// A link to show the review on Google Maps.
1517    #[serde(rename = "googleMapsUri")]
1518    pub google_maps_uri: Option<String>,
1519    /// A reference representing this place review which may be used to look up this place review again (also called the API "resource" name: `places/{place_id}/reviews/{review}`).
1520    pub name: Option<String>,
1521    /// The review text in its original language.
1522    #[serde(rename = "originalText")]
1523    pub original_text: Option<GoogleTypeLocalizedText>,
1524    /// Timestamp for the review.
1525    #[serde(rename = "publishTime")]
1526    pub publish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1527    /// A number between 1.0 and 5.0, also called the number of stars.
1528    pub rating: Option<f64>,
1529    /// A string of formatted recent time, expressing the review time relative to the current time in a form appropriate for the language and country.
1530    #[serde(rename = "relativePublishTimeDescription")]
1531    pub relative_publish_time_description: Option<String>,
1532    /// The localized text of the review.
1533    pub text: Option<GoogleTypeLocalizedText>,
1534    /// The date when the author visited the place. This is truncated to the year and month of the visit.
1535    #[serde(rename = "visitDate")]
1536    pub visit_date: Option<GoogleTypeDate>,
1537}
1538
1539impl common::Part for GoogleMapsPlacesV1Review {}
1540
1541/// Encapsulates a set of optional conditions to satisfy when calculating the routes.
1542///
1543/// This type is not used in any activity, and only used as *part* of another schema.
1544///
1545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1546#[serde_with::serde_as]
1547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1548pub struct GoogleMapsPlacesV1RouteModifiers {
1549    /// Optional. When set to true, avoids ferries where reasonable, giving preference to routes not containing ferries. Applies only to the `DRIVE` and `TWO_WHEELER` `TravelMode`.
1550    #[serde(rename = "avoidFerries")]
1551    pub avoid_ferries: Option<bool>,
1552    /// Optional. When set to true, avoids highways where reasonable, giving preference to routes not containing highways. Applies only to the `DRIVE` and `TWO_WHEELER` `TravelMode`.
1553    #[serde(rename = "avoidHighways")]
1554    pub avoid_highways: Option<bool>,
1555    /// Optional. When set to true, avoids navigating indoors where reasonable, giving preference to routes not containing indoor navigation. Applies only to the `WALK` `TravelMode`.
1556    #[serde(rename = "avoidIndoor")]
1557    pub avoid_indoor: Option<bool>,
1558    /// Optional. When set to true, avoids toll roads where reasonable, giving preference to routes not containing toll roads. Applies only to the `DRIVE` and `TWO_WHEELER` `TravelMode`.
1559    #[serde(rename = "avoidTolls")]
1560    pub avoid_tolls: Option<bool>,
1561}
1562
1563impl common::Part for GoogleMapsPlacesV1RouteModifiers {}
1564
1565/// Parameters to configure the routing calculations to the places in the response, both along a route (where result ranking will be influenced) and for calculating travel times on results.
1566///
1567/// This type is not used in any activity, and only used as *part* of another schema.
1568///
1569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1570#[serde_with::serde_as]
1571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1572pub struct GoogleMapsPlacesV1RoutingParameters {
1573    /// Optional. An explicit routing origin that overrides the origin defined in the polyline. By default, the polyline origin is used.
1574    pub origin: Option<GoogleTypeLatLng>,
1575    /// Optional. The route modifiers.
1576    #[serde(rename = "routeModifiers")]
1577    pub route_modifiers: Option<GoogleMapsPlacesV1RouteModifiers>,
1578    /// Optional. Specifies how to compute the routing summaries. The server attempts to use the selected routing preference to compute the route. The traffic aware routing preference is only available for the `DRIVE` or `TWO_WHEELER` `travelMode`.
1579    #[serde(rename = "routingPreference")]
1580    pub routing_preference: Option<String>,
1581    /// Optional. The travel mode.
1582    #[serde(rename = "travelMode")]
1583    pub travel_mode: Option<String>,
1584}
1585
1586impl common::Part for GoogleMapsPlacesV1RoutingParameters {}
1587
1588/// The duration and distance from the routing origin to a place in the response, and a second leg from that place to the destination, if requested. **Note:** Adding `routingSummaries` in the field mask without also including either the `routingParameters.origin` parameter or the `searchAlongRouteParameters.polyline.encodedPolyline` parameter in the request causes an error.
1589///
1590/// This type is not used in any activity, and only used as *part* of another schema.
1591///
1592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1593#[serde_with::serde_as]
1594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1595pub struct GoogleMapsPlacesV1RoutingSummary {
1596    /// A link to show directions on Google Maps using the waypoints from the given routing summary. The route generated by this link is not guaranteed to be the same as the route used to generate the routing summary. The link uses information provided in the request, from fields including `routingParameters` and `searchAlongRouteParameters` when applicable, to generate the directions link.
1597    #[serde(rename = "directionsUri")]
1598    pub directions_uri: Option<String>,
1599    /// The legs of the trip. When you calculate travel duration and distance from a set origin, `legs` contains a single leg containing the duration and distance from the origin to the destination. When you do a search along route, `legs` contains two legs: one from the origin to place, and one from the place to the destination.
1600    pub legs: Option<Vec<GoogleMapsPlacesV1RoutingSummaryLeg>>,
1601}
1602
1603impl common::Part for GoogleMapsPlacesV1RoutingSummary {}
1604
1605/// A leg is a single portion of a journey from one location to another.
1606///
1607/// This type is not used in any activity, and only used as *part* of another schema.
1608///
1609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1610#[serde_with::serde_as]
1611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1612pub struct GoogleMapsPlacesV1RoutingSummaryLeg {
1613    /// The distance of this leg of the trip.
1614    #[serde(rename = "distanceMeters")]
1615    pub distance_meters: Option<i32>,
1616    /// The time it takes to complete this leg of the trip.
1617    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1618    pub duration: Option<chrono::Duration>,
1619}
1620
1621impl common::Part for GoogleMapsPlacesV1RoutingSummaryLeg {}
1622
1623/// Request proto for Search Nearby.
1624///
1625/// # Activities
1626///
1627/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1628/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1629///
1630/// * [search nearby places](PlaceSearchNearbyCall) (request)
1631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1632#[serde_with::serde_as]
1633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1634pub struct GoogleMapsPlacesV1SearchNearbyRequest {
1635    /// Excluded primary Place type (e.g. "restaurant" or "gas_station") from https://developers.google.com/maps/documentation/places/web-service/place-types. Up to 50 types from [Table A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a) may be specified. If there are any conflicting primary types, i.e. a type appears in both included_primary_types and excluded_primary_types, an INVALID_ARGUMENT error is returned. If a Place type is specified with multiple type restrictions, only places that satisfy all of the restrictions are returned. For example, if we have {included_types = ["restaurant"], excluded_primary_types = ["restaurant"]}, the returned places provide "restaurant" related services but do not operate primarily as "restaurants".
1636    #[serde(rename = "excludedPrimaryTypes")]
1637    pub excluded_primary_types: Option<Vec<String>>,
1638    /// Excluded Place type (eg, "restaurant" or "gas_station") from https://developers.google.com/maps/documentation/places/web-service/place-types. Up to 50 types from [Table A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a) may be specified. If the client provides both included_types (e.g. restaurant) and excluded_types (e.g. cafe), then the response should include places that are restaurant but not cafe. The response includes places that match at least one of the included_types and none of the excluded_types. If there are any conflicting types, i.e. a type appears in both included_types and excluded_types, an INVALID_ARGUMENT error is returned. If a Place type is specified with multiple type restrictions, only places that satisfy all of the restrictions are returned. For example, if we have {included_types = ["restaurant"], excluded_primary_types = ["restaurant"]}, the returned places provide "restaurant" related services but do not operate primarily as "restaurants".
1639    #[serde(rename = "excludedTypes")]
1640    pub excluded_types: Option<Vec<String>>,
1641    /// Included primary Place type (e.g. "restaurant" or "gas_station") from https://developers.google.com/maps/documentation/places/web-service/place-types. A place can only have a single primary type from the supported types table associated with it. Up to 50 types from [Table A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a) may be specified. If there are any conflicting primary types, i.e. a type appears in both included_primary_types and excluded_primary_types, an INVALID_ARGUMENT error is returned. If a Place type is specified with multiple type restrictions, only places that satisfy all of the restrictions are returned. For example, if we have {included_types = ["restaurant"], excluded_primary_types = ["restaurant"]}, the returned places provide "restaurant" related services but do not operate primarily as "restaurants".
1642    #[serde(rename = "includedPrimaryTypes")]
1643    pub included_primary_types: Option<Vec<String>>,
1644    /// Included Place type (eg, "restaurant" or "gas_station") from https://developers.google.com/maps/documentation/places/web-service/place-types. Up to 50 types from [Table A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a) may be specified. If there are any conflicting types, i.e. a type appears in both included_types and excluded_types, an INVALID_ARGUMENT error is returned. If a Place type is specified with multiple type restrictions, only places that satisfy all of the restrictions are returned. For example, if we have {included_types = ["restaurant"], excluded_primary_types = ["restaurant"]}, the returned places provide "restaurant" related services but do not operate primarily as "restaurants".
1645    #[serde(rename = "includedTypes")]
1646    pub included_types: Option<Vec<String>>,
1647    /// Place details will be displayed with the preferred language if available. If the language code is unspecified or unrecognized, place details of any language may be returned, with a preference for English if such details exist. Current list of supported languages: https://developers.google.com/maps/faq#languagesupport.
1648    #[serde(rename = "languageCode")]
1649    pub language_code: Option<String>,
1650    /// Required. The region to search.
1651    #[serde(rename = "locationRestriction")]
1652    pub location_restriction: Option<GoogleMapsPlacesV1SearchNearbyRequestLocationRestriction>,
1653    /// Maximum number of results to return. It must be between 1 and 20 (default), inclusively. If the number is unset, it falls back to the upper limit. If the number is set to negative or exceeds the upper limit, an INVALID_ARGUMENT error is returned.
1654    #[serde(rename = "maxResultCount")]
1655    pub max_result_count: Option<i32>,
1656    /// How results will be ranked in the response.
1657    #[serde(rename = "rankPreference")]
1658    pub rank_preference: Option<String>,
1659    /// The Unicode country/region code (CLDR) of the location where the request is coming from. This parameter is used to display the place details, like region-specific place name, if available. The parameter can affect results based on applicable law. For more information, see https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html. Note that 3-digit region codes are not currently supported.
1660    #[serde(rename = "regionCode")]
1661    pub region_code: Option<String>,
1662    /// Optional. Parameters that affect the routing to the search results.
1663    #[serde(rename = "routingParameters")]
1664    pub routing_parameters: Option<GoogleMapsPlacesV1RoutingParameters>,
1665}
1666
1667impl common::RequestValue for GoogleMapsPlacesV1SearchNearbyRequest {}
1668
1669/// The region to search.
1670///
1671/// This type is not used in any activity, and only used as *part* of another schema.
1672///
1673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1674#[serde_with::serde_as]
1675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1676pub struct GoogleMapsPlacesV1SearchNearbyRequestLocationRestriction {
1677    /// A circle defined by center point and radius.
1678    pub circle: Option<GoogleMapsPlacesV1Circle>,
1679}
1680
1681impl common::Part for GoogleMapsPlacesV1SearchNearbyRequestLocationRestriction {}
1682
1683/// Response proto for Search Nearby.
1684///
1685/// # Activities
1686///
1687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1689///
1690/// * [search nearby places](PlaceSearchNearbyCall) (response)
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct GoogleMapsPlacesV1SearchNearbyResponse {
1695    /// A list of places that meets user's requirements like places types, number of places and specific location restriction.
1696    pub places: Option<Vec<GoogleMapsPlacesV1Place>>,
1697    /// A list of routing summaries where each entry associates to the corresponding place in the same index in the `places` field. If the routing summary is not available for one of the places, it will contain an empty entry. This list should have as many entries as the list of places if requested.
1698    #[serde(rename = "routingSummaries")]
1699    pub routing_summaries: Option<Vec<GoogleMapsPlacesV1RoutingSummary>>,
1700}
1701
1702impl common::ResponseResult for GoogleMapsPlacesV1SearchNearbyResponse {}
1703
1704/// Request proto for SearchText.
1705///
1706/// # Activities
1707///
1708/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1709/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1710///
1711/// * [search text places](PlaceSearchTextCall) (request)
1712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1713#[serde_with::serde_as]
1714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1715pub struct GoogleMapsPlacesV1SearchTextRequest {
1716    /// Optional. Set the searchable EV options of a place search request.
1717    #[serde(rename = "evOptions")]
1718    pub ev_options: Option<GoogleMapsPlacesV1SearchTextRequestEVOptions>,
1719    /// Optional. Include pure service area businesses if the field is set to true. Pure service area business is a business that visits or delivers to customers directly but does not serve customers at their business address. For example, businesses like cleaning services or plumbers. Those businesses do not have a physical address or location on Google Maps. Places will not return fields including `location`, `plus_code`, and other location related fields for these businesses.
1720    #[serde(rename = "includePureServiceAreaBusinesses")]
1721    pub include_pure_service_area_businesses: Option<bool>,
1722    /// The requested place type. Full list of types supported: https://developers.google.com/maps/documentation/places/web-service/place-types. Only support one included type.
1723    #[serde(rename = "includedType")]
1724    pub included_type: Option<String>,
1725    /// Place details will be displayed with the preferred language if available. If the language code is unspecified or unrecognized, place details of any language may be returned, with a preference for English if such details exist. Current list of supported languages: https://developers.google.com/maps/faq#languagesupport.
1726    #[serde(rename = "languageCode")]
1727    pub language_code: Option<String>,
1728    /// The region to search. This location serves as a bias which means results around given location might be returned. Cannot be set along with location_restriction.
1729    #[serde(rename = "locationBias")]
1730    pub location_bias: Option<GoogleMapsPlacesV1SearchTextRequestLocationBias>,
1731    /// The region to search. This location serves as a restriction which means results outside given location will not be returned. Cannot be set along with location_bias.
1732    #[serde(rename = "locationRestriction")]
1733    pub location_restriction: Option<GoogleMapsPlacesV1SearchTextRequestLocationRestriction>,
1734    /// Deprecated: Use `page_size` instead. The maximum number of results per page that can be returned. If the number of available results is larger than `max_result_count`, a `next_page_token` is returned which can be passed to `page_token` to get the next page of results in subsequent requests. If 0 or no value is provided, a default of 20 is used. The maximum value is 20; values above 20 will be coerced to 20. Negative values will return an INVALID_ARGUMENT error. If both `max_result_count` and `page_size` are specified, `max_result_count` will be ignored.
1735    #[serde(rename = "maxResultCount")]
1736    pub max_result_count: Option<i32>,
1737    /// Filter out results whose average user rating is strictly less than this limit. A valid value must be a float between 0 and 5 (inclusively) at a 0.5 cadence i.e. [0, 0.5, 1.0, ... , 5.0] inclusively. The input rating will round up to the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all results with a less than 1.0 rating.
1738    #[serde(rename = "minRating")]
1739    pub min_rating: Option<f64>,
1740    /// Used to restrict the search to places that are currently open. The default is false.
1741    #[serde(rename = "openNow")]
1742    pub open_now: Option<bool>,
1743    /// Optional. The maximum number of results per page that can be returned. If the number of available results is larger than `page_size`, a `next_page_token` is returned which can be passed to `page_token` to get the next page of results in subsequent requests. If 0 or no value is provided, a default of 20 is used. The maximum value is 20; values above 20 will be set to 20. Negative values will return an INVALID_ARGUMENT error. If both `max_result_count` and `page_size` are specified, `max_result_count` will be ignored.
1744    #[serde(rename = "pageSize")]
1745    pub page_size: Option<i32>,
1746    /// Optional. A page token, received from a previous TextSearch call. Provide this to retrieve the subsequent page. When paginating, all parameters other than `page_token`, `page_size`, and `max_result_count` provided to TextSearch must match the initial call that provided the page token. Otherwise an INVALID_ARGUMENT error is returned.
1747    #[serde(rename = "pageToken")]
1748    pub page_token: Option<String>,
1749    /// Used to restrict the search to places that are marked as certain price levels. Users can choose any combinations of price levels. Default to select all price levels.
1750    #[serde(rename = "priceLevels")]
1751    pub price_levels: Option<Vec<String>>,
1752    /// How results will be ranked in the response.
1753    #[serde(rename = "rankPreference")]
1754    pub rank_preference: Option<String>,
1755    /// The Unicode country/region code (CLDR) of the location where the request is coming from. This parameter is used to display the place details, like region-specific place name, if available. The parameter can affect results based on applicable law. For more information, see https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html. Note that 3-digit region codes are not currently supported.
1756    #[serde(rename = "regionCode")]
1757    pub region_code: Option<String>,
1758    /// Optional. Additional parameters for routing to results.
1759    #[serde(rename = "routingParameters")]
1760    pub routing_parameters: Option<GoogleMapsPlacesV1RoutingParameters>,
1761    /// Optional. Additional parameters proto for searching along a route.
1762    #[serde(rename = "searchAlongRouteParameters")]
1763    pub search_along_route_parameters:
1764        Option<GoogleMapsPlacesV1SearchTextRequestSearchAlongRouteParameters>,
1765    /// Used to set strict type filtering for included_type. If set to true, only results of the same type will be returned. Default to false.
1766    #[serde(rename = "strictTypeFiltering")]
1767    pub strict_type_filtering: Option<bool>,
1768    /// Required. The text query for textual search.
1769    #[serde(rename = "textQuery")]
1770    pub text_query: Option<String>,
1771}
1772
1773impl common::RequestValue for GoogleMapsPlacesV1SearchTextRequest {}
1774
1775/// Searchable EV options of a place search request.
1776///
1777/// This type is not used in any activity, and only used as *part* of another schema.
1778///
1779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1780#[serde_with::serde_as]
1781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1782pub struct GoogleMapsPlacesV1SearchTextRequestEVOptions {
1783    /// Optional. The list of preferred EV connector types. A place that does not support any of the listed connector types is filtered out.
1784    #[serde(rename = "connectorTypes")]
1785    pub connector_types: Option<Vec<String>>,
1786    /// Optional. Minimum required charging rate in kilowatts. A place with a charging rate less than the specified rate is filtered out.
1787    #[serde(rename = "minimumChargingRateKw")]
1788    pub minimum_charging_rate_kw: Option<f64>,
1789}
1790
1791impl common::Part for GoogleMapsPlacesV1SearchTextRequestEVOptions {}
1792
1793/// The region to search. This location serves as a bias which means results around given location might be returned.
1794///
1795/// This type is not used in any activity, and only used as *part* of another schema.
1796///
1797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1798#[serde_with::serde_as]
1799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1800pub struct GoogleMapsPlacesV1SearchTextRequestLocationBias {
1801    /// A circle defined by center point and radius.
1802    pub circle: Option<GoogleMapsPlacesV1Circle>,
1803    /// A rectangle box defined by northeast and southwest corner. `rectangle.high()` must be the northeast point of the rectangle viewport. `rectangle.low()` must be the southwest point of the rectangle viewport. `rectangle.low().latitude()` cannot be greater than `rectangle.high().latitude()`. This will result in an empty latitude range. A rectangle viewport cannot be wider than 180 degrees.
1804    pub rectangle: Option<GoogleGeoTypeViewport>,
1805}
1806
1807impl common::Part for GoogleMapsPlacesV1SearchTextRequestLocationBias {}
1808
1809/// The region to search. This location serves as a restriction which means results outside given location will not be returned.
1810///
1811/// This type is not used in any activity, and only used as *part* of another schema.
1812///
1813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1814#[serde_with::serde_as]
1815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1816pub struct GoogleMapsPlacesV1SearchTextRequestLocationRestriction {
1817    /// A rectangle box defined by northeast and southwest corner. `rectangle.high()` must be the northeast point of the rectangle viewport. `rectangle.low()` must be the southwest point of the rectangle viewport. `rectangle.low().latitude()` cannot be greater than `rectangle.high().latitude()`. This will result in an empty latitude range. A rectangle viewport cannot be wider than 180 degrees.
1818    pub rectangle: Option<GoogleGeoTypeViewport>,
1819}
1820
1821impl common::Part for GoogleMapsPlacesV1SearchTextRequestLocationRestriction {}
1822
1823/// Specifies a precalculated polyline from the [Routes API](https://developers.google.com/maps/documentation/routes) defining the route to search. Searching along a route is similar to using the `locationBias` or `locationRestriction` request option to bias the search results. However, while the `locationBias` and `locationRestriction` options let you specify a region to bias the search results, this option lets you bias the results along a trip route. Results are not guaranteed to be along the route provided, but rather are ranked within the search area defined by the polyline and, optionally, by the `locationBias` or `locationRestriction` based on minimal detour times from origin to destination. The results might be along an alternate route, especially if the provided polyline does not define an optimal route from origin to destination.
1824///
1825/// This type is not used in any activity, and only used as *part* of another schema.
1826///
1827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1828#[serde_with::serde_as]
1829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1830pub struct GoogleMapsPlacesV1SearchTextRequestSearchAlongRouteParameters {
1831    /// Required. The route polyline.
1832    pub polyline: Option<GoogleMapsPlacesV1Polyline>,
1833}
1834
1835impl common::Part for GoogleMapsPlacesV1SearchTextRequestSearchAlongRouteParameters {}
1836
1837/// Response proto for SearchText.
1838///
1839/// # Activities
1840///
1841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1843///
1844/// * [search text places](PlaceSearchTextCall) (response)
1845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1846#[serde_with::serde_as]
1847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1848pub struct GoogleMapsPlacesV1SearchTextResponse {
1849    /// Experimental: See https://developers.google.com/maps/documentation/places/web-service/experimental/places-generative for more details. A list of contextual contents where each entry associates to the corresponding place in the same index in the places field. The contents that are relevant to the `text_query` in the request are preferred. If the contextual content is not available for one of the places, it will return non-contextual content. It will be empty only when the content is unavailable for this place. This list will have as many entries as the list of places if requested.
1850    #[serde(rename = "contextualContents")]
1851    pub contextual_contents: Option<Vec<GoogleMapsPlacesV1ContextualContent>>,
1852    /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
1853    #[serde(rename = "nextPageToken")]
1854    pub next_page_token: Option<String>,
1855    /// A list of places that meet the user's text search criteria.
1856    pub places: Option<Vec<GoogleMapsPlacesV1Place>>,
1857    /// A list of routing summaries where each entry associates to the corresponding place in the same index in the `places` field. If the routing summary is not available for one of the places, it will contain an empty entry. This list will have as many entries as the list of places if requested.
1858    #[serde(rename = "routingSummaries")]
1859    pub routing_summaries: Option<Vec<GoogleMapsPlacesV1RoutingSummary>>,
1860    /// A link allows the user to search with the same text query as specified in the request on Google Maps.
1861    #[serde(rename = "searchUri")]
1862    pub search_uri: Option<String>,
1863}
1864
1865impl common::ResponseResult for GoogleMapsPlacesV1SearchTextResponse {}
1866
1867/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
1868///
1869/// This type is not used in any activity, and only used as *part* of another schema.
1870///
1871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1872#[serde_with::serde_as]
1873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1874pub struct GoogleTypeDate {
1875    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
1876    pub day: Option<i32>,
1877    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
1878    pub month: Option<i32>,
1879    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
1880    pub year: Option<i32>,
1881}
1882
1883impl common::Part for GoogleTypeDate {}
1884
1885/// An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
1886///
1887/// This type is not used in any activity, and only used as *part* of another schema.
1888///
1889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1890#[serde_with::serde_as]
1891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1892pub struct GoogleTypeLatLng {
1893    /// The latitude in degrees. It must be in the range [-90.0, +90.0].
1894    pub latitude: Option<f64>,
1895    /// The longitude in degrees. It must be in the range [-180.0, +180.0].
1896    pub longitude: Option<f64>,
1897}
1898
1899impl common::Part for GoogleTypeLatLng {}
1900
1901/// Localized variant of a text in a particular language.
1902///
1903/// This type is not used in any activity, and only used as *part* of another schema.
1904///
1905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1906#[serde_with::serde_as]
1907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1908pub struct GoogleTypeLocalizedText {
1909    /// The text's BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
1910    #[serde(rename = "languageCode")]
1911    pub language_code: Option<String>,
1912    /// Localized string in the language corresponding to language_code below.
1913    pub text: Option<String>,
1914}
1915
1916impl common::Part for GoogleTypeLocalizedText {}
1917
1918/// Represents an amount of money with its currency type.
1919///
1920/// This type is not used in any activity, and only used as *part* of another schema.
1921///
1922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1923#[serde_with::serde_as]
1924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1925pub struct GoogleTypeMoney {
1926    /// The three-letter currency code defined in ISO 4217.
1927    #[serde(rename = "currencyCode")]
1928    pub currency_code: Option<String>,
1929    /// Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
1930    pub nanos: Option<i32>,
1931    /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
1932    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1933    pub units: Option<i64>,
1934}
1935
1936impl common::Part for GoogleTypeMoney {}
1937
1938/// Represents a postal address, such as for postal delivery or payments addresses. With a postal address, a postal service can deliver items to a premise, P.O. box, or similar. A postal address is not intended to model geographical locations like roads, towns, or mountains. In typical usage, an address would be created by user input or from importing existing data, depending on the type of process. Advice on address input or editing: - Use an internationalization-ready address widget such as https://github.com/google/libaddressinput. - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. For more guidance on how to use this schema, see: https://support.google.com/business/answer/6397478.
1939///
1940/// This type is not used in any activity, and only used as *part* of another schema.
1941///
1942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1943#[serde_with::serde_as]
1944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1945pub struct GoogleTypePostalAddress {
1946    /// Unstructured address lines describing the lower levels of an address. Because values in `address_lines` do not have type information and may sometimes contain multiple values in a single field (for example, "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country or region of the address. In places where this can vary (for example, Japan), `address_language` is used to make it explicit (for example, "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this way, the most specific line of an address can be selected based on the language. The minimum permitted structural representation of an address consists of a `region_code` with all remaining information placed in the `address_lines`. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. Creating an address only containing a `region_code` and `address_lines` and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas).
1947    #[serde(rename = "addressLines")]
1948    pub address_lines: Option<Vec<String>>,
1949    /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. For Spain, this is the province and not the autonomous community (for example, "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. For example, in Switzerland, this should be left unpopulated.
1950    #[serde(rename = "administrativeArea")]
1951    pub administrative_area: Option<String>,
1952    /// Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
1953    #[serde(rename = "languageCode")]
1954    pub language_code: Option<String>,
1955    /// Optional. Generally refers to the city or town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave `locality` empty and use `address_lines`.
1956    pub locality: Option<String>,
1957    /// Optional. The name of the organization at the address.
1958    pub organization: Option<String>,
1959    /// Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (for example, state or zip code validation in the United States).
1960    #[serde(rename = "postalCode")]
1961    pub postal_code: Option<String>,
1962    /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
1963    pub recipients: Option<Vec<String>>,
1964    /// Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
1965    #[serde(rename = "regionCode")]
1966    pub region_code: Option<String>,
1967    /// The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. All new revisions **must** be backward compatible with old revisions.
1968    pub revision: Option<i32>,
1969    /// Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
1970    #[serde(rename = "sortingCode")]
1971    pub sorting_code: Option<String>,
1972    /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
1973    pub sublocality: Option<String>,
1974}
1975
1976impl common::Part for GoogleTypePostalAddress {}
1977
1978/// Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
1979///
1980/// This type is not used in any activity, and only used as *part* of another schema.
1981///
1982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1983#[serde_with::serde_as]
1984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1985pub struct GoogleTypeTimeZone {
1986    /// IANA Time Zone Database time zone. For example "America/New_York".
1987    pub id: Option<String>,
1988    /// Optional. IANA Time Zone Database version number. For example "2019a".
1989    pub version: Option<String>,
1990}
1991
1992impl common::Part for GoogleTypeTimeZone {}
1993
1994// ###################
1995// MethodBuilders ###
1996// #################
1997
1998/// A builder providing access to all methods supported on *place* resources.
1999/// It is not used directly, but through the [`MapsPlaces`] hub.
2000///
2001/// # Example
2002///
2003/// Instantiate a resource builder
2004///
2005/// ```test_harness,no_run
2006/// extern crate hyper;
2007/// extern crate hyper_rustls;
2008/// extern crate google_places1 as places1;
2009///
2010/// # async fn dox() {
2011/// use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2012///
2013/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2014/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2015///     .with_native_roots()
2016///     .unwrap()
2017///     .https_only()
2018///     .enable_http2()
2019///     .build();
2020///
2021/// let executor = hyper_util::rt::TokioExecutor::new();
2022/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2023///     secret,
2024///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2025///     yup_oauth2::client::CustomHyperClientBuilder::from(
2026///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2027///     ),
2028/// ).build().await.unwrap();
2029///
2030/// let client = hyper_util::client::legacy::Client::builder(
2031///     hyper_util::rt::TokioExecutor::new()
2032/// )
2033/// .build(
2034///     hyper_rustls::HttpsConnectorBuilder::new()
2035///         .with_native_roots()
2036///         .unwrap()
2037///         .https_or_http()
2038///         .enable_http2()
2039///         .build()
2040/// );
2041/// let mut hub = MapsPlaces::new(client, auth);
2042/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2043/// // like `autocomplete(...)`, `get(...)`, `photos_get_media(...)`, `search_nearby(...)` and `search_text(...)`
2044/// // to build up your call.
2045/// let rb = hub.places();
2046/// # }
2047/// ```
2048pub struct PlaceMethods<'a, C>
2049where
2050    C: 'a,
2051{
2052    hub: &'a MapsPlaces<C>,
2053}
2054
2055impl<'a, C> common::MethodsBuilder for PlaceMethods<'a, C> {}
2056
2057impl<'a, C> PlaceMethods<'a, C> {
2058    /// Create a builder to help you perform the following task:
2059    ///
2060    /// Get a photo media with a photo reference string.
2061    ///
2062    /// # Arguments
2063    ///
2064    /// * `name` - Required. The resource name of a photo media in the format: `places/{place_id}/photos/{photo_reference}/media`. The resource name of a photo as returned in a Place object's `photos.name` field comes with the format `places/{place_id}/photos/{photo_reference}`. You need to append `/media` at the end of the photo resource to get the photo media resource name.
2065    pub fn photos_get_media(&self, name: &str) -> PlacePhotoGetMediaCall<'a, C> {
2066        PlacePhotoGetMediaCall {
2067            hub: self.hub,
2068            _name: name.to_string(),
2069            _skip_http_redirect: Default::default(),
2070            _max_width_px: Default::default(),
2071            _max_height_px: Default::default(),
2072            _delegate: Default::default(),
2073            _additional_params: Default::default(),
2074            _scopes: Default::default(),
2075        }
2076    }
2077
2078    /// Create a builder to help you perform the following task:
2079    ///
2080    /// Returns predictions for the given input.
2081    ///
2082    /// # Arguments
2083    ///
2084    /// * `request` - No description provided.
2085    pub fn autocomplete(
2086        &self,
2087        request: GoogleMapsPlacesV1AutocompletePlacesRequest,
2088    ) -> PlaceAutocompleteCall<'a, C> {
2089        PlaceAutocompleteCall {
2090            hub: self.hub,
2091            _request: request,
2092            _delegate: Default::default(),
2093            _additional_params: Default::default(),
2094            _scopes: Default::default(),
2095        }
2096    }
2097
2098    /// Create a builder to help you perform the following task:
2099    ///
2100    /// Get the details of a place based on its resource name, which is a string in the `places/{place_id}` format.
2101    ///
2102    /// # Arguments
2103    ///
2104    /// * `name` - Required. The resource name of a place, in the `places/{place_id}` format.
2105    pub fn get(&self, name: &str) -> PlaceGetCall<'a, C> {
2106        PlaceGetCall {
2107            hub: self.hub,
2108            _name: name.to_string(),
2109            _session_token: Default::default(),
2110            _region_code: Default::default(),
2111            _language_code: Default::default(),
2112            _delegate: Default::default(),
2113            _additional_params: Default::default(),
2114            _scopes: Default::default(),
2115        }
2116    }
2117
2118    /// Create a builder to help you perform the following task:
2119    ///
2120    /// Search for places near locations.
2121    ///
2122    /// # Arguments
2123    ///
2124    /// * `request` - No description provided.
2125    pub fn search_nearby(
2126        &self,
2127        request: GoogleMapsPlacesV1SearchNearbyRequest,
2128    ) -> PlaceSearchNearbyCall<'a, C> {
2129        PlaceSearchNearbyCall {
2130            hub: self.hub,
2131            _request: request,
2132            _delegate: Default::default(),
2133            _additional_params: Default::default(),
2134            _scopes: Default::default(),
2135        }
2136    }
2137
2138    /// Create a builder to help you perform the following task:
2139    ///
2140    /// Text query based place search.
2141    ///
2142    /// # Arguments
2143    ///
2144    /// * `request` - No description provided.
2145    pub fn search_text(
2146        &self,
2147        request: GoogleMapsPlacesV1SearchTextRequest,
2148    ) -> PlaceSearchTextCall<'a, C> {
2149        PlaceSearchTextCall {
2150            hub: self.hub,
2151            _request: request,
2152            _delegate: Default::default(),
2153            _additional_params: Default::default(),
2154            _scopes: Default::default(),
2155        }
2156    }
2157}
2158
2159// ###################
2160// CallBuilders   ###
2161// #################
2162
2163/// Get a photo media with a photo reference string.
2164///
2165/// A builder for the *photos.getMedia* method supported by a *place* resource.
2166/// It is not used directly, but through a [`PlaceMethods`] instance.
2167///
2168/// # Example
2169///
2170/// Instantiate a resource method builder
2171///
2172/// ```test_harness,no_run
2173/// # extern crate hyper;
2174/// # extern crate hyper_rustls;
2175/// # extern crate google_places1 as places1;
2176/// # async fn dox() {
2177/// # use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2178///
2179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2180/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2181/// #     .with_native_roots()
2182/// #     .unwrap()
2183/// #     .https_only()
2184/// #     .enable_http2()
2185/// #     .build();
2186///
2187/// # let executor = hyper_util::rt::TokioExecutor::new();
2188/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2189/// #     secret,
2190/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2191/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2192/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2193/// #     ),
2194/// # ).build().await.unwrap();
2195///
2196/// # let client = hyper_util::client::legacy::Client::builder(
2197/// #     hyper_util::rt::TokioExecutor::new()
2198/// # )
2199/// # .build(
2200/// #     hyper_rustls::HttpsConnectorBuilder::new()
2201/// #         .with_native_roots()
2202/// #         .unwrap()
2203/// #         .https_or_http()
2204/// #         .enable_http2()
2205/// #         .build()
2206/// # );
2207/// # let mut hub = MapsPlaces::new(client, auth);
2208/// // You can configure optional parameters by calling the respective setters at will, and
2209/// // execute the final call using `doit()`.
2210/// // Values shown here are possibly random and not representative !
2211/// let result = hub.places().photos_get_media("name")
2212///              .skip_http_redirect(true)
2213///              .max_width_px(-51)
2214///              .max_height_px(-12)
2215///              .doit().await;
2216/// # }
2217/// ```
2218pub struct PlacePhotoGetMediaCall<'a, C>
2219where
2220    C: 'a,
2221{
2222    hub: &'a MapsPlaces<C>,
2223    _name: String,
2224    _skip_http_redirect: Option<bool>,
2225    _max_width_px: Option<i32>,
2226    _max_height_px: Option<i32>,
2227    _delegate: Option<&'a mut dyn common::Delegate>,
2228    _additional_params: HashMap<String, String>,
2229    _scopes: BTreeSet<String>,
2230}
2231
2232impl<'a, C> common::CallBuilder for PlacePhotoGetMediaCall<'a, C> {}
2233
2234impl<'a, C> PlacePhotoGetMediaCall<'a, C>
2235where
2236    C: common::Connector,
2237{
2238    /// Perform the operation you have build so far.
2239    pub async fn doit(
2240        mut self,
2241    ) -> common::Result<(common::Response, GoogleMapsPlacesV1PhotoMedia)> {
2242        use std::borrow::Cow;
2243        use std::io::{Read, Seek};
2244
2245        use common::{url::Params, ToParts};
2246        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2247
2248        let mut dd = common::DefaultDelegate;
2249        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2250        dlg.begin(common::MethodInfo {
2251            id: "places.places.photos.getMedia",
2252            http_method: hyper::Method::GET,
2253        });
2254
2255        for &field in [
2256            "alt",
2257            "name",
2258            "skipHttpRedirect",
2259            "maxWidthPx",
2260            "maxHeightPx",
2261        ]
2262        .iter()
2263        {
2264            if self._additional_params.contains_key(field) {
2265                dlg.finished(false);
2266                return Err(common::Error::FieldClash(field));
2267            }
2268        }
2269
2270        let mut params = Params::with_capacity(6 + self._additional_params.len());
2271        params.push("name", self._name);
2272        if let Some(value) = self._skip_http_redirect.as_ref() {
2273            params.push("skipHttpRedirect", value.to_string());
2274        }
2275        if let Some(value) = self._max_width_px.as_ref() {
2276            params.push("maxWidthPx", value.to_string());
2277        }
2278        if let Some(value) = self._max_height_px.as_ref() {
2279            params.push("maxHeightPx", value.to_string());
2280        }
2281
2282        params.extend(self._additional_params.iter());
2283
2284        params.push("alt", "json");
2285        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2286        if self._scopes.is_empty() {
2287            self._scopes
2288                .insert(Scope::CloudPlatform.as_ref().to_string());
2289        }
2290
2291        #[allow(clippy::single_element_loop)]
2292        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2293            url = params.uri_replacement(url, param_name, find_this, true);
2294        }
2295        {
2296            let to_remove = ["name"];
2297            params.remove_params(&to_remove);
2298        }
2299
2300        let url = params.parse_with_url(&url);
2301
2302        loop {
2303            let token = match self
2304                .hub
2305                .auth
2306                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2307                .await
2308            {
2309                Ok(token) => token,
2310                Err(e) => match dlg.token(e) {
2311                    Ok(token) => token,
2312                    Err(e) => {
2313                        dlg.finished(false);
2314                        return Err(common::Error::MissingToken(e));
2315                    }
2316                },
2317            };
2318            let mut req_result = {
2319                let client = &self.hub.client;
2320                dlg.pre_request();
2321                let mut req_builder = hyper::Request::builder()
2322                    .method(hyper::Method::GET)
2323                    .uri(url.as_str())
2324                    .header(USER_AGENT, self.hub._user_agent.clone());
2325
2326                if let Some(token) = token.as_ref() {
2327                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2328                }
2329
2330                let request = req_builder
2331                    .header(CONTENT_LENGTH, 0_u64)
2332                    .body(common::to_body::<String>(None));
2333
2334                client.request(request.unwrap()).await
2335            };
2336
2337            match req_result {
2338                Err(err) => {
2339                    if let common::Retry::After(d) = dlg.http_error(&err) {
2340                        sleep(d).await;
2341                        continue;
2342                    }
2343                    dlg.finished(false);
2344                    return Err(common::Error::HttpError(err));
2345                }
2346                Ok(res) => {
2347                    let (mut parts, body) = res.into_parts();
2348                    let mut body = common::Body::new(body);
2349                    if !parts.status.is_success() {
2350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2351                        let error = serde_json::from_str(&common::to_string(&bytes));
2352                        let response = common::to_response(parts, bytes.into());
2353
2354                        if let common::Retry::After(d) =
2355                            dlg.http_failure(&response, error.as_ref().ok())
2356                        {
2357                            sleep(d).await;
2358                            continue;
2359                        }
2360
2361                        dlg.finished(false);
2362
2363                        return Err(match error {
2364                            Ok(value) => common::Error::BadRequest(value),
2365                            _ => common::Error::Failure(response),
2366                        });
2367                    }
2368                    let response = {
2369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2370                        let encoded = common::to_string(&bytes);
2371                        match serde_json::from_str(&encoded) {
2372                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2373                            Err(error) => {
2374                                dlg.response_json_decode_error(&encoded, &error);
2375                                return Err(common::Error::JsonDecodeError(
2376                                    encoded.to_string(),
2377                                    error,
2378                                ));
2379                            }
2380                        }
2381                    };
2382
2383                    dlg.finished(true);
2384                    return Ok(response);
2385                }
2386            }
2387        }
2388    }
2389
2390    /// Required. The resource name of a photo media in the format: `places/{place_id}/photos/{photo_reference}/media`. The resource name of a photo as returned in a Place object's `photos.name` field comes with the format `places/{place_id}/photos/{photo_reference}`. You need to append `/media` at the end of the photo resource to get the photo media resource name.
2391    ///
2392    /// Sets the *name* path property to the given value.
2393    ///
2394    /// Even though the property as already been set when instantiating this call,
2395    /// we provide this method for API completeness.
2396    pub fn name(mut self, new_value: &str) -> PlacePhotoGetMediaCall<'a, C> {
2397        self._name = new_value.to_string();
2398        self
2399    }
2400    /// Optional. If set, skip the default HTTP redirect behavior and render a text format (for example, in JSON format for HTTP use case) response. If not set, an HTTP redirect will be issued to redirect the call to the image media. This option is ignored for non-HTTP requests.
2401    ///
2402    /// Sets the *skip http redirect* query property to the given value.
2403    pub fn skip_http_redirect(mut self, new_value: bool) -> PlacePhotoGetMediaCall<'a, C> {
2404        self._skip_http_redirect = Some(new_value);
2405        self
2406    }
2407    /// Optional. Specifies the maximum desired width, in pixels, of the image. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the max_height_px and max_width_px properties accept an integer between 1 and 4800, inclusively. If the value is not within the allowed range, an INVALID_ARGUMENT error will be returned. At least one of max_height_px or max_width_px needs to be specified. If neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT error will be returned.
2408    ///
2409    /// Sets the *max width px* query property to the given value.
2410    pub fn max_width_px(mut self, new_value: i32) -> PlacePhotoGetMediaCall<'a, C> {
2411        self._max_width_px = Some(new_value);
2412        self
2413    }
2414    /// Optional. Specifies the maximum desired height, in pixels, of the image. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the max_height_px and max_width_px properties accept an integer between 1 and 4800, inclusively. If the value is not within the allowed range, an INVALID_ARGUMENT error will be returned. At least one of max_height_px or max_width_px needs to be specified. If neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT error will be returned.
2415    ///
2416    /// Sets the *max height px* query property to the given value.
2417    pub fn max_height_px(mut self, new_value: i32) -> PlacePhotoGetMediaCall<'a, C> {
2418        self._max_height_px = Some(new_value);
2419        self
2420    }
2421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2422    /// while executing the actual API request.
2423    ///
2424    /// ````text
2425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2426    /// ````
2427    ///
2428    /// Sets the *delegate* property to the given value.
2429    pub fn delegate(
2430        mut self,
2431        new_value: &'a mut dyn common::Delegate,
2432    ) -> PlacePhotoGetMediaCall<'a, C> {
2433        self._delegate = Some(new_value);
2434        self
2435    }
2436
2437    /// Set any additional parameter of the query string used in the request.
2438    /// It should be used to set parameters which are not yet available through their own
2439    /// setters.
2440    ///
2441    /// Please note that this method must not be used to set any of the known parameters
2442    /// which have their own setter method. If done anyway, the request will fail.
2443    ///
2444    /// # Additional Parameters
2445    ///
2446    /// * *$.xgafv* (query-string) - V1 error format.
2447    /// * *access_token* (query-string) - OAuth access token.
2448    /// * *alt* (query-string) - Data format for response.
2449    /// * *callback* (query-string) - JSONP
2450    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2451    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2452    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2453    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2454    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2455    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2456    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2457    pub fn param<T>(mut self, name: T, value: T) -> PlacePhotoGetMediaCall<'a, C>
2458    where
2459        T: AsRef<str>,
2460    {
2461        self._additional_params
2462            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2463        self
2464    }
2465
2466    /// Identifies the authorization scope for the method you are building.
2467    ///
2468    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2469    /// [`Scope::CloudPlatform`].
2470    ///
2471    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2472    /// tokens for more than one scope.
2473    ///
2474    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2475    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2476    /// sufficient, a read-write scope will do as well.
2477    pub fn add_scope<St>(mut self, scope: St) -> PlacePhotoGetMediaCall<'a, C>
2478    where
2479        St: AsRef<str>,
2480    {
2481        self._scopes.insert(String::from(scope.as_ref()));
2482        self
2483    }
2484    /// Identifies the authorization scope(s) for the method you are building.
2485    ///
2486    /// See [`Self::add_scope()`] for details.
2487    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacePhotoGetMediaCall<'a, C>
2488    where
2489        I: IntoIterator<Item = St>,
2490        St: AsRef<str>,
2491    {
2492        self._scopes
2493            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2494        self
2495    }
2496
2497    /// Removes all scopes, and no default scope will be used either.
2498    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2499    /// for details).
2500    pub fn clear_scopes(mut self) -> PlacePhotoGetMediaCall<'a, C> {
2501        self._scopes.clear();
2502        self
2503    }
2504}
2505
2506/// Returns predictions for the given input.
2507///
2508/// A builder for the *autocomplete* method supported by a *place* resource.
2509/// It is not used directly, but through a [`PlaceMethods`] instance.
2510///
2511/// # Example
2512///
2513/// Instantiate a resource method builder
2514///
2515/// ```test_harness,no_run
2516/// # extern crate hyper;
2517/// # extern crate hyper_rustls;
2518/// # extern crate google_places1 as places1;
2519/// use places1::api::GoogleMapsPlacesV1AutocompletePlacesRequest;
2520/// # async fn dox() {
2521/// # use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2522///
2523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2524/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2525/// #     .with_native_roots()
2526/// #     .unwrap()
2527/// #     .https_only()
2528/// #     .enable_http2()
2529/// #     .build();
2530///
2531/// # let executor = hyper_util::rt::TokioExecutor::new();
2532/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2533/// #     secret,
2534/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2535/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2536/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2537/// #     ),
2538/// # ).build().await.unwrap();
2539///
2540/// # let client = hyper_util::client::legacy::Client::builder(
2541/// #     hyper_util::rt::TokioExecutor::new()
2542/// # )
2543/// # .build(
2544/// #     hyper_rustls::HttpsConnectorBuilder::new()
2545/// #         .with_native_roots()
2546/// #         .unwrap()
2547/// #         .https_or_http()
2548/// #         .enable_http2()
2549/// #         .build()
2550/// # );
2551/// # let mut hub = MapsPlaces::new(client, auth);
2552/// // As the method needs a request, you would usually fill it with the desired information
2553/// // into the respective structure. Some of the parts shown here might not be applicable !
2554/// // Values shown here are possibly random and not representative !
2555/// let mut req = GoogleMapsPlacesV1AutocompletePlacesRequest::default();
2556///
2557/// // You can configure optional parameters by calling the respective setters at will, and
2558/// // execute the final call using `doit()`.
2559/// // Values shown here are possibly random and not representative !
2560/// let result = hub.places().autocomplete(req)
2561///              .doit().await;
2562/// # }
2563/// ```
2564pub struct PlaceAutocompleteCall<'a, C>
2565where
2566    C: 'a,
2567{
2568    hub: &'a MapsPlaces<C>,
2569    _request: GoogleMapsPlacesV1AutocompletePlacesRequest,
2570    _delegate: Option<&'a mut dyn common::Delegate>,
2571    _additional_params: HashMap<String, String>,
2572    _scopes: BTreeSet<String>,
2573}
2574
2575impl<'a, C> common::CallBuilder for PlaceAutocompleteCall<'a, C> {}
2576
2577impl<'a, C> PlaceAutocompleteCall<'a, C>
2578where
2579    C: common::Connector,
2580{
2581    /// Perform the operation you have build so far.
2582    pub async fn doit(
2583        mut self,
2584    ) -> common::Result<(
2585        common::Response,
2586        GoogleMapsPlacesV1AutocompletePlacesResponse,
2587    )> {
2588        use std::borrow::Cow;
2589        use std::io::{Read, Seek};
2590
2591        use common::{url::Params, ToParts};
2592        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2593
2594        let mut dd = common::DefaultDelegate;
2595        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2596        dlg.begin(common::MethodInfo {
2597            id: "places.places.autocomplete",
2598            http_method: hyper::Method::POST,
2599        });
2600
2601        for &field in ["alt"].iter() {
2602            if self._additional_params.contains_key(field) {
2603                dlg.finished(false);
2604                return Err(common::Error::FieldClash(field));
2605            }
2606        }
2607
2608        let mut params = Params::with_capacity(3 + self._additional_params.len());
2609
2610        params.extend(self._additional_params.iter());
2611
2612        params.push("alt", "json");
2613        let mut url = self.hub._base_url.clone() + "v1/places:autocomplete";
2614        if self._scopes.is_empty() {
2615            self._scopes
2616                .insert(Scope::CloudPlatform.as_ref().to_string());
2617        }
2618
2619        let url = params.parse_with_url(&url);
2620
2621        let mut json_mime_type = mime::APPLICATION_JSON;
2622        let mut request_value_reader = {
2623            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2624            common::remove_json_null_values(&mut value);
2625            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2626            serde_json::to_writer(&mut dst, &value).unwrap();
2627            dst
2628        };
2629        let request_size = request_value_reader
2630            .seek(std::io::SeekFrom::End(0))
2631            .unwrap();
2632        request_value_reader
2633            .seek(std::io::SeekFrom::Start(0))
2634            .unwrap();
2635
2636        loop {
2637            let token = match self
2638                .hub
2639                .auth
2640                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2641                .await
2642            {
2643                Ok(token) => token,
2644                Err(e) => match dlg.token(e) {
2645                    Ok(token) => token,
2646                    Err(e) => {
2647                        dlg.finished(false);
2648                        return Err(common::Error::MissingToken(e));
2649                    }
2650                },
2651            };
2652            request_value_reader
2653                .seek(std::io::SeekFrom::Start(0))
2654                .unwrap();
2655            let mut req_result = {
2656                let client = &self.hub.client;
2657                dlg.pre_request();
2658                let mut req_builder = hyper::Request::builder()
2659                    .method(hyper::Method::POST)
2660                    .uri(url.as_str())
2661                    .header(USER_AGENT, self.hub._user_agent.clone());
2662
2663                if let Some(token) = token.as_ref() {
2664                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2665                }
2666
2667                let request = req_builder
2668                    .header(CONTENT_TYPE, json_mime_type.to_string())
2669                    .header(CONTENT_LENGTH, request_size as u64)
2670                    .body(common::to_body(
2671                        request_value_reader.get_ref().clone().into(),
2672                    ));
2673
2674                client.request(request.unwrap()).await
2675            };
2676
2677            match req_result {
2678                Err(err) => {
2679                    if let common::Retry::After(d) = dlg.http_error(&err) {
2680                        sleep(d).await;
2681                        continue;
2682                    }
2683                    dlg.finished(false);
2684                    return Err(common::Error::HttpError(err));
2685                }
2686                Ok(res) => {
2687                    let (mut parts, body) = res.into_parts();
2688                    let mut body = common::Body::new(body);
2689                    if !parts.status.is_success() {
2690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2691                        let error = serde_json::from_str(&common::to_string(&bytes));
2692                        let response = common::to_response(parts, bytes.into());
2693
2694                        if let common::Retry::After(d) =
2695                            dlg.http_failure(&response, error.as_ref().ok())
2696                        {
2697                            sleep(d).await;
2698                            continue;
2699                        }
2700
2701                        dlg.finished(false);
2702
2703                        return Err(match error {
2704                            Ok(value) => common::Error::BadRequest(value),
2705                            _ => common::Error::Failure(response),
2706                        });
2707                    }
2708                    let response = {
2709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2710                        let encoded = common::to_string(&bytes);
2711                        match serde_json::from_str(&encoded) {
2712                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2713                            Err(error) => {
2714                                dlg.response_json_decode_error(&encoded, &error);
2715                                return Err(common::Error::JsonDecodeError(
2716                                    encoded.to_string(),
2717                                    error,
2718                                ));
2719                            }
2720                        }
2721                    };
2722
2723                    dlg.finished(true);
2724                    return Ok(response);
2725                }
2726            }
2727        }
2728    }
2729
2730    ///
2731    /// Sets the *request* property to the given value.
2732    ///
2733    /// Even though the property as already been set when instantiating this call,
2734    /// we provide this method for API completeness.
2735    pub fn request(
2736        mut self,
2737        new_value: GoogleMapsPlacesV1AutocompletePlacesRequest,
2738    ) -> PlaceAutocompleteCall<'a, C> {
2739        self._request = new_value;
2740        self
2741    }
2742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2743    /// while executing the actual API request.
2744    ///
2745    /// ````text
2746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2747    /// ````
2748    ///
2749    /// Sets the *delegate* property to the given value.
2750    pub fn delegate(
2751        mut self,
2752        new_value: &'a mut dyn common::Delegate,
2753    ) -> PlaceAutocompleteCall<'a, C> {
2754        self._delegate = Some(new_value);
2755        self
2756    }
2757
2758    /// Set any additional parameter of the query string used in the request.
2759    /// It should be used to set parameters which are not yet available through their own
2760    /// setters.
2761    ///
2762    /// Please note that this method must not be used to set any of the known parameters
2763    /// which have their own setter method. If done anyway, the request will fail.
2764    ///
2765    /// # Additional Parameters
2766    ///
2767    /// * *$.xgafv* (query-string) - V1 error format.
2768    /// * *access_token* (query-string) - OAuth access token.
2769    /// * *alt* (query-string) - Data format for response.
2770    /// * *callback* (query-string) - JSONP
2771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2772    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2775    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2778    pub fn param<T>(mut self, name: T, value: T) -> PlaceAutocompleteCall<'a, C>
2779    where
2780        T: AsRef<str>,
2781    {
2782        self._additional_params
2783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2784        self
2785    }
2786
2787    /// Identifies the authorization scope for the method you are building.
2788    ///
2789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2790    /// [`Scope::CloudPlatform`].
2791    ///
2792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2793    /// tokens for more than one scope.
2794    ///
2795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2797    /// sufficient, a read-write scope will do as well.
2798    pub fn add_scope<St>(mut self, scope: St) -> PlaceAutocompleteCall<'a, C>
2799    where
2800        St: AsRef<str>,
2801    {
2802        self._scopes.insert(String::from(scope.as_ref()));
2803        self
2804    }
2805    /// Identifies the authorization scope(s) for the method you are building.
2806    ///
2807    /// See [`Self::add_scope()`] for details.
2808    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlaceAutocompleteCall<'a, C>
2809    where
2810        I: IntoIterator<Item = St>,
2811        St: AsRef<str>,
2812    {
2813        self._scopes
2814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2815        self
2816    }
2817
2818    /// Removes all scopes, and no default scope will be used either.
2819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2820    /// for details).
2821    pub fn clear_scopes(mut self) -> PlaceAutocompleteCall<'a, C> {
2822        self._scopes.clear();
2823        self
2824    }
2825}
2826
2827/// Get the details of a place based on its resource name, which is a string in the `places/{place_id}` format.
2828///
2829/// A builder for the *get* method supported by a *place* resource.
2830/// It is not used directly, but through a [`PlaceMethods`] instance.
2831///
2832/// # Example
2833///
2834/// Instantiate a resource method builder
2835///
2836/// ```test_harness,no_run
2837/// # extern crate hyper;
2838/// # extern crate hyper_rustls;
2839/// # extern crate google_places1 as places1;
2840/// # async fn dox() {
2841/// # use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2842///
2843/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2844/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2845/// #     .with_native_roots()
2846/// #     .unwrap()
2847/// #     .https_only()
2848/// #     .enable_http2()
2849/// #     .build();
2850///
2851/// # let executor = hyper_util::rt::TokioExecutor::new();
2852/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2853/// #     secret,
2854/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2855/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2856/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2857/// #     ),
2858/// # ).build().await.unwrap();
2859///
2860/// # let client = hyper_util::client::legacy::Client::builder(
2861/// #     hyper_util::rt::TokioExecutor::new()
2862/// # )
2863/// # .build(
2864/// #     hyper_rustls::HttpsConnectorBuilder::new()
2865/// #         .with_native_roots()
2866/// #         .unwrap()
2867/// #         .https_or_http()
2868/// #         .enable_http2()
2869/// #         .build()
2870/// # );
2871/// # let mut hub = MapsPlaces::new(client, auth);
2872/// // You can configure optional parameters by calling the respective setters at will, and
2873/// // execute the final call using `doit()`.
2874/// // Values shown here are possibly random and not representative !
2875/// let result = hub.places().get("name")
2876///              .session_token("dolor")
2877///              .region_code("ea")
2878///              .language_code("ipsum")
2879///              .doit().await;
2880/// # }
2881/// ```
2882pub struct PlaceGetCall<'a, C>
2883where
2884    C: 'a,
2885{
2886    hub: &'a MapsPlaces<C>,
2887    _name: String,
2888    _session_token: Option<String>,
2889    _region_code: Option<String>,
2890    _language_code: Option<String>,
2891    _delegate: Option<&'a mut dyn common::Delegate>,
2892    _additional_params: HashMap<String, String>,
2893    _scopes: BTreeSet<String>,
2894}
2895
2896impl<'a, C> common::CallBuilder for PlaceGetCall<'a, C> {}
2897
2898impl<'a, C> PlaceGetCall<'a, C>
2899where
2900    C: common::Connector,
2901{
2902    /// Perform the operation you have build so far.
2903    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleMapsPlacesV1Place)> {
2904        use std::borrow::Cow;
2905        use std::io::{Read, Seek};
2906
2907        use common::{url::Params, ToParts};
2908        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2909
2910        let mut dd = common::DefaultDelegate;
2911        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2912        dlg.begin(common::MethodInfo {
2913            id: "places.places.get",
2914            http_method: hyper::Method::GET,
2915        });
2916
2917        for &field in ["alt", "name", "sessionToken", "regionCode", "languageCode"].iter() {
2918            if self._additional_params.contains_key(field) {
2919                dlg.finished(false);
2920                return Err(common::Error::FieldClash(field));
2921            }
2922        }
2923
2924        let mut params = Params::with_capacity(6 + self._additional_params.len());
2925        params.push("name", self._name);
2926        if let Some(value) = self._session_token.as_ref() {
2927            params.push("sessionToken", value);
2928        }
2929        if let Some(value) = self._region_code.as_ref() {
2930            params.push("regionCode", value);
2931        }
2932        if let Some(value) = self._language_code.as_ref() {
2933            params.push("languageCode", value);
2934        }
2935
2936        params.extend(self._additional_params.iter());
2937
2938        params.push("alt", "json");
2939        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2940        if self._scopes.is_empty() {
2941            self._scopes
2942                .insert(Scope::CloudPlatform.as_ref().to_string());
2943        }
2944
2945        #[allow(clippy::single_element_loop)]
2946        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2947            url = params.uri_replacement(url, param_name, find_this, true);
2948        }
2949        {
2950            let to_remove = ["name"];
2951            params.remove_params(&to_remove);
2952        }
2953
2954        let url = params.parse_with_url(&url);
2955
2956        loop {
2957            let token = match self
2958                .hub
2959                .auth
2960                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2961                .await
2962            {
2963                Ok(token) => token,
2964                Err(e) => match dlg.token(e) {
2965                    Ok(token) => token,
2966                    Err(e) => {
2967                        dlg.finished(false);
2968                        return Err(common::Error::MissingToken(e));
2969                    }
2970                },
2971            };
2972            let mut req_result = {
2973                let client = &self.hub.client;
2974                dlg.pre_request();
2975                let mut req_builder = hyper::Request::builder()
2976                    .method(hyper::Method::GET)
2977                    .uri(url.as_str())
2978                    .header(USER_AGENT, self.hub._user_agent.clone());
2979
2980                if let Some(token) = token.as_ref() {
2981                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2982                }
2983
2984                let request = req_builder
2985                    .header(CONTENT_LENGTH, 0_u64)
2986                    .body(common::to_body::<String>(None));
2987
2988                client.request(request.unwrap()).await
2989            };
2990
2991            match req_result {
2992                Err(err) => {
2993                    if let common::Retry::After(d) = dlg.http_error(&err) {
2994                        sleep(d).await;
2995                        continue;
2996                    }
2997                    dlg.finished(false);
2998                    return Err(common::Error::HttpError(err));
2999                }
3000                Ok(res) => {
3001                    let (mut parts, body) = res.into_parts();
3002                    let mut body = common::Body::new(body);
3003                    if !parts.status.is_success() {
3004                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3005                        let error = serde_json::from_str(&common::to_string(&bytes));
3006                        let response = common::to_response(parts, bytes.into());
3007
3008                        if let common::Retry::After(d) =
3009                            dlg.http_failure(&response, error.as_ref().ok())
3010                        {
3011                            sleep(d).await;
3012                            continue;
3013                        }
3014
3015                        dlg.finished(false);
3016
3017                        return Err(match error {
3018                            Ok(value) => common::Error::BadRequest(value),
3019                            _ => common::Error::Failure(response),
3020                        });
3021                    }
3022                    let response = {
3023                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3024                        let encoded = common::to_string(&bytes);
3025                        match serde_json::from_str(&encoded) {
3026                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3027                            Err(error) => {
3028                                dlg.response_json_decode_error(&encoded, &error);
3029                                return Err(common::Error::JsonDecodeError(
3030                                    encoded.to_string(),
3031                                    error,
3032                                ));
3033                            }
3034                        }
3035                    };
3036
3037                    dlg.finished(true);
3038                    return Ok(response);
3039                }
3040            }
3041        }
3042    }
3043
3044    /// Required. The resource name of a place, in the `places/{place_id}` format.
3045    ///
3046    /// Sets the *name* path property to the given value.
3047    ///
3048    /// Even though the property as already been set when instantiating this call,
3049    /// we provide this method for API completeness.
3050    pub fn name(mut self, new_value: &str) -> PlaceGetCall<'a, C> {
3051        self._name = new_value.to_string();
3052        self
3053    }
3054    /// Optional. A string which identifies an Autocomplete session for billing purposes. Must be a URL and filename safe base64 string with at most 36 ASCII characters in length. Otherwise an INVALID_ARGUMENT error is returned. The session begins when the user starts typing a query, and concludes when they select a place and a call to Place Details or Address Validation is made. Each session can have multiple queries, followed by one Place Details or Address Validation request. The credentials used for each request within a session must belong to the same Google Cloud Console project. Once a session has concluded, the token is no longer valid; your app must generate a fresh token for each session. If the `session_token` parameter is omitted, or if you reuse a session token, the session is charged as if no session token was provided (each request is billed separately). We recommend the following guidelines: * Use session tokens for all Place Autocomplete calls. * Generate a fresh token for each session. Using a version 4 UUID is recommended. * Ensure that the credentials used for all Place Autocomplete, Place Details, and Address Validation requests within a session belong to the same Cloud Console project. * Be sure to pass a unique session token for each new session. Using the same token for more than one session will result in each request being billed individually.
3055    ///
3056    /// Sets the *session token* query property to the given value.
3057    pub fn session_token(mut self, new_value: &str) -> PlaceGetCall<'a, C> {
3058        self._session_token = Some(new_value.to_string());
3059        self
3060    }
3061    /// Optional. The Unicode country/region code (CLDR) of the location where the request is coming from. This parameter is used to display the place details, like region-specific place name, if available. The parameter can affect results based on applicable law. For more information, see https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html. Note that 3-digit region codes are not currently supported.
3062    ///
3063    /// Sets the *region code* query property to the given value.
3064    pub fn region_code(mut self, new_value: &str) -> PlaceGetCall<'a, C> {
3065        self._region_code = Some(new_value.to_string());
3066        self
3067    }
3068    /// Optional. Place details will be displayed with the preferred language if available. Current list of supported languages: https://developers.google.com/maps/faq#languagesupport.
3069    ///
3070    /// Sets the *language code* query property to the given value.
3071    pub fn language_code(mut self, new_value: &str) -> PlaceGetCall<'a, C> {
3072        self._language_code = Some(new_value.to_string());
3073        self
3074    }
3075    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3076    /// while executing the actual API request.
3077    ///
3078    /// ````text
3079    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3080    /// ````
3081    ///
3082    /// Sets the *delegate* property to the given value.
3083    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PlaceGetCall<'a, C> {
3084        self._delegate = Some(new_value);
3085        self
3086    }
3087
3088    /// Set any additional parameter of the query string used in the request.
3089    /// It should be used to set parameters which are not yet available through their own
3090    /// setters.
3091    ///
3092    /// Please note that this method must not be used to set any of the known parameters
3093    /// which have their own setter method. If done anyway, the request will fail.
3094    ///
3095    /// # Additional Parameters
3096    ///
3097    /// * *$.xgafv* (query-string) - V1 error format.
3098    /// * *access_token* (query-string) - OAuth access token.
3099    /// * *alt* (query-string) - Data format for response.
3100    /// * *callback* (query-string) - JSONP
3101    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3102    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3103    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3104    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3105    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3106    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3107    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3108    pub fn param<T>(mut self, name: T, value: T) -> PlaceGetCall<'a, C>
3109    where
3110        T: AsRef<str>,
3111    {
3112        self._additional_params
3113            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3114        self
3115    }
3116
3117    /// Identifies the authorization scope for the method you are building.
3118    ///
3119    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3120    /// [`Scope::CloudPlatform`].
3121    ///
3122    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3123    /// tokens for more than one scope.
3124    ///
3125    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3126    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3127    /// sufficient, a read-write scope will do as well.
3128    pub fn add_scope<St>(mut self, scope: St) -> PlaceGetCall<'a, C>
3129    where
3130        St: AsRef<str>,
3131    {
3132        self._scopes.insert(String::from(scope.as_ref()));
3133        self
3134    }
3135    /// Identifies the authorization scope(s) for the method you are building.
3136    ///
3137    /// See [`Self::add_scope()`] for details.
3138    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlaceGetCall<'a, C>
3139    where
3140        I: IntoIterator<Item = St>,
3141        St: AsRef<str>,
3142    {
3143        self._scopes
3144            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3145        self
3146    }
3147
3148    /// Removes all scopes, and no default scope will be used either.
3149    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3150    /// for details).
3151    pub fn clear_scopes(mut self) -> PlaceGetCall<'a, C> {
3152        self._scopes.clear();
3153        self
3154    }
3155}
3156
3157/// Search for places near locations.
3158///
3159/// A builder for the *searchNearby* method supported by a *place* resource.
3160/// It is not used directly, but through a [`PlaceMethods`] instance.
3161///
3162/// # Example
3163///
3164/// Instantiate a resource method builder
3165///
3166/// ```test_harness,no_run
3167/// # extern crate hyper;
3168/// # extern crate hyper_rustls;
3169/// # extern crate google_places1 as places1;
3170/// use places1::api::GoogleMapsPlacesV1SearchNearbyRequest;
3171/// # async fn dox() {
3172/// # use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3173///
3174/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3175/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3176/// #     .with_native_roots()
3177/// #     .unwrap()
3178/// #     .https_only()
3179/// #     .enable_http2()
3180/// #     .build();
3181///
3182/// # let executor = hyper_util::rt::TokioExecutor::new();
3183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3184/// #     secret,
3185/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3186/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3187/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3188/// #     ),
3189/// # ).build().await.unwrap();
3190///
3191/// # let client = hyper_util::client::legacy::Client::builder(
3192/// #     hyper_util::rt::TokioExecutor::new()
3193/// # )
3194/// # .build(
3195/// #     hyper_rustls::HttpsConnectorBuilder::new()
3196/// #         .with_native_roots()
3197/// #         .unwrap()
3198/// #         .https_or_http()
3199/// #         .enable_http2()
3200/// #         .build()
3201/// # );
3202/// # let mut hub = MapsPlaces::new(client, auth);
3203/// // As the method needs a request, you would usually fill it with the desired information
3204/// // into the respective structure. Some of the parts shown here might not be applicable !
3205/// // Values shown here are possibly random and not representative !
3206/// let mut req = GoogleMapsPlacesV1SearchNearbyRequest::default();
3207///
3208/// // You can configure optional parameters by calling the respective setters at will, and
3209/// // execute the final call using `doit()`.
3210/// // Values shown here are possibly random and not representative !
3211/// let result = hub.places().search_nearby(req)
3212///              .doit().await;
3213/// # }
3214/// ```
3215pub struct PlaceSearchNearbyCall<'a, C>
3216where
3217    C: 'a,
3218{
3219    hub: &'a MapsPlaces<C>,
3220    _request: GoogleMapsPlacesV1SearchNearbyRequest,
3221    _delegate: Option<&'a mut dyn common::Delegate>,
3222    _additional_params: HashMap<String, String>,
3223    _scopes: BTreeSet<String>,
3224}
3225
3226impl<'a, C> common::CallBuilder for PlaceSearchNearbyCall<'a, C> {}
3227
3228impl<'a, C> PlaceSearchNearbyCall<'a, C>
3229where
3230    C: common::Connector,
3231{
3232    /// Perform the operation you have build so far.
3233    pub async fn doit(
3234        mut self,
3235    ) -> common::Result<(common::Response, GoogleMapsPlacesV1SearchNearbyResponse)> {
3236        use std::borrow::Cow;
3237        use std::io::{Read, Seek};
3238
3239        use common::{url::Params, ToParts};
3240        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3241
3242        let mut dd = common::DefaultDelegate;
3243        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3244        dlg.begin(common::MethodInfo {
3245            id: "places.places.searchNearby",
3246            http_method: hyper::Method::POST,
3247        });
3248
3249        for &field in ["alt"].iter() {
3250            if self._additional_params.contains_key(field) {
3251                dlg.finished(false);
3252                return Err(common::Error::FieldClash(field));
3253            }
3254        }
3255
3256        let mut params = Params::with_capacity(3 + self._additional_params.len());
3257
3258        params.extend(self._additional_params.iter());
3259
3260        params.push("alt", "json");
3261        let mut url = self.hub._base_url.clone() + "v1/places:searchNearby";
3262        if self._scopes.is_empty() {
3263            self._scopes
3264                .insert(Scope::CloudPlatform.as_ref().to_string());
3265        }
3266
3267        let url = params.parse_with_url(&url);
3268
3269        let mut json_mime_type = mime::APPLICATION_JSON;
3270        let mut request_value_reader = {
3271            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3272            common::remove_json_null_values(&mut value);
3273            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3274            serde_json::to_writer(&mut dst, &value).unwrap();
3275            dst
3276        };
3277        let request_size = request_value_reader
3278            .seek(std::io::SeekFrom::End(0))
3279            .unwrap();
3280        request_value_reader
3281            .seek(std::io::SeekFrom::Start(0))
3282            .unwrap();
3283
3284        loop {
3285            let token = match self
3286                .hub
3287                .auth
3288                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3289                .await
3290            {
3291                Ok(token) => token,
3292                Err(e) => match dlg.token(e) {
3293                    Ok(token) => token,
3294                    Err(e) => {
3295                        dlg.finished(false);
3296                        return Err(common::Error::MissingToken(e));
3297                    }
3298                },
3299            };
3300            request_value_reader
3301                .seek(std::io::SeekFrom::Start(0))
3302                .unwrap();
3303            let mut req_result = {
3304                let client = &self.hub.client;
3305                dlg.pre_request();
3306                let mut req_builder = hyper::Request::builder()
3307                    .method(hyper::Method::POST)
3308                    .uri(url.as_str())
3309                    .header(USER_AGENT, self.hub._user_agent.clone());
3310
3311                if let Some(token) = token.as_ref() {
3312                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3313                }
3314
3315                let request = req_builder
3316                    .header(CONTENT_TYPE, json_mime_type.to_string())
3317                    .header(CONTENT_LENGTH, request_size as u64)
3318                    .body(common::to_body(
3319                        request_value_reader.get_ref().clone().into(),
3320                    ));
3321
3322                client.request(request.unwrap()).await
3323            };
3324
3325            match req_result {
3326                Err(err) => {
3327                    if let common::Retry::After(d) = dlg.http_error(&err) {
3328                        sleep(d).await;
3329                        continue;
3330                    }
3331                    dlg.finished(false);
3332                    return Err(common::Error::HttpError(err));
3333                }
3334                Ok(res) => {
3335                    let (mut parts, body) = res.into_parts();
3336                    let mut body = common::Body::new(body);
3337                    if !parts.status.is_success() {
3338                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3339                        let error = serde_json::from_str(&common::to_string(&bytes));
3340                        let response = common::to_response(parts, bytes.into());
3341
3342                        if let common::Retry::After(d) =
3343                            dlg.http_failure(&response, error.as_ref().ok())
3344                        {
3345                            sleep(d).await;
3346                            continue;
3347                        }
3348
3349                        dlg.finished(false);
3350
3351                        return Err(match error {
3352                            Ok(value) => common::Error::BadRequest(value),
3353                            _ => common::Error::Failure(response),
3354                        });
3355                    }
3356                    let response = {
3357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3358                        let encoded = common::to_string(&bytes);
3359                        match serde_json::from_str(&encoded) {
3360                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3361                            Err(error) => {
3362                                dlg.response_json_decode_error(&encoded, &error);
3363                                return Err(common::Error::JsonDecodeError(
3364                                    encoded.to_string(),
3365                                    error,
3366                                ));
3367                            }
3368                        }
3369                    };
3370
3371                    dlg.finished(true);
3372                    return Ok(response);
3373                }
3374            }
3375        }
3376    }
3377
3378    ///
3379    /// Sets the *request* property to the given value.
3380    ///
3381    /// Even though the property as already been set when instantiating this call,
3382    /// we provide this method for API completeness.
3383    pub fn request(
3384        mut self,
3385        new_value: GoogleMapsPlacesV1SearchNearbyRequest,
3386    ) -> PlaceSearchNearbyCall<'a, C> {
3387        self._request = new_value;
3388        self
3389    }
3390    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3391    /// while executing the actual API request.
3392    ///
3393    /// ````text
3394    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3395    /// ````
3396    ///
3397    /// Sets the *delegate* property to the given value.
3398    pub fn delegate(
3399        mut self,
3400        new_value: &'a mut dyn common::Delegate,
3401    ) -> PlaceSearchNearbyCall<'a, C> {
3402        self._delegate = Some(new_value);
3403        self
3404    }
3405
3406    /// Set any additional parameter of the query string used in the request.
3407    /// It should be used to set parameters which are not yet available through their own
3408    /// setters.
3409    ///
3410    /// Please note that this method must not be used to set any of the known parameters
3411    /// which have their own setter method. If done anyway, the request will fail.
3412    ///
3413    /// # Additional Parameters
3414    ///
3415    /// * *$.xgafv* (query-string) - V1 error format.
3416    /// * *access_token* (query-string) - OAuth access token.
3417    /// * *alt* (query-string) - Data format for response.
3418    /// * *callback* (query-string) - JSONP
3419    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3420    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3421    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3422    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3423    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3424    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3425    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3426    pub fn param<T>(mut self, name: T, value: T) -> PlaceSearchNearbyCall<'a, C>
3427    where
3428        T: AsRef<str>,
3429    {
3430        self._additional_params
3431            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3432        self
3433    }
3434
3435    /// Identifies the authorization scope for the method you are building.
3436    ///
3437    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3438    /// [`Scope::CloudPlatform`].
3439    ///
3440    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3441    /// tokens for more than one scope.
3442    ///
3443    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3444    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3445    /// sufficient, a read-write scope will do as well.
3446    pub fn add_scope<St>(mut self, scope: St) -> PlaceSearchNearbyCall<'a, C>
3447    where
3448        St: AsRef<str>,
3449    {
3450        self._scopes.insert(String::from(scope.as_ref()));
3451        self
3452    }
3453    /// Identifies the authorization scope(s) for the method you are building.
3454    ///
3455    /// See [`Self::add_scope()`] for details.
3456    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlaceSearchNearbyCall<'a, C>
3457    where
3458        I: IntoIterator<Item = St>,
3459        St: AsRef<str>,
3460    {
3461        self._scopes
3462            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3463        self
3464    }
3465
3466    /// Removes all scopes, and no default scope will be used either.
3467    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3468    /// for details).
3469    pub fn clear_scopes(mut self) -> PlaceSearchNearbyCall<'a, C> {
3470        self._scopes.clear();
3471        self
3472    }
3473}
3474
3475/// Text query based place search.
3476///
3477/// A builder for the *searchText* method supported by a *place* resource.
3478/// It is not used directly, but through a [`PlaceMethods`] instance.
3479///
3480/// # Example
3481///
3482/// Instantiate a resource method builder
3483///
3484/// ```test_harness,no_run
3485/// # extern crate hyper;
3486/// # extern crate hyper_rustls;
3487/// # extern crate google_places1 as places1;
3488/// use places1::api::GoogleMapsPlacesV1SearchTextRequest;
3489/// # async fn dox() {
3490/// # use places1::{MapsPlaces, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3491///
3492/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3493/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3494/// #     .with_native_roots()
3495/// #     .unwrap()
3496/// #     .https_only()
3497/// #     .enable_http2()
3498/// #     .build();
3499///
3500/// # let executor = hyper_util::rt::TokioExecutor::new();
3501/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3502/// #     secret,
3503/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3504/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3505/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3506/// #     ),
3507/// # ).build().await.unwrap();
3508///
3509/// # let client = hyper_util::client::legacy::Client::builder(
3510/// #     hyper_util::rt::TokioExecutor::new()
3511/// # )
3512/// # .build(
3513/// #     hyper_rustls::HttpsConnectorBuilder::new()
3514/// #         .with_native_roots()
3515/// #         .unwrap()
3516/// #         .https_or_http()
3517/// #         .enable_http2()
3518/// #         .build()
3519/// # );
3520/// # let mut hub = MapsPlaces::new(client, auth);
3521/// // As the method needs a request, you would usually fill it with the desired information
3522/// // into the respective structure. Some of the parts shown here might not be applicable !
3523/// // Values shown here are possibly random and not representative !
3524/// let mut req = GoogleMapsPlacesV1SearchTextRequest::default();
3525///
3526/// // You can configure optional parameters by calling the respective setters at will, and
3527/// // execute the final call using `doit()`.
3528/// // Values shown here are possibly random and not representative !
3529/// let result = hub.places().search_text(req)
3530///              .doit().await;
3531/// # }
3532/// ```
3533pub struct PlaceSearchTextCall<'a, C>
3534where
3535    C: 'a,
3536{
3537    hub: &'a MapsPlaces<C>,
3538    _request: GoogleMapsPlacesV1SearchTextRequest,
3539    _delegate: Option<&'a mut dyn common::Delegate>,
3540    _additional_params: HashMap<String, String>,
3541    _scopes: BTreeSet<String>,
3542}
3543
3544impl<'a, C> common::CallBuilder for PlaceSearchTextCall<'a, C> {}
3545
3546impl<'a, C> PlaceSearchTextCall<'a, C>
3547where
3548    C: common::Connector,
3549{
3550    /// Perform the operation you have build so far.
3551    pub async fn doit(
3552        mut self,
3553    ) -> common::Result<(common::Response, GoogleMapsPlacesV1SearchTextResponse)> {
3554        use std::borrow::Cow;
3555        use std::io::{Read, Seek};
3556
3557        use common::{url::Params, ToParts};
3558        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3559
3560        let mut dd = common::DefaultDelegate;
3561        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3562        dlg.begin(common::MethodInfo {
3563            id: "places.places.searchText",
3564            http_method: hyper::Method::POST,
3565        });
3566
3567        for &field in ["alt"].iter() {
3568            if self._additional_params.contains_key(field) {
3569                dlg.finished(false);
3570                return Err(common::Error::FieldClash(field));
3571            }
3572        }
3573
3574        let mut params = Params::with_capacity(3 + self._additional_params.len());
3575
3576        params.extend(self._additional_params.iter());
3577
3578        params.push("alt", "json");
3579        let mut url = self.hub._base_url.clone() + "v1/places:searchText";
3580        if self._scopes.is_empty() {
3581            self._scopes
3582                .insert(Scope::CloudPlatform.as_ref().to_string());
3583        }
3584
3585        let url = params.parse_with_url(&url);
3586
3587        let mut json_mime_type = mime::APPLICATION_JSON;
3588        let mut request_value_reader = {
3589            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3590            common::remove_json_null_values(&mut value);
3591            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3592            serde_json::to_writer(&mut dst, &value).unwrap();
3593            dst
3594        };
3595        let request_size = request_value_reader
3596            .seek(std::io::SeekFrom::End(0))
3597            .unwrap();
3598        request_value_reader
3599            .seek(std::io::SeekFrom::Start(0))
3600            .unwrap();
3601
3602        loop {
3603            let token = match self
3604                .hub
3605                .auth
3606                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3607                .await
3608            {
3609                Ok(token) => token,
3610                Err(e) => match dlg.token(e) {
3611                    Ok(token) => token,
3612                    Err(e) => {
3613                        dlg.finished(false);
3614                        return Err(common::Error::MissingToken(e));
3615                    }
3616                },
3617            };
3618            request_value_reader
3619                .seek(std::io::SeekFrom::Start(0))
3620                .unwrap();
3621            let mut req_result = {
3622                let client = &self.hub.client;
3623                dlg.pre_request();
3624                let mut req_builder = hyper::Request::builder()
3625                    .method(hyper::Method::POST)
3626                    .uri(url.as_str())
3627                    .header(USER_AGENT, self.hub._user_agent.clone());
3628
3629                if let Some(token) = token.as_ref() {
3630                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3631                }
3632
3633                let request = req_builder
3634                    .header(CONTENT_TYPE, json_mime_type.to_string())
3635                    .header(CONTENT_LENGTH, request_size as u64)
3636                    .body(common::to_body(
3637                        request_value_reader.get_ref().clone().into(),
3638                    ));
3639
3640                client.request(request.unwrap()).await
3641            };
3642
3643            match req_result {
3644                Err(err) => {
3645                    if let common::Retry::After(d) = dlg.http_error(&err) {
3646                        sleep(d).await;
3647                        continue;
3648                    }
3649                    dlg.finished(false);
3650                    return Err(common::Error::HttpError(err));
3651                }
3652                Ok(res) => {
3653                    let (mut parts, body) = res.into_parts();
3654                    let mut body = common::Body::new(body);
3655                    if !parts.status.is_success() {
3656                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3657                        let error = serde_json::from_str(&common::to_string(&bytes));
3658                        let response = common::to_response(parts, bytes.into());
3659
3660                        if let common::Retry::After(d) =
3661                            dlg.http_failure(&response, error.as_ref().ok())
3662                        {
3663                            sleep(d).await;
3664                            continue;
3665                        }
3666
3667                        dlg.finished(false);
3668
3669                        return Err(match error {
3670                            Ok(value) => common::Error::BadRequest(value),
3671                            _ => common::Error::Failure(response),
3672                        });
3673                    }
3674                    let response = {
3675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3676                        let encoded = common::to_string(&bytes);
3677                        match serde_json::from_str(&encoded) {
3678                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3679                            Err(error) => {
3680                                dlg.response_json_decode_error(&encoded, &error);
3681                                return Err(common::Error::JsonDecodeError(
3682                                    encoded.to_string(),
3683                                    error,
3684                                ));
3685                            }
3686                        }
3687                    };
3688
3689                    dlg.finished(true);
3690                    return Ok(response);
3691                }
3692            }
3693        }
3694    }
3695
3696    ///
3697    /// Sets the *request* property to the given value.
3698    ///
3699    /// Even though the property as already been set when instantiating this call,
3700    /// we provide this method for API completeness.
3701    pub fn request(
3702        mut self,
3703        new_value: GoogleMapsPlacesV1SearchTextRequest,
3704    ) -> PlaceSearchTextCall<'a, C> {
3705        self._request = new_value;
3706        self
3707    }
3708    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3709    /// while executing the actual API request.
3710    ///
3711    /// ````text
3712    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3713    /// ````
3714    ///
3715    /// Sets the *delegate* property to the given value.
3716    pub fn delegate(
3717        mut self,
3718        new_value: &'a mut dyn common::Delegate,
3719    ) -> PlaceSearchTextCall<'a, C> {
3720        self._delegate = Some(new_value);
3721        self
3722    }
3723
3724    /// Set any additional parameter of the query string used in the request.
3725    /// It should be used to set parameters which are not yet available through their own
3726    /// setters.
3727    ///
3728    /// Please note that this method must not be used to set any of the known parameters
3729    /// which have their own setter method. If done anyway, the request will fail.
3730    ///
3731    /// # Additional Parameters
3732    ///
3733    /// * *$.xgafv* (query-string) - V1 error format.
3734    /// * *access_token* (query-string) - OAuth access token.
3735    /// * *alt* (query-string) - Data format for response.
3736    /// * *callback* (query-string) - JSONP
3737    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3738    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3739    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3740    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3741    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3742    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3743    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3744    pub fn param<T>(mut self, name: T, value: T) -> PlaceSearchTextCall<'a, C>
3745    where
3746        T: AsRef<str>,
3747    {
3748        self._additional_params
3749            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3750        self
3751    }
3752
3753    /// Identifies the authorization scope for the method you are building.
3754    ///
3755    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3756    /// [`Scope::CloudPlatform`].
3757    ///
3758    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3759    /// tokens for more than one scope.
3760    ///
3761    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3762    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3763    /// sufficient, a read-write scope will do as well.
3764    pub fn add_scope<St>(mut self, scope: St) -> PlaceSearchTextCall<'a, C>
3765    where
3766        St: AsRef<str>,
3767    {
3768        self._scopes.insert(String::from(scope.as_ref()));
3769        self
3770    }
3771    /// Identifies the authorization scope(s) for the method you are building.
3772    ///
3773    /// See [`Self::add_scope()`] for details.
3774    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlaceSearchTextCall<'a, C>
3775    where
3776        I: IntoIterator<Item = St>,
3777        St: AsRef<str>,
3778    {
3779        self._scopes
3780            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3781        self
3782    }
3783
3784    /// Removes all scopes, and no default scope will be used either.
3785    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3786    /// for details).
3787    pub fn clear_scopes(mut self) -> PlaceSearchTextCall<'a, C> {
3788        self._scopes.clear();
3789        self
3790    }
3791}