google_playablelocations3/
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// ########
12// HUB ###
13// ######
14
15/// Central instance to access all PlayableLocations related resource activities
16///
17/// # Examples
18///
19/// Instantiate a new hub
20///
21/// ```test_harness,no_run
22/// extern crate hyper;
23/// extern crate hyper_rustls;
24/// extern crate google_playablelocations3 as playablelocations3;
25/// use playablelocations3::api::GoogleMapsPlayablelocationsV3LogImpressionsRequest;
26/// use playablelocations3::{Result, Error};
27/// # async fn dox() {
28/// use playablelocations3::{PlayableLocations, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29///
30/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
31/// // `client_secret`, among other things.
32/// let secret: yup_oauth2::ApplicationSecret = Default::default();
33/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
34/// // unless you replace  `None` with the desired Flow.
35/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
36/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
37/// // retrieve them from storage.
38/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
39///     .with_native_roots()
40///     .unwrap()
41///     .https_only()
42///     .enable_http2()
43///     .build();
44///
45/// let executor = hyper_util::rt::TokioExecutor::new();
46/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
47///     secret,
48///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49///     yup_oauth2::client::CustomHyperClientBuilder::from(
50///         hyper_util::client::legacy::Client::builder(executor).build(connector),
51///     ),
52/// ).build().await.unwrap();
53///
54/// let client = hyper_util::client::legacy::Client::builder(
55///     hyper_util::rt::TokioExecutor::new()
56/// )
57/// .build(
58///     hyper_rustls::HttpsConnectorBuilder::new()
59///         .with_native_roots()
60///         .unwrap()
61///         .https_or_http()
62///         .enable_http2()
63///         .build()
64/// );
65/// let mut hub = PlayableLocations::new(client, auth);
66/// // As the method needs a request, you would usually fill it with the desired information
67/// // into the respective structure. Some of the parts shown here might not be applicable !
68/// // Values shown here are possibly random and not representative !
69/// let mut req = GoogleMapsPlayablelocationsV3LogImpressionsRequest::default();
70///
71/// // You can configure optional parameters by calling the respective setters at will, and
72/// // execute the final call using `doit()`.
73/// // Values shown here are possibly random and not representative !
74/// let result = hub.methods().log_impressions(req)
75///              .doit().await;
76///
77/// match result {
78///     Err(e) => match e {
79///         // The Error enum provides details about what exactly happened.
80///         // You can also just use its `Debug`, `Display` or `Error` traits
81///          Error::HttpError(_)
82///         |Error::Io(_)
83///         |Error::MissingAPIKey
84///         |Error::MissingToken(_)
85///         |Error::Cancelled
86///         |Error::UploadSizeLimitExceeded(_, _)
87///         |Error::Failure(_)
88///         |Error::BadRequest(_)
89///         |Error::FieldClash(_)
90///         |Error::JsonDecodeError(_, _) => println!("{}", e),
91///     },
92///     Ok(res) => println!("Success: {:?}", res),
93/// }
94/// # }
95/// ```
96#[derive(Clone)]
97pub struct PlayableLocations<C> {
98    pub client: common::Client<C>,
99    pub auth: Box<dyn common::GetToken>,
100    _user_agent: String,
101    _base_url: String,
102    _root_url: String,
103}
104
105impl<C> common::Hub for PlayableLocations<C> {}
106
107impl<'a, C> PlayableLocations<C> {
108    pub fn new<A: 'static + common::GetToken>(
109        client: common::Client<C>,
110        auth: A,
111    ) -> PlayableLocations<C> {
112        PlayableLocations {
113            client,
114            auth: Box::new(auth),
115            _user_agent: "google-api-rust-client/7.0.0".to_string(),
116            _base_url: "https://playablelocations.googleapis.com/".to_string(),
117            _root_url: "https://playablelocations.googleapis.com/".to_string(),
118        }
119    }
120
121    pub fn methods(&'a self) -> MethodMethods<'a, C> {
122        MethodMethods { hub: self }
123    }
124
125    /// Set the user-agent header field to use in all requests to the server.
126    /// It defaults to `google-api-rust-client/7.0.0`.
127    ///
128    /// Returns the previously set user-agent.
129    pub fn user_agent(&mut self, agent_name: String) -> String {
130        std::mem::replace(&mut self._user_agent, agent_name)
131    }
132
133    /// Set the base url to use in all requests to the server.
134    /// It defaults to `https://playablelocations.googleapis.com/`.
135    ///
136    /// Returns the previously set base url.
137    pub fn base_url(&mut self, new_base_url: String) -> String {
138        std::mem::replace(&mut self._base_url, new_base_url)
139    }
140
141    /// Set the root url to use in all requests to the server.
142    /// It defaults to `https://playablelocations.googleapis.com/`.
143    ///
144    /// Returns the previously set root url.
145    pub fn root_url(&mut self, new_root_url: String) -> String {
146        std::mem::replace(&mut self._root_url, new_root_url)
147    }
148}
149
150// ############
151// SCHEMAS ###
152// ##########
153/// Encapsulates impression event details.
154///
155/// This type is not used in any activity, and only used as *part* of another schema.
156///
157#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
158#[serde_with::serde_as]
159#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
160pub struct GoogleMapsPlayablelocationsV3Impression {
161    /// An arbitrary, developer-defined type identifier for each type of game
162    /// object used in your game.
163    ///
164    /// Since players interact with differ types of game objects in different ways,
165    /// this field allows you to segregate impression data by type for analysis.
166    ///
167    /// You should assign a unique `game_object_type` ID to represent a distinct
168    /// type of game object in your game.
169    ///
170    /// For example, 1=monster location, 2=powerup location.
171    #[serde(rename = "gameObjectType")]
172    pub game_object_type: Option<i32>,
173    /// Required. The type of impression event.
174    #[serde(rename = "impressionType")]
175    pub impression_type: Option<String>,
176    /// Required. The name of the playable location.
177    #[serde(rename = "locationName")]
178    pub location_name: Option<String>,
179}
180
181impl common::Part for GoogleMapsPlayablelocationsV3Impression {}
182
183/// A request for logging impressions.
184///
185/// # Activities
186///
187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
189///
190/// * [log impressions](MethodLogImpressionCall) (request)
191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
192#[serde_with::serde_as]
193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
194pub struct GoogleMapsPlayablelocationsV3LogImpressionsRequest {
195    /// Required. Information about the client device. For example, device model and
196    /// operating system.
197    #[serde(rename = "clientInfo")]
198    pub client_info: Option<GoogleMapsUnityClientInfo>,
199    /// Required. Impression event details. The maximum number of impression reports that you
200    /// can log at once is 50.
201    pub impressions: Option<Vec<GoogleMapsPlayablelocationsV3Impression>>,
202    /// Required. A string that uniquely identifies the log impressions request. This allows
203    /// you to detect duplicate requests. We recommend that you use UUIDs for this
204    /// value. The value must not exceed 50 characters.
205    ///
206    /// You should reuse the `request_id` only when retrying a request in case of
207    /// failure. In this case, the request must be identical to the one that
208    /// failed.
209    #[serde(rename = "requestId")]
210    pub request_id: Option<String>,
211}
212
213impl common::RequestValue for GoogleMapsPlayablelocationsV3LogImpressionsRequest {}
214
215/// A response for the LogImpressions method.
216/// This method returns no data upon success.
217///
218/// # Activities
219///
220/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
221/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
222///
223/// * [log impressions](MethodLogImpressionCall) (response)
224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
225#[serde_with::serde_as]
226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
227pub struct GoogleMapsPlayablelocationsV3LogImpressionsResponse {
228    _never_set: Option<bool>,
229}
230
231impl common::ResponseResult for GoogleMapsPlayablelocationsV3LogImpressionsResponse {}
232
233/// A request for logging your player’s bad location reports.
234///
235/// # Activities
236///
237/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
238/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
239///
240/// * [log player reports](MethodLogPlayerReportCall) (request)
241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
242#[serde_with::serde_as]
243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
244pub struct GoogleMapsPlayablelocationsV3LogPlayerReportsRequest {
245    /// Required. Information about the client device (for example, device model and
246    /// operating system).
247    #[serde(rename = "clientInfo")]
248    pub client_info: Option<GoogleMapsUnityClientInfo>,
249    /// Required. Player reports. The maximum number of player reports that you can log at
250    /// once is 50.
251    #[serde(rename = "playerReports")]
252    pub player_reports: Option<Vec<GoogleMapsPlayablelocationsV3PlayerReport>>,
253    /// Required. A string that uniquely identifies the log player reports request. This
254    /// allows you to detect duplicate requests. We recommend that you use UUIDs
255    /// for this value. The value must not exceed 50 characters.
256    ///
257    /// You should reuse the `request_id` only when retrying a request in the case
258    /// of a failure. In that case, the request must be identical to the one that
259    /// failed.
260    #[serde(rename = "requestId")]
261    pub request_id: Option<String>,
262}
263
264impl common::RequestValue for GoogleMapsPlayablelocationsV3LogPlayerReportsRequest {}
265
266/// A response for the LogPlayerReports
267/// method.
268///
269/// This method returns no data upon success.
270///
271/// # Activities
272///
273/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
274/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
275///
276/// * [log player reports](MethodLogPlayerReportCall) (response)
277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
278#[serde_with::serde_as]
279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
280pub struct GoogleMapsPlayablelocationsV3LogPlayerReportsResponse {
281    _never_set: Option<bool>,
282}
283
284impl common::ResponseResult for GoogleMapsPlayablelocationsV3LogPlayerReportsResponse {}
285
286/// A report submitted by a player about a playable location that is considered
287/// inappropriate for use in the game.
288///
289/// This type is not used in any activity, and only used as *part* of another schema.
290///
291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
292#[serde_with::serde_as]
293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
294pub struct GoogleMapsPlayablelocationsV3PlayerReport {
295    /// Language code (in BCP-47 format) indicating the language of the freeform
296    /// description provided in `reason_details`. Examples are "en", "en-US" or
297    /// "ja-Latn". For more information, see
298    /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
299    #[serde(rename = "languageCode")]
300    pub language_code: Option<String>,
301    /// Required. The name of the playable location.
302    #[serde(rename = "locationName")]
303    pub location_name: Option<String>,
304    /// Required. A free-form description detailing why the playable location is
305    /// considered bad.
306    #[serde(rename = "reasonDetails")]
307    pub reason_details: Option<String>,
308    /// Required. One or more reasons why this playable location is considered bad.
309    pub reasons: Option<Vec<String>>,
310}
311
312impl common::Part for GoogleMapsPlayablelocationsV3PlayerReport {}
313
314/// Specifies the area to search for playable locations.
315///
316/// This type is not used in any activity, and only used as *part* of another schema.
317///
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct GoogleMapsPlayablelocationsV3SampleAreaFilter {
322    /// Required. The S2 cell ID of the area you want. This must be between cell level 11 and
323    /// 14 (inclusive).
324    ///
325    /// S2 cells are 64-bit integers that identify areas on the Earth. They are
326    /// hierarchical, and can therefore be used for spatial indexing.
327    ///
328    /// The S2 geometry library is available in a number of languages:
329    ///
330    ///   * [C++](https://github.com/google/s2geometry)
331    ///   * [Java](https://github.com/google/s2-geometry-library-java)
332    ///   * [Go](https://github.com/golang/geo)
333    ///   * [Python](https://github.com/google/s2geometry/tree/master/src/python)
334    #[serde(rename = "s2CellId")]
335    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
336    pub s2_cell_id: Option<u64>,
337}
338
339impl common::Part for GoogleMapsPlayablelocationsV3SampleAreaFilter {}
340
341/// Encapsulates a filter criterion for searching for a set of playable
342/// locations.
343///
344/// This type is not used in any activity, and only used as *part* of another schema.
345///
346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
347#[serde_with::serde_as]
348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
349pub struct GoogleMapsPlayablelocationsV3SampleCriterion {
350    /// Specifies which `PlayableLocation` fields are returned.
351    ///
352    /// `name` (which is used for logging impressions), `center_point` and
353    /// `place_id` (or `plus_code`) are always returned.
354    ///
355    /// The following fields are omitted unless you specify them here:
356    ///
357    ///   * snapped_point
358    ///   * types
359    ///
360    /// Note: The more fields you include, the more expensive in terms of data and
361    /// associated latency your query will be.
362    #[serde(rename = "fieldsToReturn")]
363    pub fields_to_return: Option<common::FieldMask>,
364    /// Specifies filtering options, and specifies what will be included in the
365    /// result set.
366    pub filter: Option<GoogleMapsPlayablelocationsV3SampleFilter>,
367    /// Required. An arbitrary, developer-defined identifier of the type of game object that
368    /// the playable location is used for. This field allows you to specify
369    /// criteria per game object type when searching for playable locations.
370    ///
371    /// You should assign a unique `game_object_type` ID across all
372    /// `request_criteria` to represent a distinct type of game object. For
373    /// example, 1=monster location, 2=powerup location.
374    ///
375    /// The response contains a map<game_object_type, Response>.
376    #[serde(rename = "gameObjectType")]
377    pub game_object_type: Option<i32>,
378}
379
380impl common::Part for GoogleMapsPlayablelocationsV3SampleCriterion {}
381
382/// Specifies the filters to use when searching for playable locations.
383///
384/// This type is not used in any activity, and only used as *part* of another schema.
385///
386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
387#[serde_with::serde_as]
388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct GoogleMapsPlayablelocationsV3SampleFilter {
390    /// Restricts the set of playable locations to just the
391    /// [types](https://developers.google.com/maps/documentation/gaming/tt/types) that you want.
392    #[serde(rename = "includedTypes")]
393    pub included_types: Option<Vec<String>>,
394    /// Specifies the maximum number of playable locations to return. This value
395    /// must not be greater than 1000. The default value is 100.
396    ///
397    /// Only the top-ranking playable locations are returned.
398    #[serde(rename = "maxLocationCount")]
399    pub max_location_count: Option<i32>,
400    /// A set of options that control the spacing between playable locations. By
401    /// default the minimum distance between locations is 200m.
402    pub spacing: Option<GoogleMapsPlayablelocationsV3SampleSpacingOptions>,
403}
404
405impl common::Part for GoogleMapsPlayablelocationsV3SampleFilter {}
406
407/// A geographical point suitable for placing game objects in location-based
408/// games.
409///
410/// This type is not used in any activity, and only used as *part* of another schema.
411///
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct GoogleMapsPlayablelocationsV3SamplePlayableLocation {
416    /// Required. The latitude and longitude associated with the center of the playable
417    /// location.
418    ///
419    /// By default, the set of playable locations returned from
420    /// SamplePlayableLocations use
421    /// center-point coordinates.
422    #[serde(rename = "centerPoint")]
423    pub center_point: Option<GoogleTypeLatLng>,
424    /// Required. The name of this playable location.
425    pub name: Option<String>,
426    /// A [place ID] (https://developers.google.com/places/place-id)
427    #[serde(rename = "placeId")]
428    pub place_id: Option<String>,
429    /// A [plus code] (http://openlocationcode.com)
430    #[serde(rename = "plusCode")]
431    pub plus_code: Option<String>,
432    /// The playable location's coordinates, snapped to the sidewalk of the
433    /// nearest road, if a nearby road exists.
434    #[serde(rename = "snappedPoint")]
435    pub snapped_point: Option<GoogleTypeLatLng>,
436    /// A collection of [Playable Location
437    /// Types](https://developers.google.com/maps/documentation/gaming/tt/types) for this playable location. The
438    /// first type in the collection is the primary type.
439    ///
440    /// Type information might not be available for all playable locations.
441    pub types: Option<Vec<String>>,
442}
443
444impl common::Part for GoogleMapsPlayablelocationsV3SamplePlayableLocation {}
445
446/// A list of PlayableLocation objects that satisfies a single Criterion.
447///
448/// This type is not used in any activity, and only used as *part* of another schema.
449///
450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
451#[serde_with::serde_as]
452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
453pub struct GoogleMapsPlayablelocationsV3SamplePlayableLocationList {
454    /// A list of playable locations for this game object type.
455    pub locations: Option<Vec<GoogleMapsPlayablelocationsV3SamplePlayableLocation>>,
456}
457
458impl common::Part for GoogleMapsPlayablelocationsV3SamplePlayableLocationList {}
459
460/// Life of a query:
461///
462/// * When a game starts in a new location, your game server issues a
463///   SamplePlayableLocations
464///   request. The request specifies the S2 cell, and contains one or more
465///   “criteria” for filtering:
466///
467/// * Criterion 0: i locations for long-lived bases, or level 0 monsters, or…
468///
469/// * Criterion 1: j locations for short-lived bases, or level 1 monsters, …
470///
471/// * Criterion 2: k locations for random objects.
472///
473/// * etc (up to 5 criterion may be specified).
474///
475/// `PlayableLocationList` will then contain mutually
476/// exclusive lists of `PlayableLocation` objects that satisfy each of
477/// the criteria. Think of it as a collection of real-world locations that you
478/// can then associate with your game state.
479///
480/// Note: These points are impermanent in nature. E.g, parks can close, and
481/// places can be removed.
482///
483/// The response specifies how long you can expect the playable locations to
484/// last. Once they expire, you should query the `samplePlayableLocations` API
485/// again to get a fresh view of the real world.
486///
487/// # Activities
488///
489/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
490/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
491///
492/// * [sample playable locations](MethodSamplePlayableLocationCall) (request)
493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
494#[serde_with::serde_as]
495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
496pub struct GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest {
497    /// Required. Specifies the area to search within for playable locations.
498    #[serde(rename = "areaFilter")]
499    pub area_filter: Option<GoogleMapsPlayablelocationsV3SampleAreaFilter>,
500    /// Required. Specifies one or more (up to 5) criteria for filtering the
501    /// returned playable locations.
502    pub criteria: Option<Vec<GoogleMapsPlayablelocationsV3SampleCriterion>>,
503}
504
505impl common::RequestValue for GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest {}
506
507/// Response for the
508/// SamplePlayableLocations
509/// method.
510///
511/// # Activities
512///
513/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
514/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
515///
516/// * [sample playable locations](MethodSamplePlayableLocationCall) (response)
517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
518#[serde_with::serde_as]
519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
520pub struct GoogleMapsPlayablelocationsV3SamplePlayableLocationsResponse {
521    /// Each PlayableLocation object corresponds to a game_object_type specified
522    /// in the request.
523    #[serde(rename = "locationsPerGameObjectType")]
524    pub locations_per_game_object_type:
525        Option<HashMap<String, GoogleMapsPlayablelocationsV3SamplePlayableLocationList>>,
526    /// Required. Specifies the "time-to-live" for the set of playable locations. You can use
527    /// this value to determine how long to cache the set of playable locations.
528    /// After this length of time, your back-end game server should issue a new
529    /// SamplePlayableLocations
530    /// request to get a fresh set of playable locations (because for example, they
531    /// might have been removed, a park might have closed for the day, a
532    /// business might have closed permanently).
533    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
534    pub ttl: Option<chrono::Duration>,
535}
536
537impl common::ResponseResult for GoogleMapsPlayablelocationsV3SamplePlayableLocationsResponse {}
538
539/// A set of options that specifies the separation between playable locations.
540///
541/// This type is not used in any activity, and only used as *part* of another schema.
542///
543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
544#[serde_with::serde_as]
545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
546pub struct GoogleMapsPlayablelocationsV3SampleSpacingOptions {
547    /// Required. The minimum spacing between any two playable locations, measured in meters.
548    /// The minimum value is 30.
549    /// The maximum value is 1000.
550    ///
551    /// Inputs will be rounded up to the next 10 meter interval.
552    ///
553    /// The default value is 200m.
554    ///
555    /// Set this field to remove tight clusters of playable locations.
556    ///
557    /// Note:
558    ///
559    /// The spacing is a greedy algorithm. It optimizes for selecting the highest
560    /// ranking locations first, not to maximize the number of locations selected.
561    /// Consider the following scenario:
562    ///
563    ///   * Rank: A: 2, B: 1, C: 3.
564    ///   * Distance: A--200m--B--200m--C
565    ///
566    /// If spacing=250, it will pick the highest ranked location [B], not [A, C].
567    ///
568    ///
569    /// Note:
570    ///
571    /// Spacing works within the game object type itself, as well as the previous
572    /// ones.
573    /// Suppose three game object types, each with the following spacing:
574    ///
575    ///   * X: 400m, Y: undefined, Z: 200m.
576    ///
577    /// 1. Add locations for X, within 400m of each other.
578    /// 2. Add locations for Y, without any spacing.
579    /// 3. Finally, add locations for Z within 200m of each other as well X and Y.
580    ///
581    /// The distance diagram between those locations end up as:
582    ///
583    ///   * From->To.
584    ///   * X->X: 400m
585    ///   * Y->X, Y->Y: unspecified.
586    ///   * Z->X, Z->Y, Z->Z: 200m.
587    #[serde(rename = "minSpacingMeters")]
588    pub min_spacing_meters: Option<f64>,
589    /// Specifies whether the minimum spacing constraint applies to the
590    /// center-point or to the snapped point of playable locations. The default
591    /// value is `CENTER_POINT`.
592    ///
593    /// If a snapped point is not available for a playable location, its
594    /// center-point is used instead.
595    ///
596    /// Set this to the point type used in your game.
597    #[serde(rename = "pointType")]
598    pub point_type: Option<String>,
599}
600
601impl common::Part for GoogleMapsPlayablelocationsV3SampleSpacingOptions {}
602
603/// Client information.
604///
605/// This type is not used in any activity, and only used as *part* of another schema.
606///
607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
608#[serde_with::serde_as]
609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
610pub struct GoogleMapsUnityClientInfo {
611    /// API client name and version. For example, the SDK calling the API. The
612    /// exact format is up to the client.
613    #[serde(rename = "apiClient")]
614    pub api_client: Option<String>,
615    /// Application ID, such as the package name on Android and the bundle
616    /// identifier on iOS platforms.
617    #[serde(rename = "applicationId")]
618    pub application_id: Option<String>,
619    /// Application version number, such as "1.2.3". The exact format is
620    /// application-dependent.
621    #[serde(rename = "applicationVersion")]
622    pub application_version: Option<String>,
623    /// Device model as reported by the device. The exact format is
624    /// platform-dependent.
625    #[serde(rename = "deviceModel")]
626    pub device_model: Option<String>,
627    /// Language code (in BCP-47 format) indicating the UI language of the client.
628    /// Examples are "en", "en-US" or "ja-Latn". For more information, see
629    /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
630    #[serde(rename = "languageCode")]
631    pub language_code: Option<String>,
632    /// Operating system name and version as reported by the OS. For example,
633    /// "Mac OS X 10.10.4". The exact format is platform-dependent.
634    #[serde(rename = "operatingSystem")]
635    pub operating_system: Option<String>,
636    /// Build number/version of the operating system. e.g., the contents of
637    /// android.os.Build.ID in Android, or the contents of sysctl "kern.osversion"
638    /// in iOS.
639    #[serde(rename = "operatingSystemBuild")]
640    pub operating_system_build: Option<String>,
641    /// Platform where the application is running.
642    pub platform: Option<String>,
643}
644
645impl common::Part for GoogleMapsUnityClientInfo {}
646
647/// An object representing a latitude/longitude pair. This is expressed as a pair
648/// of doubles representing degrees latitude and degrees longitude. Unless
649/// specified otherwise, this must conform to the
650/// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
651/// standard</a>. Values must be within normalized ranges.
652///
653/// This type is not used in any activity, and only used as *part* of another schema.
654///
655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
656#[serde_with::serde_as]
657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
658pub struct GoogleTypeLatLng {
659    /// The latitude in degrees. It must be in the range [-90.0, +90.0].
660    pub latitude: Option<f64>,
661    /// The longitude in degrees. It must be in the range [-180.0, +180.0].
662    pub longitude: Option<f64>,
663}
664
665impl common::Part for GoogleTypeLatLng {}
666
667// ###################
668// MethodBuilders ###
669// #################
670
671/// A builder providing access to all free methods, which are not associated with a particular resource.
672/// It is not used directly, but through the [`PlayableLocations`] hub.
673///
674/// # Example
675///
676/// Instantiate a resource builder
677///
678/// ```test_harness,no_run
679/// extern crate hyper;
680/// extern crate hyper_rustls;
681/// extern crate google_playablelocations3 as playablelocations3;
682///
683/// # async fn dox() {
684/// use playablelocations3::{PlayableLocations, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
685///
686/// let secret: yup_oauth2::ApplicationSecret = Default::default();
687/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
688///     .with_native_roots()
689///     .unwrap()
690///     .https_only()
691///     .enable_http2()
692///     .build();
693///
694/// let executor = hyper_util::rt::TokioExecutor::new();
695/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
696///     secret,
697///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
698///     yup_oauth2::client::CustomHyperClientBuilder::from(
699///         hyper_util::client::legacy::Client::builder(executor).build(connector),
700///     ),
701/// ).build().await.unwrap();
702///
703/// let client = hyper_util::client::legacy::Client::builder(
704///     hyper_util::rt::TokioExecutor::new()
705/// )
706/// .build(
707///     hyper_rustls::HttpsConnectorBuilder::new()
708///         .with_native_roots()
709///         .unwrap()
710///         .https_or_http()
711///         .enable_http2()
712///         .build()
713/// );
714/// let mut hub = PlayableLocations::new(client, auth);
715/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
716/// // like `log_impressions(...)`, `log_player_reports(...)` and `sample_playable_locations(...)`
717/// // to build up your call.
718/// let rb = hub.methods();
719/// # }
720/// ```
721pub struct MethodMethods<'a, C>
722where
723    C: 'a,
724{
725    hub: &'a PlayableLocations<C>,
726}
727
728impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
729
730impl<'a, C> MethodMethods<'a, C> {
731    /// Create a builder to help you perform the following task:
732    ///
733    /// Logs new events when playable locations are displayed, and when they are
734    /// interacted with.
735    ///
736    /// Impressions are not partially saved; either all impressions are saved and
737    /// this request succeeds, or no impressions are saved, and this request fails.
738    ///
739    /// # Arguments
740    ///
741    /// * `request` - No description provided.
742    pub fn log_impressions(
743        &self,
744        request: GoogleMapsPlayablelocationsV3LogImpressionsRequest,
745    ) -> MethodLogImpressionCall<'a, C> {
746        MethodLogImpressionCall {
747            hub: self.hub,
748            _request: request,
749            _delegate: Default::default(),
750            _additional_params: Default::default(),
751        }
752    }
753
754    /// Create a builder to help you perform the following task:
755    ///
756    /// Logs bad playable location reports submitted by players.
757    ///
758    /// Reports are not partially saved; either all reports are saved and this
759    /// request succeeds, or no reports are saved, and this request fails.
760    ///
761    /// # Arguments
762    ///
763    /// * `request` - No description provided.
764    pub fn log_player_reports(
765        &self,
766        request: GoogleMapsPlayablelocationsV3LogPlayerReportsRequest,
767    ) -> MethodLogPlayerReportCall<'a, C> {
768        MethodLogPlayerReportCall {
769            hub: self.hub,
770            _request: request,
771            _delegate: Default::default(),
772            _additional_params: Default::default(),
773        }
774    }
775
776    /// Create a builder to help you perform the following task:
777    ///
778    /// Returns a set of playable locations that lie within a specified area,
779    /// that satisfy optional filter criteria.
780    ///
781    /// Note: Identical `SamplePlayableLocations` requests can return different
782    /// results as the state of the world changes over time.
783    ///
784    /// # Arguments
785    ///
786    /// * `request` - No description provided.
787    pub fn sample_playable_locations(
788        &self,
789        request: GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest,
790    ) -> MethodSamplePlayableLocationCall<'a, C> {
791        MethodSamplePlayableLocationCall {
792            hub: self.hub,
793            _request: request,
794            _delegate: Default::default(),
795            _additional_params: Default::default(),
796        }
797    }
798}
799
800// ###################
801// CallBuilders   ###
802// #################
803
804/// Logs new events when playable locations are displayed, and when they are
805/// interacted with.
806///
807/// Impressions are not partially saved; either all impressions are saved and
808/// this request succeeds, or no impressions are saved, and this request fails.
809///
810/// A builder for the *logImpressions* method.
811/// It is not used directly, but through a [`MethodMethods`] instance.
812///
813/// # Example
814///
815/// Instantiate a resource method builder
816///
817/// ```test_harness,no_run
818/// # extern crate hyper;
819/// # extern crate hyper_rustls;
820/// # extern crate google_playablelocations3 as playablelocations3;
821/// use playablelocations3::api::GoogleMapsPlayablelocationsV3LogImpressionsRequest;
822/// # async fn dox() {
823/// # use playablelocations3::{PlayableLocations, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
824///
825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
826/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
827/// #     .with_native_roots()
828/// #     .unwrap()
829/// #     .https_only()
830/// #     .enable_http2()
831/// #     .build();
832///
833/// # let executor = hyper_util::rt::TokioExecutor::new();
834/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
835/// #     secret,
836/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
837/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
838/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
839/// #     ),
840/// # ).build().await.unwrap();
841///
842/// # let client = hyper_util::client::legacy::Client::builder(
843/// #     hyper_util::rt::TokioExecutor::new()
844/// # )
845/// # .build(
846/// #     hyper_rustls::HttpsConnectorBuilder::new()
847/// #         .with_native_roots()
848/// #         .unwrap()
849/// #         .https_or_http()
850/// #         .enable_http2()
851/// #         .build()
852/// # );
853/// # let mut hub = PlayableLocations::new(client, auth);
854/// // As the method needs a request, you would usually fill it with the desired information
855/// // into the respective structure. Some of the parts shown here might not be applicable !
856/// // Values shown here are possibly random and not representative !
857/// let mut req = GoogleMapsPlayablelocationsV3LogImpressionsRequest::default();
858///
859/// // You can configure optional parameters by calling the respective setters at will, and
860/// // execute the final call using `doit()`.
861/// // Values shown here are possibly random and not representative !
862/// let result = hub.methods().log_impressions(req)
863///              .doit().await;
864/// # }
865/// ```
866pub struct MethodLogImpressionCall<'a, C>
867where
868    C: 'a,
869{
870    hub: &'a PlayableLocations<C>,
871    _request: GoogleMapsPlayablelocationsV3LogImpressionsRequest,
872    _delegate: Option<&'a mut dyn common::Delegate>,
873    _additional_params: HashMap<String, String>,
874}
875
876impl<'a, C> common::CallBuilder for MethodLogImpressionCall<'a, C> {}
877
878impl<'a, C> MethodLogImpressionCall<'a, C>
879where
880    C: common::Connector,
881{
882    /// Perform the operation you have build so far.
883    pub async fn doit(
884        mut self,
885    ) -> common::Result<(
886        common::Response,
887        GoogleMapsPlayablelocationsV3LogImpressionsResponse,
888    )> {
889        use std::borrow::Cow;
890        use std::io::{Read, Seek};
891
892        use common::{url::Params, ToParts};
893        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
894
895        let mut dd = common::DefaultDelegate;
896        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
897        dlg.begin(common::MethodInfo {
898            id: "playablelocations.logImpressions",
899            http_method: hyper::Method::POST,
900        });
901
902        for &field in ["alt"].iter() {
903            if self._additional_params.contains_key(field) {
904                dlg.finished(false);
905                return Err(common::Error::FieldClash(field));
906            }
907        }
908
909        let mut params = Params::with_capacity(3 + self._additional_params.len());
910
911        params.extend(self._additional_params.iter());
912
913        params.push("alt", "json");
914        let mut url = self.hub._base_url.clone() + "v3:logImpressions";
915
916        match dlg.api_key() {
917            Some(value) => params.push("key", value),
918            None => {
919                dlg.finished(false);
920                return Err(common::Error::MissingAPIKey);
921            }
922        }
923
924        let url = params.parse_with_url(&url);
925
926        let mut json_mime_type = mime::APPLICATION_JSON;
927        let mut request_value_reader = {
928            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
929            common::remove_json_null_values(&mut value);
930            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
931            serde_json::to_writer(&mut dst, &value).unwrap();
932            dst
933        };
934        let request_size = request_value_reader
935            .seek(std::io::SeekFrom::End(0))
936            .unwrap();
937        request_value_reader
938            .seek(std::io::SeekFrom::Start(0))
939            .unwrap();
940
941        loop {
942            request_value_reader
943                .seek(std::io::SeekFrom::Start(0))
944                .unwrap();
945            let mut req_result = {
946                let client = &self.hub.client;
947                dlg.pre_request();
948                let mut req_builder = hyper::Request::builder()
949                    .method(hyper::Method::POST)
950                    .uri(url.as_str())
951                    .header(USER_AGENT, self.hub._user_agent.clone());
952
953                let request = req_builder
954                    .header(CONTENT_TYPE, json_mime_type.to_string())
955                    .header(CONTENT_LENGTH, request_size as u64)
956                    .body(common::to_body(
957                        request_value_reader.get_ref().clone().into(),
958                    ));
959
960                client.request(request.unwrap()).await
961            };
962
963            match req_result {
964                Err(err) => {
965                    if let common::Retry::After(d) = dlg.http_error(&err) {
966                        sleep(d).await;
967                        continue;
968                    }
969                    dlg.finished(false);
970                    return Err(common::Error::HttpError(err));
971                }
972                Ok(res) => {
973                    let (mut parts, body) = res.into_parts();
974                    let mut body = common::Body::new(body);
975                    if !parts.status.is_success() {
976                        let bytes = common::to_bytes(body).await.unwrap_or_default();
977                        let error = serde_json::from_str(&common::to_string(&bytes));
978                        let response = common::to_response(parts, bytes.into());
979
980                        if let common::Retry::After(d) =
981                            dlg.http_failure(&response, error.as_ref().ok())
982                        {
983                            sleep(d).await;
984                            continue;
985                        }
986
987                        dlg.finished(false);
988
989                        return Err(match error {
990                            Ok(value) => common::Error::BadRequest(value),
991                            _ => common::Error::Failure(response),
992                        });
993                    }
994                    let response = {
995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
996                        let encoded = common::to_string(&bytes);
997                        match serde_json::from_str(&encoded) {
998                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
999                            Err(error) => {
1000                                dlg.response_json_decode_error(&encoded, &error);
1001                                return Err(common::Error::JsonDecodeError(
1002                                    encoded.to_string(),
1003                                    error,
1004                                ));
1005                            }
1006                        }
1007                    };
1008
1009                    dlg.finished(true);
1010                    return Ok(response);
1011                }
1012            }
1013        }
1014    }
1015
1016    ///
1017    /// Sets the *request* property to the given value.
1018    ///
1019    /// Even though the property as already been set when instantiating this call,
1020    /// we provide this method for API completeness.
1021    pub fn request(
1022        mut self,
1023        new_value: GoogleMapsPlayablelocationsV3LogImpressionsRequest,
1024    ) -> MethodLogImpressionCall<'a, C> {
1025        self._request = new_value;
1026        self
1027    }
1028    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1029    /// while executing the actual API request.
1030    ///
1031    /// ````text
1032    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1033    /// ````
1034    ///
1035    /// Sets the *delegate* property to the given value.
1036    pub fn delegate(
1037        mut self,
1038        new_value: &'a mut dyn common::Delegate,
1039    ) -> MethodLogImpressionCall<'a, C> {
1040        self._delegate = Some(new_value);
1041        self
1042    }
1043
1044    /// Set any additional parameter of the query string used in the request.
1045    /// It should be used to set parameters which are not yet available through their own
1046    /// setters.
1047    ///
1048    /// Please note that this method must not be used to set any of the known parameters
1049    /// which have their own setter method. If done anyway, the request will fail.
1050    ///
1051    /// # Additional Parameters
1052    ///
1053    /// * *$.xgafv* (query-string) - V1 error format.
1054    /// * *access_token* (query-string) - OAuth access token.
1055    /// * *alt* (query-string) - Data format for response.
1056    /// * *callback* (query-string) - JSONP
1057    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1058    /// * *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.
1059    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1060    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1061    /// * *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.
1062    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1063    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1064    pub fn param<T>(mut self, name: T, value: T) -> MethodLogImpressionCall<'a, C>
1065    where
1066        T: AsRef<str>,
1067    {
1068        self._additional_params
1069            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1070        self
1071    }
1072}
1073
1074/// Logs bad playable location reports submitted by players.
1075///
1076/// Reports are not partially saved; either all reports are saved and this
1077/// request succeeds, or no reports are saved, and this request fails.
1078///
1079/// A builder for the *logPlayerReports* method.
1080/// It is not used directly, but through a [`MethodMethods`] instance.
1081///
1082/// # Example
1083///
1084/// Instantiate a resource method builder
1085///
1086/// ```test_harness,no_run
1087/// # extern crate hyper;
1088/// # extern crate hyper_rustls;
1089/// # extern crate google_playablelocations3 as playablelocations3;
1090/// use playablelocations3::api::GoogleMapsPlayablelocationsV3LogPlayerReportsRequest;
1091/// # async fn dox() {
1092/// # use playablelocations3::{PlayableLocations, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1093///
1094/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1095/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1096/// #     .with_native_roots()
1097/// #     .unwrap()
1098/// #     .https_only()
1099/// #     .enable_http2()
1100/// #     .build();
1101///
1102/// # let executor = hyper_util::rt::TokioExecutor::new();
1103/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1104/// #     secret,
1105/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1106/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1107/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1108/// #     ),
1109/// # ).build().await.unwrap();
1110///
1111/// # let client = hyper_util::client::legacy::Client::builder(
1112/// #     hyper_util::rt::TokioExecutor::new()
1113/// # )
1114/// # .build(
1115/// #     hyper_rustls::HttpsConnectorBuilder::new()
1116/// #         .with_native_roots()
1117/// #         .unwrap()
1118/// #         .https_or_http()
1119/// #         .enable_http2()
1120/// #         .build()
1121/// # );
1122/// # let mut hub = PlayableLocations::new(client, auth);
1123/// // As the method needs a request, you would usually fill it with the desired information
1124/// // into the respective structure. Some of the parts shown here might not be applicable !
1125/// // Values shown here are possibly random and not representative !
1126/// let mut req = GoogleMapsPlayablelocationsV3LogPlayerReportsRequest::default();
1127///
1128/// // You can configure optional parameters by calling the respective setters at will, and
1129/// // execute the final call using `doit()`.
1130/// // Values shown here are possibly random and not representative !
1131/// let result = hub.methods().log_player_reports(req)
1132///              .doit().await;
1133/// # }
1134/// ```
1135pub struct MethodLogPlayerReportCall<'a, C>
1136where
1137    C: 'a,
1138{
1139    hub: &'a PlayableLocations<C>,
1140    _request: GoogleMapsPlayablelocationsV3LogPlayerReportsRequest,
1141    _delegate: Option<&'a mut dyn common::Delegate>,
1142    _additional_params: HashMap<String, String>,
1143}
1144
1145impl<'a, C> common::CallBuilder for MethodLogPlayerReportCall<'a, C> {}
1146
1147impl<'a, C> MethodLogPlayerReportCall<'a, C>
1148where
1149    C: common::Connector,
1150{
1151    /// Perform the operation you have build so far.
1152    pub async fn doit(
1153        mut self,
1154    ) -> common::Result<(
1155        common::Response,
1156        GoogleMapsPlayablelocationsV3LogPlayerReportsResponse,
1157    )> {
1158        use std::borrow::Cow;
1159        use std::io::{Read, Seek};
1160
1161        use common::{url::Params, ToParts};
1162        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1163
1164        let mut dd = common::DefaultDelegate;
1165        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1166        dlg.begin(common::MethodInfo {
1167            id: "playablelocations.logPlayerReports",
1168            http_method: hyper::Method::POST,
1169        });
1170
1171        for &field in ["alt"].iter() {
1172            if self._additional_params.contains_key(field) {
1173                dlg.finished(false);
1174                return Err(common::Error::FieldClash(field));
1175            }
1176        }
1177
1178        let mut params = Params::with_capacity(3 + self._additional_params.len());
1179
1180        params.extend(self._additional_params.iter());
1181
1182        params.push("alt", "json");
1183        let mut url = self.hub._base_url.clone() + "v3:logPlayerReports";
1184
1185        match dlg.api_key() {
1186            Some(value) => params.push("key", value),
1187            None => {
1188                dlg.finished(false);
1189                return Err(common::Error::MissingAPIKey);
1190            }
1191        }
1192
1193        let url = params.parse_with_url(&url);
1194
1195        let mut json_mime_type = mime::APPLICATION_JSON;
1196        let mut request_value_reader = {
1197            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1198            common::remove_json_null_values(&mut value);
1199            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1200            serde_json::to_writer(&mut dst, &value).unwrap();
1201            dst
1202        };
1203        let request_size = request_value_reader
1204            .seek(std::io::SeekFrom::End(0))
1205            .unwrap();
1206        request_value_reader
1207            .seek(std::io::SeekFrom::Start(0))
1208            .unwrap();
1209
1210        loop {
1211            request_value_reader
1212                .seek(std::io::SeekFrom::Start(0))
1213                .unwrap();
1214            let mut req_result = {
1215                let client = &self.hub.client;
1216                dlg.pre_request();
1217                let mut req_builder = hyper::Request::builder()
1218                    .method(hyper::Method::POST)
1219                    .uri(url.as_str())
1220                    .header(USER_AGENT, self.hub._user_agent.clone());
1221
1222                let request = req_builder
1223                    .header(CONTENT_TYPE, json_mime_type.to_string())
1224                    .header(CONTENT_LENGTH, request_size as u64)
1225                    .body(common::to_body(
1226                        request_value_reader.get_ref().clone().into(),
1227                    ));
1228
1229                client.request(request.unwrap()).await
1230            };
1231
1232            match req_result {
1233                Err(err) => {
1234                    if let common::Retry::After(d) = dlg.http_error(&err) {
1235                        sleep(d).await;
1236                        continue;
1237                    }
1238                    dlg.finished(false);
1239                    return Err(common::Error::HttpError(err));
1240                }
1241                Ok(res) => {
1242                    let (mut parts, body) = res.into_parts();
1243                    let mut body = common::Body::new(body);
1244                    if !parts.status.is_success() {
1245                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1246                        let error = serde_json::from_str(&common::to_string(&bytes));
1247                        let response = common::to_response(parts, bytes.into());
1248
1249                        if let common::Retry::After(d) =
1250                            dlg.http_failure(&response, error.as_ref().ok())
1251                        {
1252                            sleep(d).await;
1253                            continue;
1254                        }
1255
1256                        dlg.finished(false);
1257
1258                        return Err(match error {
1259                            Ok(value) => common::Error::BadRequest(value),
1260                            _ => common::Error::Failure(response),
1261                        });
1262                    }
1263                    let response = {
1264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1265                        let encoded = common::to_string(&bytes);
1266                        match serde_json::from_str(&encoded) {
1267                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1268                            Err(error) => {
1269                                dlg.response_json_decode_error(&encoded, &error);
1270                                return Err(common::Error::JsonDecodeError(
1271                                    encoded.to_string(),
1272                                    error,
1273                                ));
1274                            }
1275                        }
1276                    };
1277
1278                    dlg.finished(true);
1279                    return Ok(response);
1280                }
1281            }
1282        }
1283    }
1284
1285    ///
1286    /// Sets the *request* property to the given value.
1287    ///
1288    /// Even though the property as already been set when instantiating this call,
1289    /// we provide this method for API completeness.
1290    pub fn request(
1291        mut self,
1292        new_value: GoogleMapsPlayablelocationsV3LogPlayerReportsRequest,
1293    ) -> MethodLogPlayerReportCall<'a, C> {
1294        self._request = new_value;
1295        self
1296    }
1297    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1298    /// while executing the actual API request.
1299    ///
1300    /// ````text
1301    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1302    /// ````
1303    ///
1304    /// Sets the *delegate* property to the given value.
1305    pub fn delegate(
1306        mut self,
1307        new_value: &'a mut dyn common::Delegate,
1308    ) -> MethodLogPlayerReportCall<'a, C> {
1309        self._delegate = Some(new_value);
1310        self
1311    }
1312
1313    /// Set any additional parameter of the query string used in the request.
1314    /// It should be used to set parameters which are not yet available through their own
1315    /// setters.
1316    ///
1317    /// Please note that this method must not be used to set any of the known parameters
1318    /// which have their own setter method. If done anyway, the request will fail.
1319    ///
1320    /// # Additional Parameters
1321    ///
1322    /// * *$.xgafv* (query-string) - V1 error format.
1323    /// * *access_token* (query-string) - OAuth access token.
1324    /// * *alt* (query-string) - Data format for response.
1325    /// * *callback* (query-string) - JSONP
1326    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1327    /// * *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.
1328    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1329    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1330    /// * *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.
1331    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1332    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1333    pub fn param<T>(mut self, name: T, value: T) -> MethodLogPlayerReportCall<'a, C>
1334    where
1335        T: AsRef<str>,
1336    {
1337        self._additional_params
1338            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1339        self
1340    }
1341}
1342
1343/// Returns a set of playable locations that lie within a specified area,
1344/// that satisfy optional filter criteria.
1345///
1346/// Note: Identical `SamplePlayableLocations` requests can return different
1347/// results as the state of the world changes over time.
1348///
1349/// A builder for the *samplePlayableLocations* method.
1350/// It is not used directly, but through a [`MethodMethods`] instance.
1351///
1352/// # Example
1353///
1354/// Instantiate a resource method builder
1355///
1356/// ```test_harness,no_run
1357/// # extern crate hyper;
1358/// # extern crate hyper_rustls;
1359/// # extern crate google_playablelocations3 as playablelocations3;
1360/// use playablelocations3::api::GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest;
1361/// # async fn dox() {
1362/// # use playablelocations3::{PlayableLocations, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1363///
1364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1365/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1366/// #     .with_native_roots()
1367/// #     .unwrap()
1368/// #     .https_only()
1369/// #     .enable_http2()
1370/// #     .build();
1371///
1372/// # let executor = hyper_util::rt::TokioExecutor::new();
1373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1374/// #     secret,
1375/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1376/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1377/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1378/// #     ),
1379/// # ).build().await.unwrap();
1380///
1381/// # let client = hyper_util::client::legacy::Client::builder(
1382/// #     hyper_util::rt::TokioExecutor::new()
1383/// # )
1384/// # .build(
1385/// #     hyper_rustls::HttpsConnectorBuilder::new()
1386/// #         .with_native_roots()
1387/// #         .unwrap()
1388/// #         .https_or_http()
1389/// #         .enable_http2()
1390/// #         .build()
1391/// # );
1392/// # let mut hub = PlayableLocations::new(client, auth);
1393/// // As the method needs a request, you would usually fill it with the desired information
1394/// // into the respective structure. Some of the parts shown here might not be applicable !
1395/// // Values shown here are possibly random and not representative !
1396/// let mut req = GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest::default();
1397///
1398/// // You can configure optional parameters by calling the respective setters at will, and
1399/// // execute the final call using `doit()`.
1400/// // Values shown here are possibly random and not representative !
1401/// let result = hub.methods().sample_playable_locations(req)
1402///              .doit().await;
1403/// # }
1404/// ```
1405pub struct MethodSamplePlayableLocationCall<'a, C>
1406where
1407    C: 'a,
1408{
1409    hub: &'a PlayableLocations<C>,
1410    _request: GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest,
1411    _delegate: Option<&'a mut dyn common::Delegate>,
1412    _additional_params: HashMap<String, String>,
1413}
1414
1415impl<'a, C> common::CallBuilder for MethodSamplePlayableLocationCall<'a, C> {}
1416
1417impl<'a, C> MethodSamplePlayableLocationCall<'a, C>
1418where
1419    C: common::Connector,
1420{
1421    /// Perform the operation you have build so far.
1422    pub async fn doit(
1423        mut self,
1424    ) -> common::Result<(
1425        common::Response,
1426        GoogleMapsPlayablelocationsV3SamplePlayableLocationsResponse,
1427    )> {
1428        use std::borrow::Cow;
1429        use std::io::{Read, Seek};
1430
1431        use common::{url::Params, ToParts};
1432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1433
1434        let mut dd = common::DefaultDelegate;
1435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1436        dlg.begin(common::MethodInfo {
1437            id: "playablelocations.samplePlayableLocations",
1438            http_method: hyper::Method::POST,
1439        });
1440
1441        for &field in ["alt"].iter() {
1442            if self._additional_params.contains_key(field) {
1443                dlg.finished(false);
1444                return Err(common::Error::FieldClash(field));
1445            }
1446        }
1447
1448        let mut params = Params::with_capacity(3 + self._additional_params.len());
1449
1450        params.extend(self._additional_params.iter());
1451
1452        params.push("alt", "json");
1453        let mut url = self.hub._base_url.clone() + "v3:samplePlayableLocations";
1454
1455        match dlg.api_key() {
1456            Some(value) => params.push("key", value),
1457            None => {
1458                dlg.finished(false);
1459                return Err(common::Error::MissingAPIKey);
1460            }
1461        }
1462
1463        let url = params.parse_with_url(&url);
1464
1465        let mut json_mime_type = mime::APPLICATION_JSON;
1466        let mut request_value_reader = {
1467            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1468            common::remove_json_null_values(&mut value);
1469            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1470            serde_json::to_writer(&mut dst, &value).unwrap();
1471            dst
1472        };
1473        let request_size = request_value_reader
1474            .seek(std::io::SeekFrom::End(0))
1475            .unwrap();
1476        request_value_reader
1477            .seek(std::io::SeekFrom::Start(0))
1478            .unwrap();
1479
1480        loop {
1481            request_value_reader
1482                .seek(std::io::SeekFrom::Start(0))
1483                .unwrap();
1484            let mut req_result = {
1485                let client = &self.hub.client;
1486                dlg.pre_request();
1487                let mut req_builder = hyper::Request::builder()
1488                    .method(hyper::Method::POST)
1489                    .uri(url.as_str())
1490                    .header(USER_AGENT, self.hub._user_agent.clone());
1491
1492                let request = req_builder
1493                    .header(CONTENT_TYPE, json_mime_type.to_string())
1494                    .header(CONTENT_LENGTH, request_size as u64)
1495                    .body(common::to_body(
1496                        request_value_reader.get_ref().clone().into(),
1497                    ));
1498
1499                client.request(request.unwrap()).await
1500            };
1501
1502            match req_result {
1503                Err(err) => {
1504                    if let common::Retry::After(d) = dlg.http_error(&err) {
1505                        sleep(d).await;
1506                        continue;
1507                    }
1508                    dlg.finished(false);
1509                    return Err(common::Error::HttpError(err));
1510                }
1511                Ok(res) => {
1512                    let (mut parts, body) = res.into_parts();
1513                    let mut body = common::Body::new(body);
1514                    if !parts.status.is_success() {
1515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1516                        let error = serde_json::from_str(&common::to_string(&bytes));
1517                        let response = common::to_response(parts, bytes.into());
1518
1519                        if let common::Retry::After(d) =
1520                            dlg.http_failure(&response, error.as_ref().ok())
1521                        {
1522                            sleep(d).await;
1523                            continue;
1524                        }
1525
1526                        dlg.finished(false);
1527
1528                        return Err(match error {
1529                            Ok(value) => common::Error::BadRequest(value),
1530                            _ => common::Error::Failure(response),
1531                        });
1532                    }
1533                    let response = {
1534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1535                        let encoded = common::to_string(&bytes);
1536                        match serde_json::from_str(&encoded) {
1537                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1538                            Err(error) => {
1539                                dlg.response_json_decode_error(&encoded, &error);
1540                                return Err(common::Error::JsonDecodeError(
1541                                    encoded.to_string(),
1542                                    error,
1543                                ));
1544                            }
1545                        }
1546                    };
1547
1548                    dlg.finished(true);
1549                    return Ok(response);
1550                }
1551            }
1552        }
1553    }
1554
1555    ///
1556    /// Sets the *request* property to the given value.
1557    ///
1558    /// Even though the property as already been set when instantiating this call,
1559    /// we provide this method for API completeness.
1560    pub fn request(
1561        mut self,
1562        new_value: GoogleMapsPlayablelocationsV3SamplePlayableLocationsRequest,
1563    ) -> MethodSamplePlayableLocationCall<'a, C> {
1564        self._request = new_value;
1565        self
1566    }
1567    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1568    /// while executing the actual API request.
1569    ///
1570    /// ````text
1571    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1572    /// ````
1573    ///
1574    /// Sets the *delegate* property to the given value.
1575    pub fn delegate(
1576        mut self,
1577        new_value: &'a mut dyn common::Delegate,
1578    ) -> MethodSamplePlayableLocationCall<'a, C> {
1579        self._delegate = Some(new_value);
1580        self
1581    }
1582
1583    /// Set any additional parameter of the query string used in the request.
1584    /// It should be used to set parameters which are not yet available through their own
1585    /// setters.
1586    ///
1587    /// Please note that this method must not be used to set any of the known parameters
1588    /// which have their own setter method. If done anyway, the request will fail.
1589    ///
1590    /// # Additional Parameters
1591    ///
1592    /// * *$.xgafv* (query-string) - V1 error format.
1593    /// * *access_token* (query-string) - OAuth access token.
1594    /// * *alt* (query-string) - Data format for response.
1595    /// * *callback* (query-string) - JSONP
1596    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1597    /// * *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.
1598    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1599    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1600    /// * *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.
1601    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1602    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1603    pub fn param<T>(mut self, name: T, value: T) -> MethodSamplePlayableLocationCall<'a, C>
1604    where
1605        T: AsRef<str>,
1606    {
1607        self._additional_params
1608            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1609        self
1610    }
1611}