google_games1/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 /// View and manage your Google Play Developer account
17 Androidpublisher,
18
19 /// See, create, and delete its own configuration data in your Google Drive
20 DriveAppdata,
21
22 /// Create, edit, and delete your Google Play Games activity
23 Full,
24}
25
26impl AsRef<str> for Scope {
27 fn as_ref(&self) -> &str {
28 match *self {
29 Scope::Androidpublisher => "https://www.googleapis.com/auth/androidpublisher",
30 Scope::DriveAppdata => "https://www.googleapis.com/auth/drive.appdata",
31 Scope::Full => "https://www.googleapis.com/auth/games",
32 }
33 }
34}
35
36#[allow(clippy::derivable_impls)]
37impl Default for Scope {
38 fn default() -> Scope {
39 Scope::Full
40 }
41}
42
43// ########
44// HUB ###
45// ######
46
47/// Central instance to access all Games related resource activities
48///
49/// # Examples
50///
51/// Instantiate a new hub
52///
53/// ```test_harness,no_run
54/// extern crate hyper;
55/// extern crate hyper_rustls;
56/// extern crate google_games1 as games1;
57/// use games1::{Result, Error};
58/// # async fn dox() {
59/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60///
61/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
62/// // `client_secret`, among other things.
63/// let secret: yup_oauth2::ApplicationSecret = Default::default();
64/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
65/// // unless you replace `None` with the desired Flow.
66/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
67/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
68/// // retrieve them from storage.
69/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
70/// .with_native_roots()
71/// .unwrap()
72/// .https_only()
73/// .enable_http2()
74/// .build();
75///
76/// let executor = hyper_util::rt::TokioExecutor::new();
77/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
78/// secret,
79/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80/// yup_oauth2::client::CustomHyperClientBuilder::from(
81/// hyper_util::client::legacy::Client::builder(executor).build(connector),
82/// ),
83/// ).build().await.unwrap();
84///
85/// let client = hyper_util::client::legacy::Client::builder(
86/// hyper_util::rt::TokioExecutor::new()
87/// )
88/// .build(
89/// hyper_rustls::HttpsConnectorBuilder::new()
90/// .with_native_roots()
91/// .unwrap()
92/// .https_or_http()
93/// .enable_http2()
94/// .build()
95/// );
96/// let mut hub = Games::new(client, auth);
97/// // You can configure optional parameters by calling the respective setters at will, and
98/// // execute the final call using `doit()`.
99/// // Values shown here are possibly random and not representative !
100/// let result = hub.applications().get("applicationId")
101/// .platform_type("sed")
102/// .language("amet.")
103/// .doit().await;
104///
105/// match result {
106/// Err(e) => match e {
107/// // The Error enum provides details about what exactly happened.
108/// // You can also just use its `Debug`, `Display` or `Error` traits
109/// Error::HttpError(_)
110/// |Error::Io(_)
111/// |Error::MissingAPIKey
112/// |Error::MissingToken(_)
113/// |Error::Cancelled
114/// |Error::UploadSizeLimitExceeded(_, _)
115/// |Error::Failure(_)
116/// |Error::BadRequest(_)
117/// |Error::FieldClash(_)
118/// |Error::JsonDecodeError(_, _) => println!("{}", e),
119/// },
120/// Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct Games<C> {
126 pub client: common::Client<C>,
127 pub auth: Box<dyn common::GetToken>,
128 _user_agent: String,
129 _base_url: String,
130 _root_url: String,
131}
132
133impl<C> common::Hub for Games<C> {}
134
135impl<'a, C> Games<C> {
136 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Games<C> {
137 Games {
138 client,
139 auth: Box::new(auth),
140 _user_agent: "google-api-rust-client/7.0.0".to_string(),
141 _base_url: "https://games.googleapis.com/".to_string(),
142 _root_url: "https://games.googleapis.com/".to_string(),
143 }
144 }
145
146 pub fn accesstokens(&'a self) -> AccesstokenMethods<'a, C> {
147 AccesstokenMethods { hub: self }
148 }
149 pub fn achievement_definitions(&'a self) -> AchievementDefinitionMethods<'a, C> {
150 AchievementDefinitionMethods { hub: self }
151 }
152 pub fn achievements(&'a self) -> AchievementMethods<'a, C> {
153 AchievementMethods { hub: self }
154 }
155 pub fn applications(&'a self) -> ApplicationMethods<'a, C> {
156 ApplicationMethods { hub: self }
157 }
158 pub fn events(&'a self) -> EventMethods<'a, C> {
159 EventMethods { hub: self }
160 }
161 pub fn leaderboards(&'a self) -> LeaderboardMethods<'a, C> {
162 LeaderboardMethods { hub: self }
163 }
164 pub fn metagame(&'a self) -> MetagameMethods<'a, C> {
165 MetagameMethods { hub: self }
166 }
167 pub fn players(&'a self) -> PlayerMethods<'a, C> {
168 PlayerMethods { hub: self }
169 }
170 pub fn recall(&'a self) -> RecallMethods<'a, C> {
171 RecallMethods { hub: self }
172 }
173 pub fn revisions(&'a self) -> RevisionMethods<'a, C> {
174 RevisionMethods { hub: self }
175 }
176 pub fn scores(&'a self) -> ScoreMethods<'a, C> {
177 ScoreMethods { hub: self }
178 }
179 pub fn snapshots(&'a self) -> SnapshotMethods<'a, C> {
180 SnapshotMethods { hub: self }
181 }
182 pub fn stats(&'a self) -> StatMethods<'a, C> {
183 StatMethods { hub: self }
184 }
185
186 /// Set the user-agent header field to use in all requests to the server.
187 /// It defaults to `google-api-rust-client/7.0.0`.
188 ///
189 /// Returns the previously set user-agent.
190 pub fn user_agent(&mut self, agent_name: String) -> String {
191 std::mem::replace(&mut self._user_agent, agent_name)
192 }
193
194 /// Set the base url to use in all requests to the server.
195 /// It defaults to `https://games.googleapis.com/`.
196 ///
197 /// Returns the previously set base url.
198 pub fn base_url(&mut self, new_base_url: String) -> String {
199 std::mem::replace(&mut self._base_url, new_base_url)
200 }
201
202 /// Set the root url to use in all requests to the server.
203 /// It defaults to `https://games.googleapis.com/`.
204 ///
205 /// Returns the previously set root url.
206 pub fn root_url(&mut self, new_root_url: String) -> String {
207 std::mem::replace(&mut self._root_url, new_root_url)
208 }
209}
210
211// ############
212// SCHEMAS ###
213// ##########
214/// An achievement definition object.
215///
216/// # Activities
217///
218/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
219/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
220///
221/// * [list achievement definitions](AchievementDefinitionListCall) (none)
222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
223#[serde_with::serde_as]
224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
225pub struct AchievementDefinition {
226 /// The type of the achievement.
227 #[serde(rename = "achievementType")]
228 pub achievement_type: Option<String>,
229 /// The description of the achievement.
230 pub description: Option<String>,
231 /// Experience points which will be earned when unlocking this achievement.
232 #[serde(rename = "experiencePoints")]
233 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
234 pub experience_points: Option<i64>,
235 /// The total steps for an incremental achievement as a string.
236 #[serde(rename = "formattedTotalSteps")]
237 pub formatted_total_steps: Option<String>,
238 /// The ID of the achievement.
239 pub id: Option<String>,
240 /// The initial state of the achievement.
241 #[serde(rename = "initialState")]
242 pub initial_state: Option<String>,
243 /// Indicates whether the revealed icon image being returned is a default image, or is provided by the game.
244 #[serde(rename = "isRevealedIconUrlDefault")]
245 pub is_revealed_icon_url_default: Option<bool>,
246 /// Indicates whether the unlocked icon image being returned is a default image, or is game-provided.
247 #[serde(rename = "isUnlockedIconUrlDefault")]
248 pub is_unlocked_icon_url_default: Option<bool>,
249 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementDefinition`.
250 pub kind: Option<String>,
251 /// The name of the achievement.
252 pub name: Option<String>,
253 /// The image URL for the revealed achievement icon.
254 #[serde(rename = "revealedIconUrl")]
255 pub revealed_icon_url: Option<String>,
256 /// The total steps for an incremental achievement.
257 #[serde(rename = "totalSteps")]
258 pub total_steps: Option<i32>,
259 /// The image URL for the unlocked achievement icon.
260 #[serde(rename = "unlockedIconUrl")]
261 pub unlocked_icon_url: Option<String>,
262}
263
264impl common::Resource for AchievementDefinition {}
265
266/// A list of achievement definition objects.
267///
268/// # Activities
269///
270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
272///
273/// * [list achievement definitions](AchievementDefinitionListCall) (response)
274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
275#[serde_with::serde_as]
276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
277pub struct AchievementDefinitionsListResponse {
278 /// The achievement definitions.
279 pub items: Option<Vec<AchievementDefinition>>,
280 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementDefinitionsListResponse`.
281 pub kind: Option<String>,
282 /// Token corresponding to the next page of results.
283 #[serde(rename = "nextPageToken")]
284 pub next_page_token: Option<String>,
285}
286
287impl common::ResponseResult for AchievementDefinitionsListResponse {}
288
289/// An achievement increment response
290///
291/// # Activities
292///
293/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
294/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
295///
296/// * [increment achievements](AchievementIncrementCall) (response)
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct AchievementIncrementResponse {
301 /// The current steps recorded for this incremental achievement.
302 #[serde(rename = "currentSteps")]
303 pub current_steps: Option<i32>,
304 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementIncrementResponse`.
305 pub kind: Option<String>,
306 /// Whether the current steps for the achievement has reached the number of steps required to unlock.
307 #[serde(rename = "newlyUnlocked")]
308 pub newly_unlocked: Option<bool>,
309}
310
311impl common::ResponseResult for AchievementIncrementResponse {}
312
313/// An achievement reveal response
314///
315/// # Activities
316///
317/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
318/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
319///
320/// * [reveal achievements](AchievementRevealCall) (response)
321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
322#[serde_with::serde_as]
323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
324pub struct AchievementRevealResponse {
325 /// The current state of the achievement for which a reveal was attempted. This might be `UNLOCKED` if the achievement was already unlocked.
326 #[serde(rename = "currentState")]
327 pub current_state: Option<String>,
328 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementRevealResponse`.
329 pub kind: Option<String>,
330}
331
332impl common::ResponseResult for AchievementRevealResponse {}
333
334/// An achievement set steps at least response.
335///
336/// # Activities
337///
338/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
339/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
340///
341/// * [set steps at least achievements](AchievementSetStepsAtLeastCall) (response)
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct AchievementSetStepsAtLeastResponse {
346 /// The current steps recorded for this incremental achievement.
347 #[serde(rename = "currentSteps")]
348 pub current_steps: Option<i32>,
349 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementSetStepsAtLeastResponse`.
350 pub kind: Option<String>,
351 /// Whether the current steps for the achievement has reached the number of steps required to unlock.
352 #[serde(rename = "newlyUnlocked")]
353 pub newly_unlocked: Option<bool>,
354}
355
356impl common::ResponseResult for AchievementSetStepsAtLeastResponse {}
357
358/// An achievement unlock response
359///
360/// # Activities
361///
362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
364///
365/// * [unlock achievements](AchievementUnlockCall) (response)
366#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
367#[serde_with::serde_as]
368#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
369pub struct AchievementUnlockResponse {
370 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUnlockResponse`.
371 pub kind: Option<String>,
372 /// Whether this achievement was newly unlocked (that is, whether the unlock request for the achievement was the first for the player).
373 #[serde(rename = "newlyUnlocked")]
374 pub newly_unlocked: Option<bool>,
375}
376
377impl common::ResponseResult for AchievementUnlockResponse {}
378
379/// A list of achievement update requests.
380///
381/// # Activities
382///
383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
385///
386/// * [update multiple achievements](AchievementUpdateMultipleCall) (request)
387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
388#[serde_with::serde_as]
389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct AchievementUpdateMultipleRequest {
391 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUpdateMultipleRequest`.
392 pub kind: Option<String>,
393 /// The individual achievement update requests.
394 pub updates: Option<Vec<AchievementUpdateRequest>>,
395}
396
397impl common::RequestValue for AchievementUpdateMultipleRequest {}
398
399/// Response message for UpdateMultipleAchievements rpc.
400///
401/// # Activities
402///
403/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
404/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
405///
406/// * [update multiple achievements](AchievementUpdateMultipleCall) (response)
407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
408#[serde_with::serde_as]
409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
410pub struct AchievementUpdateMultipleResponse {
411 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUpdateMultipleResponse`.
412 pub kind: Option<String>,
413 /// The updated state of the achievements.
414 #[serde(rename = "updatedAchievements")]
415 pub updated_achievements: Option<Vec<AchievementUpdateResponse>>,
416}
417
418impl common::ResponseResult for AchievementUpdateMultipleResponse {}
419
420/// A request to update an achievement.
421///
422/// This type is not used in any activity, and only used as *part* of another schema.
423///
424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
425#[serde_with::serde_as]
426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
427pub struct AchievementUpdateRequest {
428 /// The achievement this update is being applied to.
429 #[serde(rename = "achievementId")]
430 pub achievement_id: Option<String>,
431 /// The payload if an update of type `INCREMENT` was requested for the achievement.
432 #[serde(rename = "incrementPayload")]
433 pub increment_payload: Option<GamesAchievementIncrement>,
434 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUpdateRequest`.
435 pub kind: Option<String>,
436 /// The payload if an update of type `SET_STEPS_AT_LEAST` was requested for the achievement.
437 #[serde(rename = "setStepsAtLeastPayload")]
438 pub set_steps_at_least_payload: Option<GamesAchievementSetStepsAtLeast>,
439 /// The type of update being applied.
440 #[serde(rename = "updateType")]
441 pub update_type: Option<String>,
442}
443
444impl common::Part for AchievementUpdateRequest {}
445
446/// An updated achievement.
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 AchievementUpdateResponse {
454 /// The achievement this update is was applied to.
455 #[serde(rename = "achievementId")]
456 pub achievement_id: Option<String>,
457 /// The current state of the achievement.
458 #[serde(rename = "currentState")]
459 pub current_state: Option<String>,
460 /// The current steps recorded for this achievement if it is incremental.
461 #[serde(rename = "currentSteps")]
462 pub current_steps: Option<i32>,
463 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUpdateResponse`.
464 pub kind: Option<String>,
465 /// Whether this achievement was newly unlocked (that is, whether the unlock request for the achievement was the first for the player).
466 #[serde(rename = "newlyUnlocked")]
467 pub newly_unlocked: Option<bool>,
468 /// Whether the requested updates actually affected the achievement.
469 #[serde(rename = "updateOccurred")]
470 pub update_occurred: Option<bool>,
471}
472
473impl common::Part for AchievementUpdateResponse {}
474
475/// The Application resource.
476///
477/// # Activities
478///
479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
481///
482/// * [get applications](ApplicationGetCall) (response)
483/// * [get end point applications](ApplicationGetEndPointCall) (none)
484/// * [played applications](ApplicationPlayedCall) (none)
485/// * [verify applications](ApplicationVerifyCall) (none)
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct Application {
490 /// The number of achievements visible to the currently authenticated player.
491 pub achievement_count: Option<i32>,
492 /// The assets of the application.
493 pub assets: Option<Vec<ImageAsset>>,
494 /// The author of the application.
495 pub author: Option<String>,
496 /// The category of the application.
497 pub category: Option<ApplicationCategory>,
498 /// The description of the application.
499 pub description: Option<String>,
500 /// A list of features that have been enabled for the application.
501 #[serde(rename = "enabledFeatures")]
502 pub enabled_features: Option<Vec<String>>,
503 /// The ID of the application.
504 pub id: Option<String>,
505 /// The instances of the application.
506 pub instances: Option<Vec<Instance>>,
507 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#application`.
508 pub kind: Option<String>,
509 /// The last updated timestamp of the application.
510 #[serde(rename = "lastUpdatedTimestamp")]
511 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
512 pub last_updated_timestamp: Option<i64>,
513 /// The number of leaderboards visible to the currently authenticated player.
514 pub leaderboard_count: Option<i32>,
515 /// The name of the application.
516 pub name: Option<String>,
517 /// A hint to the client UI for what color to use as an app-themed color. The color is given as an RGB triplet (e.g. "E0E0E0").
518 #[serde(rename = "themeColor")]
519 pub theme_color: Option<String>,
520}
521
522impl common::Resource for Application {}
523impl common::ResponseResult for Application {}
524
525/// An application category object.
526///
527/// This type is not used in any activity, and only used as *part* of another schema.
528///
529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
530#[serde_with::serde_as]
531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
532pub struct ApplicationCategory {
533 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#applicationCategory`.
534 pub kind: Option<String>,
535 /// The primary category.
536 pub primary: Option<String>,
537 /// The secondary category.
538 pub secondary: Option<String>,
539}
540
541impl common::Part for ApplicationCategory {}
542
543/// Primary scoped player identifier for an application.
544///
545/// This type is not used in any activity, and only used as *part* of another schema.
546///
547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
548#[serde_with::serde_as]
549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
550pub struct ApplicationPlayerId {
551 /// The application that this player identifier is for.
552 #[serde(rename = "applicationId")]
553 pub application_id: Option<String>,
554 /// The player identifier for the application.
555 #[serde(rename = "playerId")]
556 pub player_id: Option<String>,
557}
558
559impl common::Part for ApplicationPlayerId {}
560
561/// A third party application verification response resource.
562///
563/// # Activities
564///
565/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
566/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
567///
568/// * [verify applications](ApplicationVerifyCall) (response)
569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
570#[serde_with::serde_as]
571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
572pub struct ApplicationVerifyResponse {
573 /// An alternate ID that was once used for the player that was issued the auth token used in this request. (This field is not normally populated.)
574 pub alternate_player_id: Option<String>,
575 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#applicationVerifyResponse`.
576 pub kind: Option<String>,
577 /// The ID of the player that was issued the auth token used in this request.
578 pub player_id: Option<String>,
579}
580
581impl common::ResponseResult for ApplicationVerifyResponse {}
582
583/// Data related to individual game categories.
584///
585/// This type is not used in any activity, and only used as *part* of another schema.
586///
587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
588#[serde_with::serde_as]
589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
590pub struct Category {
591 /// The category name.
592 pub category: Option<String>,
593 /// Experience points earned in this category.
594 #[serde(rename = "experiencePoints")]
595 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
596 pub experience_points: Option<i64>,
597 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#category`.
598 pub kind: Option<String>,
599}
600
601impl common::Part for Category {}
602
603/// A third party list metagame categories response.
604///
605/// # Activities
606///
607/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
608/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
609///
610/// * [list categories by player metagame](MetagameListCategoriesByPlayerCall) (response)
611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
612#[serde_with::serde_as]
613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
614pub struct CategoryListResponse {
615 /// The list of categories with usage data.
616 pub items: Option<Vec<Category>>,
617 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#categoryListResponse`.
618 pub kind: Option<String>,
619 /// Token corresponding to the next page of results.
620 #[serde(rename = "nextPageToken")]
621 pub next_page_token: Option<String>,
622}
623
624impl common::ResponseResult for CategoryListResponse {}
625
626/// Container for a URL end point of the requested type.
627///
628/// # Activities
629///
630/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
631/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
632///
633/// * [get end point applications](ApplicationGetEndPointCall) (response)
634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
635#[serde_with::serde_as]
636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
637pub struct EndPoint {
638 /// A URL suitable for loading in a web browser for the requested endpoint.
639 pub url: Option<String>,
640}
641
642impl common::ResponseResult for EndPoint {}
643
644/// A batch update failure resource.
645///
646/// This type is not used in any activity, and only used as *part* of another schema.
647///
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct EventBatchRecordFailure {
652 /// The cause for the update failure.
653 #[serde(rename = "failureCause")]
654 pub failure_cause: Option<String>,
655 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventBatchRecordFailure`.
656 pub kind: Option<String>,
657 /// The time range which was rejected; empty for a request-wide failure.
658 pub range: Option<EventPeriodRange>,
659}
660
661impl common::Part for EventBatchRecordFailure {}
662
663/// An event child relationship resource.
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 EventChild {
671 /// The ID of the child event.
672 #[serde(rename = "childId")]
673 pub child_id: Option<String>,
674 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventChild`.
675 pub kind: Option<String>,
676}
677
678impl common::Part for EventChild {}
679
680/// An event definition resource.
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct EventDefinition {
688 /// A list of events that are a child of this event.
689 #[serde(rename = "childEvents")]
690 pub child_events: Option<Vec<EventChild>>,
691 /// Description of what this event represents.
692 pub description: Option<String>,
693 /// The name to display for the event.
694 #[serde(rename = "displayName")]
695 pub display_name: Option<String>,
696 /// The ID of the event.
697 pub id: Option<String>,
698 /// The base URL for the image that represents the event.
699 #[serde(rename = "imageUrl")]
700 pub image_url: Option<String>,
701 /// Indicates whether the icon image being returned is a default image, or is game-provided.
702 #[serde(rename = "isDefaultImageUrl")]
703 pub is_default_image_url: Option<bool>,
704 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventDefinition`.
705 pub kind: Option<String>,
706 /// The visibility of event being tracked in this definition.
707 pub visibility: Option<String>,
708}
709
710impl common::Part for EventDefinition {}
711
712/// A ListDefinitions response.
713///
714/// # Activities
715///
716/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
717/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
718///
719/// * [list definitions events](EventListDefinitionCall) (response)
720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
721#[serde_with::serde_as]
722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
723pub struct EventDefinitionListResponse {
724 /// The event definitions.
725 pub items: Option<Vec<EventDefinition>>,
726 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventDefinitionListResponse`.
727 pub kind: Option<String>,
728 /// The pagination token for the next page of results.
729 #[serde(rename = "nextPageToken")]
730 pub next_page_token: Option<String>,
731}
732
733impl common::ResponseResult for EventDefinitionListResponse {}
734
735/// An event period time range.
736///
737/// This type is not used in any activity, and only used as *part* of another schema.
738///
739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
740#[serde_with::serde_as]
741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct EventPeriodRange {
743 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventPeriodRange`.
744 pub kind: Option<String>,
745 /// The time when this update period ends, in millis, since 1970 UTC (Unix Epoch).
746 #[serde(rename = "periodEndMillis")]
747 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
748 pub period_end_millis: Option<i64>,
749 /// The time when this update period begins, in millis, since 1970 UTC (Unix Epoch).
750 #[serde(rename = "periodStartMillis")]
751 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
752 pub period_start_millis: Option<i64>,
753}
754
755impl common::Part for EventPeriodRange {}
756
757/// An event period update resource.
758///
759/// This type is not used in any activity, and only used as *part* of another schema.
760///
761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
762#[serde_with::serde_as]
763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
764pub struct EventPeriodUpdate {
765 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventPeriodUpdate`.
766 pub kind: Option<String>,
767 /// The time period being covered by this update.
768 #[serde(rename = "timePeriod")]
769 pub time_period: Option<EventPeriodRange>,
770 /// The updates being made for this time period.
771 pub updates: Option<Vec<EventUpdateRequest>>,
772}
773
774impl common::Part for EventPeriodUpdate {}
775
776/// An event update failure resource.
777///
778/// This type is not used in any activity, and only used as *part* of another schema.
779///
780#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
781#[serde_with::serde_as]
782#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
783pub struct EventRecordFailure {
784 /// The ID of the event that was not updated.
785 #[serde(rename = "eventId")]
786 pub event_id: Option<String>,
787 /// The cause for the update failure.
788 #[serde(rename = "failureCause")]
789 pub failure_cause: Option<String>,
790 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventRecordFailure`.
791 pub kind: Option<String>,
792}
793
794impl common::Part for EventRecordFailure {}
795
796/// An event period update resource.
797///
798/// # Activities
799///
800/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
801/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
802///
803/// * [record events](EventRecordCall) (request)
804#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
805#[serde_with::serde_as]
806#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
807pub struct EventRecordRequest {
808 /// The current time when this update was sent, in milliseconds, since 1970 UTC (Unix Epoch).
809 #[serde(rename = "currentTimeMillis")]
810 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
811 pub current_time_millis: Option<i64>,
812 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventRecordRequest`.
813 pub kind: Option<String>,
814 /// The request ID used to identify this attempt to record events.
815 #[serde(rename = "requestId")]
816 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
817 pub request_id: Option<i64>,
818 /// A list of the time period updates being made in this request.
819 #[serde(rename = "timePeriods")]
820 pub time_periods: Option<Vec<EventPeriodUpdate>>,
821}
822
823impl common::RequestValue for EventRecordRequest {}
824
825/// An event period update resource.
826///
827/// This type is not used in any activity, and only used as *part* of another schema.
828///
829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
830#[serde_with::serde_as]
831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
832pub struct EventUpdateRequest {
833 /// The ID of the event being modified in this update.
834 #[serde(rename = "definitionId")]
835 pub definition_id: Option<String>,
836 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventUpdateRequest`.
837 pub kind: Option<String>,
838 /// The number of times this event occurred in this time period.
839 #[serde(rename = "updateCount")]
840 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
841 pub update_count: Option<i64>,
842}
843
844impl common::Part for EventUpdateRequest {}
845
846/// An event period update resource.
847///
848/// # Activities
849///
850/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
851/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
852///
853/// * [record events](EventRecordCall) (response)
854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
855#[serde_with::serde_as]
856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
857pub struct EventUpdateResponse {
858 /// Any batch-wide failures which occurred applying updates.
859 #[serde(rename = "batchFailures")]
860 pub batch_failures: Option<Vec<EventBatchRecordFailure>>,
861 /// Any failures updating a particular event.
862 #[serde(rename = "eventFailures")]
863 pub event_failures: Option<Vec<EventRecordFailure>>,
864 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#eventUpdateResponse`.
865 pub kind: Option<String>,
866 /// The current status of any updated events
867 #[serde(rename = "playerEvents")]
868 pub player_events: Option<Vec<PlayerEvent>>,
869}
870
871impl common::ResponseResult for EventUpdateResponse {}
872
873/// Recall tokens for a game.
874///
875/// This type is not used in any activity, and only used as *part* of another schema.
876///
877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
878#[serde_with::serde_as]
879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
880pub struct GamePlayerToken {
881 /// The application that this player identifier is for.
882 #[serde(rename = "applicationId")]
883 pub application_id: Option<String>,
884 /// Recall token data.
885 #[serde(rename = "recallToken")]
886 pub recall_token: Option<RecallToken>,
887}
888
889impl common::Part for GamePlayerToken {}
890
891/// The payload to request to increment an achievement.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct GamesAchievementIncrement {
899 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#GamesAchievementIncrement`.
900 pub kind: Option<String>,
901 /// The requestId associated with an increment to an achievement.
902 #[serde(rename = "requestId")]
903 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
904 pub request_id: Option<i64>,
905 /// The number of steps to be incremented.
906 pub steps: Option<i32>,
907}
908
909impl common::Part for GamesAchievementIncrement {}
910
911/// The payload to request to increment an achievement.
912///
913/// This type is not used in any activity, and only used as *part* of another schema.
914///
915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
916#[serde_with::serde_as]
917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
918pub struct GamesAchievementSetStepsAtLeast {
919 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#GamesAchievementSetStepsAtLeast`.
920 pub kind: Option<String>,
921 /// The minimum number of steps for the achievement to be set to.
922 pub steps: Option<i32>,
923}
924
925impl common::Part for GamesAchievementSetStepsAtLeast {}
926
927/// Response for the GeneratePlayGroupingApiToken RPC.
928///
929/// # Activities
930///
931/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
932/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
933///
934/// * [generate play grouping api token accesstokens](AccesstokenGeneratePlayGroupingApiTokenCall) (response)
935#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
936#[serde_with::serde_as]
937#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
938pub struct GeneratePlayGroupingApiTokenResponse {
939 /// Token for accessing the Play Grouping API.
940 pub token: Option<PlayGroupingApiToken>,
941}
942
943impl common::ResponseResult for GeneratePlayGroupingApiTokenResponse {}
944
945/// Response for the GenerateRecallPlayGroupingApiToken RPC.
946///
947/// # Activities
948///
949/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
950/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
951///
952/// * [generate recall play grouping api token accesstokens](AccesstokenGenerateRecallPlayGroupingApiTokenCall) (response)
953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
954#[serde_with::serde_as]
955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
956pub struct GenerateRecallPlayGroupingApiTokenResponse {
957 /// Token for accessing the Play Grouping API.
958 pub token: Option<PlayGroupingApiToken>,
959}
960
961impl common::ResponseResult for GenerateRecallPlayGroupingApiTokenResponse {}
962
963/// Response message for GetMultipleApplicationPlayerIds rpc.
964///
965/// # Activities
966///
967/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
968/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
969///
970/// * [get multiple application player ids players](PlayerGetMultipleApplicationPlayerIdCall) (response)
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct GetMultipleApplicationPlayerIdsResponse {
975 /// Output only. The requested applications along with the scoped ids for tha player, if that player has an id for the application. If not, the application is not included in the response.
976 #[serde(rename = "playerIds")]
977 pub player_ids: Option<Vec<ApplicationPlayerId>>,
978}
979
980impl common::ResponseResult for GetMultipleApplicationPlayerIdsResponse {}
981
982/// An image asset object.
983///
984/// This type is not used in any activity, and only used as *part* of another schema.
985///
986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
987#[serde_with::serde_as]
988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
989pub struct ImageAsset {
990 /// The height of the asset.
991 pub height: Option<i32>,
992 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#imageAsset`.
993 pub kind: Option<String>,
994 /// The name of the asset.
995 pub name: Option<String>,
996 /// The URL of the asset.
997 pub url: Option<String>,
998 /// The width of the asset.
999 pub width: Option<i32>,
1000}
1001
1002impl common::Part for ImageAsset {}
1003
1004/// The Instance resource.
1005///
1006/// This type is not used in any activity, and only used as *part* of another schema.
1007///
1008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1009#[serde_with::serde_as]
1010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1011pub struct Instance {
1012 /// URI which shows where a user can acquire this instance.
1013 #[serde(rename = "acquisitionUri")]
1014 pub acquisition_uri: Option<String>,
1015 /// Platform dependent details for Android.
1016 #[serde(rename = "androidInstance")]
1017 pub android_instance: Option<InstanceAndroidDetails>,
1018 /// Platform dependent details for iOS.
1019 #[serde(rename = "iosInstance")]
1020 pub ios_instance: Option<InstanceIosDetails>,
1021 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#instance`.
1022 pub kind: Option<String>,
1023 /// Localized display name.
1024 pub name: Option<String>,
1025 /// The platform type.
1026 #[serde(rename = "platformType")]
1027 pub platform_type: Option<String>,
1028 /// Flag to show if this game instance supports realtime play.
1029 #[serde(rename = "realtimePlay")]
1030 pub realtime_play: Option<bool>,
1031 /// Flag to show if this game instance supports turn based play.
1032 #[serde(rename = "turnBasedPlay")]
1033 pub turn_based_play: Option<bool>,
1034 /// Platform dependent details for Web.
1035 #[serde(rename = "webInstance")]
1036 pub web_instance: Option<InstanceWebDetails>,
1037}
1038
1039impl common::Part for Instance {}
1040
1041/// The Android instance details resource.
1042///
1043/// This type is not used in any activity, and only used as *part* of another schema.
1044///
1045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1046#[serde_with::serde_as]
1047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1048pub struct InstanceAndroidDetails {
1049 /// Flag indicating whether the anti-piracy check is enabled.
1050 #[serde(rename = "enablePiracyCheck")]
1051 pub enable_piracy_check: Option<bool>,
1052 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#instanceAndroidDetails`.
1053 pub kind: Option<String>,
1054 /// Android package name which maps to Google Play URL.
1055 #[serde(rename = "packageName")]
1056 pub package_name: Option<String>,
1057 /// Indicates that this instance is the default for new installations.
1058 pub preferred: Option<bool>,
1059}
1060
1061impl common::Part for InstanceAndroidDetails {}
1062
1063/// The iOS details resource.
1064///
1065/// This type is not used in any activity, and only used as *part* of another schema.
1066///
1067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1068#[serde_with::serde_as]
1069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1070pub struct InstanceIosDetails {
1071 /// Bundle identifier.
1072 #[serde(rename = "bundleIdentifier")]
1073 pub bundle_identifier: Option<String>,
1074 /// iTunes App ID.
1075 #[serde(rename = "itunesAppId")]
1076 pub itunes_app_id: Option<String>,
1077 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#instanceIosDetails`.
1078 pub kind: Option<String>,
1079 /// Indicates that this instance is the default for new installations on iPad devices.
1080 #[serde(rename = "preferredForIpad")]
1081 pub preferred_for_ipad: Option<bool>,
1082 /// Indicates that this instance is the default for new installations on iPhone devices.
1083 #[serde(rename = "preferredForIphone")]
1084 pub preferred_for_iphone: Option<bool>,
1085 /// Flag to indicate if this instance supports iPad.
1086 #[serde(rename = "supportIpad")]
1087 pub support_ipad: Option<bool>,
1088 /// Flag to indicate if this instance supports iPhone.
1089 #[serde(rename = "supportIphone")]
1090 pub support_iphone: Option<bool>,
1091}
1092
1093impl common::Part for InstanceIosDetails {}
1094
1095/// The Web details resource.
1096///
1097/// This type is not used in any activity, and only used as *part* of another schema.
1098///
1099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1100#[serde_with::serde_as]
1101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1102pub struct InstanceWebDetails {
1103 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#instanceWebDetails`.
1104 pub kind: Option<String>,
1105 /// Launch URL for the game.
1106 #[serde(rename = "launchUrl")]
1107 pub launch_url: Option<String>,
1108 /// Indicates that this instance is the default for new installations.
1109 pub preferred: Option<bool>,
1110}
1111
1112impl common::Part for InstanceWebDetails {}
1113
1114/// The Leaderboard resource.
1115///
1116/// # Activities
1117///
1118/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1119/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1120///
1121/// * [get leaderboards](LeaderboardGetCall) (response)
1122/// * [list leaderboards](LeaderboardListCall) (none)
1123#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1124#[serde_with::serde_as]
1125#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1126pub struct Leaderboard {
1127 /// The icon for the leaderboard.
1128 #[serde(rename = "iconUrl")]
1129 pub icon_url: Option<String>,
1130 /// The leaderboard ID.
1131 pub id: Option<String>,
1132 /// Indicates whether the icon image being returned is a default image, or is game-provided.
1133 #[serde(rename = "isIconUrlDefault")]
1134 pub is_icon_url_default: Option<bool>,
1135 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#leaderboard`.
1136 pub kind: Option<String>,
1137 /// The name of the leaderboard.
1138 pub name: Option<String>,
1139 /// How scores are ordered.
1140 pub order: Option<String>,
1141}
1142
1143impl common::Resource for Leaderboard {}
1144impl common::ResponseResult for Leaderboard {}
1145
1146/// The Leaderboard Entry resource.
1147///
1148/// This type is not used in any activity, and only used as *part* of another schema.
1149///
1150#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1151#[serde_with::serde_as]
1152#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1153pub struct LeaderboardEntry {
1154 /// The localized string for the numerical value of this score.
1155 #[serde(rename = "formattedScore")]
1156 pub formatted_score: Option<String>,
1157 /// The localized string for the rank of this score for this leaderboard.
1158 #[serde(rename = "formattedScoreRank")]
1159 pub formatted_score_rank: Option<String>,
1160 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#leaderboardEntry`.
1161 pub kind: Option<String>,
1162 /// The player who holds this score.
1163 pub player: Option<Player>,
1164 /// The rank of this score for this leaderboard.
1165 #[serde(rename = "scoreRank")]
1166 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1167 pub score_rank: Option<i64>,
1168 /// Additional information about the score. Values must contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
1169 #[serde(rename = "scoreTag")]
1170 pub score_tag: Option<String>,
1171 /// The numerical value of this score.
1172 #[serde(rename = "scoreValue")]
1173 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1174 pub score_value: Option<i64>,
1175 /// The time span of this high score.
1176 #[serde(rename = "timeSpan")]
1177 pub time_span: Option<String>,
1178 /// The timestamp at which this score was recorded, in milliseconds since the epoch in UTC.
1179 #[serde(rename = "writeTimestampMillis")]
1180 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1181 pub write_timestamp_millis: Option<i64>,
1182}
1183
1184impl common::Part for LeaderboardEntry {}
1185
1186/// A list of leaderboard objects.
1187///
1188/// # Activities
1189///
1190/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1191/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1192///
1193/// * [list leaderboards](LeaderboardListCall) (response)
1194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1195#[serde_with::serde_as]
1196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1197pub struct LeaderboardListResponse {
1198 /// The leaderboards.
1199 pub items: Option<Vec<Leaderboard>>,
1200 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#leaderboardListResponse`.
1201 pub kind: Option<String>,
1202 /// Token corresponding to the next page of results.
1203 #[serde(rename = "nextPageToken")]
1204 pub next_page_token: Option<String>,
1205}
1206
1207impl common::ResponseResult for LeaderboardListResponse {}
1208
1209/// A score rank in a leaderboard.
1210///
1211/// This type is not used in any activity, and only used as *part* of another schema.
1212///
1213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1214#[serde_with::serde_as]
1215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1216pub struct LeaderboardScoreRank {
1217 /// The number of scores in the leaderboard as a string.
1218 #[serde(rename = "formattedNumScores")]
1219 pub formatted_num_scores: Option<String>,
1220 /// The rank in the leaderboard as a string.
1221 #[serde(rename = "formattedRank")]
1222 pub formatted_rank: Option<String>,
1223 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#leaderboardScoreRank`.
1224 pub kind: Option<String>,
1225 /// The number of scores in the leaderboard.
1226 #[serde(rename = "numScores")]
1227 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1228 pub num_scores: Option<i64>,
1229 /// The rank in the leaderboard.
1230 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1231 pub rank: Option<i64>,
1232}
1233
1234impl common::Part for LeaderboardScoreRank {}
1235
1236/// A ListScores response.
1237///
1238/// # Activities
1239///
1240/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1241/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1242///
1243/// * [list scores](ScoreListCall) (response)
1244/// * [list window scores](ScoreListWindowCall) (response)
1245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1246#[serde_with::serde_as]
1247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1248pub struct LeaderboardScores {
1249 /// The scores in the leaderboard.
1250 pub items: Option<Vec<LeaderboardEntry>>,
1251 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#leaderboardScores`.
1252 pub kind: Option<String>,
1253 /// The pagination token for the next page of results.
1254 #[serde(rename = "nextPageToken")]
1255 pub next_page_token: Option<String>,
1256 /// The total number of scores in the leaderboard.
1257 #[serde(rename = "numScores")]
1258 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1259 pub num_scores: Option<i64>,
1260 /// The score of the requesting player on the leaderboard. The player's score may appear both here and in the list of scores above. If you are viewing a public leaderboard and the player is not sharing their gameplay information publicly, the `scoreRank`and `formattedScoreRank` values will not be present.
1261 #[serde(rename = "playerScore")]
1262 pub player_score: Option<LeaderboardEntry>,
1263 /// The pagination token for the previous page of results.
1264 #[serde(rename = "prevPageToken")]
1265 pub prev_page_token: Option<String>,
1266}
1267
1268impl common::ResponseResult for LeaderboardScores {}
1269
1270/// Request to link an in-game account with a PGS principal (encoded in the session id).
1271///
1272/// # Activities
1273///
1274/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1275/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1276///
1277/// * [link persona recall](RecallLinkPersonaCall) (request)
1278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1279#[serde_with::serde_as]
1280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1281pub struct LinkPersonaRequest {
1282 /// Required. Cardinality constraint to observe when linking a persona to a player in the scope of a game.
1283 #[serde(rename = "cardinalityConstraint")]
1284 pub cardinality_constraint: Option<String>,
1285 /// Required. Resolution policy to apply when the linking of a persona to a player would result in violating the specified cardinality constraint.
1286 #[serde(rename = "conflictingLinksResolutionPolicy")]
1287 pub conflicting_links_resolution_policy: Option<String>,
1288 /// Input only. Optional expiration time.
1289 #[serde(rename = "expireTime")]
1290 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1291 /// Required. Stable identifier of the in-game account. Please refrain from re-using the same persona for different games.
1292 pub persona: Option<String>,
1293 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
1294 #[serde(rename = "sessionId")]
1295 pub session_id: Option<String>,
1296 /// Required. Value of the token to create. Opaque to Play Games and assumed to be non-stable (encrypted with key rotation).
1297 pub token: Option<String>,
1298 /// Input only. Optional time-to-live.
1299 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1300 pub ttl: Option<chrono::Duration>,
1301}
1302
1303impl common::RequestValue for LinkPersonaRequest {}
1304
1305/// Outcome of a persona linking attempt.
1306///
1307/// # Activities
1308///
1309/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1310/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1311///
1312/// * [link persona recall](RecallLinkPersonaCall) (response)
1313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1314#[serde_with::serde_as]
1315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1316pub struct LinkPersonaResponse {
1317 /// Output only. State of a persona linking attempt.
1318 pub state: Option<String>,
1319}
1320
1321impl common::ResponseResult for LinkPersonaResponse {}
1322
1323/// The metagame config resource
1324///
1325/// # Activities
1326///
1327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1329///
1330/// * [get metagame config metagame](MetagameGetMetagameConfigCall) (response)
1331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1332#[serde_with::serde_as]
1333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1334pub struct MetagameConfig {
1335 /// Current version of the metagame configuration data. When this data is updated, the version number will be increased by one.
1336 #[serde(rename = "currentVersion")]
1337 pub current_version: Option<i32>,
1338 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#metagameConfig`.
1339 pub kind: Option<String>,
1340 /// The list of player levels.
1341 #[serde(rename = "playerLevels")]
1342 pub player_levels: Option<Vec<PlayerLevel>>,
1343}
1344
1345impl common::ResponseResult for MetagameConfig {}
1346
1347/// Token data returned from GeneratePlayGroupingApiToken RPC.
1348///
1349/// This type is not used in any activity, and only used as *part* of another schema.
1350///
1351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1352#[serde_with::serde_as]
1353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1354pub struct PlayGroupingApiToken {
1355 /// Value of the token.
1356 #[serde(rename = "tokenValue")]
1357 pub token_value: Option<String>,
1358}
1359
1360impl common::Part for PlayGroupingApiToken {}
1361
1362/// A Player resource.
1363///
1364/// # Activities
1365///
1366/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1367/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1368///
1369/// * [get players](PlayerGetCall) (response)
1370/// * [get multiple application player ids players](PlayerGetMultipleApplicationPlayerIdCall) (none)
1371/// * [get scoped player ids players](PlayerGetScopedPlayerIdCall) (none)
1372/// * [list players](PlayerListCall) (none)
1373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1374#[serde_with::serde_as]
1375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1376pub struct Player {
1377 /// The base URL for the image that represents the player.
1378 #[serde(rename = "avatarImageUrl")]
1379 pub avatar_image_url: Option<String>,
1380 /// The url to the landscape mode player banner image.
1381 #[serde(rename = "bannerUrlLandscape")]
1382 pub banner_url_landscape: Option<String>,
1383 /// The url to the portrait mode player banner image.
1384 #[serde(rename = "bannerUrlPortrait")]
1385 pub banner_url_portrait: Option<String>,
1386 /// The name to display for the player.
1387 #[serde(rename = "displayName")]
1388 pub display_name: Option<String>,
1389 /// An object to represent Play Game experience information for the player.
1390 #[serde(rename = "experienceInfo")]
1391 pub experience_info: Option<PlayerExperienceInfo>,
1392 /// The friend status of the given player, relative to the requester. This is unset if the player is not sharing their friends list with the game.
1393 #[serde(rename = "friendStatus")]
1394 pub friend_status: Option<String>,
1395 /// Per-application unique player identifier.
1396 #[serde(rename = "gamePlayerId")]
1397 pub game_player_id: Option<String>,
1398 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#player`
1399 pub kind: Option<String>,
1400 /// A representation of the individual components of the name.
1401 pub name: Option<PlayerName>,
1402 /// The player ID that was used for this player the first time they signed into the game in question. This is only populated for calls to player.get for the requesting player, only if the player ID has subsequently changed, and only to clients that support remapping player IDs.
1403 #[serde(rename = "originalPlayerId")]
1404 pub original_player_id: Option<String>,
1405 /// The ID of the player.
1406 #[serde(rename = "playerId")]
1407 pub player_id: Option<String>,
1408 /// The player's profile settings. Controls whether or not the player's profile is visible to other players.
1409 #[serde(rename = "profileSettings")]
1410 pub profile_settings: Option<ProfileSettings>,
1411 /// The player's title rewarded for their game activities.
1412 pub title: Option<String>,
1413}
1414
1415impl common::Resource for Player {}
1416impl common::ResponseResult for Player {}
1417
1418/// An achievement object.
1419///
1420/// This type is not used in any activity, and only used as *part* of another schema.
1421///
1422#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1423#[serde_with::serde_as]
1424#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1425pub struct PlayerAchievement {
1426 /// The state of the achievement.
1427 #[serde(rename = "achievementState")]
1428 pub achievement_state: Option<String>,
1429 /// The current steps for an incremental achievement.
1430 #[serde(rename = "currentSteps")]
1431 pub current_steps: Option<i32>,
1432 /// Experience points earned for the achievement. This field is absent for achievements that have not yet been unlocked and 0 for achievements that have been unlocked by testers but that are unpublished.
1433 #[serde(rename = "experiencePoints")]
1434 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1435 pub experience_points: Option<i64>,
1436 /// The current steps for an incremental achievement as a string.
1437 #[serde(rename = "formattedCurrentStepsString")]
1438 pub formatted_current_steps_string: Option<String>,
1439 /// The ID of the achievement.
1440 pub id: Option<String>,
1441 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerAchievement`.
1442 pub kind: Option<String>,
1443 /// The timestamp of the last modification to this achievement's state.
1444 #[serde(rename = "lastUpdatedTimestamp")]
1445 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1446 pub last_updated_timestamp: Option<i64>,
1447}
1448
1449impl common::Part for PlayerAchievement {}
1450
1451/// A list of achievement objects.
1452///
1453/// # Activities
1454///
1455/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1457///
1458/// * [list achievements](AchievementListCall) (response)
1459#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1460#[serde_with::serde_as]
1461#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1462pub struct PlayerAchievementListResponse {
1463 /// The achievements.
1464 pub items: Option<Vec<PlayerAchievement>>,
1465 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerAchievementListResponse`.
1466 pub kind: Option<String>,
1467 /// Token corresponding to the next page of results.
1468 #[serde(rename = "nextPageToken")]
1469 pub next_page_token: Option<String>,
1470}
1471
1472impl common::ResponseResult for PlayerAchievementListResponse {}
1473
1474/// An event status resource.
1475///
1476/// This type is not used in any activity, and only used as *part* of another schema.
1477///
1478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1479#[serde_with::serde_as]
1480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1481pub struct PlayerEvent {
1482 /// The ID of the event definition.
1483 #[serde(rename = "definitionId")]
1484 pub definition_id: Option<String>,
1485 /// The current number of times this event has occurred, as a string. The formatting of this string depends on the configuration of your event in the Play Games Developer Console.
1486 #[serde(rename = "formattedNumEvents")]
1487 pub formatted_num_events: Option<String>,
1488 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerEvent`.
1489 pub kind: Option<String>,
1490 /// The current number of times this event has occurred.
1491 #[serde(rename = "numEvents")]
1492 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1493 pub num_events: Option<i64>,
1494 /// The ID of the player.
1495 #[serde(rename = "playerId")]
1496 pub player_id: Option<String>,
1497}
1498
1499impl common::Part for PlayerEvent {}
1500
1501/// A ListByPlayer response.
1502///
1503/// # Activities
1504///
1505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1507///
1508/// * [list by player events](EventListByPlayerCall) (response)
1509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1510#[serde_with::serde_as]
1511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1512pub struct PlayerEventListResponse {
1513 /// The player events.
1514 pub items: Option<Vec<PlayerEvent>>,
1515 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerEventListResponse`.
1516 pub kind: Option<String>,
1517 /// The pagination token for the next page of results.
1518 #[serde(rename = "nextPageToken")]
1519 pub next_page_token: Option<String>,
1520}
1521
1522impl common::ResponseResult for PlayerEventListResponse {}
1523
1524/// 1P/3P metadata about the player's experience.
1525///
1526/// This type is not used in any activity, and only used as *part* of another schema.
1527///
1528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1529#[serde_with::serde_as]
1530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1531pub struct PlayerExperienceInfo {
1532 /// The current number of experience points for the player.
1533 #[serde(rename = "currentExperiencePoints")]
1534 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1535 pub current_experience_points: Option<i64>,
1536 /// The current level of the player.
1537 #[serde(rename = "currentLevel")]
1538 pub current_level: Option<PlayerLevel>,
1539 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerExperienceInfo`.
1540 pub kind: Option<String>,
1541 /// The timestamp when the player was leveled up, in millis since Unix epoch UTC.
1542 #[serde(rename = "lastLevelUpTimestampMillis")]
1543 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1544 pub last_level_up_timestamp_millis: Option<i64>,
1545 /// The next level of the player. If the current level is the maximum level, this should be same as the current level.
1546 #[serde(rename = "nextLevel")]
1547 pub next_level: Option<PlayerLevel>,
1548}
1549
1550impl common::Part for PlayerExperienceInfo {}
1551
1552/// A player leaderboard score object.
1553///
1554/// This type is not used in any activity, and only used as *part* of another schema.
1555///
1556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1557#[serde_with::serde_as]
1558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1559pub struct PlayerLeaderboardScore {
1560 /// The rank of the score in the friends collection for this leaderboard.
1561 #[serde(rename = "friendsRank")]
1562 pub friends_rank: Option<LeaderboardScoreRank>,
1563 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerLeaderboardScore`.
1564 pub kind: Option<String>,
1565 /// The ID of the leaderboard this score is in.
1566 pub leaderboard_id: Option<String>,
1567 /// The public rank of the score in this leaderboard. This object will not be present if the user is not sharing their scores publicly.
1568 #[serde(rename = "publicRank")]
1569 pub public_rank: Option<LeaderboardScoreRank>,
1570 /// The formatted value of this score.
1571 #[serde(rename = "scoreString")]
1572 pub score_string: Option<String>,
1573 /// Additional information about the score. Values must contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
1574 #[serde(rename = "scoreTag")]
1575 pub score_tag: Option<String>,
1576 /// The numerical value of this score.
1577 #[serde(rename = "scoreValue")]
1578 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1579 pub score_value: Option<i64>,
1580 /// The social rank of the score in this leaderboard.
1581 #[serde(rename = "socialRank")]
1582 pub social_rank: Option<LeaderboardScoreRank>,
1583 /// The time span of this score.
1584 #[serde(rename = "timeSpan")]
1585 pub time_span: Option<String>,
1586 /// The timestamp at which this score was recorded, in milliseconds since the epoch in UTC.
1587 #[serde(rename = "writeTimestamp")]
1588 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1589 pub write_timestamp: Option<i64>,
1590}
1591
1592impl common::Part for PlayerLeaderboardScore {}
1593
1594/// A list of player leaderboard scores.
1595///
1596/// # Activities
1597///
1598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1600///
1601/// * [get scores](ScoreGetCall) (response)
1602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1603#[serde_with::serde_as]
1604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1605pub struct PlayerLeaderboardScoreListResponse {
1606 /// The leaderboard scores.
1607 pub items: Option<Vec<PlayerLeaderboardScore>>,
1608 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerLeaderboardScoreListResponse`.
1609 pub kind: Option<String>,
1610 /// The pagination token for the next page of results.
1611 #[serde(rename = "nextPageToken")]
1612 pub next_page_token: Option<String>,
1613 /// The Player resources for the owner of this score.
1614 pub player: Option<Player>,
1615}
1616
1617impl common::ResponseResult for PlayerLeaderboardScoreListResponse {}
1618
1619/// 1P/3P metadata about a user's level.
1620///
1621/// This type is not used in any activity, and only used as *part* of another schema.
1622///
1623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1624#[serde_with::serde_as]
1625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1626pub struct PlayerLevel {
1627 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerLevel`.
1628 pub kind: Option<String>,
1629 /// The level for the user.
1630 pub level: Option<i32>,
1631 /// The maximum experience points for this level.
1632 #[serde(rename = "maxExperiencePoints")]
1633 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1634 pub max_experience_points: Option<i64>,
1635 /// The minimum experience points for this level.
1636 #[serde(rename = "minExperiencePoints")]
1637 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1638 pub min_experience_points: Option<i64>,
1639}
1640
1641impl common::Part for PlayerLevel {}
1642
1643/// A third party player list response.
1644///
1645/// # Activities
1646///
1647/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1648/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1649///
1650/// * [list players](PlayerListCall) (response)
1651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1652#[serde_with::serde_as]
1653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1654pub struct PlayerListResponse {
1655 /// The players.
1656 pub items: Option<Vec<Player>>,
1657 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerListResponse`.
1658 pub kind: Option<String>,
1659 /// Token corresponding to the next page of results.
1660 #[serde(rename = "nextPageToken")]
1661 pub next_page_token: Option<String>,
1662}
1663
1664impl common::ResponseResult for PlayerListResponse {}
1665
1666/// A player score.
1667///
1668/// This type is not used in any activity, and only used as *part* of another schema.
1669///
1670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1671#[serde_with::serde_as]
1672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1673pub struct PlayerScore {
1674 /// The formatted score for this player score.
1675 #[serde(rename = "formattedScore")]
1676 pub formatted_score: Option<String>,
1677 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerScore`.
1678 pub kind: Option<String>,
1679 /// The numerical value for this player score.
1680 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1681 pub score: Option<i64>,
1682 /// Additional information about this score. Values will contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
1683 #[serde(rename = "scoreTag")]
1684 pub score_tag: Option<String>,
1685 /// The time span for this player score.
1686 #[serde(rename = "timeSpan")]
1687 pub time_span: Option<String>,
1688}
1689
1690impl common::Part for PlayerScore {}
1691
1692/// A list of score submission statuses.
1693///
1694/// # Activities
1695///
1696/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1697/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1698///
1699/// * [submit multiple scores](ScoreSubmitMultipleCall) (response)
1700#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1701#[serde_with::serde_as]
1702#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1703pub struct PlayerScoreListResponse {
1704 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerScoreListResponse`.
1705 pub kind: Option<String>,
1706 /// The score submissions statuses.
1707 #[serde(rename = "submittedScores")]
1708 pub submitted_scores: Option<Vec<PlayerScoreResponse>>,
1709}
1710
1711impl common::ResponseResult for PlayerScoreListResponse {}
1712
1713/// A list of leaderboard entry resources.
1714///
1715/// # Activities
1716///
1717/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1718/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1719///
1720/// * [submit scores](ScoreSubmitCall) (response)
1721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1722#[serde_with::serde_as]
1723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1724pub struct PlayerScoreResponse {
1725 /// The time spans where the submitted score is better than the existing score for that time span.
1726 #[serde(rename = "beatenScoreTimeSpans")]
1727 pub beaten_score_time_spans: Option<Vec<String>>,
1728 /// The formatted value of the submitted score.
1729 #[serde(rename = "formattedScore")]
1730 pub formatted_score: Option<String>,
1731 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerScoreResponse`.
1732 pub kind: Option<String>,
1733 /// The leaderboard ID that this score was submitted to.
1734 #[serde(rename = "leaderboardId")]
1735 pub leaderboard_id: Option<String>,
1736 /// Additional information about this score. Values will contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
1737 #[serde(rename = "scoreTag")]
1738 pub score_tag: Option<String>,
1739 /// The scores in time spans that have not been beaten. As an example, the submitted score may be better than the player's `DAILY` score, but not better than the player's scores for the `WEEKLY` or `ALL_TIME` time spans.
1740 #[serde(rename = "unbeatenScores")]
1741 pub unbeaten_scores: Option<Vec<PlayerScore>>,
1742}
1743
1744impl common::ResponseResult for PlayerScoreResponse {}
1745
1746/// A list of score submission requests.
1747///
1748/// # Activities
1749///
1750/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1751/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1752///
1753/// * [submit multiple scores](ScoreSubmitMultipleCall) (request)
1754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1755#[serde_with::serde_as]
1756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1757pub struct PlayerScoreSubmissionList {
1758 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#playerScoreSubmissionList`.
1759 pub kind: Option<String>,
1760 /// The score submissions.
1761 pub scores: Option<Vec<ScoreSubmission>>,
1762}
1763
1764impl common::RequestValue for PlayerScoreSubmissionList {}
1765
1766/// Profile settings
1767///
1768/// This type is not used in any activity, and only used as *part* of another schema.
1769///
1770#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1771#[serde_with::serde_as]
1772#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1773pub struct ProfileSettings {
1774 /// no description provided
1775 #[serde(rename = "friendsListVisibility")]
1776 pub friends_list_visibility: Option<String>,
1777 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#profileSettings`.
1778 pub kind: Option<String>,
1779 /// Whether the player's profile is visible to the currently signed in player.
1780 #[serde(rename = "profileVisible")]
1781 pub profile_visible: Option<bool>,
1782}
1783
1784impl common::Part for ProfileSettings {}
1785
1786/// Recall token data returned from RetrievePlayerTokens RPC
1787///
1788/// This type is not used in any activity, and only used as *part* of another schema.
1789///
1790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1791#[serde_with::serde_as]
1792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1793pub struct RecallToken {
1794 /// Optional. Optional expiration time of the token
1795 #[serde(rename = "expireTime")]
1796 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1797 /// Required. Whether the persona identified by the token is linked to multiple PGS Players
1798 #[serde(rename = "multiPlayerPersona")]
1799 pub multi_player_persona: Option<bool>,
1800 /// Required. Value of the Recall token as it is provided by the client via LinkPersona RPC
1801 pub token: Option<String>,
1802}
1803
1804impl common::Part for RecallToken {}
1805
1806/// Request to remove all Recall tokens associated with a persona for an app.
1807///
1808/// # Activities
1809///
1810/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1811/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1812///
1813/// * [reset persona recall](RecallResetPersonaCall) (request)
1814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1815#[serde_with::serde_as]
1816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1817pub struct ResetPersonaRequest {
1818 /// Value of the 'persona' field as it was provided by the client in LinkPersona RPC
1819 pub persona: Option<String>,
1820}
1821
1822impl common::RequestValue for ResetPersonaRequest {}
1823
1824/// Response for the ResetPersona RPC
1825///
1826/// # Activities
1827///
1828/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1829/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1830///
1831/// * [reset persona recall](RecallResetPersonaCall) (response)
1832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1833#[serde_with::serde_as]
1834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1835pub struct ResetPersonaResponse {
1836 /// Required. Whether any tokens were unlinked as a result of this request.
1837 pub unlinked: Option<bool>,
1838}
1839
1840impl common::ResponseResult for ResetPersonaResponse {}
1841
1842/// Recall token data returned from for the RetrieveDeveloperGamesLastPlayerToken RPC
1843///
1844/// # Activities
1845///
1846/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1847/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1848///
1849/// * [last token from all developer games recall](RecallLastTokenFromAllDeveloperGameCall) (response)
1850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1851#[serde_with::serde_as]
1852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1853pub struct RetrieveDeveloperGamesLastPlayerTokenResponse {
1854 /// The recall token associated with the requested PGS Player principal. It can be unset if there is no recall token associated with the requested principal.
1855 #[serde(rename = "gamePlayerToken")]
1856 pub game_player_token: Option<GamePlayerToken>,
1857}
1858
1859impl common::ResponseResult for RetrieveDeveloperGamesLastPlayerTokenResponse {}
1860
1861/// A list of recall token data returned from the RetrieveGamesPlayerTokens RPC
1862///
1863/// # Activities
1864///
1865/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1866/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1867///
1868/// * [games player tokens recall](RecallGamesPlayerTokenCall) (response)
1869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1870#[serde_with::serde_as]
1871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1872pub struct RetrieveGamesPlayerTokensResponse {
1873 /// The requested applications along with the recall tokens for the player. If the player does not have recall tokens for an application, that application is not included in the response.
1874 #[serde(rename = "gamePlayerTokens")]
1875 pub game_player_tokens: Option<Vec<GamePlayerToken>>,
1876}
1877
1878impl common::ResponseResult for RetrieveGamesPlayerTokensResponse {}
1879
1880/// Response for the RetrievePlayerTokens RPC
1881///
1882/// # Activities
1883///
1884/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1885/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1886///
1887/// * [retrieve tokens recall](RecallRetrieveTokenCall) (response)
1888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1889#[serde_with::serde_as]
1890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1891pub struct RetrievePlayerTokensResponse {
1892 /// Required. Recall tokens associated with the requested PGS Player principal
1893 pub tokens: Option<Vec<RecallToken>>,
1894}
1895
1896impl common::ResponseResult for RetrievePlayerTokensResponse {}
1897
1898/// A third party checking a revision response.
1899///
1900/// # Activities
1901///
1902/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1903/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1904///
1905/// * [check revisions](RevisionCheckCall) (response)
1906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1907#[serde_with::serde_as]
1908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1909pub struct RevisionCheckResponse {
1910 /// The version of the API this client revision should use when calling API methods.
1911 #[serde(rename = "apiVersion")]
1912 pub api_version: Option<String>,
1913 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#revisionCheckResponse`.
1914 pub kind: Option<String>,
1915 /// The result of the revision check.
1916 #[serde(rename = "revisionStatus")]
1917 pub revision_status: Option<String>,
1918}
1919
1920impl common::ResponseResult for RevisionCheckResponse {}
1921
1922/// Scoped player identifiers.
1923///
1924/// # Activities
1925///
1926/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1927/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1928///
1929/// * [get scoped player ids players](PlayerGetScopedPlayerIdCall) (response)
1930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1931#[serde_with::serde_as]
1932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1933pub struct ScopedPlayerIds {
1934 /// Identifier of the player across all games of the given developer. Every player has the same developer_player_key in all games of one developer. Developer player key changes for the game if the game is transferred to another developer. Note that game_player_id will stay unchanged.
1935 #[serde(rename = "developerPlayerKey")]
1936 pub developer_player_key: Option<String>,
1937 /// Game-scoped player identifier. This is the same id that is returned in GetPlayer game_player_id field.
1938 #[serde(rename = "gamePlayerId")]
1939 pub game_player_id: Option<String>,
1940}
1941
1942impl common::ResponseResult for ScopedPlayerIds {}
1943
1944/// A request to submit a score to leaderboards.
1945///
1946/// This type is not used in any activity, and only used as *part* of another schema.
1947///
1948#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1949#[serde_with::serde_as]
1950#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1951pub struct ScoreSubmission {
1952 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#scoreSubmission`.
1953 pub kind: Option<String>,
1954 /// The leaderboard this score is being submitted to.
1955 #[serde(rename = "leaderboardId")]
1956 pub leaderboard_id: Option<String>,
1957 /// The new score being submitted.
1958 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1959 pub score: Option<i64>,
1960 /// Additional information about this score. Values will contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
1961 #[serde(rename = "scoreTag")]
1962 pub score_tag: Option<String>,
1963 /// Signature Values will contain URI-safe characters as defined by section 2.3 of RFC 3986.
1964 pub signature: Option<String>,
1965}
1966
1967impl common::Part for ScoreSubmission {}
1968
1969/// An snapshot object.
1970///
1971/// # Activities
1972///
1973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1975///
1976/// * [get snapshots](SnapshotGetCall) (response)
1977/// * [list snapshots](SnapshotListCall) (none)
1978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1979#[serde_with::serde_as]
1980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1981pub struct Snapshot {
1982 /// The cover image of this snapshot. May be absent if there is no image.
1983 #[serde(rename = "coverImage")]
1984 pub cover_image: Option<SnapshotImage>,
1985 /// The description of this snapshot.
1986 pub description: Option<String>,
1987 /// The ID of the file underlying this snapshot in the Drive API. Only present if the snapshot is a view on a Drive file and the file is owned by the caller.
1988 #[serde(rename = "driveId")]
1989 pub drive_id: Option<String>,
1990 /// The duration associated with this snapshot, in millis.
1991 #[serde(rename = "durationMillis")]
1992 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1993 pub duration_millis: Option<i64>,
1994 /// The ID of the snapshot.
1995 pub id: Option<String>,
1996 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#snapshot`.
1997 pub kind: Option<String>,
1998 /// The timestamp (in millis since Unix epoch) of the last modification to this snapshot.
1999 #[serde(rename = "lastModifiedMillis")]
2000 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2001 pub last_modified_millis: Option<i64>,
2002 /// The progress value (64-bit integer set by developer) associated with this snapshot.
2003 #[serde(rename = "progressValue")]
2004 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2005 pub progress_value: Option<i64>,
2006 /// The title of this snapshot.
2007 pub title: Option<String>,
2008 /// The type of this snapshot.
2009 #[serde(rename = "type")]
2010 pub type_: Option<String>,
2011 /// The unique name provided when the snapshot was created.
2012 #[serde(rename = "uniqueName")]
2013 pub unique_name: Option<String>,
2014}
2015
2016impl common::Resource for Snapshot {}
2017impl common::ResponseResult for Snapshot {}
2018
2019/// An image of a snapshot.
2020///
2021/// This type is not used in any activity, and only used as *part* of another schema.
2022///
2023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2024#[serde_with::serde_as]
2025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2026pub struct SnapshotImage {
2027 /// The height of the image.
2028 pub height: Option<i32>,
2029 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#snapshotImage`.
2030 pub kind: Option<String>,
2031 /// The MIME type of the image.
2032 pub mime_type: Option<String>,
2033 /// The URL of the image. This URL may be invalidated at any time and should not be cached.
2034 pub url: Option<String>,
2035 /// The width of the image.
2036 pub width: Option<i32>,
2037}
2038
2039impl common::Part for SnapshotImage {}
2040
2041/// A third party list snapshots response.
2042///
2043/// # Activities
2044///
2045/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2046/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2047///
2048/// * [list snapshots](SnapshotListCall) (response)
2049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2050#[serde_with::serde_as]
2051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2052pub struct SnapshotListResponse {
2053 /// The snapshots.
2054 pub items: Option<Vec<Snapshot>>,
2055 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#snapshotListResponse`.
2056 pub kind: Option<String>,
2057 /// Token corresponding to the next page of results. If there are no more results, the token is omitted.
2058 #[serde(rename = "nextPageToken")]
2059 pub next_page_token: Option<String>,
2060}
2061
2062impl common::ResponseResult for SnapshotListResponse {}
2063
2064/// A third party stats resource.
2065///
2066/// # Activities
2067///
2068/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2069/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2070///
2071/// * [get stats](StatGetCall) (response)
2072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2073#[serde_with::serde_as]
2074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2075pub struct StatsResponse {
2076 /// Average session length in minutes of the player. E.g., 1, 30, 60, ... . Not populated if there is not enough information.
2077 pub avg_session_length_minutes: Option<f32>,
2078 /// The probability of the player not returning to play the game in the next day. E.g., 0, 0.1, 0.5, ..., 1.0. Not populated if there is not enough information.
2079 pub churn_probability: Option<f32>,
2080 /// Number of days since the player last played this game. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
2081 pub days_since_last_played: Option<i32>,
2082 /// The probability of the player going to spend beyond a threshold amount of money. E.g., 0, 0.25, 0.50, 0.75. Not populated if there is not enough information.
2083 pub high_spender_probability: Option<f32>,
2084 /// Uniquely identifies the type of this resource. Value is always the fixed string `games#statsResponse`.
2085 pub kind: Option<String>,
2086 /// Number of in-app purchases made by the player in this game. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
2087 pub num_purchases: Option<i32>,
2088 /// The approximate number of sessions of the player within the last 28 days, where a session begins when the player is connected to Play Games Services and ends when they are disconnected. E.g., 0, 1, 5, 10, ... . Not populated if there is not enough information.
2089 pub num_sessions: Option<i32>,
2090 /// The approximation of the sessions percentile of the player within the last 30 days, where a session begins when the player is connected to Play Games Services and ends when they are disconnected. E.g., 0, 0.25, 0.5, 0.75. Not populated if there is not enough information.
2091 pub num_sessions_percentile: Option<f32>,
2092 /// The approximate spend percentile of the player in this game. E.g., 0, 0.25, 0.5, 0.75. Not populated if there is not enough information.
2093 pub spend_percentile: Option<f32>,
2094 /// The probability of the player going to spend the game in the next seven days. E.g., 0, 0.25, 0.50, 0.75. Not populated if there is not enough information.
2095 pub spend_probability: Option<f32>,
2096 /// The predicted amount of money that the player going to spend in the next 28 days. E.g., 1, 30, 60, ... . Not populated if there is not enough information.
2097 pub total_spend_next_28_days: Option<f32>,
2098}
2099
2100impl common::ResponseResult for StatsResponse {}
2101
2102/// Request to remove a Recall token linking PGS principal and an in-game account
2103///
2104/// # Activities
2105///
2106/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2107/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2108///
2109/// * [unlink persona recall](RecallUnlinkPersonaCall) (request)
2110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2111#[serde_with::serde_as]
2112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2113pub struct UnlinkPersonaRequest {
2114 /// Value of the 'persona' field as it was provided by the client in LinkPersona RPC
2115 pub persona: Option<String>,
2116 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
2117 #[serde(rename = "sessionId")]
2118 pub session_id: Option<String>,
2119 /// Value of the Recall token as it was provided by the client in LinkPersona RPC
2120 pub token: Option<String>,
2121}
2122
2123impl common::RequestValue for UnlinkPersonaRequest {}
2124
2125/// Response for the UnlinkPersona RPC
2126///
2127/// # Activities
2128///
2129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2131///
2132/// * [unlink persona recall](RecallUnlinkPersonaCall) (response)
2133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2134#[serde_with::serde_as]
2135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2136pub struct UnlinkPersonaResponse {
2137 /// Required. Whether a Recall token specified by the request was deleted. Can be 'false' when there were no Recall tokens satisfied the criteria from the request.
2138 pub unlinked: Option<bool>,
2139}
2140
2141impl common::ResponseResult for UnlinkPersonaResponse {}
2142
2143/// A representation of the individual components of the name.
2144///
2145/// This type is not used in any activity, and only used as *part* of another schema.
2146///
2147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2148#[serde_with::serde_as]
2149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2150pub struct PlayerName {
2151 /// The family name of this player. In some places, this is known as the last name.
2152 #[serde(rename = "familyName")]
2153 pub family_name: Option<String>,
2154 /// The given name of this player. In some places, this is known as the first name.
2155 #[serde(rename = "givenName")]
2156 pub given_name: Option<String>,
2157}
2158
2159impl common::NestedType for PlayerName {}
2160impl common::Part for PlayerName {}
2161
2162// ###################
2163// MethodBuilders ###
2164// #################
2165
2166/// A builder providing access to all methods supported on *accesstoken* resources.
2167/// It is not used directly, but through the [`Games`] hub.
2168///
2169/// # Example
2170///
2171/// Instantiate a resource builder
2172///
2173/// ```test_harness,no_run
2174/// extern crate hyper;
2175/// extern crate hyper_rustls;
2176/// extern crate google_games1 as games1;
2177///
2178/// # async fn dox() {
2179/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2180///
2181/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2182/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2183/// .with_native_roots()
2184/// .unwrap()
2185/// .https_only()
2186/// .enable_http2()
2187/// .build();
2188///
2189/// let executor = hyper_util::rt::TokioExecutor::new();
2190/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2191/// secret,
2192/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2193/// yup_oauth2::client::CustomHyperClientBuilder::from(
2194/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2195/// ),
2196/// ).build().await.unwrap();
2197///
2198/// let client = hyper_util::client::legacy::Client::builder(
2199/// hyper_util::rt::TokioExecutor::new()
2200/// )
2201/// .build(
2202/// hyper_rustls::HttpsConnectorBuilder::new()
2203/// .with_native_roots()
2204/// .unwrap()
2205/// .https_or_http()
2206/// .enable_http2()
2207/// .build()
2208/// );
2209/// let mut hub = Games::new(client, auth);
2210/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2211/// // like `generate_play_grouping_api_token(...)` and `generate_recall_play_grouping_api_token(...)`
2212/// // to build up your call.
2213/// let rb = hub.accesstokens();
2214/// # }
2215/// ```
2216pub struct AccesstokenMethods<'a, C>
2217where
2218 C: 'a,
2219{
2220 hub: &'a Games<C>,
2221}
2222
2223impl<'a, C> common::MethodsBuilder for AccesstokenMethods<'a, C> {}
2224
2225impl<'a, C> AccesstokenMethods<'a, C> {
2226 /// Create a builder to help you perform the following task:
2227 ///
2228 /// Generates a Play Grouping API token for the PGS user identified by the attached credential.
2229 pub fn generate_play_grouping_api_token(
2230 &self,
2231 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {
2232 AccesstokenGeneratePlayGroupingApiTokenCall {
2233 hub: self.hub,
2234 _persona: Default::default(),
2235 _package_name: Default::default(),
2236 _delegate: Default::default(),
2237 _additional_params: Default::default(),
2238 _scopes: Default::default(),
2239 }
2240 }
2241
2242 /// Create a builder to help you perform the following task:
2243 ///
2244 /// Generates a Play Grouping API token for the PGS user identified by the Recall session ID provided in the request.
2245 pub fn generate_recall_play_grouping_api_token(
2246 &self,
2247 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
2248 AccesstokenGenerateRecallPlayGroupingApiTokenCall {
2249 hub: self.hub,
2250 _recall_session_id: Default::default(),
2251 _persona: Default::default(),
2252 _package_name: Default::default(),
2253 _delegate: Default::default(),
2254 _additional_params: Default::default(),
2255 _scopes: Default::default(),
2256 }
2257 }
2258}
2259
2260/// A builder providing access to all methods supported on *achievementDefinition* resources.
2261/// It is not used directly, but through the [`Games`] hub.
2262///
2263/// # Example
2264///
2265/// Instantiate a resource builder
2266///
2267/// ```test_harness,no_run
2268/// extern crate hyper;
2269/// extern crate hyper_rustls;
2270/// extern crate google_games1 as games1;
2271///
2272/// # async fn dox() {
2273/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2274///
2275/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2276/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2277/// .with_native_roots()
2278/// .unwrap()
2279/// .https_only()
2280/// .enable_http2()
2281/// .build();
2282///
2283/// let executor = hyper_util::rt::TokioExecutor::new();
2284/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2285/// secret,
2286/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2287/// yup_oauth2::client::CustomHyperClientBuilder::from(
2288/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2289/// ),
2290/// ).build().await.unwrap();
2291///
2292/// let client = hyper_util::client::legacy::Client::builder(
2293/// hyper_util::rt::TokioExecutor::new()
2294/// )
2295/// .build(
2296/// hyper_rustls::HttpsConnectorBuilder::new()
2297/// .with_native_roots()
2298/// .unwrap()
2299/// .https_or_http()
2300/// .enable_http2()
2301/// .build()
2302/// );
2303/// let mut hub = Games::new(client, auth);
2304/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2305/// // like `list(...)`
2306/// // to build up your call.
2307/// let rb = hub.achievement_definitions();
2308/// # }
2309/// ```
2310pub struct AchievementDefinitionMethods<'a, C>
2311where
2312 C: 'a,
2313{
2314 hub: &'a Games<C>,
2315}
2316
2317impl<'a, C> common::MethodsBuilder for AchievementDefinitionMethods<'a, C> {}
2318
2319impl<'a, C> AchievementDefinitionMethods<'a, C> {
2320 /// Create a builder to help you perform the following task:
2321 ///
2322 /// Lists all the achievement definitions for your application.
2323 pub fn list(&self) -> AchievementDefinitionListCall<'a, C> {
2324 AchievementDefinitionListCall {
2325 hub: self.hub,
2326 _page_token: Default::default(),
2327 _max_results: Default::default(),
2328 _language: Default::default(),
2329 _delegate: Default::default(),
2330 _additional_params: Default::default(),
2331 _scopes: Default::default(),
2332 }
2333 }
2334}
2335
2336/// A builder providing access to all methods supported on *achievement* resources.
2337/// It is not used directly, but through the [`Games`] hub.
2338///
2339/// # Example
2340///
2341/// Instantiate a resource builder
2342///
2343/// ```test_harness,no_run
2344/// extern crate hyper;
2345/// extern crate hyper_rustls;
2346/// extern crate google_games1 as games1;
2347///
2348/// # async fn dox() {
2349/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2350///
2351/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2352/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2353/// .with_native_roots()
2354/// .unwrap()
2355/// .https_only()
2356/// .enable_http2()
2357/// .build();
2358///
2359/// let executor = hyper_util::rt::TokioExecutor::new();
2360/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2361/// secret,
2362/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2363/// yup_oauth2::client::CustomHyperClientBuilder::from(
2364/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2365/// ),
2366/// ).build().await.unwrap();
2367///
2368/// let client = hyper_util::client::legacy::Client::builder(
2369/// hyper_util::rt::TokioExecutor::new()
2370/// )
2371/// .build(
2372/// hyper_rustls::HttpsConnectorBuilder::new()
2373/// .with_native_roots()
2374/// .unwrap()
2375/// .https_or_http()
2376/// .enable_http2()
2377/// .build()
2378/// );
2379/// let mut hub = Games::new(client, auth);
2380/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2381/// // like `increment(...)`, `list(...)`, `reveal(...)`, `set_steps_at_least(...)`, `unlock(...)` and `update_multiple(...)`
2382/// // to build up your call.
2383/// let rb = hub.achievements();
2384/// # }
2385/// ```
2386pub struct AchievementMethods<'a, C>
2387where
2388 C: 'a,
2389{
2390 hub: &'a Games<C>,
2391}
2392
2393impl<'a, C> common::MethodsBuilder for AchievementMethods<'a, C> {}
2394
2395impl<'a, C> AchievementMethods<'a, C> {
2396 /// Create a builder to help you perform the following task:
2397 ///
2398 /// Increments the steps of the achievement with the given ID for the currently authenticated player.
2399 ///
2400 /// # Arguments
2401 ///
2402 /// * `achievementId` - The ID of the achievement used by this method.
2403 /// * `stepsToIncrement` - Required. The number of steps to increment.
2404 pub fn increment(
2405 &self,
2406 achievement_id: &str,
2407 steps_to_increment: i32,
2408 ) -> AchievementIncrementCall<'a, C> {
2409 AchievementIncrementCall {
2410 hub: self.hub,
2411 _achievement_id: achievement_id.to_string(),
2412 _steps_to_increment: steps_to_increment,
2413 _request_id: Default::default(),
2414 _delegate: Default::default(),
2415 _additional_params: Default::default(),
2416 _scopes: Default::default(),
2417 }
2418 }
2419
2420 /// Create a builder to help you perform the following task:
2421 ///
2422 /// Lists the progress for all your application's achievements for the currently authenticated player.
2423 ///
2424 /// # Arguments
2425 ///
2426 /// * `playerId` - A player ID. A value of `me` may be used in place of the authenticated player's ID.
2427 pub fn list(&self, player_id: &str) -> AchievementListCall<'a, C> {
2428 AchievementListCall {
2429 hub: self.hub,
2430 _player_id: player_id.to_string(),
2431 _state: Default::default(),
2432 _page_token: Default::default(),
2433 _max_results: Default::default(),
2434 _language: Default::default(),
2435 _delegate: Default::default(),
2436 _additional_params: Default::default(),
2437 _scopes: Default::default(),
2438 }
2439 }
2440
2441 /// Create a builder to help you perform the following task:
2442 ///
2443 /// Sets the state of the achievement with the given ID to `REVEALED` for the currently authenticated player.
2444 ///
2445 /// # Arguments
2446 ///
2447 /// * `achievementId` - The ID of the achievement used by this method.
2448 pub fn reveal(&self, achievement_id: &str) -> AchievementRevealCall<'a, C> {
2449 AchievementRevealCall {
2450 hub: self.hub,
2451 _achievement_id: achievement_id.to_string(),
2452 _delegate: Default::default(),
2453 _additional_params: Default::default(),
2454 _scopes: Default::default(),
2455 }
2456 }
2457
2458 /// Create a builder to help you perform the following task:
2459 ///
2460 /// Sets the steps for the currently authenticated player towards unlocking an achievement. If the steps parameter is less than the current number of steps that the player already gained for the achievement, the achievement is not modified.
2461 ///
2462 /// # Arguments
2463 ///
2464 /// * `achievementId` - The ID of the achievement used by this method.
2465 /// * `steps` - Required. The minimum value to set the steps to.
2466 pub fn set_steps_at_least(
2467 &self,
2468 achievement_id: &str,
2469 steps: i32,
2470 ) -> AchievementSetStepsAtLeastCall<'a, C> {
2471 AchievementSetStepsAtLeastCall {
2472 hub: self.hub,
2473 _achievement_id: achievement_id.to_string(),
2474 _steps: steps,
2475 _delegate: Default::default(),
2476 _additional_params: Default::default(),
2477 _scopes: Default::default(),
2478 }
2479 }
2480
2481 /// Create a builder to help you perform the following task:
2482 ///
2483 /// Unlocks this achievement for the currently authenticated player.
2484 ///
2485 /// # Arguments
2486 ///
2487 /// * `achievementId` - The ID of the achievement used by this method.
2488 pub fn unlock(&self, achievement_id: &str) -> AchievementUnlockCall<'a, C> {
2489 AchievementUnlockCall {
2490 hub: self.hub,
2491 _achievement_id: achievement_id.to_string(),
2492 _delegate: Default::default(),
2493 _additional_params: Default::default(),
2494 _scopes: Default::default(),
2495 }
2496 }
2497
2498 /// Create a builder to help you perform the following task:
2499 ///
2500 /// Updates multiple achievements for the currently authenticated player.
2501 ///
2502 /// # Arguments
2503 ///
2504 /// * `request` - No description provided.
2505 pub fn update_multiple(
2506 &self,
2507 request: AchievementUpdateMultipleRequest,
2508 ) -> AchievementUpdateMultipleCall<'a, C> {
2509 AchievementUpdateMultipleCall {
2510 hub: self.hub,
2511 _request: request,
2512 _delegate: Default::default(),
2513 _additional_params: Default::default(),
2514 _scopes: Default::default(),
2515 }
2516 }
2517}
2518
2519/// A builder providing access to all methods supported on *application* resources.
2520/// It is not used directly, but through the [`Games`] hub.
2521///
2522/// # Example
2523///
2524/// Instantiate a resource builder
2525///
2526/// ```test_harness,no_run
2527/// extern crate hyper;
2528/// extern crate hyper_rustls;
2529/// extern crate google_games1 as games1;
2530///
2531/// # async fn dox() {
2532/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2533///
2534/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2535/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2536/// .with_native_roots()
2537/// .unwrap()
2538/// .https_only()
2539/// .enable_http2()
2540/// .build();
2541///
2542/// let executor = hyper_util::rt::TokioExecutor::new();
2543/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2544/// secret,
2545/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2546/// yup_oauth2::client::CustomHyperClientBuilder::from(
2547/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2548/// ),
2549/// ).build().await.unwrap();
2550///
2551/// let client = hyper_util::client::legacy::Client::builder(
2552/// hyper_util::rt::TokioExecutor::new()
2553/// )
2554/// .build(
2555/// hyper_rustls::HttpsConnectorBuilder::new()
2556/// .with_native_roots()
2557/// .unwrap()
2558/// .https_or_http()
2559/// .enable_http2()
2560/// .build()
2561/// );
2562/// let mut hub = Games::new(client, auth);
2563/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2564/// // like `get(...)`, `get_end_point(...)`, `played(...)` and `verify(...)`
2565/// // to build up your call.
2566/// let rb = hub.applications();
2567/// # }
2568/// ```
2569pub struct ApplicationMethods<'a, C>
2570where
2571 C: 'a,
2572{
2573 hub: &'a Games<C>,
2574}
2575
2576impl<'a, C> common::MethodsBuilder for ApplicationMethods<'a, C> {}
2577
2578impl<'a, C> ApplicationMethods<'a, C> {
2579 /// Create a builder to help you perform the following task:
2580 ///
2581 /// Retrieves the metadata of the application with the given ID. If the requested application is not available for the specified `platformType`, the returned response will not include any instance data.
2582 ///
2583 /// # Arguments
2584 ///
2585 /// * `applicationId` - The application ID from the Google Play developer console.
2586 pub fn get(&self, application_id: &str) -> ApplicationGetCall<'a, C> {
2587 ApplicationGetCall {
2588 hub: self.hub,
2589 _application_id: application_id.to_string(),
2590 _platform_type: Default::default(),
2591 _language: Default::default(),
2592 _delegate: Default::default(),
2593 _additional_params: Default::default(),
2594 _scopes: Default::default(),
2595 }
2596 }
2597
2598 /// Create a builder to help you perform the following task:
2599 ///
2600 /// Returns a URL for the requested end point type.
2601 pub fn get_end_point(&self) -> ApplicationGetEndPointCall<'a, C> {
2602 ApplicationGetEndPointCall {
2603 hub: self.hub,
2604 _end_point_type: Default::default(),
2605 _application_id: Default::default(),
2606 _delegate: Default::default(),
2607 _additional_params: Default::default(),
2608 _scopes: Default::default(),
2609 }
2610 }
2611
2612 /// Create a builder to help you perform the following task:
2613 ///
2614 /// Indicate that the currently authenticated user is playing your application.
2615 pub fn played(&self) -> ApplicationPlayedCall<'a, C> {
2616 ApplicationPlayedCall {
2617 hub: self.hub,
2618 _delegate: Default::default(),
2619 _additional_params: Default::default(),
2620 _scopes: Default::default(),
2621 }
2622 }
2623
2624 /// Create a builder to help you perform the following task:
2625 ///
2626 /// Verifies the auth token provided with this request is for the application with the specified ID, and returns the ID of the player it was granted for.
2627 ///
2628 /// # Arguments
2629 ///
2630 /// * `applicationId` - The application ID from the Google Play developer console.
2631 pub fn verify(&self, application_id: &str) -> ApplicationVerifyCall<'a, C> {
2632 ApplicationVerifyCall {
2633 hub: self.hub,
2634 _application_id: application_id.to_string(),
2635 _delegate: Default::default(),
2636 _additional_params: Default::default(),
2637 _scopes: Default::default(),
2638 }
2639 }
2640}
2641
2642/// A builder providing access to all methods supported on *event* resources.
2643/// It is not used directly, but through the [`Games`] hub.
2644///
2645/// # Example
2646///
2647/// Instantiate a resource builder
2648///
2649/// ```test_harness,no_run
2650/// extern crate hyper;
2651/// extern crate hyper_rustls;
2652/// extern crate google_games1 as games1;
2653///
2654/// # async fn dox() {
2655/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2656///
2657/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2658/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2659/// .with_native_roots()
2660/// .unwrap()
2661/// .https_only()
2662/// .enable_http2()
2663/// .build();
2664///
2665/// let executor = hyper_util::rt::TokioExecutor::new();
2666/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2667/// secret,
2668/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2669/// yup_oauth2::client::CustomHyperClientBuilder::from(
2670/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2671/// ),
2672/// ).build().await.unwrap();
2673///
2674/// let client = hyper_util::client::legacy::Client::builder(
2675/// hyper_util::rt::TokioExecutor::new()
2676/// )
2677/// .build(
2678/// hyper_rustls::HttpsConnectorBuilder::new()
2679/// .with_native_roots()
2680/// .unwrap()
2681/// .https_or_http()
2682/// .enable_http2()
2683/// .build()
2684/// );
2685/// let mut hub = Games::new(client, auth);
2686/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2687/// // like `list_by_player(...)`, `list_definitions(...)` and `record(...)`
2688/// // to build up your call.
2689/// let rb = hub.events();
2690/// # }
2691/// ```
2692pub struct EventMethods<'a, C>
2693where
2694 C: 'a,
2695{
2696 hub: &'a Games<C>,
2697}
2698
2699impl<'a, C> common::MethodsBuilder for EventMethods<'a, C> {}
2700
2701impl<'a, C> EventMethods<'a, C> {
2702 /// Create a builder to help you perform the following task:
2703 ///
2704 /// Returns a list showing the current progress on events in this application for the currently authenticated user.
2705 pub fn list_by_player(&self) -> EventListByPlayerCall<'a, C> {
2706 EventListByPlayerCall {
2707 hub: self.hub,
2708 _page_token: Default::default(),
2709 _max_results: Default::default(),
2710 _language: Default::default(),
2711 _delegate: Default::default(),
2712 _additional_params: Default::default(),
2713 _scopes: Default::default(),
2714 }
2715 }
2716
2717 /// Create a builder to help you perform the following task:
2718 ///
2719 /// Returns a list of the event definitions in this application.
2720 pub fn list_definitions(&self) -> EventListDefinitionCall<'a, C> {
2721 EventListDefinitionCall {
2722 hub: self.hub,
2723 _page_token: Default::default(),
2724 _max_results: Default::default(),
2725 _language: Default::default(),
2726 _delegate: Default::default(),
2727 _additional_params: Default::default(),
2728 _scopes: Default::default(),
2729 }
2730 }
2731
2732 /// Create a builder to help you perform the following task:
2733 ///
2734 /// Records a batch of changes to the number of times events have occurred for the currently authenticated user of this application.
2735 ///
2736 /// # Arguments
2737 ///
2738 /// * `request` - No description provided.
2739 pub fn record(&self, request: EventRecordRequest) -> EventRecordCall<'a, C> {
2740 EventRecordCall {
2741 hub: self.hub,
2742 _request: request,
2743 _language: Default::default(),
2744 _delegate: Default::default(),
2745 _additional_params: Default::default(),
2746 _scopes: Default::default(),
2747 }
2748 }
2749}
2750
2751/// A builder providing access to all methods supported on *leaderboard* resources.
2752/// It is not used directly, but through the [`Games`] hub.
2753///
2754/// # Example
2755///
2756/// Instantiate a resource builder
2757///
2758/// ```test_harness,no_run
2759/// extern crate hyper;
2760/// extern crate hyper_rustls;
2761/// extern crate google_games1 as games1;
2762///
2763/// # async fn dox() {
2764/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2765///
2766/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2767/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2768/// .with_native_roots()
2769/// .unwrap()
2770/// .https_only()
2771/// .enable_http2()
2772/// .build();
2773///
2774/// let executor = hyper_util::rt::TokioExecutor::new();
2775/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2776/// secret,
2777/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2778/// yup_oauth2::client::CustomHyperClientBuilder::from(
2779/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2780/// ),
2781/// ).build().await.unwrap();
2782///
2783/// let client = hyper_util::client::legacy::Client::builder(
2784/// hyper_util::rt::TokioExecutor::new()
2785/// )
2786/// .build(
2787/// hyper_rustls::HttpsConnectorBuilder::new()
2788/// .with_native_roots()
2789/// .unwrap()
2790/// .https_or_http()
2791/// .enable_http2()
2792/// .build()
2793/// );
2794/// let mut hub = Games::new(client, auth);
2795/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2796/// // like `get(...)` and `list(...)`
2797/// // to build up your call.
2798/// let rb = hub.leaderboards();
2799/// # }
2800/// ```
2801pub struct LeaderboardMethods<'a, C>
2802where
2803 C: 'a,
2804{
2805 hub: &'a Games<C>,
2806}
2807
2808impl<'a, C> common::MethodsBuilder for LeaderboardMethods<'a, C> {}
2809
2810impl<'a, C> LeaderboardMethods<'a, C> {
2811 /// Create a builder to help you perform the following task:
2812 ///
2813 /// Retrieves the metadata of the leaderboard with the given ID.
2814 ///
2815 /// # Arguments
2816 ///
2817 /// * `leaderboardId` - The ID of the leaderboard.
2818 pub fn get(&self, leaderboard_id: &str) -> LeaderboardGetCall<'a, C> {
2819 LeaderboardGetCall {
2820 hub: self.hub,
2821 _leaderboard_id: leaderboard_id.to_string(),
2822 _language: Default::default(),
2823 _delegate: Default::default(),
2824 _additional_params: Default::default(),
2825 _scopes: Default::default(),
2826 }
2827 }
2828
2829 /// Create a builder to help you perform the following task:
2830 ///
2831 /// Lists all the leaderboard metadata for your application.
2832 pub fn list(&self) -> LeaderboardListCall<'a, C> {
2833 LeaderboardListCall {
2834 hub: self.hub,
2835 _page_token: Default::default(),
2836 _max_results: Default::default(),
2837 _language: Default::default(),
2838 _delegate: Default::default(),
2839 _additional_params: Default::default(),
2840 _scopes: Default::default(),
2841 }
2842 }
2843}
2844
2845/// A builder providing access to all methods supported on *metagame* resources.
2846/// It is not used directly, but through the [`Games`] hub.
2847///
2848/// # Example
2849///
2850/// Instantiate a resource builder
2851///
2852/// ```test_harness,no_run
2853/// extern crate hyper;
2854/// extern crate hyper_rustls;
2855/// extern crate google_games1 as games1;
2856///
2857/// # async fn dox() {
2858/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2859///
2860/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2861/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2862/// .with_native_roots()
2863/// .unwrap()
2864/// .https_only()
2865/// .enable_http2()
2866/// .build();
2867///
2868/// let executor = hyper_util::rt::TokioExecutor::new();
2869/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2870/// secret,
2871/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2872/// yup_oauth2::client::CustomHyperClientBuilder::from(
2873/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2874/// ),
2875/// ).build().await.unwrap();
2876///
2877/// let client = hyper_util::client::legacy::Client::builder(
2878/// hyper_util::rt::TokioExecutor::new()
2879/// )
2880/// .build(
2881/// hyper_rustls::HttpsConnectorBuilder::new()
2882/// .with_native_roots()
2883/// .unwrap()
2884/// .https_or_http()
2885/// .enable_http2()
2886/// .build()
2887/// );
2888/// let mut hub = Games::new(client, auth);
2889/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2890/// // like `get_metagame_config(...)` and `list_categories_by_player(...)`
2891/// // to build up your call.
2892/// let rb = hub.metagame();
2893/// # }
2894/// ```
2895pub struct MetagameMethods<'a, C>
2896where
2897 C: 'a,
2898{
2899 hub: &'a Games<C>,
2900}
2901
2902impl<'a, C> common::MethodsBuilder for MetagameMethods<'a, C> {}
2903
2904impl<'a, C> MetagameMethods<'a, C> {
2905 /// Create a builder to help you perform the following task:
2906 ///
2907 /// Return the metagame configuration data for the calling application.
2908 pub fn get_metagame_config(&self) -> MetagameGetMetagameConfigCall<'a, C> {
2909 MetagameGetMetagameConfigCall {
2910 hub: self.hub,
2911 _delegate: Default::default(),
2912 _additional_params: Default::default(),
2913 _scopes: Default::default(),
2914 }
2915 }
2916
2917 /// Create a builder to help you perform the following task:
2918 ///
2919 /// List play data aggregated per category for the player corresponding to `playerId`.
2920 ///
2921 /// # Arguments
2922 ///
2923 /// * `playerId` - A player ID. A value of `me` may be used in place of the authenticated player's ID.
2924 /// * `collection` - The collection of categories for which data will be returned.
2925 pub fn list_categories_by_player(
2926 &self,
2927 player_id: &str,
2928 collection: &str,
2929 ) -> MetagameListCategoriesByPlayerCall<'a, C> {
2930 MetagameListCategoriesByPlayerCall {
2931 hub: self.hub,
2932 _player_id: player_id.to_string(),
2933 _collection: collection.to_string(),
2934 _page_token: Default::default(),
2935 _max_results: Default::default(),
2936 _language: Default::default(),
2937 _delegate: Default::default(),
2938 _additional_params: Default::default(),
2939 _scopes: Default::default(),
2940 }
2941 }
2942}
2943
2944/// A builder providing access to all methods supported on *player* resources.
2945/// It is not used directly, but through the [`Games`] hub.
2946///
2947/// # Example
2948///
2949/// Instantiate a resource builder
2950///
2951/// ```test_harness,no_run
2952/// extern crate hyper;
2953/// extern crate hyper_rustls;
2954/// extern crate google_games1 as games1;
2955///
2956/// # async fn dox() {
2957/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2958///
2959/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2960/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2961/// .with_native_roots()
2962/// .unwrap()
2963/// .https_only()
2964/// .enable_http2()
2965/// .build();
2966///
2967/// let executor = hyper_util::rt::TokioExecutor::new();
2968/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2969/// secret,
2970/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2971/// yup_oauth2::client::CustomHyperClientBuilder::from(
2972/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2973/// ),
2974/// ).build().await.unwrap();
2975///
2976/// let client = hyper_util::client::legacy::Client::builder(
2977/// hyper_util::rt::TokioExecutor::new()
2978/// )
2979/// .build(
2980/// hyper_rustls::HttpsConnectorBuilder::new()
2981/// .with_native_roots()
2982/// .unwrap()
2983/// .https_or_http()
2984/// .enable_http2()
2985/// .build()
2986/// );
2987/// let mut hub = Games::new(client, auth);
2988/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2989/// // like `get(...)`, `get_multiple_application_player_ids(...)`, `get_scoped_player_ids(...)` and `list(...)`
2990/// // to build up your call.
2991/// let rb = hub.players();
2992/// # }
2993/// ```
2994pub struct PlayerMethods<'a, C>
2995where
2996 C: 'a,
2997{
2998 hub: &'a Games<C>,
2999}
3000
3001impl<'a, C> common::MethodsBuilder for PlayerMethods<'a, C> {}
3002
3003impl<'a, C> PlayerMethods<'a, C> {
3004 /// Create a builder to help you perform the following task:
3005 ///
3006 /// Retrieves the Player resource with the given ID. To retrieve the player for the currently authenticated user, set `playerId` to `me`.
3007 ///
3008 /// # Arguments
3009 ///
3010 /// * `playerId` - A player ID. A value of `me` may be used in place of the authenticated player's ID.
3011 pub fn get(&self, player_id: &str) -> PlayerGetCall<'a, C> {
3012 PlayerGetCall {
3013 hub: self.hub,
3014 _player_id: player_id.to_string(),
3015 _player_id_consistency_token: Default::default(),
3016 _language: Default::default(),
3017 _delegate: Default::default(),
3018 _additional_params: Default::default(),
3019 _scopes: Default::default(),
3020 }
3021 }
3022
3023 /// Create a builder to help you perform the following task:
3024 ///
3025 /// Get the application player ids for the currently authenticated player across all requested games by the same developer as the calling application. This will only return ids for players that actually have an id (scoped or otherwise) with that game.
3026 pub fn get_multiple_application_player_ids(
3027 &self,
3028 ) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C> {
3029 PlayerGetMultipleApplicationPlayerIdCall {
3030 hub: self.hub,
3031 _application_ids: Default::default(),
3032 _delegate: Default::default(),
3033 _additional_params: Default::default(),
3034 _scopes: Default::default(),
3035 }
3036 }
3037
3038 /// Create a builder to help you perform the following task:
3039 ///
3040 /// Retrieves scoped player identifiers for currently authenticated user.
3041 pub fn get_scoped_player_ids(&self) -> PlayerGetScopedPlayerIdCall<'a, C> {
3042 PlayerGetScopedPlayerIdCall {
3043 hub: self.hub,
3044 _delegate: Default::default(),
3045 _additional_params: Default::default(),
3046 _scopes: Default::default(),
3047 }
3048 }
3049
3050 /// Create a builder to help you perform the following task:
3051 ///
3052 /// Get the collection of players for the currently authenticated user.
3053 ///
3054 /// # Arguments
3055 ///
3056 /// * `collection` - Collection of players being retrieved
3057 pub fn list(&self, collection: &str) -> PlayerListCall<'a, C> {
3058 PlayerListCall {
3059 hub: self.hub,
3060 _collection: collection.to_string(),
3061 _page_token: Default::default(),
3062 _max_results: Default::default(),
3063 _language: Default::default(),
3064 _delegate: Default::default(),
3065 _additional_params: Default::default(),
3066 _scopes: Default::default(),
3067 }
3068 }
3069}
3070
3071/// A builder providing access to all methods supported on *recall* resources.
3072/// It is not used directly, but through the [`Games`] hub.
3073///
3074/// # Example
3075///
3076/// Instantiate a resource builder
3077///
3078/// ```test_harness,no_run
3079/// extern crate hyper;
3080/// extern crate hyper_rustls;
3081/// extern crate google_games1 as games1;
3082///
3083/// # async fn dox() {
3084/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3085///
3086/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3087/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3088/// .with_native_roots()
3089/// .unwrap()
3090/// .https_only()
3091/// .enable_http2()
3092/// .build();
3093///
3094/// let executor = hyper_util::rt::TokioExecutor::new();
3095/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3096/// secret,
3097/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3098/// yup_oauth2::client::CustomHyperClientBuilder::from(
3099/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3100/// ),
3101/// ).build().await.unwrap();
3102///
3103/// let client = hyper_util::client::legacy::Client::builder(
3104/// hyper_util::rt::TokioExecutor::new()
3105/// )
3106/// .build(
3107/// hyper_rustls::HttpsConnectorBuilder::new()
3108/// .with_native_roots()
3109/// .unwrap()
3110/// .https_or_http()
3111/// .enable_http2()
3112/// .build()
3113/// );
3114/// let mut hub = Games::new(client, auth);
3115/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3116/// // like `games_player_tokens(...)`, `last_token_from_all_developer_games(...)`, `link_persona(...)`, `reset_persona(...)`, `retrieve_tokens(...)` and `unlink_persona(...)`
3117/// // to build up your call.
3118/// let rb = hub.recall();
3119/// # }
3120/// ```
3121pub struct RecallMethods<'a, C>
3122where
3123 C: 'a,
3124{
3125 hub: &'a Games<C>,
3126}
3127
3128impl<'a, C> common::MethodsBuilder for RecallMethods<'a, C> {}
3129
3130impl<'a, C> RecallMethods<'a, C> {
3131 /// Create a builder to help you perform the following task:
3132 ///
3133 /// Retrieve the Recall tokens from all requested games that is associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have an active PGS Player profile.
3134 ///
3135 /// # Arguments
3136 ///
3137 /// * `sessionId` - Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
3138 pub fn games_player_tokens(&self, session_id: &str) -> RecallGamesPlayerTokenCall<'a, C> {
3139 RecallGamesPlayerTokenCall {
3140 hub: self.hub,
3141 _session_id: session_id.to_string(),
3142 _application_ids: Default::default(),
3143 _delegate: Default::default(),
3144 _additional_params: Default::default(),
3145 _scopes: Default::default(),
3146 }
3147 }
3148
3149 /// Create a builder to help you perform the following task:
3150 ///
3151 /// Retrieve the last Recall token from all developer games that is associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have active PGS Player profile.
3152 ///
3153 /// # Arguments
3154 ///
3155 /// * `sessionId` - Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
3156 pub fn last_token_from_all_developer_games(
3157 &self,
3158 session_id: &str,
3159 ) -> RecallLastTokenFromAllDeveloperGameCall<'a, C> {
3160 RecallLastTokenFromAllDeveloperGameCall {
3161 hub: self.hub,
3162 _session_id: session_id.to_string(),
3163 _delegate: Default::default(),
3164 _additional_params: Default::default(),
3165 _scopes: Default::default(),
3166 }
3167 }
3168
3169 /// Create a builder to help you perform the following task:
3170 ///
3171 /// Associate the PGS Player principal encoded in the provided recall session id with an in-game account
3172 ///
3173 /// # Arguments
3174 ///
3175 /// * `request` - No description provided.
3176 pub fn link_persona(&self, request: LinkPersonaRequest) -> RecallLinkPersonaCall<'a, C> {
3177 RecallLinkPersonaCall {
3178 hub: self.hub,
3179 _request: request,
3180 _delegate: Default::default(),
3181 _additional_params: Default::default(),
3182 _scopes: Default::default(),
3183 }
3184 }
3185
3186 /// Create a builder to help you perform the following task:
3187 ///
3188 /// Delete all Recall tokens linking the given persona to any player (with or without a profile).
3189 ///
3190 /// # Arguments
3191 ///
3192 /// * `request` - No description provided.
3193 pub fn reset_persona(&self, request: ResetPersonaRequest) -> RecallResetPersonaCall<'a, C> {
3194 RecallResetPersonaCall {
3195 hub: self.hub,
3196 _request: request,
3197 _delegate: Default::default(),
3198 _additional_params: Default::default(),
3199 _scopes: Default::default(),
3200 }
3201 }
3202
3203 /// Create a builder to help you perform the following task:
3204 ///
3205 /// Retrieve all Recall tokens associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have active PGS Player profile.
3206 ///
3207 /// # Arguments
3208 ///
3209 /// * `sessionId` - Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
3210 pub fn retrieve_tokens(&self, session_id: &str) -> RecallRetrieveTokenCall<'a, C> {
3211 RecallRetrieveTokenCall {
3212 hub: self.hub,
3213 _session_id: session_id.to_string(),
3214 _delegate: Default::default(),
3215 _additional_params: Default::default(),
3216 _scopes: Default::default(),
3217 }
3218 }
3219
3220 /// Create a builder to help you perform the following task:
3221 ///
3222 /// Delete a Recall token linking the PGS Player principal identified by the Recall session and an in-game account identified either by the 'persona' or by the token value.
3223 ///
3224 /// # Arguments
3225 ///
3226 /// * `request` - No description provided.
3227 pub fn unlink_persona(&self, request: UnlinkPersonaRequest) -> RecallUnlinkPersonaCall<'a, C> {
3228 RecallUnlinkPersonaCall {
3229 hub: self.hub,
3230 _request: request,
3231 _delegate: Default::default(),
3232 _additional_params: Default::default(),
3233 _scopes: Default::default(),
3234 }
3235 }
3236}
3237
3238/// A builder providing access to all methods supported on *revision* resources.
3239/// It is not used directly, but through the [`Games`] hub.
3240///
3241/// # Example
3242///
3243/// Instantiate a resource builder
3244///
3245/// ```test_harness,no_run
3246/// extern crate hyper;
3247/// extern crate hyper_rustls;
3248/// extern crate google_games1 as games1;
3249///
3250/// # async fn dox() {
3251/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3252///
3253/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3254/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3255/// .with_native_roots()
3256/// .unwrap()
3257/// .https_only()
3258/// .enable_http2()
3259/// .build();
3260///
3261/// let executor = hyper_util::rt::TokioExecutor::new();
3262/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3263/// secret,
3264/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3265/// yup_oauth2::client::CustomHyperClientBuilder::from(
3266/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3267/// ),
3268/// ).build().await.unwrap();
3269///
3270/// let client = hyper_util::client::legacy::Client::builder(
3271/// hyper_util::rt::TokioExecutor::new()
3272/// )
3273/// .build(
3274/// hyper_rustls::HttpsConnectorBuilder::new()
3275/// .with_native_roots()
3276/// .unwrap()
3277/// .https_or_http()
3278/// .enable_http2()
3279/// .build()
3280/// );
3281/// let mut hub = Games::new(client, auth);
3282/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3283/// // like `check(...)`
3284/// // to build up your call.
3285/// let rb = hub.revisions();
3286/// # }
3287/// ```
3288pub struct RevisionMethods<'a, C>
3289where
3290 C: 'a,
3291{
3292 hub: &'a Games<C>,
3293}
3294
3295impl<'a, C> common::MethodsBuilder for RevisionMethods<'a, C> {}
3296
3297impl<'a, C> RevisionMethods<'a, C> {
3298 /// Create a builder to help you perform the following task:
3299 ///
3300 /// Checks whether the games client is out of date.
3301 ///
3302 /// # Arguments
3303 ///
3304 /// * `clientRevision` - Required. The revision of the client SDK used by your application. Format: `[PLATFORM_TYPE]:[VERSION_NUMBER]`. Possible values of `PLATFORM_TYPE` are: * `ANDROID` - Client is running the Android SDK. * `IOS` - Client is running the iOS SDK. * `WEB_APP` - Client is running as a Web App.
3305 pub fn check(&self, client_revision: &str) -> RevisionCheckCall<'a, C> {
3306 RevisionCheckCall {
3307 hub: self.hub,
3308 _client_revision: client_revision.to_string(),
3309 _delegate: Default::default(),
3310 _additional_params: Default::default(),
3311 _scopes: Default::default(),
3312 }
3313 }
3314}
3315
3316/// A builder providing access to all methods supported on *score* resources.
3317/// It is not used directly, but through the [`Games`] hub.
3318///
3319/// # Example
3320///
3321/// Instantiate a resource builder
3322///
3323/// ```test_harness,no_run
3324/// extern crate hyper;
3325/// extern crate hyper_rustls;
3326/// extern crate google_games1 as games1;
3327///
3328/// # async fn dox() {
3329/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3330///
3331/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3332/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3333/// .with_native_roots()
3334/// .unwrap()
3335/// .https_only()
3336/// .enable_http2()
3337/// .build();
3338///
3339/// let executor = hyper_util::rt::TokioExecutor::new();
3340/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3341/// secret,
3342/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3343/// yup_oauth2::client::CustomHyperClientBuilder::from(
3344/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3345/// ),
3346/// ).build().await.unwrap();
3347///
3348/// let client = hyper_util::client::legacy::Client::builder(
3349/// hyper_util::rt::TokioExecutor::new()
3350/// )
3351/// .build(
3352/// hyper_rustls::HttpsConnectorBuilder::new()
3353/// .with_native_roots()
3354/// .unwrap()
3355/// .https_or_http()
3356/// .enable_http2()
3357/// .build()
3358/// );
3359/// let mut hub = Games::new(client, auth);
3360/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3361/// // like `get(...)`, `list(...)`, `list_window(...)`, `submit(...)` and `submit_multiple(...)`
3362/// // to build up your call.
3363/// let rb = hub.scores();
3364/// # }
3365/// ```
3366pub struct ScoreMethods<'a, C>
3367where
3368 C: 'a,
3369{
3370 hub: &'a Games<C>,
3371}
3372
3373impl<'a, C> common::MethodsBuilder for ScoreMethods<'a, C> {}
3374
3375impl<'a, C> ScoreMethods<'a, C> {
3376 /// Create a builder to help you perform the following task:
3377 ///
3378 /// Get high scores, and optionally ranks, in leaderboards for the currently authenticated player. For a specific time span, `leaderboardId` can be set to `ALL` to retrieve data for all leaderboards in a given time span. `NOTE: You cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; only one parameter may be set to 'ALL'.
3379 ///
3380 /// # Arguments
3381 ///
3382 /// * `playerId` - A player ID. A value of `me` may be used in place of the authenticated player's ID.
3383 /// * `leaderboardId` - The ID of the leaderboard. Can be set to 'ALL' to retrieve data for all leaderboards for this application.
3384 /// * `timeSpan` - The time span for the scores and ranks you're requesting.
3385 pub fn get(
3386 &self,
3387 player_id: &str,
3388 leaderboard_id: &str,
3389 time_span: &str,
3390 ) -> ScoreGetCall<'a, C> {
3391 ScoreGetCall {
3392 hub: self.hub,
3393 _player_id: player_id.to_string(),
3394 _leaderboard_id: leaderboard_id.to_string(),
3395 _time_span: time_span.to_string(),
3396 _page_token: Default::default(),
3397 _max_results: Default::default(),
3398 _language: Default::default(),
3399 _include_rank_type: Default::default(),
3400 _delegate: Default::default(),
3401 _additional_params: Default::default(),
3402 _scopes: Default::default(),
3403 }
3404 }
3405
3406 /// Create a builder to help you perform the following task:
3407 ///
3408 /// Lists the scores in a leaderboard, starting from the top.
3409 ///
3410 /// # Arguments
3411 ///
3412 /// * `leaderboardId` - The ID of the leaderboard.
3413 /// * `collection` - The collection of scores you're requesting.
3414 /// * `timeSpan` - Required. The time span for the scores and ranks you're requesting.
3415 pub fn list(
3416 &self,
3417 leaderboard_id: &str,
3418 collection: &str,
3419 time_span: &str,
3420 ) -> ScoreListCall<'a, C> {
3421 ScoreListCall {
3422 hub: self.hub,
3423 _leaderboard_id: leaderboard_id.to_string(),
3424 _collection: collection.to_string(),
3425 _time_span: time_span.to_string(),
3426 _page_token: Default::default(),
3427 _max_results: Default::default(),
3428 _language: Default::default(),
3429 _delegate: Default::default(),
3430 _additional_params: Default::default(),
3431 _scopes: Default::default(),
3432 }
3433 }
3434
3435 /// Create a builder to help you perform the following task:
3436 ///
3437 /// Lists the scores in a leaderboard around (and including) a player's score.
3438 ///
3439 /// # Arguments
3440 ///
3441 /// * `leaderboardId` - The ID of the leaderboard.
3442 /// * `collection` - The collection of scores you're requesting.
3443 /// * `timeSpan` - Required. The time span for the scores and ranks you're requesting.
3444 pub fn list_window(
3445 &self,
3446 leaderboard_id: &str,
3447 collection: &str,
3448 time_span: &str,
3449 ) -> ScoreListWindowCall<'a, C> {
3450 ScoreListWindowCall {
3451 hub: self.hub,
3452 _leaderboard_id: leaderboard_id.to_string(),
3453 _collection: collection.to_string(),
3454 _time_span: time_span.to_string(),
3455 _return_top_if_absent: Default::default(),
3456 _results_above: Default::default(),
3457 _page_token: Default::default(),
3458 _max_results: Default::default(),
3459 _language: Default::default(),
3460 _delegate: Default::default(),
3461 _additional_params: Default::default(),
3462 _scopes: Default::default(),
3463 }
3464 }
3465
3466 /// Create a builder to help you perform the following task:
3467 ///
3468 /// Submits a score to the specified leaderboard.
3469 ///
3470 /// # Arguments
3471 ///
3472 /// * `leaderboardId` - The ID of the leaderboard.
3473 /// * `score` - Required. The score you're submitting. The submitted score is ignored if it is worse than a previously submitted score, where worse depends on the leaderboard sort order. The meaning of the score value depends on the leaderboard format type. For fixed-point, the score represents the raw value. For time, the score represents elapsed time in milliseconds. For currency, the score represents a value in micro units.
3474 pub fn submit(&self, leaderboard_id: &str, score: i64) -> ScoreSubmitCall<'a, C> {
3475 ScoreSubmitCall {
3476 hub: self.hub,
3477 _leaderboard_id: leaderboard_id.to_string(),
3478 _score: score,
3479 _score_tag: Default::default(),
3480 _language: Default::default(),
3481 _delegate: Default::default(),
3482 _additional_params: Default::default(),
3483 _scopes: Default::default(),
3484 }
3485 }
3486
3487 /// Create a builder to help you perform the following task:
3488 ///
3489 /// Submits multiple scores to leaderboards.
3490 ///
3491 /// # Arguments
3492 ///
3493 /// * `request` - No description provided.
3494 pub fn submit_multiple(
3495 &self,
3496 request: PlayerScoreSubmissionList,
3497 ) -> ScoreSubmitMultipleCall<'a, C> {
3498 ScoreSubmitMultipleCall {
3499 hub: self.hub,
3500 _request: request,
3501 _language: Default::default(),
3502 _delegate: Default::default(),
3503 _additional_params: Default::default(),
3504 _scopes: Default::default(),
3505 }
3506 }
3507}
3508
3509/// A builder providing access to all methods supported on *snapshot* resources.
3510/// It is not used directly, but through the [`Games`] hub.
3511///
3512/// # Example
3513///
3514/// Instantiate a resource builder
3515///
3516/// ```test_harness,no_run
3517/// extern crate hyper;
3518/// extern crate hyper_rustls;
3519/// extern crate google_games1 as games1;
3520///
3521/// # async fn dox() {
3522/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3523///
3524/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3525/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3526/// .with_native_roots()
3527/// .unwrap()
3528/// .https_only()
3529/// .enable_http2()
3530/// .build();
3531///
3532/// let executor = hyper_util::rt::TokioExecutor::new();
3533/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3534/// secret,
3535/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3536/// yup_oauth2::client::CustomHyperClientBuilder::from(
3537/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3538/// ),
3539/// ).build().await.unwrap();
3540///
3541/// let client = hyper_util::client::legacy::Client::builder(
3542/// hyper_util::rt::TokioExecutor::new()
3543/// )
3544/// .build(
3545/// hyper_rustls::HttpsConnectorBuilder::new()
3546/// .with_native_roots()
3547/// .unwrap()
3548/// .https_or_http()
3549/// .enable_http2()
3550/// .build()
3551/// );
3552/// let mut hub = Games::new(client, auth);
3553/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3554/// // like `get(...)` and `list(...)`
3555/// // to build up your call.
3556/// let rb = hub.snapshots();
3557/// # }
3558/// ```
3559pub struct SnapshotMethods<'a, C>
3560where
3561 C: 'a,
3562{
3563 hub: &'a Games<C>,
3564}
3565
3566impl<'a, C> common::MethodsBuilder for SnapshotMethods<'a, C> {}
3567
3568impl<'a, C> SnapshotMethods<'a, C> {
3569 /// Create a builder to help you perform the following task:
3570 ///
3571 /// Retrieves the metadata for a given snapshot ID.
3572 ///
3573 /// # Arguments
3574 ///
3575 /// * `snapshotId` - The ID of the snapshot.
3576 pub fn get(&self, snapshot_id: &str) -> SnapshotGetCall<'a, C> {
3577 SnapshotGetCall {
3578 hub: self.hub,
3579 _snapshot_id: snapshot_id.to_string(),
3580 _language: Default::default(),
3581 _delegate: Default::default(),
3582 _additional_params: Default::default(),
3583 _scopes: Default::default(),
3584 }
3585 }
3586
3587 /// Create a builder to help you perform the following task:
3588 ///
3589 /// Retrieves a list of snapshots created by your application for the player corresponding to the player ID.
3590 ///
3591 /// # Arguments
3592 ///
3593 /// * `playerId` - A player ID. A value of `me` may be used in place of the authenticated player's ID.
3594 pub fn list(&self, player_id: &str) -> SnapshotListCall<'a, C> {
3595 SnapshotListCall {
3596 hub: self.hub,
3597 _player_id: player_id.to_string(),
3598 _page_token: Default::default(),
3599 _max_results: Default::default(),
3600 _language: Default::default(),
3601 _delegate: Default::default(),
3602 _additional_params: Default::default(),
3603 _scopes: Default::default(),
3604 }
3605 }
3606}
3607
3608/// A builder providing access to all methods supported on *stat* resources.
3609/// It is not used directly, but through the [`Games`] hub.
3610///
3611/// # Example
3612///
3613/// Instantiate a resource builder
3614///
3615/// ```test_harness,no_run
3616/// extern crate hyper;
3617/// extern crate hyper_rustls;
3618/// extern crate google_games1 as games1;
3619///
3620/// # async fn dox() {
3621/// use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3622///
3623/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3624/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3625/// .with_native_roots()
3626/// .unwrap()
3627/// .https_only()
3628/// .enable_http2()
3629/// .build();
3630///
3631/// let executor = hyper_util::rt::TokioExecutor::new();
3632/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3633/// secret,
3634/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3635/// yup_oauth2::client::CustomHyperClientBuilder::from(
3636/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3637/// ),
3638/// ).build().await.unwrap();
3639///
3640/// let client = hyper_util::client::legacy::Client::builder(
3641/// hyper_util::rt::TokioExecutor::new()
3642/// )
3643/// .build(
3644/// hyper_rustls::HttpsConnectorBuilder::new()
3645/// .with_native_roots()
3646/// .unwrap()
3647/// .https_or_http()
3648/// .enable_http2()
3649/// .build()
3650/// );
3651/// let mut hub = Games::new(client, auth);
3652/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3653/// // like `get(...)`
3654/// // to build up your call.
3655/// let rb = hub.stats();
3656/// # }
3657/// ```
3658pub struct StatMethods<'a, C>
3659where
3660 C: 'a,
3661{
3662 hub: &'a Games<C>,
3663}
3664
3665impl<'a, C> common::MethodsBuilder for StatMethods<'a, C> {}
3666
3667impl<'a, C> StatMethods<'a, C> {
3668 /// Create a builder to help you perform the following task:
3669 ///
3670 /// Returns engagement and spend statistics in this application for the currently authenticated user.
3671 pub fn get(&self) -> StatGetCall<'a, C> {
3672 StatGetCall {
3673 hub: self.hub,
3674 _delegate: Default::default(),
3675 _additional_params: Default::default(),
3676 _scopes: Default::default(),
3677 }
3678 }
3679}
3680
3681// ###################
3682// CallBuilders ###
3683// #################
3684
3685/// Generates a Play Grouping API token for the PGS user identified by the attached credential.
3686///
3687/// A builder for the *generatePlayGroupingApiToken* method supported by a *accesstoken* resource.
3688/// It is not used directly, but through a [`AccesstokenMethods`] instance.
3689///
3690/// # Example
3691///
3692/// Instantiate a resource method builder
3693///
3694/// ```test_harness,no_run
3695/// # extern crate hyper;
3696/// # extern crate hyper_rustls;
3697/// # extern crate google_games1 as games1;
3698/// # async fn dox() {
3699/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3700///
3701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3702/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3703/// # .with_native_roots()
3704/// # .unwrap()
3705/// # .https_only()
3706/// # .enable_http2()
3707/// # .build();
3708///
3709/// # let executor = hyper_util::rt::TokioExecutor::new();
3710/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3711/// # secret,
3712/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3713/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3714/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3715/// # ),
3716/// # ).build().await.unwrap();
3717///
3718/// # let client = hyper_util::client::legacy::Client::builder(
3719/// # hyper_util::rt::TokioExecutor::new()
3720/// # )
3721/// # .build(
3722/// # hyper_rustls::HttpsConnectorBuilder::new()
3723/// # .with_native_roots()
3724/// # .unwrap()
3725/// # .https_or_http()
3726/// # .enable_http2()
3727/// # .build()
3728/// # );
3729/// # let mut hub = Games::new(client, auth);
3730/// // You can configure optional parameters by calling the respective setters at will, and
3731/// // execute the final call using `doit()`.
3732/// // Values shown here are possibly random and not representative !
3733/// let result = hub.accesstokens().generate_play_grouping_api_token()
3734/// .persona("takimata")
3735/// .package_name("amet.")
3736/// .doit().await;
3737/// # }
3738/// ```
3739pub struct AccesstokenGeneratePlayGroupingApiTokenCall<'a, C>
3740where
3741 C: 'a,
3742{
3743 hub: &'a Games<C>,
3744 _persona: Option<String>,
3745 _package_name: Option<String>,
3746 _delegate: Option<&'a mut dyn common::Delegate>,
3747 _additional_params: HashMap<String, String>,
3748 _scopes: BTreeSet<String>,
3749}
3750
3751impl<'a, C> common::CallBuilder for AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {}
3752
3753impl<'a, C> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C>
3754where
3755 C: common::Connector,
3756{
3757 /// Perform the operation you have build so far.
3758 pub async fn doit(
3759 mut self,
3760 ) -> common::Result<(common::Response, GeneratePlayGroupingApiTokenResponse)> {
3761 use std::borrow::Cow;
3762 use std::io::{Read, Seek};
3763
3764 use common::{url::Params, ToParts};
3765 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3766
3767 let mut dd = common::DefaultDelegate;
3768 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3769 dlg.begin(common::MethodInfo {
3770 id: "games.accesstokens.generatePlayGroupingApiToken",
3771 http_method: hyper::Method::POST,
3772 });
3773
3774 for &field in ["alt", "persona", "packageName"].iter() {
3775 if self._additional_params.contains_key(field) {
3776 dlg.finished(false);
3777 return Err(common::Error::FieldClash(field));
3778 }
3779 }
3780
3781 let mut params = Params::with_capacity(4 + self._additional_params.len());
3782 if let Some(value) = self._persona.as_ref() {
3783 params.push("persona", value);
3784 }
3785 if let Some(value) = self._package_name.as_ref() {
3786 params.push("packageName", value);
3787 }
3788
3789 params.extend(self._additional_params.iter());
3790
3791 params.push("alt", "json");
3792 let mut url =
3793 self.hub._base_url.clone() + "games/v1/accesstokens/generatePlayGroupingApiToken";
3794 if self._scopes.is_empty() {
3795 self._scopes.insert(Scope::Full.as_ref().to_string());
3796 }
3797
3798 let url = params.parse_with_url(&url);
3799
3800 loop {
3801 let token = match self
3802 .hub
3803 .auth
3804 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3805 .await
3806 {
3807 Ok(token) => token,
3808 Err(e) => match dlg.token(e) {
3809 Ok(token) => token,
3810 Err(e) => {
3811 dlg.finished(false);
3812 return Err(common::Error::MissingToken(e));
3813 }
3814 },
3815 };
3816 let mut req_result = {
3817 let client = &self.hub.client;
3818 dlg.pre_request();
3819 let mut req_builder = hyper::Request::builder()
3820 .method(hyper::Method::POST)
3821 .uri(url.as_str())
3822 .header(USER_AGENT, self.hub._user_agent.clone());
3823
3824 if let Some(token) = token.as_ref() {
3825 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3826 }
3827
3828 let request = req_builder
3829 .header(CONTENT_LENGTH, 0_u64)
3830 .body(common::to_body::<String>(None));
3831
3832 client.request(request.unwrap()).await
3833 };
3834
3835 match req_result {
3836 Err(err) => {
3837 if let common::Retry::After(d) = dlg.http_error(&err) {
3838 sleep(d).await;
3839 continue;
3840 }
3841 dlg.finished(false);
3842 return Err(common::Error::HttpError(err));
3843 }
3844 Ok(res) => {
3845 let (mut parts, body) = res.into_parts();
3846 let mut body = common::Body::new(body);
3847 if !parts.status.is_success() {
3848 let bytes = common::to_bytes(body).await.unwrap_or_default();
3849 let error = serde_json::from_str(&common::to_string(&bytes));
3850 let response = common::to_response(parts, bytes.into());
3851
3852 if let common::Retry::After(d) =
3853 dlg.http_failure(&response, error.as_ref().ok())
3854 {
3855 sleep(d).await;
3856 continue;
3857 }
3858
3859 dlg.finished(false);
3860
3861 return Err(match error {
3862 Ok(value) => common::Error::BadRequest(value),
3863 _ => common::Error::Failure(response),
3864 });
3865 }
3866 let response = {
3867 let bytes = common::to_bytes(body).await.unwrap_or_default();
3868 let encoded = common::to_string(&bytes);
3869 match serde_json::from_str(&encoded) {
3870 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3871 Err(error) => {
3872 dlg.response_json_decode_error(&encoded, &error);
3873 return Err(common::Error::JsonDecodeError(
3874 encoded.to_string(),
3875 error,
3876 ));
3877 }
3878 }
3879 };
3880
3881 dlg.finished(true);
3882 return Ok(response);
3883 }
3884 }
3885 }
3886 }
3887
3888 /// Required. Persona to associate with the token. Persona is a developer-provided stable identifier of the user. Must be deterministically generated (e.g. as a one-way hash) from the user account ID and user profile ID (if the app has the concept), according to the developer's own user identity system.
3889 ///
3890 /// Sets the *persona* query property to the given value.
3891 pub fn persona(
3892 mut self,
3893 new_value: &str,
3894 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {
3895 self._persona = Some(new_value.to_string());
3896 self
3897 }
3898 /// Required. App package name to generate the token for (e.g. com.example.mygame).
3899 ///
3900 /// Sets the *package name* query property to the given value.
3901 pub fn package_name(
3902 mut self,
3903 new_value: &str,
3904 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {
3905 self._package_name = Some(new_value.to_string());
3906 self
3907 }
3908 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3909 /// while executing the actual API request.
3910 ///
3911 /// ````text
3912 /// It should be used to handle progress information, and to implement a certain level of resilience.
3913 /// ````
3914 ///
3915 /// Sets the *delegate* property to the given value.
3916 pub fn delegate(
3917 mut self,
3918 new_value: &'a mut dyn common::Delegate,
3919 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {
3920 self._delegate = Some(new_value);
3921 self
3922 }
3923
3924 /// Set any additional parameter of the query string used in the request.
3925 /// It should be used to set parameters which are not yet available through their own
3926 /// setters.
3927 ///
3928 /// Please note that this method must not be used to set any of the known parameters
3929 /// which have their own setter method. If done anyway, the request will fail.
3930 ///
3931 /// # Additional Parameters
3932 ///
3933 /// * *$.xgafv* (query-string) - V1 error format.
3934 /// * *access_token* (query-string) - OAuth access token.
3935 /// * *alt* (query-string) - Data format for response.
3936 /// * *callback* (query-string) - JSONP
3937 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3938 /// * *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.
3939 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3940 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3941 /// * *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.
3942 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3943 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3944 pub fn param<T>(
3945 mut self,
3946 name: T,
3947 value: T,
3948 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C>
3949 where
3950 T: AsRef<str>,
3951 {
3952 self._additional_params
3953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3954 self
3955 }
3956
3957 /// Identifies the authorization scope for the method you are building.
3958 ///
3959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3960 /// [`Scope::Full`].
3961 ///
3962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3963 /// tokens for more than one scope.
3964 ///
3965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3967 /// sufficient, a read-write scope will do as well.
3968 pub fn add_scope<St>(mut self, scope: St) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C>
3969 where
3970 St: AsRef<str>,
3971 {
3972 self._scopes.insert(String::from(scope.as_ref()));
3973 self
3974 }
3975 /// Identifies the authorization scope(s) for the method you are building.
3976 ///
3977 /// See [`Self::add_scope()`] for details.
3978 pub fn add_scopes<I, St>(
3979 mut self,
3980 scopes: I,
3981 ) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C>
3982 where
3983 I: IntoIterator<Item = St>,
3984 St: AsRef<str>,
3985 {
3986 self._scopes
3987 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3988 self
3989 }
3990
3991 /// Removes all scopes, and no default scope will be used either.
3992 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3993 /// for details).
3994 pub fn clear_scopes(mut self) -> AccesstokenGeneratePlayGroupingApiTokenCall<'a, C> {
3995 self._scopes.clear();
3996 self
3997 }
3998}
3999
4000/// Generates a Play Grouping API token for the PGS user identified by the Recall session ID provided in the request.
4001///
4002/// A builder for the *generateRecallPlayGroupingApiToken* method supported by a *accesstoken* resource.
4003/// It is not used directly, but through a [`AccesstokenMethods`] instance.
4004///
4005/// # Example
4006///
4007/// Instantiate a resource method builder
4008///
4009/// ```test_harness,no_run
4010/// # extern crate hyper;
4011/// # extern crate hyper_rustls;
4012/// # extern crate google_games1 as games1;
4013/// # async fn dox() {
4014/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4015///
4016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4017/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4018/// # .with_native_roots()
4019/// # .unwrap()
4020/// # .https_only()
4021/// # .enable_http2()
4022/// # .build();
4023///
4024/// # let executor = hyper_util::rt::TokioExecutor::new();
4025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4026/// # secret,
4027/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4028/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4029/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4030/// # ),
4031/// # ).build().await.unwrap();
4032///
4033/// # let client = hyper_util::client::legacy::Client::builder(
4034/// # hyper_util::rt::TokioExecutor::new()
4035/// # )
4036/// # .build(
4037/// # hyper_rustls::HttpsConnectorBuilder::new()
4038/// # .with_native_roots()
4039/// # .unwrap()
4040/// # .https_or_http()
4041/// # .enable_http2()
4042/// # .build()
4043/// # );
4044/// # let mut hub = Games::new(client, auth);
4045/// // You can configure optional parameters by calling the respective setters at will, and
4046/// // execute the final call using `doit()`.
4047/// // Values shown here are possibly random and not representative !
4048/// let result = hub.accesstokens().generate_recall_play_grouping_api_token()
4049/// .recall_session_id("duo")
4050/// .persona("ipsum")
4051/// .package_name("gubergren")
4052/// .doit().await;
4053/// # }
4054/// ```
4055pub struct AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C>
4056where
4057 C: 'a,
4058{
4059 hub: &'a Games<C>,
4060 _recall_session_id: Option<String>,
4061 _persona: Option<String>,
4062 _package_name: Option<String>,
4063 _delegate: Option<&'a mut dyn common::Delegate>,
4064 _additional_params: HashMap<String, String>,
4065 _scopes: BTreeSet<String>,
4066}
4067
4068impl<'a, C> common::CallBuilder for AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {}
4069
4070impl<'a, C> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C>
4071where
4072 C: common::Connector,
4073{
4074 /// Perform the operation you have build so far.
4075 pub async fn doit(
4076 mut self,
4077 ) -> common::Result<(common::Response, GenerateRecallPlayGroupingApiTokenResponse)> {
4078 use std::borrow::Cow;
4079 use std::io::{Read, Seek};
4080
4081 use common::{url::Params, ToParts};
4082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4083
4084 let mut dd = common::DefaultDelegate;
4085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4086 dlg.begin(common::MethodInfo {
4087 id: "games.accesstokens.generateRecallPlayGroupingApiToken",
4088 http_method: hyper::Method::POST,
4089 });
4090
4091 for &field in ["alt", "recallSessionId", "persona", "packageName"].iter() {
4092 if self._additional_params.contains_key(field) {
4093 dlg.finished(false);
4094 return Err(common::Error::FieldClash(field));
4095 }
4096 }
4097
4098 let mut params = Params::with_capacity(5 + self._additional_params.len());
4099 if let Some(value) = self._recall_session_id.as_ref() {
4100 params.push("recallSessionId", value);
4101 }
4102 if let Some(value) = self._persona.as_ref() {
4103 params.push("persona", value);
4104 }
4105 if let Some(value) = self._package_name.as_ref() {
4106 params.push("packageName", value);
4107 }
4108
4109 params.extend(self._additional_params.iter());
4110
4111 params.push("alt", "json");
4112 let mut url =
4113 self.hub._base_url.clone() + "games/v1/accesstokens/generateRecallPlayGroupingApiToken";
4114 if self._scopes.is_empty() {
4115 self._scopes
4116 .insert(Scope::Androidpublisher.as_ref().to_string());
4117 }
4118
4119 let url = params.parse_with_url(&url);
4120
4121 loop {
4122 let token = match self
4123 .hub
4124 .auth
4125 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4126 .await
4127 {
4128 Ok(token) => token,
4129 Err(e) => match dlg.token(e) {
4130 Ok(token) => token,
4131 Err(e) => {
4132 dlg.finished(false);
4133 return Err(common::Error::MissingToken(e));
4134 }
4135 },
4136 };
4137 let mut req_result = {
4138 let client = &self.hub.client;
4139 dlg.pre_request();
4140 let mut req_builder = hyper::Request::builder()
4141 .method(hyper::Method::POST)
4142 .uri(url.as_str())
4143 .header(USER_AGENT, self.hub._user_agent.clone());
4144
4145 if let Some(token) = token.as_ref() {
4146 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4147 }
4148
4149 let request = req_builder
4150 .header(CONTENT_LENGTH, 0_u64)
4151 .body(common::to_body::<String>(None));
4152
4153 client.request(request.unwrap()).await
4154 };
4155
4156 match req_result {
4157 Err(err) => {
4158 if let common::Retry::After(d) = dlg.http_error(&err) {
4159 sleep(d).await;
4160 continue;
4161 }
4162 dlg.finished(false);
4163 return Err(common::Error::HttpError(err));
4164 }
4165 Ok(res) => {
4166 let (mut parts, body) = res.into_parts();
4167 let mut body = common::Body::new(body);
4168 if !parts.status.is_success() {
4169 let bytes = common::to_bytes(body).await.unwrap_or_default();
4170 let error = serde_json::from_str(&common::to_string(&bytes));
4171 let response = common::to_response(parts, bytes.into());
4172
4173 if let common::Retry::After(d) =
4174 dlg.http_failure(&response, error.as_ref().ok())
4175 {
4176 sleep(d).await;
4177 continue;
4178 }
4179
4180 dlg.finished(false);
4181
4182 return Err(match error {
4183 Ok(value) => common::Error::BadRequest(value),
4184 _ => common::Error::Failure(response),
4185 });
4186 }
4187 let response = {
4188 let bytes = common::to_bytes(body).await.unwrap_or_default();
4189 let encoded = common::to_string(&bytes);
4190 match serde_json::from_str(&encoded) {
4191 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4192 Err(error) => {
4193 dlg.response_json_decode_error(&encoded, &error);
4194 return Err(common::Error::JsonDecodeError(
4195 encoded.to_string(),
4196 error,
4197 ));
4198 }
4199 }
4200 };
4201
4202 dlg.finished(true);
4203 return Ok(response);
4204 }
4205 }
4206 }
4207 }
4208
4209 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application. See https://developer.android.com/games/pgs/recall/recall-setup on how to integrate with Recall and get session ID.
4210 ///
4211 /// Sets the *recall session id* query property to the given value.
4212 pub fn recall_session_id(
4213 mut self,
4214 new_value: &str,
4215 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
4216 self._recall_session_id = Some(new_value.to_string());
4217 self
4218 }
4219 /// Required. Persona to associate with the token. Persona is a developer-provided stable identifier of the user. Must be deterministically generated (e.g. as a one-way hash) from the user account ID and user profile ID (if the app has the concept), according to the developer's own user identity system.
4220 ///
4221 /// Sets the *persona* query property to the given value.
4222 pub fn persona(
4223 mut self,
4224 new_value: &str,
4225 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
4226 self._persona = Some(new_value.to_string());
4227 self
4228 }
4229 /// Required. App package name to generate the token for (e.g. com.example.mygame).
4230 ///
4231 /// Sets the *package name* query property to the given value.
4232 pub fn package_name(
4233 mut self,
4234 new_value: &str,
4235 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
4236 self._package_name = Some(new_value.to_string());
4237 self
4238 }
4239 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4240 /// while executing the actual API request.
4241 ///
4242 /// ````text
4243 /// It should be used to handle progress information, and to implement a certain level of resilience.
4244 /// ````
4245 ///
4246 /// Sets the *delegate* property to the given value.
4247 pub fn delegate(
4248 mut self,
4249 new_value: &'a mut dyn common::Delegate,
4250 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
4251 self._delegate = Some(new_value);
4252 self
4253 }
4254
4255 /// Set any additional parameter of the query string used in the request.
4256 /// It should be used to set parameters which are not yet available through their own
4257 /// setters.
4258 ///
4259 /// Please note that this method must not be used to set any of the known parameters
4260 /// which have their own setter method. If done anyway, the request will fail.
4261 ///
4262 /// # Additional Parameters
4263 ///
4264 /// * *$.xgafv* (query-string) - V1 error format.
4265 /// * *access_token* (query-string) - OAuth access token.
4266 /// * *alt* (query-string) - Data format for response.
4267 /// * *callback* (query-string) - JSONP
4268 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4269 /// * *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.
4270 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4271 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4272 /// * *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.
4273 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4274 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4275 pub fn param<T>(
4276 mut self,
4277 name: T,
4278 value: T,
4279 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C>
4280 where
4281 T: AsRef<str>,
4282 {
4283 self._additional_params
4284 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4285 self
4286 }
4287
4288 /// Identifies the authorization scope for the method you are building.
4289 ///
4290 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4291 /// [`Scope::Androidpublisher`].
4292 ///
4293 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4294 /// tokens for more than one scope.
4295 ///
4296 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4297 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4298 /// sufficient, a read-write scope will do as well.
4299 pub fn add_scope<St>(
4300 mut self,
4301 scope: St,
4302 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C>
4303 where
4304 St: AsRef<str>,
4305 {
4306 self._scopes.insert(String::from(scope.as_ref()));
4307 self
4308 }
4309 /// Identifies the authorization scope(s) for the method you are building.
4310 ///
4311 /// See [`Self::add_scope()`] for details.
4312 pub fn add_scopes<I, St>(
4313 mut self,
4314 scopes: I,
4315 ) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C>
4316 where
4317 I: IntoIterator<Item = St>,
4318 St: AsRef<str>,
4319 {
4320 self._scopes
4321 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4322 self
4323 }
4324
4325 /// Removes all scopes, and no default scope will be used either.
4326 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4327 /// for details).
4328 pub fn clear_scopes(mut self) -> AccesstokenGenerateRecallPlayGroupingApiTokenCall<'a, C> {
4329 self._scopes.clear();
4330 self
4331 }
4332}
4333
4334/// Lists all the achievement definitions for your application.
4335///
4336/// A builder for the *list* method supported by a *achievementDefinition* resource.
4337/// It is not used directly, but through a [`AchievementDefinitionMethods`] instance.
4338///
4339/// # Example
4340///
4341/// Instantiate a resource method builder
4342///
4343/// ```test_harness,no_run
4344/// # extern crate hyper;
4345/// # extern crate hyper_rustls;
4346/// # extern crate google_games1 as games1;
4347/// # async fn dox() {
4348/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4349///
4350/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4351/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4352/// # .with_native_roots()
4353/// # .unwrap()
4354/// # .https_only()
4355/// # .enable_http2()
4356/// # .build();
4357///
4358/// # let executor = hyper_util::rt::TokioExecutor::new();
4359/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4360/// # secret,
4361/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4362/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4363/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4364/// # ),
4365/// # ).build().await.unwrap();
4366///
4367/// # let client = hyper_util::client::legacy::Client::builder(
4368/// # hyper_util::rt::TokioExecutor::new()
4369/// # )
4370/// # .build(
4371/// # hyper_rustls::HttpsConnectorBuilder::new()
4372/// # .with_native_roots()
4373/// # .unwrap()
4374/// # .https_or_http()
4375/// # .enable_http2()
4376/// # .build()
4377/// # );
4378/// # let mut hub = Games::new(client, auth);
4379/// // You can configure optional parameters by calling the respective setters at will, and
4380/// // execute the final call using `doit()`.
4381/// // Values shown here are possibly random and not representative !
4382/// let result = hub.achievement_definitions().list()
4383/// .page_token("Lorem")
4384/// .max_results(-12)
4385/// .language("eos")
4386/// .doit().await;
4387/// # }
4388/// ```
4389pub struct AchievementDefinitionListCall<'a, C>
4390where
4391 C: 'a,
4392{
4393 hub: &'a Games<C>,
4394 _page_token: Option<String>,
4395 _max_results: Option<i32>,
4396 _language: Option<String>,
4397 _delegate: Option<&'a mut dyn common::Delegate>,
4398 _additional_params: HashMap<String, String>,
4399 _scopes: BTreeSet<String>,
4400}
4401
4402impl<'a, C> common::CallBuilder for AchievementDefinitionListCall<'a, C> {}
4403
4404impl<'a, C> AchievementDefinitionListCall<'a, C>
4405where
4406 C: common::Connector,
4407{
4408 /// Perform the operation you have build so far.
4409 pub async fn doit(
4410 mut self,
4411 ) -> common::Result<(common::Response, AchievementDefinitionsListResponse)> {
4412 use std::borrow::Cow;
4413 use std::io::{Read, Seek};
4414
4415 use common::{url::Params, ToParts};
4416 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4417
4418 let mut dd = common::DefaultDelegate;
4419 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4420 dlg.begin(common::MethodInfo {
4421 id: "games.achievementDefinitions.list",
4422 http_method: hyper::Method::GET,
4423 });
4424
4425 for &field in ["alt", "pageToken", "maxResults", "language"].iter() {
4426 if self._additional_params.contains_key(field) {
4427 dlg.finished(false);
4428 return Err(common::Error::FieldClash(field));
4429 }
4430 }
4431
4432 let mut params = Params::with_capacity(5 + self._additional_params.len());
4433 if let Some(value) = self._page_token.as_ref() {
4434 params.push("pageToken", value);
4435 }
4436 if let Some(value) = self._max_results.as_ref() {
4437 params.push("maxResults", value.to_string());
4438 }
4439 if let Some(value) = self._language.as_ref() {
4440 params.push("language", value);
4441 }
4442
4443 params.extend(self._additional_params.iter());
4444
4445 params.push("alt", "json");
4446 let mut url = self.hub._base_url.clone() + "games/v1/achievements";
4447 if self._scopes.is_empty() {
4448 self._scopes.insert(Scope::Full.as_ref().to_string());
4449 }
4450
4451 let url = params.parse_with_url(&url);
4452
4453 loop {
4454 let token = match self
4455 .hub
4456 .auth
4457 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4458 .await
4459 {
4460 Ok(token) => token,
4461 Err(e) => match dlg.token(e) {
4462 Ok(token) => token,
4463 Err(e) => {
4464 dlg.finished(false);
4465 return Err(common::Error::MissingToken(e));
4466 }
4467 },
4468 };
4469 let mut req_result = {
4470 let client = &self.hub.client;
4471 dlg.pre_request();
4472 let mut req_builder = hyper::Request::builder()
4473 .method(hyper::Method::GET)
4474 .uri(url.as_str())
4475 .header(USER_AGENT, self.hub._user_agent.clone());
4476
4477 if let Some(token) = token.as_ref() {
4478 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4479 }
4480
4481 let request = req_builder
4482 .header(CONTENT_LENGTH, 0_u64)
4483 .body(common::to_body::<String>(None));
4484
4485 client.request(request.unwrap()).await
4486 };
4487
4488 match req_result {
4489 Err(err) => {
4490 if let common::Retry::After(d) = dlg.http_error(&err) {
4491 sleep(d).await;
4492 continue;
4493 }
4494 dlg.finished(false);
4495 return Err(common::Error::HttpError(err));
4496 }
4497 Ok(res) => {
4498 let (mut parts, body) = res.into_parts();
4499 let mut body = common::Body::new(body);
4500 if !parts.status.is_success() {
4501 let bytes = common::to_bytes(body).await.unwrap_or_default();
4502 let error = serde_json::from_str(&common::to_string(&bytes));
4503 let response = common::to_response(parts, bytes.into());
4504
4505 if let common::Retry::After(d) =
4506 dlg.http_failure(&response, error.as_ref().ok())
4507 {
4508 sleep(d).await;
4509 continue;
4510 }
4511
4512 dlg.finished(false);
4513
4514 return Err(match error {
4515 Ok(value) => common::Error::BadRequest(value),
4516 _ => common::Error::Failure(response),
4517 });
4518 }
4519 let response = {
4520 let bytes = common::to_bytes(body).await.unwrap_or_default();
4521 let encoded = common::to_string(&bytes);
4522 match serde_json::from_str(&encoded) {
4523 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4524 Err(error) => {
4525 dlg.response_json_decode_error(&encoded, &error);
4526 return Err(common::Error::JsonDecodeError(
4527 encoded.to_string(),
4528 error,
4529 ));
4530 }
4531 }
4532 };
4533
4534 dlg.finished(true);
4535 return Ok(response);
4536 }
4537 }
4538 }
4539 }
4540
4541 /// The token returned by the previous request.
4542 ///
4543 /// Sets the *page token* query property to the given value.
4544 pub fn page_token(mut self, new_value: &str) -> AchievementDefinitionListCall<'a, C> {
4545 self._page_token = Some(new_value.to_string());
4546 self
4547 }
4548 /// The maximum number of achievement resources to return in the response, used for paging. For any response, the actual number of achievement resources returned may be less than the specified `maxResults`.
4549 ///
4550 /// Sets the *max results* query property to the given value.
4551 pub fn max_results(mut self, new_value: i32) -> AchievementDefinitionListCall<'a, C> {
4552 self._max_results = Some(new_value);
4553 self
4554 }
4555 /// The preferred language to use for strings returned by this method.
4556 ///
4557 /// Sets the *language* query property to the given value.
4558 pub fn language(mut self, new_value: &str) -> AchievementDefinitionListCall<'a, C> {
4559 self._language = Some(new_value.to_string());
4560 self
4561 }
4562 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4563 /// while executing the actual API request.
4564 ///
4565 /// ````text
4566 /// It should be used to handle progress information, and to implement a certain level of resilience.
4567 /// ````
4568 ///
4569 /// Sets the *delegate* property to the given value.
4570 pub fn delegate(
4571 mut self,
4572 new_value: &'a mut dyn common::Delegate,
4573 ) -> AchievementDefinitionListCall<'a, C> {
4574 self._delegate = Some(new_value);
4575 self
4576 }
4577
4578 /// Set any additional parameter of the query string used in the request.
4579 /// It should be used to set parameters which are not yet available through their own
4580 /// setters.
4581 ///
4582 /// Please note that this method must not be used to set any of the known parameters
4583 /// which have their own setter method. If done anyway, the request will fail.
4584 ///
4585 /// # Additional Parameters
4586 ///
4587 /// * *$.xgafv* (query-string) - V1 error format.
4588 /// * *access_token* (query-string) - OAuth access token.
4589 /// * *alt* (query-string) - Data format for response.
4590 /// * *callback* (query-string) - JSONP
4591 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4592 /// * *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.
4593 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4594 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4595 /// * *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.
4596 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4597 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4598 pub fn param<T>(mut self, name: T, value: T) -> AchievementDefinitionListCall<'a, C>
4599 where
4600 T: AsRef<str>,
4601 {
4602 self._additional_params
4603 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4604 self
4605 }
4606
4607 /// Identifies the authorization scope for the method you are building.
4608 ///
4609 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4610 /// [`Scope::Full`].
4611 ///
4612 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4613 /// tokens for more than one scope.
4614 ///
4615 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4616 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4617 /// sufficient, a read-write scope will do as well.
4618 pub fn add_scope<St>(mut self, scope: St) -> AchievementDefinitionListCall<'a, C>
4619 where
4620 St: AsRef<str>,
4621 {
4622 self._scopes.insert(String::from(scope.as_ref()));
4623 self
4624 }
4625 /// Identifies the authorization scope(s) for the method you are building.
4626 ///
4627 /// See [`Self::add_scope()`] for details.
4628 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementDefinitionListCall<'a, C>
4629 where
4630 I: IntoIterator<Item = St>,
4631 St: AsRef<str>,
4632 {
4633 self._scopes
4634 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4635 self
4636 }
4637
4638 /// Removes all scopes, and no default scope will be used either.
4639 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4640 /// for details).
4641 pub fn clear_scopes(mut self) -> AchievementDefinitionListCall<'a, C> {
4642 self._scopes.clear();
4643 self
4644 }
4645}
4646
4647/// Increments the steps of the achievement with the given ID for the currently authenticated player.
4648///
4649/// A builder for the *increment* method supported by a *achievement* resource.
4650/// It is not used directly, but through a [`AchievementMethods`] instance.
4651///
4652/// # Example
4653///
4654/// Instantiate a resource method builder
4655///
4656/// ```test_harness,no_run
4657/// # extern crate hyper;
4658/// # extern crate hyper_rustls;
4659/// # extern crate google_games1 as games1;
4660/// # async fn dox() {
4661/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4662///
4663/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4664/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4665/// # .with_native_roots()
4666/// # .unwrap()
4667/// # .https_only()
4668/// # .enable_http2()
4669/// # .build();
4670///
4671/// # let executor = hyper_util::rt::TokioExecutor::new();
4672/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4673/// # secret,
4674/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4675/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4676/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4677/// # ),
4678/// # ).build().await.unwrap();
4679///
4680/// # let client = hyper_util::client::legacy::Client::builder(
4681/// # hyper_util::rt::TokioExecutor::new()
4682/// # )
4683/// # .build(
4684/// # hyper_rustls::HttpsConnectorBuilder::new()
4685/// # .with_native_roots()
4686/// # .unwrap()
4687/// # .https_or_http()
4688/// # .enable_http2()
4689/// # .build()
4690/// # );
4691/// # let mut hub = Games::new(client, auth);
4692/// // You can configure optional parameters by calling the respective setters at will, and
4693/// // execute the final call using `doit()`.
4694/// // Values shown here are possibly random and not representative !
4695/// let result = hub.achievements().increment("achievementId", -17)
4696/// .request_id(-55)
4697/// .doit().await;
4698/// # }
4699/// ```
4700pub struct AchievementIncrementCall<'a, C>
4701where
4702 C: 'a,
4703{
4704 hub: &'a Games<C>,
4705 _achievement_id: String,
4706 _steps_to_increment: i32,
4707 _request_id: Option<i64>,
4708 _delegate: Option<&'a mut dyn common::Delegate>,
4709 _additional_params: HashMap<String, String>,
4710 _scopes: BTreeSet<String>,
4711}
4712
4713impl<'a, C> common::CallBuilder for AchievementIncrementCall<'a, C> {}
4714
4715impl<'a, C> AchievementIncrementCall<'a, C>
4716where
4717 C: common::Connector,
4718{
4719 /// Perform the operation you have build so far.
4720 pub async fn doit(
4721 mut self,
4722 ) -> common::Result<(common::Response, AchievementIncrementResponse)> {
4723 use std::borrow::Cow;
4724 use std::io::{Read, Seek};
4725
4726 use common::{url::Params, ToParts};
4727 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4728
4729 let mut dd = common::DefaultDelegate;
4730 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4731 dlg.begin(common::MethodInfo {
4732 id: "games.achievements.increment",
4733 http_method: hyper::Method::POST,
4734 });
4735
4736 for &field in ["alt", "achievementId", "stepsToIncrement", "requestId"].iter() {
4737 if self._additional_params.contains_key(field) {
4738 dlg.finished(false);
4739 return Err(common::Error::FieldClash(field));
4740 }
4741 }
4742
4743 let mut params = Params::with_capacity(5 + self._additional_params.len());
4744 params.push("achievementId", self._achievement_id);
4745 params.push("stepsToIncrement", self._steps_to_increment.to_string());
4746 if let Some(value) = self._request_id.as_ref() {
4747 params.push("requestId", value.to_string());
4748 }
4749
4750 params.extend(self._additional_params.iter());
4751
4752 params.push("alt", "json");
4753 let mut url =
4754 self.hub._base_url.clone() + "games/v1/achievements/{achievementId}/increment";
4755 if self._scopes.is_empty() {
4756 self._scopes.insert(Scope::Full.as_ref().to_string());
4757 }
4758
4759 #[allow(clippy::single_element_loop)]
4760 for &(find_this, param_name) in [("{achievementId}", "achievementId")].iter() {
4761 url = params.uri_replacement(url, param_name, find_this, false);
4762 }
4763 {
4764 let to_remove = ["achievementId"];
4765 params.remove_params(&to_remove);
4766 }
4767
4768 let url = params.parse_with_url(&url);
4769
4770 loop {
4771 let token = match self
4772 .hub
4773 .auth
4774 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4775 .await
4776 {
4777 Ok(token) => token,
4778 Err(e) => match dlg.token(e) {
4779 Ok(token) => token,
4780 Err(e) => {
4781 dlg.finished(false);
4782 return Err(common::Error::MissingToken(e));
4783 }
4784 },
4785 };
4786 let mut req_result = {
4787 let client = &self.hub.client;
4788 dlg.pre_request();
4789 let mut req_builder = hyper::Request::builder()
4790 .method(hyper::Method::POST)
4791 .uri(url.as_str())
4792 .header(USER_AGENT, self.hub._user_agent.clone());
4793
4794 if let Some(token) = token.as_ref() {
4795 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4796 }
4797
4798 let request = req_builder
4799 .header(CONTENT_LENGTH, 0_u64)
4800 .body(common::to_body::<String>(None));
4801
4802 client.request(request.unwrap()).await
4803 };
4804
4805 match req_result {
4806 Err(err) => {
4807 if let common::Retry::After(d) = dlg.http_error(&err) {
4808 sleep(d).await;
4809 continue;
4810 }
4811 dlg.finished(false);
4812 return Err(common::Error::HttpError(err));
4813 }
4814 Ok(res) => {
4815 let (mut parts, body) = res.into_parts();
4816 let mut body = common::Body::new(body);
4817 if !parts.status.is_success() {
4818 let bytes = common::to_bytes(body).await.unwrap_or_default();
4819 let error = serde_json::from_str(&common::to_string(&bytes));
4820 let response = common::to_response(parts, bytes.into());
4821
4822 if let common::Retry::After(d) =
4823 dlg.http_failure(&response, error.as_ref().ok())
4824 {
4825 sleep(d).await;
4826 continue;
4827 }
4828
4829 dlg.finished(false);
4830
4831 return Err(match error {
4832 Ok(value) => common::Error::BadRequest(value),
4833 _ => common::Error::Failure(response),
4834 });
4835 }
4836 let response = {
4837 let bytes = common::to_bytes(body).await.unwrap_or_default();
4838 let encoded = common::to_string(&bytes);
4839 match serde_json::from_str(&encoded) {
4840 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4841 Err(error) => {
4842 dlg.response_json_decode_error(&encoded, &error);
4843 return Err(common::Error::JsonDecodeError(
4844 encoded.to_string(),
4845 error,
4846 ));
4847 }
4848 }
4849 };
4850
4851 dlg.finished(true);
4852 return Ok(response);
4853 }
4854 }
4855 }
4856 }
4857
4858 /// The ID of the achievement used by this method.
4859 ///
4860 /// Sets the *achievement id* path property to the given value.
4861 ///
4862 /// Even though the property as already been set when instantiating this call,
4863 /// we provide this method for API completeness.
4864 pub fn achievement_id(mut self, new_value: &str) -> AchievementIncrementCall<'a, C> {
4865 self._achievement_id = new_value.to_string();
4866 self
4867 }
4868 /// Required. The number of steps to increment.
4869 ///
4870 /// Sets the *steps to increment* query property to the given value.
4871 ///
4872 /// Even though the property as already been set when instantiating this call,
4873 /// we provide this method for API completeness.
4874 pub fn steps_to_increment(mut self, new_value: i32) -> AchievementIncrementCall<'a, C> {
4875 self._steps_to_increment = new_value;
4876 self
4877 }
4878 /// A randomly generated numeric ID for each request specified by the caller. This number is used at the server to ensure that the request is handled correctly across retries.
4879 ///
4880 /// Sets the *request id* query property to the given value.
4881 pub fn request_id(mut self, new_value: i64) -> AchievementIncrementCall<'a, C> {
4882 self._request_id = Some(new_value);
4883 self
4884 }
4885 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4886 /// while executing the actual API request.
4887 ///
4888 /// ````text
4889 /// It should be used to handle progress information, and to implement a certain level of resilience.
4890 /// ````
4891 ///
4892 /// Sets the *delegate* property to the given value.
4893 pub fn delegate(
4894 mut self,
4895 new_value: &'a mut dyn common::Delegate,
4896 ) -> AchievementIncrementCall<'a, C> {
4897 self._delegate = Some(new_value);
4898 self
4899 }
4900
4901 /// Set any additional parameter of the query string used in the request.
4902 /// It should be used to set parameters which are not yet available through their own
4903 /// setters.
4904 ///
4905 /// Please note that this method must not be used to set any of the known parameters
4906 /// which have their own setter method. If done anyway, the request will fail.
4907 ///
4908 /// # Additional Parameters
4909 ///
4910 /// * *$.xgafv* (query-string) - V1 error format.
4911 /// * *access_token* (query-string) - OAuth access token.
4912 /// * *alt* (query-string) - Data format for response.
4913 /// * *callback* (query-string) - JSONP
4914 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4915 /// * *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.
4916 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4917 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4918 /// * *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.
4919 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4920 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4921 pub fn param<T>(mut self, name: T, value: T) -> AchievementIncrementCall<'a, C>
4922 where
4923 T: AsRef<str>,
4924 {
4925 self._additional_params
4926 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4927 self
4928 }
4929
4930 /// Identifies the authorization scope for the method you are building.
4931 ///
4932 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4933 /// [`Scope::Full`].
4934 ///
4935 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4936 /// tokens for more than one scope.
4937 ///
4938 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4939 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4940 /// sufficient, a read-write scope will do as well.
4941 pub fn add_scope<St>(mut self, scope: St) -> AchievementIncrementCall<'a, C>
4942 where
4943 St: AsRef<str>,
4944 {
4945 self._scopes.insert(String::from(scope.as_ref()));
4946 self
4947 }
4948 /// Identifies the authorization scope(s) for the method you are building.
4949 ///
4950 /// See [`Self::add_scope()`] for details.
4951 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementIncrementCall<'a, C>
4952 where
4953 I: IntoIterator<Item = St>,
4954 St: AsRef<str>,
4955 {
4956 self._scopes
4957 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4958 self
4959 }
4960
4961 /// Removes all scopes, and no default scope will be used either.
4962 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4963 /// for details).
4964 pub fn clear_scopes(mut self) -> AchievementIncrementCall<'a, C> {
4965 self._scopes.clear();
4966 self
4967 }
4968}
4969
4970/// Lists the progress for all your application's achievements for the currently authenticated player.
4971///
4972/// A builder for the *list* method supported by a *achievement* resource.
4973/// It is not used directly, but through a [`AchievementMethods`] instance.
4974///
4975/// # Example
4976///
4977/// Instantiate a resource method builder
4978///
4979/// ```test_harness,no_run
4980/// # extern crate hyper;
4981/// # extern crate hyper_rustls;
4982/// # extern crate google_games1 as games1;
4983/// # async fn dox() {
4984/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4985///
4986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4987/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4988/// # .with_native_roots()
4989/// # .unwrap()
4990/// # .https_only()
4991/// # .enable_http2()
4992/// # .build();
4993///
4994/// # let executor = hyper_util::rt::TokioExecutor::new();
4995/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4996/// # secret,
4997/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4998/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4999/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5000/// # ),
5001/// # ).build().await.unwrap();
5002///
5003/// # let client = hyper_util::client::legacy::Client::builder(
5004/// # hyper_util::rt::TokioExecutor::new()
5005/// # )
5006/// # .build(
5007/// # hyper_rustls::HttpsConnectorBuilder::new()
5008/// # .with_native_roots()
5009/// # .unwrap()
5010/// # .https_or_http()
5011/// # .enable_http2()
5012/// # .build()
5013/// # );
5014/// # let mut hub = Games::new(client, auth);
5015/// // You can configure optional parameters by calling the respective setters at will, and
5016/// // execute the final call using `doit()`.
5017/// // Values shown here are possibly random and not representative !
5018/// let result = hub.achievements().list("playerId")
5019/// .state("amet")
5020/// .page_token("duo")
5021/// .max_results(-50)
5022/// .language("sed")
5023/// .doit().await;
5024/// # }
5025/// ```
5026pub struct AchievementListCall<'a, C>
5027where
5028 C: 'a,
5029{
5030 hub: &'a Games<C>,
5031 _player_id: String,
5032 _state: Option<String>,
5033 _page_token: Option<String>,
5034 _max_results: Option<i32>,
5035 _language: Option<String>,
5036 _delegate: Option<&'a mut dyn common::Delegate>,
5037 _additional_params: HashMap<String, String>,
5038 _scopes: BTreeSet<String>,
5039}
5040
5041impl<'a, C> common::CallBuilder for AchievementListCall<'a, C> {}
5042
5043impl<'a, C> AchievementListCall<'a, C>
5044where
5045 C: common::Connector,
5046{
5047 /// Perform the operation you have build so far.
5048 pub async fn doit(
5049 mut self,
5050 ) -> common::Result<(common::Response, PlayerAchievementListResponse)> {
5051 use std::borrow::Cow;
5052 use std::io::{Read, Seek};
5053
5054 use common::{url::Params, ToParts};
5055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5056
5057 let mut dd = common::DefaultDelegate;
5058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5059 dlg.begin(common::MethodInfo {
5060 id: "games.achievements.list",
5061 http_method: hyper::Method::GET,
5062 });
5063
5064 for &field in [
5065 "alt",
5066 "playerId",
5067 "state",
5068 "pageToken",
5069 "maxResults",
5070 "language",
5071 ]
5072 .iter()
5073 {
5074 if self._additional_params.contains_key(field) {
5075 dlg.finished(false);
5076 return Err(common::Error::FieldClash(field));
5077 }
5078 }
5079
5080 let mut params = Params::with_capacity(7 + self._additional_params.len());
5081 params.push("playerId", self._player_id);
5082 if let Some(value) = self._state.as_ref() {
5083 params.push("state", value);
5084 }
5085 if let Some(value) = self._page_token.as_ref() {
5086 params.push("pageToken", value);
5087 }
5088 if let Some(value) = self._max_results.as_ref() {
5089 params.push("maxResults", value.to_string());
5090 }
5091 if let Some(value) = self._language.as_ref() {
5092 params.push("language", value);
5093 }
5094
5095 params.extend(self._additional_params.iter());
5096
5097 params.push("alt", "json");
5098 let mut url = self.hub._base_url.clone() + "games/v1/players/{playerId}/achievements";
5099 if self._scopes.is_empty() {
5100 self._scopes.insert(Scope::Full.as_ref().to_string());
5101 }
5102
5103 #[allow(clippy::single_element_loop)]
5104 for &(find_this, param_name) in [("{playerId}", "playerId")].iter() {
5105 url = params.uri_replacement(url, param_name, find_this, false);
5106 }
5107 {
5108 let to_remove = ["playerId"];
5109 params.remove_params(&to_remove);
5110 }
5111
5112 let url = params.parse_with_url(&url);
5113
5114 loop {
5115 let token = match self
5116 .hub
5117 .auth
5118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5119 .await
5120 {
5121 Ok(token) => token,
5122 Err(e) => match dlg.token(e) {
5123 Ok(token) => token,
5124 Err(e) => {
5125 dlg.finished(false);
5126 return Err(common::Error::MissingToken(e));
5127 }
5128 },
5129 };
5130 let mut req_result = {
5131 let client = &self.hub.client;
5132 dlg.pre_request();
5133 let mut req_builder = hyper::Request::builder()
5134 .method(hyper::Method::GET)
5135 .uri(url.as_str())
5136 .header(USER_AGENT, self.hub._user_agent.clone());
5137
5138 if let Some(token) = token.as_ref() {
5139 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5140 }
5141
5142 let request = req_builder
5143 .header(CONTENT_LENGTH, 0_u64)
5144 .body(common::to_body::<String>(None));
5145
5146 client.request(request.unwrap()).await
5147 };
5148
5149 match req_result {
5150 Err(err) => {
5151 if let common::Retry::After(d) = dlg.http_error(&err) {
5152 sleep(d).await;
5153 continue;
5154 }
5155 dlg.finished(false);
5156 return Err(common::Error::HttpError(err));
5157 }
5158 Ok(res) => {
5159 let (mut parts, body) = res.into_parts();
5160 let mut body = common::Body::new(body);
5161 if !parts.status.is_success() {
5162 let bytes = common::to_bytes(body).await.unwrap_or_default();
5163 let error = serde_json::from_str(&common::to_string(&bytes));
5164 let response = common::to_response(parts, bytes.into());
5165
5166 if let common::Retry::After(d) =
5167 dlg.http_failure(&response, error.as_ref().ok())
5168 {
5169 sleep(d).await;
5170 continue;
5171 }
5172
5173 dlg.finished(false);
5174
5175 return Err(match error {
5176 Ok(value) => common::Error::BadRequest(value),
5177 _ => common::Error::Failure(response),
5178 });
5179 }
5180 let response = {
5181 let bytes = common::to_bytes(body).await.unwrap_or_default();
5182 let encoded = common::to_string(&bytes);
5183 match serde_json::from_str(&encoded) {
5184 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5185 Err(error) => {
5186 dlg.response_json_decode_error(&encoded, &error);
5187 return Err(common::Error::JsonDecodeError(
5188 encoded.to_string(),
5189 error,
5190 ));
5191 }
5192 }
5193 };
5194
5195 dlg.finished(true);
5196 return Ok(response);
5197 }
5198 }
5199 }
5200 }
5201
5202 /// A player ID. A value of `me` may be used in place of the authenticated player's ID.
5203 ///
5204 /// Sets the *player id* path property to the given value.
5205 ///
5206 /// Even though the property as already been set when instantiating this call,
5207 /// we provide this method for API completeness.
5208 pub fn player_id(mut self, new_value: &str) -> AchievementListCall<'a, C> {
5209 self._player_id = new_value.to_string();
5210 self
5211 }
5212 /// Tells the server to return only achievements with the specified state. If this parameter isn't specified, all achievements are returned.
5213 ///
5214 /// Sets the *state* query property to the given value.
5215 pub fn state(mut self, new_value: &str) -> AchievementListCall<'a, C> {
5216 self._state = Some(new_value.to_string());
5217 self
5218 }
5219 /// The token returned by the previous request.
5220 ///
5221 /// Sets the *page token* query property to the given value.
5222 pub fn page_token(mut self, new_value: &str) -> AchievementListCall<'a, C> {
5223 self._page_token = Some(new_value.to_string());
5224 self
5225 }
5226 /// The maximum number of achievement resources to return in the response, used for paging. For any response, the actual number of achievement resources returned may be less than the specified `maxResults`.
5227 ///
5228 /// Sets the *max results* query property to the given value.
5229 pub fn max_results(mut self, new_value: i32) -> AchievementListCall<'a, C> {
5230 self._max_results = Some(new_value);
5231 self
5232 }
5233 /// The preferred language to use for strings returned by this method.
5234 ///
5235 /// Sets the *language* query property to the given value.
5236 pub fn language(mut self, new_value: &str) -> AchievementListCall<'a, C> {
5237 self._language = Some(new_value.to_string());
5238 self
5239 }
5240 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5241 /// while executing the actual API request.
5242 ///
5243 /// ````text
5244 /// It should be used to handle progress information, and to implement a certain level of resilience.
5245 /// ````
5246 ///
5247 /// Sets the *delegate* property to the given value.
5248 pub fn delegate(
5249 mut self,
5250 new_value: &'a mut dyn common::Delegate,
5251 ) -> AchievementListCall<'a, C> {
5252 self._delegate = Some(new_value);
5253 self
5254 }
5255
5256 /// Set any additional parameter of the query string used in the request.
5257 /// It should be used to set parameters which are not yet available through their own
5258 /// setters.
5259 ///
5260 /// Please note that this method must not be used to set any of the known parameters
5261 /// which have their own setter method. If done anyway, the request will fail.
5262 ///
5263 /// # Additional Parameters
5264 ///
5265 /// * *$.xgafv* (query-string) - V1 error format.
5266 /// * *access_token* (query-string) - OAuth access token.
5267 /// * *alt* (query-string) - Data format for response.
5268 /// * *callback* (query-string) - JSONP
5269 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5270 /// * *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.
5271 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5272 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5273 /// * *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.
5274 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5275 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5276 pub fn param<T>(mut self, name: T, value: T) -> AchievementListCall<'a, C>
5277 where
5278 T: AsRef<str>,
5279 {
5280 self._additional_params
5281 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5282 self
5283 }
5284
5285 /// Identifies the authorization scope for the method you are building.
5286 ///
5287 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5288 /// [`Scope::Full`].
5289 ///
5290 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5291 /// tokens for more than one scope.
5292 ///
5293 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5294 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5295 /// sufficient, a read-write scope will do as well.
5296 pub fn add_scope<St>(mut self, scope: St) -> AchievementListCall<'a, C>
5297 where
5298 St: AsRef<str>,
5299 {
5300 self._scopes.insert(String::from(scope.as_ref()));
5301 self
5302 }
5303 /// Identifies the authorization scope(s) for the method you are building.
5304 ///
5305 /// See [`Self::add_scope()`] for details.
5306 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementListCall<'a, C>
5307 where
5308 I: IntoIterator<Item = St>,
5309 St: AsRef<str>,
5310 {
5311 self._scopes
5312 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5313 self
5314 }
5315
5316 /// Removes all scopes, and no default scope will be used either.
5317 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5318 /// for details).
5319 pub fn clear_scopes(mut self) -> AchievementListCall<'a, C> {
5320 self._scopes.clear();
5321 self
5322 }
5323}
5324
5325/// Sets the state of the achievement with the given ID to `REVEALED` for the currently authenticated player.
5326///
5327/// A builder for the *reveal* method supported by a *achievement* resource.
5328/// It is not used directly, but through a [`AchievementMethods`] instance.
5329///
5330/// # Example
5331///
5332/// Instantiate a resource method builder
5333///
5334/// ```test_harness,no_run
5335/// # extern crate hyper;
5336/// # extern crate hyper_rustls;
5337/// # extern crate google_games1 as games1;
5338/// # async fn dox() {
5339/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5340///
5341/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5342/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5343/// # .with_native_roots()
5344/// # .unwrap()
5345/// # .https_only()
5346/// # .enable_http2()
5347/// # .build();
5348///
5349/// # let executor = hyper_util::rt::TokioExecutor::new();
5350/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5351/// # secret,
5352/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5353/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5354/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5355/// # ),
5356/// # ).build().await.unwrap();
5357///
5358/// # let client = hyper_util::client::legacy::Client::builder(
5359/// # hyper_util::rt::TokioExecutor::new()
5360/// # )
5361/// # .build(
5362/// # hyper_rustls::HttpsConnectorBuilder::new()
5363/// # .with_native_roots()
5364/// # .unwrap()
5365/// # .https_or_http()
5366/// # .enable_http2()
5367/// # .build()
5368/// # );
5369/// # let mut hub = Games::new(client, auth);
5370/// // You can configure optional parameters by calling the respective setters at will, and
5371/// // execute the final call using `doit()`.
5372/// // Values shown here are possibly random and not representative !
5373/// let result = hub.achievements().reveal("achievementId")
5374/// .doit().await;
5375/// # }
5376/// ```
5377pub struct AchievementRevealCall<'a, C>
5378where
5379 C: 'a,
5380{
5381 hub: &'a Games<C>,
5382 _achievement_id: String,
5383 _delegate: Option<&'a mut dyn common::Delegate>,
5384 _additional_params: HashMap<String, String>,
5385 _scopes: BTreeSet<String>,
5386}
5387
5388impl<'a, C> common::CallBuilder for AchievementRevealCall<'a, C> {}
5389
5390impl<'a, C> AchievementRevealCall<'a, C>
5391where
5392 C: common::Connector,
5393{
5394 /// Perform the operation you have build so far.
5395 pub async fn doit(mut self) -> common::Result<(common::Response, AchievementRevealResponse)> {
5396 use std::borrow::Cow;
5397 use std::io::{Read, Seek};
5398
5399 use common::{url::Params, ToParts};
5400 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5401
5402 let mut dd = common::DefaultDelegate;
5403 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5404 dlg.begin(common::MethodInfo {
5405 id: "games.achievements.reveal",
5406 http_method: hyper::Method::POST,
5407 });
5408
5409 for &field in ["alt", "achievementId"].iter() {
5410 if self._additional_params.contains_key(field) {
5411 dlg.finished(false);
5412 return Err(common::Error::FieldClash(field));
5413 }
5414 }
5415
5416 let mut params = Params::with_capacity(3 + self._additional_params.len());
5417 params.push("achievementId", self._achievement_id);
5418
5419 params.extend(self._additional_params.iter());
5420
5421 params.push("alt", "json");
5422 let mut url = self.hub._base_url.clone() + "games/v1/achievements/{achievementId}/reveal";
5423 if self._scopes.is_empty() {
5424 self._scopes.insert(Scope::Full.as_ref().to_string());
5425 }
5426
5427 #[allow(clippy::single_element_loop)]
5428 for &(find_this, param_name) in [("{achievementId}", "achievementId")].iter() {
5429 url = params.uri_replacement(url, param_name, find_this, false);
5430 }
5431 {
5432 let to_remove = ["achievementId"];
5433 params.remove_params(&to_remove);
5434 }
5435
5436 let url = params.parse_with_url(&url);
5437
5438 loop {
5439 let token = match self
5440 .hub
5441 .auth
5442 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5443 .await
5444 {
5445 Ok(token) => token,
5446 Err(e) => match dlg.token(e) {
5447 Ok(token) => token,
5448 Err(e) => {
5449 dlg.finished(false);
5450 return Err(common::Error::MissingToken(e));
5451 }
5452 },
5453 };
5454 let mut req_result = {
5455 let client = &self.hub.client;
5456 dlg.pre_request();
5457 let mut req_builder = hyper::Request::builder()
5458 .method(hyper::Method::POST)
5459 .uri(url.as_str())
5460 .header(USER_AGENT, self.hub._user_agent.clone());
5461
5462 if let Some(token) = token.as_ref() {
5463 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5464 }
5465
5466 let request = req_builder
5467 .header(CONTENT_LENGTH, 0_u64)
5468 .body(common::to_body::<String>(None));
5469
5470 client.request(request.unwrap()).await
5471 };
5472
5473 match req_result {
5474 Err(err) => {
5475 if let common::Retry::After(d) = dlg.http_error(&err) {
5476 sleep(d).await;
5477 continue;
5478 }
5479 dlg.finished(false);
5480 return Err(common::Error::HttpError(err));
5481 }
5482 Ok(res) => {
5483 let (mut parts, body) = res.into_parts();
5484 let mut body = common::Body::new(body);
5485 if !parts.status.is_success() {
5486 let bytes = common::to_bytes(body).await.unwrap_or_default();
5487 let error = serde_json::from_str(&common::to_string(&bytes));
5488 let response = common::to_response(parts, bytes.into());
5489
5490 if let common::Retry::After(d) =
5491 dlg.http_failure(&response, error.as_ref().ok())
5492 {
5493 sleep(d).await;
5494 continue;
5495 }
5496
5497 dlg.finished(false);
5498
5499 return Err(match error {
5500 Ok(value) => common::Error::BadRequest(value),
5501 _ => common::Error::Failure(response),
5502 });
5503 }
5504 let response = {
5505 let bytes = common::to_bytes(body).await.unwrap_or_default();
5506 let encoded = common::to_string(&bytes);
5507 match serde_json::from_str(&encoded) {
5508 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5509 Err(error) => {
5510 dlg.response_json_decode_error(&encoded, &error);
5511 return Err(common::Error::JsonDecodeError(
5512 encoded.to_string(),
5513 error,
5514 ));
5515 }
5516 }
5517 };
5518
5519 dlg.finished(true);
5520 return Ok(response);
5521 }
5522 }
5523 }
5524 }
5525
5526 /// The ID of the achievement used by this method.
5527 ///
5528 /// Sets the *achievement id* path property to the given value.
5529 ///
5530 /// Even though the property as already been set when instantiating this call,
5531 /// we provide this method for API completeness.
5532 pub fn achievement_id(mut self, new_value: &str) -> AchievementRevealCall<'a, C> {
5533 self._achievement_id = new_value.to_string();
5534 self
5535 }
5536 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5537 /// while executing the actual API request.
5538 ///
5539 /// ````text
5540 /// It should be used to handle progress information, and to implement a certain level of resilience.
5541 /// ````
5542 ///
5543 /// Sets the *delegate* property to the given value.
5544 pub fn delegate(
5545 mut self,
5546 new_value: &'a mut dyn common::Delegate,
5547 ) -> AchievementRevealCall<'a, C> {
5548 self._delegate = Some(new_value);
5549 self
5550 }
5551
5552 /// Set any additional parameter of the query string used in the request.
5553 /// It should be used to set parameters which are not yet available through their own
5554 /// setters.
5555 ///
5556 /// Please note that this method must not be used to set any of the known parameters
5557 /// which have their own setter method. If done anyway, the request will fail.
5558 ///
5559 /// # Additional Parameters
5560 ///
5561 /// * *$.xgafv* (query-string) - V1 error format.
5562 /// * *access_token* (query-string) - OAuth access token.
5563 /// * *alt* (query-string) - Data format for response.
5564 /// * *callback* (query-string) - JSONP
5565 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5566 /// * *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.
5567 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5568 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5569 /// * *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.
5570 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5571 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5572 pub fn param<T>(mut self, name: T, value: T) -> AchievementRevealCall<'a, C>
5573 where
5574 T: AsRef<str>,
5575 {
5576 self._additional_params
5577 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5578 self
5579 }
5580
5581 /// Identifies the authorization scope for the method you are building.
5582 ///
5583 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5584 /// [`Scope::Full`].
5585 ///
5586 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5587 /// tokens for more than one scope.
5588 ///
5589 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5590 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5591 /// sufficient, a read-write scope will do as well.
5592 pub fn add_scope<St>(mut self, scope: St) -> AchievementRevealCall<'a, C>
5593 where
5594 St: AsRef<str>,
5595 {
5596 self._scopes.insert(String::from(scope.as_ref()));
5597 self
5598 }
5599 /// Identifies the authorization scope(s) for the method you are building.
5600 ///
5601 /// See [`Self::add_scope()`] for details.
5602 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementRevealCall<'a, C>
5603 where
5604 I: IntoIterator<Item = St>,
5605 St: AsRef<str>,
5606 {
5607 self._scopes
5608 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5609 self
5610 }
5611
5612 /// Removes all scopes, and no default scope will be used either.
5613 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5614 /// for details).
5615 pub fn clear_scopes(mut self) -> AchievementRevealCall<'a, C> {
5616 self._scopes.clear();
5617 self
5618 }
5619}
5620
5621/// Sets the steps for the currently authenticated player towards unlocking an achievement. If the steps parameter is less than the current number of steps that the player already gained for the achievement, the achievement is not modified.
5622///
5623/// A builder for the *setStepsAtLeast* method supported by a *achievement* resource.
5624/// It is not used directly, but through a [`AchievementMethods`] instance.
5625///
5626/// # Example
5627///
5628/// Instantiate a resource method builder
5629///
5630/// ```test_harness,no_run
5631/// # extern crate hyper;
5632/// # extern crate hyper_rustls;
5633/// # extern crate google_games1 as games1;
5634/// # async fn dox() {
5635/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5636///
5637/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5638/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5639/// # .with_native_roots()
5640/// # .unwrap()
5641/// # .https_only()
5642/// # .enable_http2()
5643/// # .build();
5644///
5645/// # let executor = hyper_util::rt::TokioExecutor::new();
5646/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5647/// # secret,
5648/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5649/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5650/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5651/// # ),
5652/// # ).build().await.unwrap();
5653///
5654/// # let client = hyper_util::client::legacy::Client::builder(
5655/// # hyper_util::rt::TokioExecutor::new()
5656/// # )
5657/// # .build(
5658/// # hyper_rustls::HttpsConnectorBuilder::new()
5659/// # .with_native_roots()
5660/// # .unwrap()
5661/// # .https_or_http()
5662/// # .enable_http2()
5663/// # .build()
5664/// # );
5665/// # let mut hub = Games::new(client, auth);
5666/// // You can configure optional parameters by calling the respective setters at will, and
5667/// // execute the final call using `doit()`.
5668/// // Values shown here are possibly random and not representative !
5669/// let result = hub.achievements().set_steps_at_least("achievementId", -16)
5670/// .doit().await;
5671/// # }
5672/// ```
5673pub struct AchievementSetStepsAtLeastCall<'a, C>
5674where
5675 C: 'a,
5676{
5677 hub: &'a Games<C>,
5678 _achievement_id: String,
5679 _steps: i32,
5680 _delegate: Option<&'a mut dyn common::Delegate>,
5681 _additional_params: HashMap<String, String>,
5682 _scopes: BTreeSet<String>,
5683}
5684
5685impl<'a, C> common::CallBuilder for AchievementSetStepsAtLeastCall<'a, C> {}
5686
5687impl<'a, C> AchievementSetStepsAtLeastCall<'a, C>
5688where
5689 C: common::Connector,
5690{
5691 /// Perform the operation you have build so far.
5692 pub async fn doit(
5693 mut self,
5694 ) -> common::Result<(common::Response, AchievementSetStepsAtLeastResponse)> {
5695 use std::borrow::Cow;
5696 use std::io::{Read, Seek};
5697
5698 use common::{url::Params, ToParts};
5699 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5700
5701 let mut dd = common::DefaultDelegate;
5702 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5703 dlg.begin(common::MethodInfo {
5704 id: "games.achievements.setStepsAtLeast",
5705 http_method: hyper::Method::POST,
5706 });
5707
5708 for &field in ["alt", "achievementId", "steps"].iter() {
5709 if self._additional_params.contains_key(field) {
5710 dlg.finished(false);
5711 return Err(common::Error::FieldClash(field));
5712 }
5713 }
5714
5715 let mut params = Params::with_capacity(4 + self._additional_params.len());
5716 params.push("achievementId", self._achievement_id);
5717 params.push("steps", self._steps.to_string());
5718
5719 params.extend(self._additional_params.iter());
5720
5721 params.push("alt", "json");
5722 let mut url =
5723 self.hub._base_url.clone() + "games/v1/achievements/{achievementId}/setStepsAtLeast";
5724 if self._scopes.is_empty() {
5725 self._scopes.insert(Scope::Full.as_ref().to_string());
5726 }
5727
5728 #[allow(clippy::single_element_loop)]
5729 for &(find_this, param_name) in [("{achievementId}", "achievementId")].iter() {
5730 url = params.uri_replacement(url, param_name, find_this, false);
5731 }
5732 {
5733 let to_remove = ["achievementId"];
5734 params.remove_params(&to_remove);
5735 }
5736
5737 let url = params.parse_with_url(&url);
5738
5739 loop {
5740 let token = match self
5741 .hub
5742 .auth
5743 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5744 .await
5745 {
5746 Ok(token) => token,
5747 Err(e) => match dlg.token(e) {
5748 Ok(token) => token,
5749 Err(e) => {
5750 dlg.finished(false);
5751 return Err(common::Error::MissingToken(e));
5752 }
5753 },
5754 };
5755 let mut req_result = {
5756 let client = &self.hub.client;
5757 dlg.pre_request();
5758 let mut req_builder = hyper::Request::builder()
5759 .method(hyper::Method::POST)
5760 .uri(url.as_str())
5761 .header(USER_AGENT, self.hub._user_agent.clone());
5762
5763 if let Some(token) = token.as_ref() {
5764 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5765 }
5766
5767 let request = req_builder
5768 .header(CONTENT_LENGTH, 0_u64)
5769 .body(common::to_body::<String>(None));
5770
5771 client.request(request.unwrap()).await
5772 };
5773
5774 match req_result {
5775 Err(err) => {
5776 if let common::Retry::After(d) = dlg.http_error(&err) {
5777 sleep(d).await;
5778 continue;
5779 }
5780 dlg.finished(false);
5781 return Err(common::Error::HttpError(err));
5782 }
5783 Ok(res) => {
5784 let (mut parts, body) = res.into_parts();
5785 let mut body = common::Body::new(body);
5786 if !parts.status.is_success() {
5787 let bytes = common::to_bytes(body).await.unwrap_or_default();
5788 let error = serde_json::from_str(&common::to_string(&bytes));
5789 let response = common::to_response(parts, bytes.into());
5790
5791 if let common::Retry::After(d) =
5792 dlg.http_failure(&response, error.as_ref().ok())
5793 {
5794 sleep(d).await;
5795 continue;
5796 }
5797
5798 dlg.finished(false);
5799
5800 return Err(match error {
5801 Ok(value) => common::Error::BadRequest(value),
5802 _ => common::Error::Failure(response),
5803 });
5804 }
5805 let response = {
5806 let bytes = common::to_bytes(body).await.unwrap_or_default();
5807 let encoded = common::to_string(&bytes);
5808 match serde_json::from_str(&encoded) {
5809 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5810 Err(error) => {
5811 dlg.response_json_decode_error(&encoded, &error);
5812 return Err(common::Error::JsonDecodeError(
5813 encoded.to_string(),
5814 error,
5815 ));
5816 }
5817 }
5818 };
5819
5820 dlg.finished(true);
5821 return Ok(response);
5822 }
5823 }
5824 }
5825 }
5826
5827 /// The ID of the achievement used by this method.
5828 ///
5829 /// Sets the *achievement id* path property to the given value.
5830 ///
5831 /// Even though the property as already been set when instantiating this call,
5832 /// we provide this method for API completeness.
5833 pub fn achievement_id(mut self, new_value: &str) -> AchievementSetStepsAtLeastCall<'a, C> {
5834 self._achievement_id = new_value.to_string();
5835 self
5836 }
5837 /// Required. The minimum value to set the steps to.
5838 ///
5839 /// Sets the *steps* query property to the given value.
5840 ///
5841 /// Even though the property as already been set when instantiating this call,
5842 /// we provide this method for API completeness.
5843 pub fn steps(mut self, new_value: i32) -> AchievementSetStepsAtLeastCall<'a, C> {
5844 self._steps = new_value;
5845 self
5846 }
5847 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5848 /// while executing the actual API request.
5849 ///
5850 /// ````text
5851 /// It should be used to handle progress information, and to implement a certain level of resilience.
5852 /// ````
5853 ///
5854 /// Sets the *delegate* property to the given value.
5855 pub fn delegate(
5856 mut self,
5857 new_value: &'a mut dyn common::Delegate,
5858 ) -> AchievementSetStepsAtLeastCall<'a, C> {
5859 self._delegate = Some(new_value);
5860 self
5861 }
5862
5863 /// Set any additional parameter of the query string used in the request.
5864 /// It should be used to set parameters which are not yet available through their own
5865 /// setters.
5866 ///
5867 /// Please note that this method must not be used to set any of the known parameters
5868 /// which have their own setter method. If done anyway, the request will fail.
5869 ///
5870 /// # Additional Parameters
5871 ///
5872 /// * *$.xgafv* (query-string) - V1 error format.
5873 /// * *access_token* (query-string) - OAuth access token.
5874 /// * *alt* (query-string) - Data format for response.
5875 /// * *callback* (query-string) - JSONP
5876 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5877 /// * *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.
5878 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5879 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5880 /// * *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.
5881 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5882 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5883 pub fn param<T>(mut self, name: T, value: T) -> AchievementSetStepsAtLeastCall<'a, C>
5884 where
5885 T: AsRef<str>,
5886 {
5887 self._additional_params
5888 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5889 self
5890 }
5891
5892 /// Identifies the authorization scope for the method you are building.
5893 ///
5894 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5895 /// [`Scope::Full`].
5896 ///
5897 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5898 /// tokens for more than one scope.
5899 ///
5900 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5901 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5902 /// sufficient, a read-write scope will do as well.
5903 pub fn add_scope<St>(mut self, scope: St) -> AchievementSetStepsAtLeastCall<'a, C>
5904 where
5905 St: AsRef<str>,
5906 {
5907 self._scopes.insert(String::from(scope.as_ref()));
5908 self
5909 }
5910 /// Identifies the authorization scope(s) for the method you are building.
5911 ///
5912 /// See [`Self::add_scope()`] for details.
5913 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementSetStepsAtLeastCall<'a, C>
5914 where
5915 I: IntoIterator<Item = St>,
5916 St: AsRef<str>,
5917 {
5918 self._scopes
5919 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5920 self
5921 }
5922
5923 /// Removes all scopes, and no default scope will be used either.
5924 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5925 /// for details).
5926 pub fn clear_scopes(mut self) -> AchievementSetStepsAtLeastCall<'a, C> {
5927 self._scopes.clear();
5928 self
5929 }
5930}
5931
5932/// Unlocks this achievement for the currently authenticated player.
5933///
5934/// A builder for the *unlock* method supported by a *achievement* resource.
5935/// It is not used directly, but through a [`AchievementMethods`] instance.
5936///
5937/// # Example
5938///
5939/// Instantiate a resource method builder
5940///
5941/// ```test_harness,no_run
5942/// # extern crate hyper;
5943/// # extern crate hyper_rustls;
5944/// # extern crate google_games1 as games1;
5945/// # async fn dox() {
5946/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5947///
5948/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5949/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5950/// # .with_native_roots()
5951/// # .unwrap()
5952/// # .https_only()
5953/// # .enable_http2()
5954/// # .build();
5955///
5956/// # let executor = hyper_util::rt::TokioExecutor::new();
5957/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5958/// # secret,
5959/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5960/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5961/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5962/// # ),
5963/// # ).build().await.unwrap();
5964///
5965/// # let client = hyper_util::client::legacy::Client::builder(
5966/// # hyper_util::rt::TokioExecutor::new()
5967/// # )
5968/// # .build(
5969/// # hyper_rustls::HttpsConnectorBuilder::new()
5970/// # .with_native_roots()
5971/// # .unwrap()
5972/// # .https_or_http()
5973/// # .enable_http2()
5974/// # .build()
5975/// # );
5976/// # let mut hub = Games::new(client, auth);
5977/// // You can configure optional parameters by calling the respective setters at will, and
5978/// // execute the final call using `doit()`.
5979/// // Values shown here are possibly random and not representative !
5980/// let result = hub.achievements().unlock("achievementId")
5981/// .doit().await;
5982/// # }
5983/// ```
5984pub struct AchievementUnlockCall<'a, C>
5985where
5986 C: 'a,
5987{
5988 hub: &'a Games<C>,
5989 _achievement_id: String,
5990 _delegate: Option<&'a mut dyn common::Delegate>,
5991 _additional_params: HashMap<String, String>,
5992 _scopes: BTreeSet<String>,
5993}
5994
5995impl<'a, C> common::CallBuilder for AchievementUnlockCall<'a, C> {}
5996
5997impl<'a, C> AchievementUnlockCall<'a, C>
5998where
5999 C: common::Connector,
6000{
6001 /// Perform the operation you have build so far.
6002 pub async fn doit(mut self) -> common::Result<(common::Response, AchievementUnlockResponse)> {
6003 use std::borrow::Cow;
6004 use std::io::{Read, Seek};
6005
6006 use common::{url::Params, ToParts};
6007 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6008
6009 let mut dd = common::DefaultDelegate;
6010 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6011 dlg.begin(common::MethodInfo {
6012 id: "games.achievements.unlock",
6013 http_method: hyper::Method::POST,
6014 });
6015
6016 for &field in ["alt", "achievementId"].iter() {
6017 if self._additional_params.contains_key(field) {
6018 dlg.finished(false);
6019 return Err(common::Error::FieldClash(field));
6020 }
6021 }
6022
6023 let mut params = Params::with_capacity(3 + self._additional_params.len());
6024 params.push("achievementId", self._achievement_id);
6025
6026 params.extend(self._additional_params.iter());
6027
6028 params.push("alt", "json");
6029 let mut url = self.hub._base_url.clone() + "games/v1/achievements/{achievementId}/unlock";
6030 if self._scopes.is_empty() {
6031 self._scopes.insert(Scope::Full.as_ref().to_string());
6032 }
6033
6034 #[allow(clippy::single_element_loop)]
6035 for &(find_this, param_name) in [("{achievementId}", "achievementId")].iter() {
6036 url = params.uri_replacement(url, param_name, find_this, false);
6037 }
6038 {
6039 let to_remove = ["achievementId"];
6040 params.remove_params(&to_remove);
6041 }
6042
6043 let url = params.parse_with_url(&url);
6044
6045 loop {
6046 let token = match self
6047 .hub
6048 .auth
6049 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6050 .await
6051 {
6052 Ok(token) => token,
6053 Err(e) => match dlg.token(e) {
6054 Ok(token) => token,
6055 Err(e) => {
6056 dlg.finished(false);
6057 return Err(common::Error::MissingToken(e));
6058 }
6059 },
6060 };
6061 let mut req_result = {
6062 let client = &self.hub.client;
6063 dlg.pre_request();
6064 let mut req_builder = hyper::Request::builder()
6065 .method(hyper::Method::POST)
6066 .uri(url.as_str())
6067 .header(USER_AGENT, self.hub._user_agent.clone());
6068
6069 if let Some(token) = token.as_ref() {
6070 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6071 }
6072
6073 let request = req_builder
6074 .header(CONTENT_LENGTH, 0_u64)
6075 .body(common::to_body::<String>(None));
6076
6077 client.request(request.unwrap()).await
6078 };
6079
6080 match req_result {
6081 Err(err) => {
6082 if let common::Retry::After(d) = dlg.http_error(&err) {
6083 sleep(d).await;
6084 continue;
6085 }
6086 dlg.finished(false);
6087 return Err(common::Error::HttpError(err));
6088 }
6089 Ok(res) => {
6090 let (mut parts, body) = res.into_parts();
6091 let mut body = common::Body::new(body);
6092 if !parts.status.is_success() {
6093 let bytes = common::to_bytes(body).await.unwrap_or_default();
6094 let error = serde_json::from_str(&common::to_string(&bytes));
6095 let response = common::to_response(parts, bytes.into());
6096
6097 if let common::Retry::After(d) =
6098 dlg.http_failure(&response, error.as_ref().ok())
6099 {
6100 sleep(d).await;
6101 continue;
6102 }
6103
6104 dlg.finished(false);
6105
6106 return Err(match error {
6107 Ok(value) => common::Error::BadRequest(value),
6108 _ => common::Error::Failure(response),
6109 });
6110 }
6111 let response = {
6112 let bytes = common::to_bytes(body).await.unwrap_or_default();
6113 let encoded = common::to_string(&bytes);
6114 match serde_json::from_str(&encoded) {
6115 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6116 Err(error) => {
6117 dlg.response_json_decode_error(&encoded, &error);
6118 return Err(common::Error::JsonDecodeError(
6119 encoded.to_string(),
6120 error,
6121 ));
6122 }
6123 }
6124 };
6125
6126 dlg.finished(true);
6127 return Ok(response);
6128 }
6129 }
6130 }
6131 }
6132
6133 /// The ID of the achievement used by this method.
6134 ///
6135 /// Sets the *achievement id* path property to the given value.
6136 ///
6137 /// Even though the property as already been set when instantiating this call,
6138 /// we provide this method for API completeness.
6139 pub fn achievement_id(mut self, new_value: &str) -> AchievementUnlockCall<'a, C> {
6140 self._achievement_id = new_value.to_string();
6141 self
6142 }
6143 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6144 /// while executing the actual API request.
6145 ///
6146 /// ````text
6147 /// It should be used to handle progress information, and to implement a certain level of resilience.
6148 /// ````
6149 ///
6150 /// Sets the *delegate* property to the given value.
6151 pub fn delegate(
6152 mut self,
6153 new_value: &'a mut dyn common::Delegate,
6154 ) -> AchievementUnlockCall<'a, C> {
6155 self._delegate = Some(new_value);
6156 self
6157 }
6158
6159 /// Set any additional parameter of the query string used in the request.
6160 /// It should be used to set parameters which are not yet available through their own
6161 /// setters.
6162 ///
6163 /// Please note that this method must not be used to set any of the known parameters
6164 /// which have their own setter method. If done anyway, the request will fail.
6165 ///
6166 /// # Additional Parameters
6167 ///
6168 /// * *$.xgafv* (query-string) - V1 error format.
6169 /// * *access_token* (query-string) - OAuth access token.
6170 /// * *alt* (query-string) - Data format for response.
6171 /// * *callback* (query-string) - JSONP
6172 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6173 /// * *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.
6174 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6175 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6176 /// * *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.
6177 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6178 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6179 pub fn param<T>(mut self, name: T, value: T) -> AchievementUnlockCall<'a, C>
6180 where
6181 T: AsRef<str>,
6182 {
6183 self._additional_params
6184 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6185 self
6186 }
6187
6188 /// Identifies the authorization scope for the method you are building.
6189 ///
6190 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6191 /// [`Scope::Full`].
6192 ///
6193 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6194 /// tokens for more than one scope.
6195 ///
6196 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6197 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6198 /// sufficient, a read-write scope will do as well.
6199 pub fn add_scope<St>(mut self, scope: St) -> AchievementUnlockCall<'a, C>
6200 where
6201 St: AsRef<str>,
6202 {
6203 self._scopes.insert(String::from(scope.as_ref()));
6204 self
6205 }
6206 /// Identifies the authorization scope(s) for the method you are building.
6207 ///
6208 /// See [`Self::add_scope()`] for details.
6209 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementUnlockCall<'a, C>
6210 where
6211 I: IntoIterator<Item = St>,
6212 St: AsRef<str>,
6213 {
6214 self._scopes
6215 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6216 self
6217 }
6218
6219 /// Removes all scopes, and no default scope will be used either.
6220 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6221 /// for details).
6222 pub fn clear_scopes(mut self) -> AchievementUnlockCall<'a, C> {
6223 self._scopes.clear();
6224 self
6225 }
6226}
6227
6228/// Updates multiple achievements for the currently authenticated player.
6229///
6230/// A builder for the *updateMultiple* method supported by a *achievement* resource.
6231/// It is not used directly, but through a [`AchievementMethods`] instance.
6232///
6233/// # Example
6234///
6235/// Instantiate a resource method builder
6236///
6237/// ```test_harness,no_run
6238/// # extern crate hyper;
6239/// # extern crate hyper_rustls;
6240/// # extern crate google_games1 as games1;
6241/// use games1::api::AchievementUpdateMultipleRequest;
6242/// # async fn dox() {
6243/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6244///
6245/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6246/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6247/// # .with_native_roots()
6248/// # .unwrap()
6249/// # .https_only()
6250/// # .enable_http2()
6251/// # .build();
6252///
6253/// # let executor = hyper_util::rt::TokioExecutor::new();
6254/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6255/// # secret,
6256/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6257/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6258/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6259/// # ),
6260/// # ).build().await.unwrap();
6261///
6262/// # let client = hyper_util::client::legacy::Client::builder(
6263/// # hyper_util::rt::TokioExecutor::new()
6264/// # )
6265/// # .build(
6266/// # hyper_rustls::HttpsConnectorBuilder::new()
6267/// # .with_native_roots()
6268/// # .unwrap()
6269/// # .https_or_http()
6270/// # .enable_http2()
6271/// # .build()
6272/// # );
6273/// # let mut hub = Games::new(client, auth);
6274/// // As the method needs a request, you would usually fill it with the desired information
6275/// // into the respective structure. Some of the parts shown here might not be applicable !
6276/// // Values shown here are possibly random and not representative !
6277/// let mut req = AchievementUpdateMultipleRequest::default();
6278///
6279/// // You can configure optional parameters by calling the respective setters at will, and
6280/// // execute the final call using `doit()`.
6281/// // Values shown here are possibly random and not representative !
6282/// let result = hub.achievements().update_multiple(req)
6283/// .doit().await;
6284/// # }
6285/// ```
6286pub struct AchievementUpdateMultipleCall<'a, C>
6287where
6288 C: 'a,
6289{
6290 hub: &'a Games<C>,
6291 _request: AchievementUpdateMultipleRequest,
6292 _delegate: Option<&'a mut dyn common::Delegate>,
6293 _additional_params: HashMap<String, String>,
6294 _scopes: BTreeSet<String>,
6295}
6296
6297impl<'a, C> common::CallBuilder for AchievementUpdateMultipleCall<'a, C> {}
6298
6299impl<'a, C> AchievementUpdateMultipleCall<'a, C>
6300where
6301 C: common::Connector,
6302{
6303 /// Perform the operation you have build so far.
6304 pub async fn doit(
6305 mut self,
6306 ) -> common::Result<(common::Response, AchievementUpdateMultipleResponse)> {
6307 use std::borrow::Cow;
6308 use std::io::{Read, Seek};
6309
6310 use common::{url::Params, ToParts};
6311 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6312
6313 let mut dd = common::DefaultDelegate;
6314 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6315 dlg.begin(common::MethodInfo {
6316 id: "games.achievements.updateMultiple",
6317 http_method: hyper::Method::POST,
6318 });
6319
6320 for &field in ["alt"].iter() {
6321 if self._additional_params.contains_key(field) {
6322 dlg.finished(false);
6323 return Err(common::Error::FieldClash(field));
6324 }
6325 }
6326
6327 let mut params = Params::with_capacity(3 + self._additional_params.len());
6328
6329 params.extend(self._additional_params.iter());
6330
6331 params.push("alt", "json");
6332 let mut url = self.hub._base_url.clone() + "games/v1/achievements/updateMultiple";
6333 if self._scopes.is_empty() {
6334 self._scopes.insert(Scope::Full.as_ref().to_string());
6335 }
6336
6337 let url = params.parse_with_url(&url);
6338
6339 let mut json_mime_type = mime::APPLICATION_JSON;
6340 let mut request_value_reader = {
6341 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6342 common::remove_json_null_values(&mut value);
6343 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6344 serde_json::to_writer(&mut dst, &value).unwrap();
6345 dst
6346 };
6347 let request_size = request_value_reader
6348 .seek(std::io::SeekFrom::End(0))
6349 .unwrap();
6350 request_value_reader
6351 .seek(std::io::SeekFrom::Start(0))
6352 .unwrap();
6353
6354 loop {
6355 let token = match self
6356 .hub
6357 .auth
6358 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6359 .await
6360 {
6361 Ok(token) => token,
6362 Err(e) => match dlg.token(e) {
6363 Ok(token) => token,
6364 Err(e) => {
6365 dlg.finished(false);
6366 return Err(common::Error::MissingToken(e));
6367 }
6368 },
6369 };
6370 request_value_reader
6371 .seek(std::io::SeekFrom::Start(0))
6372 .unwrap();
6373 let mut req_result = {
6374 let client = &self.hub.client;
6375 dlg.pre_request();
6376 let mut req_builder = hyper::Request::builder()
6377 .method(hyper::Method::POST)
6378 .uri(url.as_str())
6379 .header(USER_AGENT, self.hub._user_agent.clone());
6380
6381 if let Some(token) = token.as_ref() {
6382 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6383 }
6384
6385 let request = req_builder
6386 .header(CONTENT_TYPE, json_mime_type.to_string())
6387 .header(CONTENT_LENGTH, request_size as u64)
6388 .body(common::to_body(
6389 request_value_reader.get_ref().clone().into(),
6390 ));
6391
6392 client.request(request.unwrap()).await
6393 };
6394
6395 match req_result {
6396 Err(err) => {
6397 if let common::Retry::After(d) = dlg.http_error(&err) {
6398 sleep(d).await;
6399 continue;
6400 }
6401 dlg.finished(false);
6402 return Err(common::Error::HttpError(err));
6403 }
6404 Ok(res) => {
6405 let (mut parts, body) = res.into_parts();
6406 let mut body = common::Body::new(body);
6407 if !parts.status.is_success() {
6408 let bytes = common::to_bytes(body).await.unwrap_or_default();
6409 let error = serde_json::from_str(&common::to_string(&bytes));
6410 let response = common::to_response(parts, bytes.into());
6411
6412 if let common::Retry::After(d) =
6413 dlg.http_failure(&response, error.as_ref().ok())
6414 {
6415 sleep(d).await;
6416 continue;
6417 }
6418
6419 dlg.finished(false);
6420
6421 return Err(match error {
6422 Ok(value) => common::Error::BadRequest(value),
6423 _ => common::Error::Failure(response),
6424 });
6425 }
6426 let response = {
6427 let bytes = common::to_bytes(body).await.unwrap_or_default();
6428 let encoded = common::to_string(&bytes);
6429 match serde_json::from_str(&encoded) {
6430 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6431 Err(error) => {
6432 dlg.response_json_decode_error(&encoded, &error);
6433 return Err(common::Error::JsonDecodeError(
6434 encoded.to_string(),
6435 error,
6436 ));
6437 }
6438 }
6439 };
6440
6441 dlg.finished(true);
6442 return Ok(response);
6443 }
6444 }
6445 }
6446 }
6447
6448 ///
6449 /// Sets the *request* property to the given value.
6450 ///
6451 /// Even though the property as already been set when instantiating this call,
6452 /// we provide this method for API completeness.
6453 pub fn request(
6454 mut self,
6455 new_value: AchievementUpdateMultipleRequest,
6456 ) -> AchievementUpdateMultipleCall<'a, C> {
6457 self._request = new_value;
6458 self
6459 }
6460 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6461 /// while executing the actual API request.
6462 ///
6463 /// ````text
6464 /// It should be used to handle progress information, and to implement a certain level of resilience.
6465 /// ````
6466 ///
6467 /// Sets the *delegate* property to the given value.
6468 pub fn delegate(
6469 mut self,
6470 new_value: &'a mut dyn common::Delegate,
6471 ) -> AchievementUpdateMultipleCall<'a, C> {
6472 self._delegate = Some(new_value);
6473 self
6474 }
6475
6476 /// Set any additional parameter of the query string used in the request.
6477 /// It should be used to set parameters which are not yet available through their own
6478 /// setters.
6479 ///
6480 /// Please note that this method must not be used to set any of the known parameters
6481 /// which have their own setter method. If done anyway, the request will fail.
6482 ///
6483 /// # Additional Parameters
6484 ///
6485 /// * *$.xgafv* (query-string) - V1 error format.
6486 /// * *access_token* (query-string) - OAuth access token.
6487 /// * *alt* (query-string) - Data format for response.
6488 /// * *callback* (query-string) - JSONP
6489 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6490 /// * *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.
6491 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6492 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6493 /// * *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.
6494 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6495 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6496 pub fn param<T>(mut self, name: T, value: T) -> AchievementUpdateMultipleCall<'a, C>
6497 where
6498 T: AsRef<str>,
6499 {
6500 self._additional_params
6501 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6502 self
6503 }
6504
6505 /// Identifies the authorization scope for the method you are building.
6506 ///
6507 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6508 /// [`Scope::Full`].
6509 ///
6510 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6511 /// tokens for more than one scope.
6512 ///
6513 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6514 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6515 /// sufficient, a read-write scope will do as well.
6516 pub fn add_scope<St>(mut self, scope: St) -> AchievementUpdateMultipleCall<'a, C>
6517 where
6518 St: AsRef<str>,
6519 {
6520 self._scopes.insert(String::from(scope.as_ref()));
6521 self
6522 }
6523 /// Identifies the authorization scope(s) for the method you are building.
6524 ///
6525 /// See [`Self::add_scope()`] for details.
6526 pub fn add_scopes<I, St>(mut self, scopes: I) -> AchievementUpdateMultipleCall<'a, C>
6527 where
6528 I: IntoIterator<Item = St>,
6529 St: AsRef<str>,
6530 {
6531 self._scopes
6532 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6533 self
6534 }
6535
6536 /// Removes all scopes, and no default scope will be used either.
6537 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6538 /// for details).
6539 pub fn clear_scopes(mut self) -> AchievementUpdateMultipleCall<'a, C> {
6540 self._scopes.clear();
6541 self
6542 }
6543}
6544
6545/// Retrieves the metadata of the application with the given ID. If the requested application is not available for the specified `platformType`, the returned response will not include any instance data.
6546///
6547/// A builder for the *get* method supported by a *application* resource.
6548/// It is not used directly, but through a [`ApplicationMethods`] instance.
6549///
6550/// # Example
6551///
6552/// Instantiate a resource method builder
6553///
6554/// ```test_harness,no_run
6555/// # extern crate hyper;
6556/// # extern crate hyper_rustls;
6557/// # extern crate google_games1 as games1;
6558/// # async fn dox() {
6559/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6560///
6561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6562/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6563/// # .with_native_roots()
6564/// # .unwrap()
6565/// # .https_only()
6566/// # .enable_http2()
6567/// # .build();
6568///
6569/// # let executor = hyper_util::rt::TokioExecutor::new();
6570/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6571/// # secret,
6572/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6573/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6574/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6575/// # ),
6576/// # ).build().await.unwrap();
6577///
6578/// # let client = hyper_util::client::legacy::Client::builder(
6579/// # hyper_util::rt::TokioExecutor::new()
6580/// # )
6581/// # .build(
6582/// # hyper_rustls::HttpsConnectorBuilder::new()
6583/// # .with_native_roots()
6584/// # .unwrap()
6585/// # .https_or_http()
6586/// # .enable_http2()
6587/// # .build()
6588/// # );
6589/// # let mut hub = Games::new(client, auth);
6590/// // You can configure optional parameters by calling the respective setters at will, and
6591/// // execute the final call using `doit()`.
6592/// // Values shown here are possibly random and not representative !
6593/// let result = hub.applications().get("applicationId")
6594/// .platform_type("ipsum")
6595/// .language("est")
6596/// .doit().await;
6597/// # }
6598/// ```
6599pub struct ApplicationGetCall<'a, C>
6600where
6601 C: 'a,
6602{
6603 hub: &'a Games<C>,
6604 _application_id: String,
6605 _platform_type: Option<String>,
6606 _language: Option<String>,
6607 _delegate: Option<&'a mut dyn common::Delegate>,
6608 _additional_params: HashMap<String, String>,
6609 _scopes: BTreeSet<String>,
6610}
6611
6612impl<'a, C> common::CallBuilder for ApplicationGetCall<'a, C> {}
6613
6614impl<'a, C> ApplicationGetCall<'a, C>
6615where
6616 C: common::Connector,
6617{
6618 /// Perform the operation you have build so far.
6619 pub async fn doit(mut self) -> common::Result<(common::Response, Application)> {
6620 use std::borrow::Cow;
6621 use std::io::{Read, Seek};
6622
6623 use common::{url::Params, ToParts};
6624 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6625
6626 let mut dd = common::DefaultDelegate;
6627 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6628 dlg.begin(common::MethodInfo {
6629 id: "games.applications.get",
6630 http_method: hyper::Method::GET,
6631 });
6632
6633 for &field in ["alt", "applicationId", "platformType", "language"].iter() {
6634 if self._additional_params.contains_key(field) {
6635 dlg.finished(false);
6636 return Err(common::Error::FieldClash(field));
6637 }
6638 }
6639
6640 let mut params = Params::with_capacity(5 + self._additional_params.len());
6641 params.push("applicationId", self._application_id);
6642 if let Some(value) = self._platform_type.as_ref() {
6643 params.push("platformType", value);
6644 }
6645 if let Some(value) = self._language.as_ref() {
6646 params.push("language", value);
6647 }
6648
6649 params.extend(self._additional_params.iter());
6650
6651 params.push("alt", "json");
6652 let mut url = self.hub._base_url.clone() + "games/v1/applications/{applicationId}";
6653 if self._scopes.is_empty() {
6654 self._scopes.insert(Scope::Full.as_ref().to_string());
6655 }
6656
6657 #[allow(clippy::single_element_loop)]
6658 for &(find_this, param_name) in [("{applicationId}", "applicationId")].iter() {
6659 url = params.uri_replacement(url, param_name, find_this, false);
6660 }
6661 {
6662 let to_remove = ["applicationId"];
6663 params.remove_params(&to_remove);
6664 }
6665
6666 let url = params.parse_with_url(&url);
6667
6668 loop {
6669 let token = match self
6670 .hub
6671 .auth
6672 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6673 .await
6674 {
6675 Ok(token) => token,
6676 Err(e) => match dlg.token(e) {
6677 Ok(token) => token,
6678 Err(e) => {
6679 dlg.finished(false);
6680 return Err(common::Error::MissingToken(e));
6681 }
6682 },
6683 };
6684 let mut req_result = {
6685 let client = &self.hub.client;
6686 dlg.pre_request();
6687 let mut req_builder = hyper::Request::builder()
6688 .method(hyper::Method::GET)
6689 .uri(url.as_str())
6690 .header(USER_AGENT, self.hub._user_agent.clone());
6691
6692 if let Some(token) = token.as_ref() {
6693 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6694 }
6695
6696 let request = req_builder
6697 .header(CONTENT_LENGTH, 0_u64)
6698 .body(common::to_body::<String>(None));
6699
6700 client.request(request.unwrap()).await
6701 };
6702
6703 match req_result {
6704 Err(err) => {
6705 if let common::Retry::After(d) = dlg.http_error(&err) {
6706 sleep(d).await;
6707 continue;
6708 }
6709 dlg.finished(false);
6710 return Err(common::Error::HttpError(err));
6711 }
6712 Ok(res) => {
6713 let (mut parts, body) = res.into_parts();
6714 let mut body = common::Body::new(body);
6715 if !parts.status.is_success() {
6716 let bytes = common::to_bytes(body).await.unwrap_or_default();
6717 let error = serde_json::from_str(&common::to_string(&bytes));
6718 let response = common::to_response(parts, bytes.into());
6719
6720 if let common::Retry::After(d) =
6721 dlg.http_failure(&response, error.as_ref().ok())
6722 {
6723 sleep(d).await;
6724 continue;
6725 }
6726
6727 dlg.finished(false);
6728
6729 return Err(match error {
6730 Ok(value) => common::Error::BadRequest(value),
6731 _ => common::Error::Failure(response),
6732 });
6733 }
6734 let response = {
6735 let bytes = common::to_bytes(body).await.unwrap_or_default();
6736 let encoded = common::to_string(&bytes);
6737 match serde_json::from_str(&encoded) {
6738 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6739 Err(error) => {
6740 dlg.response_json_decode_error(&encoded, &error);
6741 return Err(common::Error::JsonDecodeError(
6742 encoded.to_string(),
6743 error,
6744 ));
6745 }
6746 }
6747 };
6748
6749 dlg.finished(true);
6750 return Ok(response);
6751 }
6752 }
6753 }
6754 }
6755
6756 /// The application ID from the Google Play developer console.
6757 ///
6758 /// Sets the *application id* path property to the given value.
6759 ///
6760 /// Even though the property as already been set when instantiating this call,
6761 /// we provide this method for API completeness.
6762 pub fn application_id(mut self, new_value: &str) -> ApplicationGetCall<'a, C> {
6763 self._application_id = new_value.to_string();
6764 self
6765 }
6766 /// Restrict application details returned to the specific platform.
6767 ///
6768 /// Sets the *platform type* query property to the given value.
6769 pub fn platform_type(mut self, new_value: &str) -> ApplicationGetCall<'a, C> {
6770 self._platform_type = Some(new_value.to_string());
6771 self
6772 }
6773 /// The preferred language to use for strings returned by this method.
6774 ///
6775 /// Sets the *language* query property to the given value.
6776 pub fn language(mut self, new_value: &str) -> ApplicationGetCall<'a, C> {
6777 self._language = Some(new_value.to_string());
6778 self
6779 }
6780 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6781 /// while executing the actual API request.
6782 ///
6783 /// ````text
6784 /// It should be used to handle progress information, and to implement a certain level of resilience.
6785 /// ````
6786 ///
6787 /// Sets the *delegate* property to the given value.
6788 pub fn delegate(
6789 mut self,
6790 new_value: &'a mut dyn common::Delegate,
6791 ) -> ApplicationGetCall<'a, C> {
6792 self._delegate = Some(new_value);
6793 self
6794 }
6795
6796 /// Set any additional parameter of the query string used in the request.
6797 /// It should be used to set parameters which are not yet available through their own
6798 /// setters.
6799 ///
6800 /// Please note that this method must not be used to set any of the known parameters
6801 /// which have their own setter method. If done anyway, the request will fail.
6802 ///
6803 /// # Additional Parameters
6804 ///
6805 /// * *$.xgafv* (query-string) - V1 error format.
6806 /// * *access_token* (query-string) - OAuth access token.
6807 /// * *alt* (query-string) - Data format for response.
6808 /// * *callback* (query-string) - JSONP
6809 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6810 /// * *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.
6811 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6812 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6813 /// * *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.
6814 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6815 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6816 pub fn param<T>(mut self, name: T, value: T) -> ApplicationGetCall<'a, C>
6817 where
6818 T: AsRef<str>,
6819 {
6820 self._additional_params
6821 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6822 self
6823 }
6824
6825 /// Identifies the authorization scope for the method you are building.
6826 ///
6827 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6828 /// [`Scope::Full`].
6829 ///
6830 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6831 /// tokens for more than one scope.
6832 ///
6833 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6834 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6835 /// sufficient, a read-write scope will do as well.
6836 pub fn add_scope<St>(mut self, scope: St) -> ApplicationGetCall<'a, C>
6837 where
6838 St: AsRef<str>,
6839 {
6840 self._scopes.insert(String::from(scope.as_ref()));
6841 self
6842 }
6843 /// Identifies the authorization scope(s) for the method you are building.
6844 ///
6845 /// See [`Self::add_scope()`] for details.
6846 pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationGetCall<'a, C>
6847 where
6848 I: IntoIterator<Item = St>,
6849 St: AsRef<str>,
6850 {
6851 self._scopes
6852 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6853 self
6854 }
6855
6856 /// Removes all scopes, and no default scope will be used either.
6857 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6858 /// for details).
6859 pub fn clear_scopes(mut self) -> ApplicationGetCall<'a, C> {
6860 self._scopes.clear();
6861 self
6862 }
6863}
6864
6865/// Returns a URL for the requested end point type.
6866///
6867/// A builder for the *getEndPoint* method supported by a *application* resource.
6868/// It is not used directly, but through a [`ApplicationMethods`] instance.
6869///
6870/// # Example
6871///
6872/// Instantiate a resource method builder
6873///
6874/// ```test_harness,no_run
6875/// # extern crate hyper;
6876/// # extern crate hyper_rustls;
6877/// # extern crate google_games1 as games1;
6878/// # async fn dox() {
6879/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6880///
6881/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6882/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6883/// # .with_native_roots()
6884/// # .unwrap()
6885/// # .https_only()
6886/// # .enable_http2()
6887/// # .build();
6888///
6889/// # let executor = hyper_util::rt::TokioExecutor::new();
6890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6891/// # secret,
6892/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6893/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6894/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6895/// # ),
6896/// # ).build().await.unwrap();
6897///
6898/// # let client = hyper_util::client::legacy::Client::builder(
6899/// # hyper_util::rt::TokioExecutor::new()
6900/// # )
6901/// # .build(
6902/// # hyper_rustls::HttpsConnectorBuilder::new()
6903/// # .with_native_roots()
6904/// # .unwrap()
6905/// # .https_or_http()
6906/// # .enable_http2()
6907/// # .build()
6908/// # );
6909/// # let mut hub = Games::new(client, auth);
6910/// // You can configure optional parameters by calling the respective setters at will, and
6911/// // execute the final call using `doit()`.
6912/// // Values shown here are possibly random and not representative !
6913/// let result = hub.applications().get_end_point()
6914/// .end_point_type("gubergren")
6915/// .application_id("ea")
6916/// .doit().await;
6917/// # }
6918/// ```
6919pub struct ApplicationGetEndPointCall<'a, C>
6920where
6921 C: 'a,
6922{
6923 hub: &'a Games<C>,
6924 _end_point_type: Option<String>,
6925 _application_id: Option<String>,
6926 _delegate: Option<&'a mut dyn common::Delegate>,
6927 _additional_params: HashMap<String, String>,
6928 _scopes: BTreeSet<String>,
6929}
6930
6931impl<'a, C> common::CallBuilder for ApplicationGetEndPointCall<'a, C> {}
6932
6933impl<'a, C> ApplicationGetEndPointCall<'a, C>
6934where
6935 C: common::Connector,
6936{
6937 /// Perform the operation you have build so far.
6938 pub async fn doit(mut self) -> common::Result<(common::Response, EndPoint)> {
6939 use std::borrow::Cow;
6940 use std::io::{Read, Seek};
6941
6942 use common::{url::Params, ToParts};
6943 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6944
6945 let mut dd = common::DefaultDelegate;
6946 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6947 dlg.begin(common::MethodInfo {
6948 id: "games.applications.getEndPoint",
6949 http_method: hyper::Method::POST,
6950 });
6951
6952 for &field in ["alt", "endPointType", "applicationId"].iter() {
6953 if self._additional_params.contains_key(field) {
6954 dlg.finished(false);
6955 return Err(common::Error::FieldClash(field));
6956 }
6957 }
6958
6959 let mut params = Params::with_capacity(4 + self._additional_params.len());
6960 if let Some(value) = self._end_point_type.as_ref() {
6961 params.push("endPointType", value);
6962 }
6963 if let Some(value) = self._application_id.as_ref() {
6964 params.push("applicationId", value);
6965 }
6966
6967 params.extend(self._additional_params.iter());
6968
6969 params.push("alt", "json");
6970 let mut url = self.hub._base_url.clone() + "games/v1/applications/getEndPoint";
6971 if self._scopes.is_empty() {
6972 self._scopes.insert(Scope::Full.as_ref().to_string());
6973 }
6974
6975 let url = params.parse_with_url(&url);
6976
6977 loop {
6978 let token = match self
6979 .hub
6980 .auth
6981 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6982 .await
6983 {
6984 Ok(token) => token,
6985 Err(e) => match dlg.token(e) {
6986 Ok(token) => token,
6987 Err(e) => {
6988 dlg.finished(false);
6989 return Err(common::Error::MissingToken(e));
6990 }
6991 },
6992 };
6993 let mut req_result = {
6994 let client = &self.hub.client;
6995 dlg.pre_request();
6996 let mut req_builder = hyper::Request::builder()
6997 .method(hyper::Method::POST)
6998 .uri(url.as_str())
6999 .header(USER_AGENT, self.hub._user_agent.clone());
7000
7001 if let Some(token) = token.as_ref() {
7002 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7003 }
7004
7005 let request = req_builder
7006 .header(CONTENT_LENGTH, 0_u64)
7007 .body(common::to_body::<String>(None));
7008
7009 client.request(request.unwrap()).await
7010 };
7011
7012 match req_result {
7013 Err(err) => {
7014 if let common::Retry::After(d) = dlg.http_error(&err) {
7015 sleep(d).await;
7016 continue;
7017 }
7018 dlg.finished(false);
7019 return Err(common::Error::HttpError(err));
7020 }
7021 Ok(res) => {
7022 let (mut parts, body) = res.into_parts();
7023 let mut body = common::Body::new(body);
7024 if !parts.status.is_success() {
7025 let bytes = common::to_bytes(body).await.unwrap_or_default();
7026 let error = serde_json::from_str(&common::to_string(&bytes));
7027 let response = common::to_response(parts, bytes.into());
7028
7029 if let common::Retry::After(d) =
7030 dlg.http_failure(&response, error.as_ref().ok())
7031 {
7032 sleep(d).await;
7033 continue;
7034 }
7035
7036 dlg.finished(false);
7037
7038 return Err(match error {
7039 Ok(value) => common::Error::BadRequest(value),
7040 _ => common::Error::Failure(response),
7041 });
7042 }
7043 let response = {
7044 let bytes = common::to_bytes(body).await.unwrap_or_default();
7045 let encoded = common::to_string(&bytes);
7046 match serde_json::from_str(&encoded) {
7047 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7048 Err(error) => {
7049 dlg.response_json_decode_error(&encoded, &error);
7050 return Err(common::Error::JsonDecodeError(
7051 encoded.to_string(),
7052 error,
7053 ));
7054 }
7055 }
7056 };
7057
7058 dlg.finished(true);
7059 return Ok(response);
7060 }
7061 }
7062 }
7063 }
7064
7065 /// Type of endpoint being requested.
7066 ///
7067 /// Sets the *end point type* query property to the given value.
7068 pub fn end_point_type(mut self, new_value: &str) -> ApplicationGetEndPointCall<'a, C> {
7069 self._end_point_type = Some(new_value.to_string());
7070 self
7071 }
7072 /// The application ID from the Google Play developer console.
7073 ///
7074 /// Sets the *application id* query property to the given value.
7075 pub fn application_id(mut self, new_value: &str) -> ApplicationGetEndPointCall<'a, C> {
7076 self._application_id = Some(new_value.to_string());
7077 self
7078 }
7079 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7080 /// while executing the actual API request.
7081 ///
7082 /// ````text
7083 /// It should be used to handle progress information, and to implement a certain level of resilience.
7084 /// ````
7085 ///
7086 /// Sets the *delegate* property to the given value.
7087 pub fn delegate(
7088 mut self,
7089 new_value: &'a mut dyn common::Delegate,
7090 ) -> ApplicationGetEndPointCall<'a, C> {
7091 self._delegate = Some(new_value);
7092 self
7093 }
7094
7095 /// Set any additional parameter of the query string used in the request.
7096 /// It should be used to set parameters which are not yet available through their own
7097 /// setters.
7098 ///
7099 /// Please note that this method must not be used to set any of the known parameters
7100 /// which have their own setter method. If done anyway, the request will fail.
7101 ///
7102 /// # Additional Parameters
7103 ///
7104 /// * *$.xgafv* (query-string) - V1 error format.
7105 /// * *access_token* (query-string) - OAuth access token.
7106 /// * *alt* (query-string) - Data format for response.
7107 /// * *callback* (query-string) - JSONP
7108 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7109 /// * *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.
7110 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7111 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7112 /// * *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.
7113 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7114 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7115 pub fn param<T>(mut self, name: T, value: T) -> ApplicationGetEndPointCall<'a, C>
7116 where
7117 T: AsRef<str>,
7118 {
7119 self._additional_params
7120 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7121 self
7122 }
7123
7124 /// Identifies the authorization scope for the method you are building.
7125 ///
7126 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7127 /// [`Scope::Full`].
7128 ///
7129 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7130 /// tokens for more than one scope.
7131 ///
7132 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7133 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7134 /// sufficient, a read-write scope will do as well.
7135 pub fn add_scope<St>(mut self, scope: St) -> ApplicationGetEndPointCall<'a, C>
7136 where
7137 St: AsRef<str>,
7138 {
7139 self._scopes.insert(String::from(scope.as_ref()));
7140 self
7141 }
7142 /// Identifies the authorization scope(s) for the method you are building.
7143 ///
7144 /// See [`Self::add_scope()`] for details.
7145 pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationGetEndPointCall<'a, C>
7146 where
7147 I: IntoIterator<Item = St>,
7148 St: AsRef<str>,
7149 {
7150 self._scopes
7151 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7152 self
7153 }
7154
7155 /// Removes all scopes, and no default scope will be used either.
7156 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7157 /// for details).
7158 pub fn clear_scopes(mut self) -> ApplicationGetEndPointCall<'a, C> {
7159 self._scopes.clear();
7160 self
7161 }
7162}
7163
7164/// Indicate that the currently authenticated user is playing your application.
7165///
7166/// A builder for the *played* method supported by a *application* resource.
7167/// It is not used directly, but through a [`ApplicationMethods`] instance.
7168///
7169/// # Example
7170///
7171/// Instantiate a resource method builder
7172///
7173/// ```test_harness,no_run
7174/// # extern crate hyper;
7175/// # extern crate hyper_rustls;
7176/// # extern crate google_games1 as games1;
7177/// # async fn dox() {
7178/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7179///
7180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7181/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7182/// # .with_native_roots()
7183/// # .unwrap()
7184/// # .https_only()
7185/// # .enable_http2()
7186/// # .build();
7187///
7188/// # let executor = hyper_util::rt::TokioExecutor::new();
7189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7190/// # secret,
7191/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7192/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7193/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7194/// # ),
7195/// # ).build().await.unwrap();
7196///
7197/// # let client = hyper_util::client::legacy::Client::builder(
7198/// # hyper_util::rt::TokioExecutor::new()
7199/// # )
7200/// # .build(
7201/// # hyper_rustls::HttpsConnectorBuilder::new()
7202/// # .with_native_roots()
7203/// # .unwrap()
7204/// # .https_or_http()
7205/// # .enable_http2()
7206/// # .build()
7207/// # );
7208/// # let mut hub = Games::new(client, auth);
7209/// // You can configure optional parameters by calling the respective setters at will, and
7210/// // execute the final call using `doit()`.
7211/// // Values shown here are possibly random and not representative !
7212/// let result = hub.applications().played()
7213/// .doit().await;
7214/// # }
7215/// ```
7216pub struct ApplicationPlayedCall<'a, C>
7217where
7218 C: 'a,
7219{
7220 hub: &'a Games<C>,
7221 _delegate: Option<&'a mut dyn common::Delegate>,
7222 _additional_params: HashMap<String, String>,
7223 _scopes: BTreeSet<String>,
7224}
7225
7226impl<'a, C> common::CallBuilder for ApplicationPlayedCall<'a, C> {}
7227
7228impl<'a, C> ApplicationPlayedCall<'a, C>
7229where
7230 C: common::Connector,
7231{
7232 /// Perform the operation you have build so far.
7233 pub async fn doit(mut self) -> common::Result<common::Response> {
7234 use std::borrow::Cow;
7235 use std::io::{Read, Seek};
7236
7237 use common::{url::Params, ToParts};
7238 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7239
7240 let mut dd = common::DefaultDelegate;
7241 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7242 dlg.begin(common::MethodInfo {
7243 id: "games.applications.played",
7244 http_method: hyper::Method::POST,
7245 });
7246
7247 for &field in [].iter() {
7248 if self._additional_params.contains_key(field) {
7249 dlg.finished(false);
7250 return Err(common::Error::FieldClash(field));
7251 }
7252 }
7253
7254 let mut params = Params::with_capacity(1 + self._additional_params.len());
7255
7256 params.extend(self._additional_params.iter());
7257
7258 let mut url = self.hub._base_url.clone() + "games/v1/applications/played";
7259 if self._scopes.is_empty() {
7260 self._scopes.insert(Scope::Full.as_ref().to_string());
7261 }
7262
7263 let url = params.parse_with_url(&url);
7264
7265 loop {
7266 let token = match self
7267 .hub
7268 .auth
7269 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7270 .await
7271 {
7272 Ok(token) => token,
7273 Err(e) => match dlg.token(e) {
7274 Ok(token) => token,
7275 Err(e) => {
7276 dlg.finished(false);
7277 return Err(common::Error::MissingToken(e));
7278 }
7279 },
7280 };
7281 let mut req_result = {
7282 let client = &self.hub.client;
7283 dlg.pre_request();
7284 let mut req_builder = hyper::Request::builder()
7285 .method(hyper::Method::POST)
7286 .uri(url.as_str())
7287 .header(USER_AGENT, self.hub._user_agent.clone());
7288
7289 if let Some(token) = token.as_ref() {
7290 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7291 }
7292
7293 let request = req_builder
7294 .header(CONTENT_LENGTH, 0_u64)
7295 .body(common::to_body::<String>(None));
7296
7297 client.request(request.unwrap()).await
7298 };
7299
7300 match req_result {
7301 Err(err) => {
7302 if let common::Retry::After(d) = dlg.http_error(&err) {
7303 sleep(d).await;
7304 continue;
7305 }
7306 dlg.finished(false);
7307 return Err(common::Error::HttpError(err));
7308 }
7309 Ok(res) => {
7310 let (mut parts, body) = res.into_parts();
7311 let mut body = common::Body::new(body);
7312 if !parts.status.is_success() {
7313 let bytes = common::to_bytes(body).await.unwrap_or_default();
7314 let error = serde_json::from_str(&common::to_string(&bytes));
7315 let response = common::to_response(parts, bytes.into());
7316
7317 if let common::Retry::After(d) =
7318 dlg.http_failure(&response, error.as_ref().ok())
7319 {
7320 sleep(d).await;
7321 continue;
7322 }
7323
7324 dlg.finished(false);
7325
7326 return Err(match error {
7327 Ok(value) => common::Error::BadRequest(value),
7328 _ => common::Error::Failure(response),
7329 });
7330 }
7331 let response = common::Response::from_parts(parts, body);
7332
7333 dlg.finished(true);
7334 return Ok(response);
7335 }
7336 }
7337 }
7338 }
7339
7340 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7341 /// while executing the actual API request.
7342 ///
7343 /// ````text
7344 /// It should be used to handle progress information, and to implement a certain level of resilience.
7345 /// ````
7346 ///
7347 /// Sets the *delegate* property to the given value.
7348 pub fn delegate(
7349 mut self,
7350 new_value: &'a mut dyn common::Delegate,
7351 ) -> ApplicationPlayedCall<'a, C> {
7352 self._delegate = Some(new_value);
7353 self
7354 }
7355
7356 /// Set any additional parameter of the query string used in the request.
7357 /// It should be used to set parameters which are not yet available through their own
7358 /// setters.
7359 ///
7360 /// Please note that this method must not be used to set any of the known parameters
7361 /// which have their own setter method. If done anyway, the request will fail.
7362 ///
7363 /// # Additional Parameters
7364 ///
7365 /// * *$.xgafv* (query-string) - V1 error format.
7366 /// * *access_token* (query-string) - OAuth access token.
7367 /// * *alt* (query-string) - Data format for response.
7368 /// * *callback* (query-string) - JSONP
7369 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7370 /// * *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.
7371 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7372 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7373 /// * *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.
7374 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7375 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7376 pub fn param<T>(mut self, name: T, value: T) -> ApplicationPlayedCall<'a, C>
7377 where
7378 T: AsRef<str>,
7379 {
7380 self._additional_params
7381 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7382 self
7383 }
7384
7385 /// Identifies the authorization scope for the method you are building.
7386 ///
7387 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7388 /// [`Scope::Full`].
7389 ///
7390 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7391 /// tokens for more than one scope.
7392 ///
7393 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7394 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7395 /// sufficient, a read-write scope will do as well.
7396 pub fn add_scope<St>(mut self, scope: St) -> ApplicationPlayedCall<'a, C>
7397 where
7398 St: AsRef<str>,
7399 {
7400 self._scopes.insert(String::from(scope.as_ref()));
7401 self
7402 }
7403 /// Identifies the authorization scope(s) for the method you are building.
7404 ///
7405 /// See [`Self::add_scope()`] for details.
7406 pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationPlayedCall<'a, C>
7407 where
7408 I: IntoIterator<Item = St>,
7409 St: AsRef<str>,
7410 {
7411 self._scopes
7412 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7413 self
7414 }
7415
7416 /// Removes all scopes, and no default scope will be used either.
7417 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7418 /// for details).
7419 pub fn clear_scopes(mut self) -> ApplicationPlayedCall<'a, C> {
7420 self._scopes.clear();
7421 self
7422 }
7423}
7424
7425/// Verifies the auth token provided with this request is for the application with the specified ID, and returns the ID of the player it was granted for.
7426///
7427/// A builder for the *verify* method supported by a *application* resource.
7428/// It is not used directly, but through a [`ApplicationMethods`] instance.
7429///
7430/// # Example
7431///
7432/// Instantiate a resource method builder
7433///
7434/// ```test_harness,no_run
7435/// # extern crate hyper;
7436/// # extern crate hyper_rustls;
7437/// # extern crate google_games1 as games1;
7438/// # async fn dox() {
7439/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7440///
7441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7442/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7443/// # .with_native_roots()
7444/// # .unwrap()
7445/// # .https_only()
7446/// # .enable_http2()
7447/// # .build();
7448///
7449/// # let executor = hyper_util::rt::TokioExecutor::new();
7450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7451/// # secret,
7452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7453/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7454/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7455/// # ),
7456/// # ).build().await.unwrap();
7457///
7458/// # let client = hyper_util::client::legacy::Client::builder(
7459/// # hyper_util::rt::TokioExecutor::new()
7460/// # )
7461/// # .build(
7462/// # hyper_rustls::HttpsConnectorBuilder::new()
7463/// # .with_native_roots()
7464/// # .unwrap()
7465/// # .https_or_http()
7466/// # .enable_http2()
7467/// # .build()
7468/// # );
7469/// # let mut hub = Games::new(client, auth);
7470/// // You can configure optional parameters by calling the respective setters at will, and
7471/// // execute the final call using `doit()`.
7472/// // Values shown here are possibly random and not representative !
7473/// let result = hub.applications().verify("applicationId")
7474/// .doit().await;
7475/// # }
7476/// ```
7477pub struct ApplicationVerifyCall<'a, C>
7478where
7479 C: 'a,
7480{
7481 hub: &'a Games<C>,
7482 _application_id: String,
7483 _delegate: Option<&'a mut dyn common::Delegate>,
7484 _additional_params: HashMap<String, String>,
7485 _scopes: BTreeSet<String>,
7486}
7487
7488impl<'a, C> common::CallBuilder for ApplicationVerifyCall<'a, C> {}
7489
7490impl<'a, C> ApplicationVerifyCall<'a, C>
7491where
7492 C: common::Connector,
7493{
7494 /// Perform the operation you have build so far.
7495 pub async fn doit(mut self) -> common::Result<(common::Response, ApplicationVerifyResponse)> {
7496 use std::borrow::Cow;
7497 use std::io::{Read, Seek};
7498
7499 use common::{url::Params, ToParts};
7500 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7501
7502 let mut dd = common::DefaultDelegate;
7503 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7504 dlg.begin(common::MethodInfo {
7505 id: "games.applications.verify",
7506 http_method: hyper::Method::GET,
7507 });
7508
7509 for &field in ["alt", "applicationId"].iter() {
7510 if self._additional_params.contains_key(field) {
7511 dlg.finished(false);
7512 return Err(common::Error::FieldClash(field));
7513 }
7514 }
7515
7516 let mut params = Params::with_capacity(3 + self._additional_params.len());
7517 params.push("applicationId", self._application_id);
7518
7519 params.extend(self._additional_params.iter());
7520
7521 params.push("alt", "json");
7522 let mut url = self.hub._base_url.clone() + "games/v1/applications/{applicationId}/verify";
7523 if self._scopes.is_empty() {
7524 self._scopes.insert(Scope::Full.as_ref().to_string());
7525 }
7526
7527 #[allow(clippy::single_element_loop)]
7528 for &(find_this, param_name) in [("{applicationId}", "applicationId")].iter() {
7529 url = params.uri_replacement(url, param_name, find_this, false);
7530 }
7531 {
7532 let to_remove = ["applicationId"];
7533 params.remove_params(&to_remove);
7534 }
7535
7536 let url = params.parse_with_url(&url);
7537
7538 loop {
7539 let token = match self
7540 .hub
7541 .auth
7542 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7543 .await
7544 {
7545 Ok(token) => token,
7546 Err(e) => match dlg.token(e) {
7547 Ok(token) => token,
7548 Err(e) => {
7549 dlg.finished(false);
7550 return Err(common::Error::MissingToken(e));
7551 }
7552 },
7553 };
7554 let mut req_result = {
7555 let client = &self.hub.client;
7556 dlg.pre_request();
7557 let mut req_builder = hyper::Request::builder()
7558 .method(hyper::Method::GET)
7559 .uri(url.as_str())
7560 .header(USER_AGENT, self.hub._user_agent.clone());
7561
7562 if let Some(token) = token.as_ref() {
7563 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7564 }
7565
7566 let request = req_builder
7567 .header(CONTENT_LENGTH, 0_u64)
7568 .body(common::to_body::<String>(None));
7569
7570 client.request(request.unwrap()).await
7571 };
7572
7573 match req_result {
7574 Err(err) => {
7575 if let common::Retry::After(d) = dlg.http_error(&err) {
7576 sleep(d).await;
7577 continue;
7578 }
7579 dlg.finished(false);
7580 return Err(common::Error::HttpError(err));
7581 }
7582 Ok(res) => {
7583 let (mut parts, body) = res.into_parts();
7584 let mut body = common::Body::new(body);
7585 if !parts.status.is_success() {
7586 let bytes = common::to_bytes(body).await.unwrap_or_default();
7587 let error = serde_json::from_str(&common::to_string(&bytes));
7588 let response = common::to_response(parts, bytes.into());
7589
7590 if let common::Retry::After(d) =
7591 dlg.http_failure(&response, error.as_ref().ok())
7592 {
7593 sleep(d).await;
7594 continue;
7595 }
7596
7597 dlg.finished(false);
7598
7599 return Err(match error {
7600 Ok(value) => common::Error::BadRequest(value),
7601 _ => common::Error::Failure(response),
7602 });
7603 }
7604 let response = {
7605 let bytes = common::to_bytes(body).await.unwrap_or_default();
7606 let encoded = common::to_string(&bytes);
7607 match serde_json::from_str(&encoded) {
7608 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7609 Err(error) => {
7610 dlg.response_json_decode_error(&encoded, &error);
7611 return Err(common::Error::JsonDecodeError(
7612 encoded.to_string(),
7613 error,
7614 ));
7615 }
7616 }
7617 };
7618
7619 dlg.finished(true);
7620 return Ok(response);
7621 }
7622 }
7623 }
7624 }
7625
7626 /// The application ID from the Google Play developer console.
7627 ///
7628 /// Sets the *application id* path property to the given value.
7629 ///
7630 /// Even though the property as already been set when instantiating this call,
7631 /// we provide this method for API completeness.
7632 pub fn application_id(mut self, new_value: &str) -> ApplicationVerifyCall<'a, C> {
7633 self._application_id = new_value.to_string();
7634 self
7635 }
7636 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7637 /// while executing the actual API request.
7638 ///
7639 /// ````text
7640 /// It should be used to handle progress information, and to implement a certain level of resilience.
7641 /// ````
7642 ///
7643 /// Sets the *delegate* property to the given value.
7644 pub fn delegate(
7645 mut self,
7646 new_value: &'a mut dyn common::Delegate,
7647 ) -> ApplicationVerifyCall<'a, C> {
7648 self._delegate = Some(new_value);
7649 self
7650 }
7651
7652 /// Set any additional parameter of the query string used in the request.
7653 /// It should be used to set parameters which are not yet available through their own
7654 /// setters.
7655 ///
7656 /// Please note that this method must not be used to set any of the known parameters
7657 /// which have their own setter method. If done anyway, the request will fail.
7658 ///
7659 /// # Additional Parameters
7660 ///
7661 /// * *$.xgafv* (query-string) - V1 error format.
7662 /// * *access_token* (query-string) - OAuth access token.
7663 /// * *alt* (query-string) - Data format for response.
7664 /// * *callback* (query-string) - JSONP
7665 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7666 /// * *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.
7667 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7668 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7669 /// * *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.
7670 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7671 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7672 pub fn param<T>(mut self, name: T, value: T) -> ApplicationVerifyCall<'a, C>
7673 where
7674 T: AsRef<str>,
7675 {
7676 self._additional_params
7677 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7678 self
7679 }
7680
7681 /// Identifies the authorization scope for the method you are building.
7682 ///
7683 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7684 /// [`Scope::Full`].
7685 ///
7686 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7687 /// tokens for more than one scope.
7688 ///
7689 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7690 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7691 /// sufficient, a read-write scope will do as well.
7692 pub fn add_scope<St>(mut self, scope: St) -> ApplicationVerifyCall<'a, C>
7693 where
7694 St: AsRef<str>,
7695 {
7696 self._scopes.insert(String::from(scope.as_ref()));
7697 self
7698 }
7699 /// Identifies the authorization scope(s) for the method you are building.
7700 ///
7701 /// See [`Self::add_scope()`] for details.
7702 pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationVerifyCall<'a, C>
7703 where
7704 I: IntoIterator<Item = St>,
7705 St: AsRef<str>,
7706 {
7707 self._scopes
7708 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7709 self
7710 }
7711
7712 /// Removes all scopes, and no default scope will be used either.
7713 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7714 /// for details).
7715 pub fn clear_scopes(mut self) -> ApplicationVerifyCall<'a, C> {
7716 self._scopes.clear();
7717 self
7718 }
7719}
7720
7721/// Returns a list showing the current progress on events in this application for the currently authenticated user.
7722///
7723/// A builder for the *listByPlayer* method supported by a *event* resource.
7724/// It is not used directly, but through a [`EventMethods`] instance.
7725///
7726/// # Example
7727///
7728/// Instantiate a resource method builder
7729///
7730/// ```test_harness,no_run
7731/// # extern crate hyper;
7732/// # extern crate hyper_rustls;
7733/// # extern crate google_games1 as games1;
7734/// # async fn dox() {
7735/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7736///
7737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7738/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7739/// # .with_native_roots()
7740/// # .unwrap()
7741/// # .https_only()
7742/// # .enable_http2()
7743/// # .build();
7744///
7745/// # let executor = hyper_util::rt::TokioExecutor::new();
7746/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7747/// # secret,
7748/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7749/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7750/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7751/// # ),
7752/// # ).build().await.unwrap();
7753///
7754/// # let client = hyper_util::client::legacy::Client::builder(
7755/// # hyper_util::rt::TokioExecutor::new()
7756/// # )
7757/// # .build(
7758/// # hyper_rustls::HttpsConnectorBuilder::new()
7759/// # .with_native_roots()
7760/// # .unwrap()
7761/// # .https_or_http()
7762/// # .enable_http2()
7763/// # .build()
7764/// # );
7765/// # let mut hub = Games::new(client, auth);
7766/// // You can configure optional parameters by calling the respective setters at will, and
7767/// // execute the final call using `doit()`.
7768/// // Values shown here are possibly random and not representative !
7769/// let result = hub.events().list_by_player()
7770/// .page_token("Lorem")
7771/// .max_results(-25)
7772/// .language("labore")
7773/// .doit().await;
7774/// # }
7775/// ```
7776pub struct EventListByPlayerCall<'a, C>
7777where
7778 C: 'a,
7779{
7780 hub: &'a Games<C>,
7781 _page_token: Option<String>,
7782 _max_results: Option<i32>,
7783 _language: Option<String>,
7784 _delegate: Option<&'a mut dyn common::Delegate>,
7785 _additional_params: HashMap<String, String>,
7786 _scopes: BTreeSet<String>,
7787}
7788
7789impl<'a, C> common::CallBuilder for EventListByPlayerCall<'a, C> {}
7790
7791impl<'a, C> EventListByPlayerCall<'a, C>
7792where
7793 C: common::Connector,
7794{
7795 /// Perform the operation you have build so far.
7796 pub async fn doit(mut self) -> common::Result<(common::Response, PlayerEventListResponse)> {
7797 use std::borrow::Cow;
7798 use std::io::{Read, Seek};
7799
7800 use common::{url::Params, ToParts};
7801 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7802
7803 let mut dd = common::DefaultDelegate;
7804 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7805 dlg.begin(common::MethodInfo {
7806 id: "games.events.listByPlayer",
7807 http_method: hyper::Method::GET,
7808 });
7809
7810 for &field in ["alt", "pageToken", "maxResults", "language"].iter() {
7811 if self._additional_params.contains_key(field) {
7812 dlg.finished(false);
7813 return Err(common::Error::FieldClash(field));
7814 }
7815 }
7816
7817 let mut params = Params::with_capacity(5 + self._additional_params.len());
7818 if let Some(value) = self._page_token.as_ref() {
7819 params.push("pageToken", value);
7820 }
7821 if let Some(value) = self._max_results.as_ref() {
7822 params.push("maxResults", value.to_string());
7823 }
7824 if let Some(value) = self._language.as_ref() {
7825 params.push("language", value);
7826 }
7827
7828 params.extend(self._additional_params.iter());
7829
7830 params.push("alt", "json");
7831 let mut url = self.hub._base_url.clone() + "games/v1/events";
7832 if self._scopes.is_empty() {
7833 self._scopes.insert(Scope::Full.as_ref().to_string());
7834 }
7835
7836 let url = params.parse_with_url(&url);
7837
7838 loop {
7839 let token = match self
7840 .hub
7841 .auth
7842 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7843 .await
7844 {
7845 Ok(token) => token,
7846 Err(e) => match dlg.token(e) {
7847 Ok(token) => token,
7848 Err(e) => {
7849 dlg.finished(false);
7850 return Err(common::Error::MissingToken(e));
7851 }
7852 },
7853 };
7854 let mut req_result = {
7855 let client = &self.hub.client;
7856 dlg.pre_request();
7857 let mut req_builder = hyper::Request::builder()
7858 .method(hyper::Method::GET)
7859 .uri(url.as_str())
7860 .header(USER_AGENT, self.hub._user_agent.clone());
7861
7862 if let Some(token) = token.as_ref() {
7863 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7864 }
7865
7866 let request = req_builder
7867 .header(CONTENT_LENGTH, 0_u64)
7868 .body(common::to_body::<String>(None));
7869
7870 client.request(request.unwrap()).await
7871 };
7872
7873 match req_result {
7874 Err(err) => {
7875 if let common::Retry::After(d) = dlg.http_error(&err) {
7876 sleep(d).await;
7877 continue;
7878 }
7879 dlg.finished(false);
7880 return Err(common::Error::HttpError(err));
7881 }
7882 Ok(res) => {
7883 let (mut parts, body) = res.into_parts();
7884 let mut body = common::Body::new(body);
7885 if !parts.status.is_success() {
7886 let bytes = common::to_bytes(body).await.unwrap_or_default();
7887 let error = serde_json::from_str(&common::to_string(&bytes));
7888 let response = common::to_response(parts, bytes.into());
7889
7890 if let common::Retry::After(d) =
7891 dlg.http_failure(&response, error.as_ref().ok())
7892 {
7893 sleep(d).await;
7894 continue;
7895 }
7896
7897 dlg.finished(false);
7898
7899 return Err(match error {
7900 Ok(value) => common::Error::BadRequest(value),
7901 _ => common::Error::Failure(response),
7902 });
7903 }
7904 let response = {
7905 let bytes = common::to_bytes(body).await.unwrap_or_default();
7906 let encoded = common::to_string(&bytes);
7907 match serde_json::from_str(&encoded) {
7908 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7909 Err(error) => {
7910 dlg.response_json_decode_error(&encoded, &error);
7911 return Err(common::Error::JsonDecodeError(
7912 encoded.to_string(),
7913 error,
7914 ));
7915 }
7916 }
7917 };
7918
7919 dlg.finished(true);
7920 return Ok(response);
7921 }
7922 }
7923 }
7924 }
7925
7926 /// The token returned by the previous request.
7927 ///
7928 /// Sets the *page token* query property to the given value.
7929 pub fn page_token(mut self, new_value: &str) -> EventListByPlayerCall<'a, C> {
7930 self._page_token = Some(new_value.to_string());
7931 self
7932 }
7933 /// The maximum number of events to return in the response, used for paging. For any response, the actual number of events to return may be less than the specified maxResults.
7934 ///
7935 /// Sets the *max results* query property to the given value.
7936 pub fn max_results(mut self, new_value: i32) -> EventListByPlayerCall<'a, C> {
7937 self._max_results = Some(new_value);
7938 self
7939 }
7940 /// The preferred language to use for strings returned by this method.
7941 ///
7942 /// Sets the *language* query property to the given value.
7943 pub fn language(mut self, new_value: &str) -> EventListByPlayerCall<'a, C> {
7944 self._language = Some(new_value.to_string());
7945 self
7946 }
7947 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7948 /// while executing the actual API request.
7949 ///
7950 /// ````text
7951 /// It should be used to handle progress information, and to implement a certain level of resilience.
7952 /// ````
7953 ///
7954 /// Sets the *delegate* property to the given value.
7955 pub fn delegate(
7956 mut self,
7957 new_value: &'a mut dyn common::Delegate,
7958 ) -> EventListByPlayerCall<'a, C> {
7959 self._delegate = Some(new_value);
7960 self
7961 }
7962
7963 /// Set any additional parameter of the query string used in the request.
7964 /// It should be used to set parameters which are not yet available through their own
7965 /// setters.
7966 ///
7967 /// Please note that this method must not be used to set any of the known parameters
7968 /// which have their own setter method. If done anyway, the request will fail.
7969 ///
7970 /// # Additional Parameters
7971 ///
7972 /// * *$.xgafv* (query-string) - V1 error format.
7973 /// * *access_token* (query-string) - OAuth access token.
7974 /// * *alt* (query-string) - Data format for response.
7975 /// * *callback* (query-string) - JSONP
7976 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7977 /// * *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.
7978 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7979 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7980 /// * *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.
7981 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7982 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7983 pub fn param<T>(mut self, name: T, value: T) -> EventListByPlayerCall<'a, C>
7984 where
7985 T: AsRef<str>,
7986 {
7987 self._additional_params
7988 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7989 self
7990 }
7991
7992 /// Identifies the authorization scope for the method you are building.
7993 ///
7994 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7995 /// [`Scope::Full`].
7996 ///
7997 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7998 /// tokens for more than one scope.
7999 ///
8000 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8001 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8002 /// sufficient, a read-write scope will do as well.
8003 pub fn add_scope<St>(mut self, scope: St) -> EventListByPlayerCall<'a, C>
8004 where
8005 St: AsRef<str>,
8006 {
8007 self._scopes.insert(String::from(scope.as_ref()));
8008 self
8009 }
8010 /// Identifies the authorization scope(s) for the method you are building.
8011 ///
8012 /// See [`Self::add_scope()`] for details.
8013 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventListByPlayerCall<'a, C>
8014 where
8015 I: IntoIterator<Item = St>,
8016 St: AsRef<str>,
8017 {
8018 self._scopes
8019 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8020 self
8021 }
8022
8023 /// Removes all scopes, and no default scope will be used either.
8024 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8025 /// for details).
8026 pub fn clear_scopes(mut self) -> EventListByPlayerCall<'a, C> {
8027 self._scopes.clear();
8028 self
8029 }
8030}
8031
8032/// Returns a list of the event definitions in this application.
8033///
8034/// A builder for the *listDefinitions* method supported by a *event* resource.
8035/// It is not used directly, but through a [`EventMethods`] instance.
8036///
8037/// # Example
8038///
8039/// Instantiate a resource method builder
8040///
8041/// ```test_harness,no_run
8042/// # extern crate hyper;
8043/// # extern crate hyper_rustls;
8044/// # extern crate google_games1 as games1;
8045/// # async fn dox() {
8046/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8047///
8048/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8049/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8050/// # .with_native_roots()
8051/// # .unwrap()
8052/// # .https_only()
8053/// # .enable_http2()
8054/// # .build();
8055///
8056/// # let executor = hyper_util::rt::TokioExecutor::new();
8057/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8058/// # secret,
8059/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8060/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8061/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8062/// # ),
8063/// # ).build().await.unwrap();
8064///
8065/// # let client = hyper_util::client::legacy::Client::builder(
8066/// # hyper_util::rt::TokioExecutor::new()
8067/// # )
8068/// # .build(
8069/// # hyper_rustls::HttpsConnectorBuilder::new()
8070/// # .with_native_roots()
8071/// # .unwrap()
8072/// # .https_or_http()
8073/// # .enable_http2()
8074/// # .build()
8075/// # );
8076/// # let mut hub = Games::new(client, auth);
8077/// // You can configure optional parameters by calling the respective setters at will, and
8078/// // execute the final call using `doit()`.
8079/// // Values shown here are possibly random and not representative !
8080/// let result = hub.events().list_definitions()
8081/// .page_token("sed")
8082/// .max_results(-70)
8083/// .language("sed")
8084/// .doit().await;
8085/// # }
8086/// ```
8087pub struct EventListDefinitionCall<'a, C>
8088where
8089 C: 'a,
8090{
8091 hub: &'a Games<C>,
8092 _page_token: Option<String>,
8093 _max_results: Option<i32>,
8094 _language: Option<String>,
8095 _delegate: Option<&'a mut dyn common::Delegate>,
8096 _additional_params: HashMap<String, String>,
8097 _scopes: BTreeSet<String>,
8098}
8099
8100impl<'a, C> common::CallBuilder for EventListDefinitionCall<'a, C> {}
8101
8102impl<'a, C> EventListDefinitionCall<'a, C>
8103where
8104 C: common::Connector,
8105{
8106 /// Perform the operation you have build so far.
8107 pub async fn doit(mut self) -> common::Result<(common::Response, EventDefinitionListResponse)> {
8108 use std::borrow::Cow;
8109 use std::io::{Read, Seek};
8110
8111 use common::{url::Params, ToParts};
8112 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8113
8114 let mut dd = common::DefaultDelegate;
8115 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8116 dlg.begin(common::MethodInfo {
8117 id: "games.events.listDefinitions",
8118 http_method: hyper::Method::GET,
8119 });
8120
8121 for &field in ["alt", "pageToken", "maxResults", "language"].iter() {
8122 if self._additional_params.contains_key(field) {
8123 dlg.finished(false);
8124 return Err(common::Error::FieldClash(field));
8125 }
8126 }
8127
8128 let mut params = Params::with_capacity(5 + self._additional_params.len());
8129 if let Some(value) = self._page_token.as_ref() {
8130 params.push("pageToken", value);
8131 }
8132 if let Some(value) = self._max_results.as_ref() {
8133 params.push("maxResults", value.to_string());
8134 }
8135 if let Some(value) = self._language.as_ref() {
8136 params.push("language", value);
8137 }
8138
8139 params.extend(self._additional_params.iter());
8140
8141 params.push("alt", "json");
8142 let mut url = self.hub._base_url.clone() + "games/v1/eventDefinitions";
8143 if self._scopes.is_empty() {
8144 self._scopes.insert(Scope::Full.as_ref().to_string());
8145 }
8146
8147 let url = params.parse_with_url(&url);
8148
8149 loop {
8150 let token = match self
8151 .hub
8152 .auth
8153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8154 .await
8155 {
8156 Ok(token) => token,
8157 Err(e) => match dlg.token(e) {
8158 Ok(token) => token,
8159 Err(e) => {
8160 dlg.finished(false);
8161 return Err(common::Error::MissingToken(e));
8162 }
8163 },
8164 };
8165 let mut req_result = {
8166 let client = &self.hub.client;
8167 dlg.pre_request();
8168 let mut req_builder = hyper::Request::builder()
8169 .method(hyper::Method::GET)
8170 .uri(url.as_str())
8171 .header(USER_AGENT, self.hub._user_agent.clone());
8172
8173 if let Some(token) = token.as_ref() {
8174 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8175 }
8176
8177 let request = req_builder
8178 .header(CONTENT_LENGTH, 0_u64)
8179 .body(common::to_body::<String>(None));
8180
8181 client.request(request.unwrap()).await
8182 };
8183
8184 match req_result {
8185 Err(err) => {
8186 if let common::Retry::After(d) = dlg.http_error(&err) {
8187 sleep(d).await;
8188 continue;
8189 }
8190 dlg.finished(false);
8191 return Err(common::Error::HttpError(err));
8192 }
8193 Ok(res) => {
8194 let (mut parts, body) = res.into_parts();
8195 let mut body = common::Body::new(body);
8196 if !parts.status.is_success() {
8197 let bytes = common::to_bytes(body).await.unwrap_or_default();
8198 let error = serde_json::from_str(&common::to_string(&bytes));
8199 let response = common::to_response(parts, bytes.into());
8200
8201 if let common::Retry::After(d) =
8202 dlg.http_failure(&response, error.as_ref().ok())
8203 {
8204 sleep(d).await;
8205 continue;
8206 }
8207
8208 dlg.finished(false);
8209
8210 return Err(match error {
8211 Ok(value) => common::Error::BadRequest(value),
8212 _ => common::Error::Failure(response),
8213 });
8214 }
8215 let response = {
8216 let bytes = common::to_bytes(body).await.unwrap_or_default();
8217 let encoded = common::to_string(&bytes);
8218 match serde_json::from_str(&encoded) {
8219 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8220 Err(error) => {
8221 dlg.response_json_decode_error(&encoded, &error);
8222 return Err(common::Error::JsonDecodeError(
8223 encoded.to_string(),
8224 error,
8225 ));
8226 }
8227 }
8228 };
8229
8230 dlg.finished(true);
8231 return Ok(response);
8232 }
8233 }
8234 }
8235 }
8236
8237 /// The token returned by the previous request.
8238 ///
8239 /// Sets the *page token* query property to the given value.
8240 pub fn page_token(mut self, new_value: &str) -> EventListDefinitionCall<'a, C> {
8241 self._page_token = Some(new_value.to_string());
8242 self
8243 }
8244 /// The maximum number of event definitions to return in the response, used for paging. For any response, the actual number of event definitions to return may be less than the specified `maxResults`.
8245 ///
8246 /// Sets the *max results* query property to the given value.
8247 pub fn max_results(mut self, new_value: i32) -> EventListDefinitionCall<'a, C> {
8248 self._max_results = Some(new_value);
8249 self
8250 }
8251 /// The preferred language to use for strings returned by this method.
8252 ///
8253 /// Sets the *language* query property to the given value.
8254 pub fn language(mut self, new_value: &str) -> EventListDefinitionCall<'a, C> {
8255 self._language = Some(new_value.to_string());
8256 self
8257 }
8258 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8259 /// while executing the actual API request.
8260 ///
8261 /// ````text
8262 /// It should be used to handle progress information, and to implement a certain level of resilience.
8263 /// ````
8264 ///
8265 /// Sets the *delegate* property to the given value.
8266 pub fn delegate(
8267 mut self,
8268 new_value: &'a mut dyn common::Delegate,
8269 ) -> EventListDefinitionCall<'a, C> {
8270 self._delegate = Some(new_value);
8271 self
8272 }
8273
8274 /// Set any additional parameter of the query string used in the request.
8275 /// It should be used to set parameters which are not yet available through their own
8276 /// setters.
8277 ///
8278 /// Please note that this method must not be used to set any of the known parameters
8279 /// which have their own setter method. If done anyway, the request will fail.
8280 ///
8281 /// # Additional Parameters
8282 ///
8283 /// * *$.xgafv* (query-string) - V1 error format.
8284 /// * *access_token* (query-string) - OAuth access token.
8285 /// * *alt* (query-string) - Data format for response.
8286 /// * *callback* (query-string) - JSONP
8287 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8288 /// * *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.
8289 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8290 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8291 /// * *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.
8292 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8293 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8294 pub fn param<T>(mut self, name: T, value: T) -> EventListDefinitionCall<'a, C>
8295 where
8296 T: AsRef<str>,
8297 {
8298 self._additional_params
8299 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8300 self
8301 }
8302
8303 /// Identifies the authorization scope for the method you are building.
8304 ///
8305 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8306 /// [`Scope::Full`].
8307 ///
8308 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8309 /// tokens for more than one scope.
8310 ///
8311 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8312 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8313 /// sufficient, a read-write scope will do as well.
8314 pub fn add_scope<St>(mut self, scope: St) -> EventListDefinitionCall<'a, C>
8315 where
8316 St: AsRef<str>,
8317 {
8318 self._scopes.insert(String::from(scope.as_ref()));
8319 self
8320 }
8321 /// Identifies the authorization scope(s) for the method you are building.
8322 ///
8323 /// See [`Self::add_scope()`] for details.
8324 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventListDefinitionCall<'a, C>
8325 where
8326 I: IntoIterator<Item = St>,
8327 St: AsRef<str>,
8328 {
8329 self._scopes
8330 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8331 self
8332 }
8333
8334 /// Removes all scopes, and no default scope will be used either.
8335 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8336 /// for details).
8337 pub fn clear_scopes(mut self) -> EventListDefinitionCall<'a, C> {
8338 self._scopes.clear();
8339 self
8340 }
8341}
8342
8343/// Records a batch of changes to the number of times events have occurred for the currently authenticated user of this application.
8344///
8345/// A builder for the *record* method supported by a *event* resource.
8346/// It is not used directly, but through a [`EventMethods`] instance.
8347///
8348/// # Example
8349///
8350/// Instantiate a resource method builder
8351///
8352/// ```test_harness,no_run
8353/// # extern crate hyper;
8354/// # extern crate hyper_rustls;
8355/// # extern crate google_games1 as games1;
8356/// use games1::api::EventRecordRequest;
8357/// # async fn dox() {
8358/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8359///
8360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8361/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8362/// # .with_native_roots()
8363/// # .unwrap()
8364/// # .https_only()
8365/// # .enable_http2()
8366/// # .build();
8367///
8368/// # let executor = hyper_util::rt::TokioExecutor::new();
8369/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8370/// # secret,
8371/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8372/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8373/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8374/// # ),
8375/// # ).build().await.unwrap();
8376///
8377/// # let client = hyper_util::client::legacy::Client::builder(
8378/// # hyper_util::rt::TokioExecutor::new()
8379/// # )
8380/// # .build(
8381/// # hyper_rustls::HttpsConnectorBuilder::new()
8382/// # .with_native_roots()
8383/// # .unwrap()
8384/// # .https_or_http()
8385/// # .enable_http2()
8386/// # .build()
8387/// # );
8388/// # let mut hub = Games::new(client, auth);
8389/// // As the method needs a request, you would usually fill it with the desired information
8390/// // into the respective structure. Some of the parts shown here might not be applicable !
8391/// // Values shown here are possibly random and not representative !
8392/// let mut req = EventRecordRequest::default();
8393///
8394/// // You can configure optional parameters by calling the respective setters at will, and
8395/// // execute the final call using `doit()`.
8396/// // Values shown here are possibly random and not representative !
8397/// let result = hub.events().record(req)
8398/// .language("no")
8399/// .doit().await;
8400/// # }
8401/// ```
8402pub struct EventRecordCall<'a, C>
8403where
8404 C: 'a,
8405{
8406 hub: &'a Games<C>,
8407 _request: EventRecordRequest,
8408 _language: Option<String>,
8409 _delegate: Option<&'a mut dyn common::Delegate>,
8410 _additional_params: HashMap<String, String>,
8411 _scopes: BTreeSet<String>,
8412}
8413
8414impl<'a, C> common::CallBuilder for EventRecordCall<'a, C> {}
8415
8416impl<'a, C> EventRecordCall<'a, C>
8417where
8418 C: common::Connector,
8419{
8420 /// Perform the operation you have build so far.
8421 pub async fn doit(mut self) -> common::Result<(common::Response, EventUpdateResponse)> {
8422 use std::borrow::Cow;
8423 use std::io::{Read, Seek};
8424
8425 use common::{url::Params, ToParts};
8426 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8427
8428 let mut dd = common::DefaultDelegate;
8429 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8430 dlg.begin(common::MethodInfo {
8431 id: "games.events.record",
8432 http_method: hyper::Method::POST,
8433 });
8434
8435 for &field in ["alt", "language"].iter() {
8436 if self._additional_params.contains_key(field) {
8437 dlg.finished(false);
8438 return Err(common::Error::FieldClash(field));
8439 }
8440 }
8441
8442 let mut params = Params::with_capacity(4 + self._additional_params.len());
8443 if let Some(value) = self._language.as_ref() {
8444 params.push("language", value);
8445 }
8446
8447 params.extend(self._additional_params.iter());
8448
8449 params.push("alt", "json");
8450 let mut url = self.hub._base_url.clone() + "games/v1/events";
8451 if self._scopes.is_empty() {
8452 self._scopes.insert(Scope::Full.as_ref().to_string());
8453 }
8454
8455 let url = params.parse_with_url(&url);
8456
8457 let mut json_mime_type = mime::APPLICATION_JSON;
8458 let mut request_value_reader = {
8459 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8460 common::remove_json_null_values(&mut value);
8461 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8462 serde_json::to_writer(&mut dst, &value).unwrap();
8463 dst
8464 };
8465 let request_size = request_value_reader
8466 .seek(std::io::SeekFrom::End(0))
8467 .unwrap();
8468 request_value_reader
8469 .seek(std::io::SeekFrom::Start(0))
8470 .unwrap();
8471
8472 loop {
8473 let token = match self
8474 .hub
8475 .auth
8476 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8477 .await
8478 {
8479 Ok(token) => token,
8480 Err(e) => match dlg.token(e) {
8481 Ok(token) => token,
8482 Err(e) => {
8483 dlg.finished(false);
8484 return Err(common::Error::MissingToken(e));
8485 }
8486 },
8487 };
8488 request_value_reader
8489 .seek(std::io::SeekFrom::Start(0))
8490 .unwrap();
8491 let mut req_result = {
8492 let client = &self.hub.client;
8493 dlg.pre_request();
8494 let mut req_builder = hyper::Request::builder()
8495 .method(hyper::Method::POST)
8496 .uri(url.as_str())
8497 .header(USER_AGENT, self.hub._user_agent.clone());
8498
8499 if let Some(token) = token.as_ref() {
8500 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8501 }
8502
8503 let request = req_builder
8504 .header(CONTENT_TYPE, json_mime_type.to_string())
8505 .header(CONTENT_LENGTH, request_size as u64)
8506 .body(common::to_body(
8507 request_value_reader.get_ref().clone().into(),
8508 ));
8509
8510 client.request(request.unwrap()).await
8511 };
8512
8513 match req_result {
8514 Err(err) => {
8515 if let common::Retry::After(d) = dlg.http_error(&err) {
8516 sleep(d).await;
8517 continue;
8518 }
8519 dlg.finished(false);
8520 return Err(common::Error::HttpError(err));
8521 }
8522 Ok(res) => {
8523 let (mut parts, body) = res.into_parts();
8524 let mut body = common::Body::new(body);
8525 if !parts.status.is_success() {
8526 let bytes = common::to_bytes(body).await.unwrap_or_default();
8527 let error = serde_json::from_str(&common::to_string(&bytes));
8528 let response = common::to_response(parts, bytes.into());
8529
8530 if let common::Retry::After(d) =
8531 dlg.http_failure(&response, error.as_ref().ok())
8532 {
8533 sleep(d).await;
8534 continue;
8535 }
8536
8537 dlg.finished(false);
8538
8539 return Err(match error {
8540 Ok(value) => common::Error::BadRequest(value),
8541 _ => common::Error::Failure(response),
8542 });
8543 }
8544 let response = {
8545 let bytes = common::to_bytes(body).await.unwrap_or_default();
8546 let encoded = common::to_string(&bytes);
8547 match serde_json::from_str(&encoded) {
8548 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8549 Err(error) => {
8550 dlg.response_json_decode_error(&encoded, &error);
8551 return Err(common::Error::JsonDecodeError(
8552 encoded.to_string(),
8553 error,
8554 ));
8555 }
8556 }
8557 };
8558
8559 dlg.finished(true);
8560 return Ok(response);
8561 }
8562 }
8563 }
8564 }
8565
8566 ///
8567 /// Sets the *request* property to the given value.
8568 ///
8569 /// Even though the property as already been set when instantiating this call,
8570 /// we provide this method for API completeness.
8571 pub fn request(mut self, new_value: EventRecordRequest) -> EventRecordCall<'a, C> {
8572 self._request = new_value;
8573 self
8574 }
8575 /// The preferred language to use for strings returned by this method.
8576 ///
8577 /// Sets the *language* query property to the given value.
8578 pub fn language(mut self, new_value: &str) -> EventRecordCall<'a, C> {
8579 self._language = Some(new_value.to_string());
8580 self
8581 }
8582 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8583 /// while executing the actual API request.
8584 ///
8585 /// ````text
8586 /// It should be used to handle progress information, and to implement a certain level of resilience.
8587 /// ````
8588 ///
8589 /// Sets the *delegate* property to the given value.
8590 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EventRecordCall<'a, C> {
8591 self._delegate = Some(new_value);
8592 self
8593 }
8594
8595 /// Set any additional parameter of the query string used in the request.
8596 /// It should be used to set parameters which are not yet available through their own
8597 /// setters.
8598 ///
8599 /// Please note that this method must not be used to set any of the known parameters
8600 /// which have their own setter method. If done anyway, the request will fail.
8601 ///
8602 /// # Additional Parameters
8603 ///
8604 /// * *$.xgafv* (query-string) - V1 error format.
8605 /// * *access_token* (query-string) - OAuth access token.
8606 /// * *alt* (query-string) - Data format for response.
8607 /// * *callback* (query-string) - JSONP
8608 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8609 /// * *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.
8610 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8611 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8612 /// * *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.
8613 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8614 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8615 pub fn param<T>(mut self, name: T, value: T) -> EventRecordCall<'a, C>
8616 where
8617 T: AsRef<str>,
8618 {
8619 self._additional_params
8620 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8621 self
8622 }
8623
8624 /// Identifies the authorization scope for the method you are building.
8625 ///
8626 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8627 /// [`Scope::Full`].
8628 ///
8629 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8630 /// tokens for more than one scope.
8631 ///
8632 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8633 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8634 /// sufficient, a read-write scope will do as well.
8635 pub fn add_scope<St>(mut self, scope: St) -> EventRecordCall<'a, C>
8636 where
8637 St: AsRef<str>,
8638 {
8639 self._scopes.insert(String::from(scope.as_ref()));
8640 self
8641 }
8642 /// Identifies the authorization scope(s) for the method you are building.
8643 ///
8644 /// See [`Self::add_scope()`] for details.
8645 pub fn add_scopes<I, St>(mut self, scopes: I) -> EventRecordCall<'a, C>
8646 where
8647 I: IntoIterator<Item = St>,
8648 St: AsRef<str>,
8649 {
8650 self._scopes
8651 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8652 self
8653 }
8654
8655 /// Removes all scopes, and no default scope will be used either.
8656 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8657 /// for details).
8658 pub fn clear_scopes(mut self) -> EventRecordCall<'a, C> {
8659 self._scopes.clear();
8660 self
8661 }
8662}
8663
8664/// Retrieves the metadata of the leaderboard with the given ID.
8665///
8666/// A builder for the *get* method supported by a *leaderboard* resource.
8667/// It is not used directly, but through a [`LeaderboardMethods`] instance.
8668///
8669/// # Example
8670///
8671/// Instantiate a resource method builder
8672///
8673/// ```test_harness,no_run
8674/// # extern crate hyper;
8675/// # extern crate hyper_rustls;
8676/// # extern crate google_games1 as games1;
8677/// # async fn dox() {
8678/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8679///
8680/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8681/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8682/// # .with_native_roots()
8683/// # .unwrap()
8684/// # .https_only()
8685/// # .enable_http2()
8686/// # .build();
8687///
8688/// # let executor = hyper_util::rt::TokioExecutor::new();
8689/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8690/// # secret,
8691/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8692/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8693/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8694/// # ),
8695/// # ).build().await.unwrap();
8696///
8697/// # let client = hyper_util::client::legacy::Client::builder(
8698/// # hyper_util::rt::TokioExecutor::new()
8699/// # )
8700/// # .build(
8701/// # hyper_rustls::HttpsConnectorBuilder::new()
8702/// # .with_native_roots()
8703/// # .unwrap()
8704/// # .https_or_http()
8705/// # .enable_http2()
8706/// # .build()
8707/// # );
8708/// # let mut hub = Games::new(client, auth);
8709/// // You can configure optional parameters by calling the respective setters at will, and
8710/// // execute the final call using `doit()`.
8711/// // Values shown here are possibly random and not representative !
8712/// let result = hub.leaderboards().get("leaderboardId")
8713/// .language("kasd")
8714/// .doit().await;
8715/// # }
8716/// ```
8717pub struct LeaderboardGetCall<'a, C>
8718where
8719 C: 'a,
8720{
8721 hub: &'a Games<C>,
8722 _leaderboard_id: String,
8723 _language: Option<String>,
8724 _delegate: Option<&'a mut dyn common::Delegate>,
8725 _additional_params: HashMap<String, String>,
8726 _scopes: BTreeSet<String>,
8727}
8728
8729impl<'a, C> common::CallBuilder for LeaderboardGetCall<'a, C> {}
8730
8731impl<'a, C> LeaderboardGetCall<'a, C>
8732where
8733 C: common::Connector,
8734{
8735 /// Perform the operation you have build so far.
8736 pub async fn doit(mut self) -> common::Result<(common::Response, Leaderboard)> {
8737 use std::borrow::Cow;
8738 use std::io::{Read, Seek};
8739
8740 use common::{url::Params, ToParts};
8741 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8742
8743 let mut dd = common::DefaultDelegate;
8744 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8745 dlg.begin(common::MethodInfo {
8746 id: "games.leaderboards.get",
8747 http_method: hyper::Method::GET,
8748 });
8749
8750 for &field in ["alt", "leaderboardId", "language"].iter() {
8751 if self._additional_params.contains_key(field) {
8752 dlg.finished(false);
8753 return Err(common::Error::FieldClash(field));
8754 }
8755 }
8756
8757 let mut params = Params::with_capacity(4 + self._additional_params.len());
8758 params.push("leaderboardId", self._leaderboard_id);
8759 if let Some(value) = self._language.as_ref() {
8760 params.push("language", value);
8761 }
8762
8763 params.extend(self._additional_params.iter());
8764
8765 params.push("alt", "json");
8766 let mut url = self.hub._base_url.clone() + "games/v1/leaderboards/{leaderboardId}";
8767 if self._scopes.is_empty() {
8768 self._scopes.insert(Scope::Full.as_ref().to_string());
8769 }
8770
8771 #[allow(clippy::single_element_loop)]
8772 for &(find_this, param_name) in [("{leaderboardId}", "leaderboardId")].iter() {
8773 url = params.uri_replacement(url, param_name, find_this, false);
8774 }
8775 {
8776 let to_remove = ["leaderboardId"];
8777 params.remove_params(&to_remove);
8778 }
8779
8780 let url = params.parse_with_url(&url);
8781
8782 loop {
8783 let token = match self
8784 .hub
8785 .auth
8786 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8787 .await
8788 {
8789 Ok(token) => token,
8790 Err(e) => match dlg.token(e) {
8791 Ok(token) => token,
8792 Err(e) => {
8793 dlg.finished(false);
8794 return Err(common::Error::MissingToken(e));
8795 }
8796 },
8797 };
8798 let mut req_result = {
8799 let client = &self.hub.client;
8800 dlg.pre_request();
8801 let mut req_builder = hyper::Request::builder()
8802 .method(hyper::Method::GET)
8803 .uri(url.as_str())
8804 .header(USER_AGENT, self.hub._user_agent.clone());
8805
8806 if let Some(token) = token.as_ref() {
8807 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8808 }
8809
8810 let request = req_builder
8811 .header(CONTENT_LENGTH, 0_u64)
8812 .body(common::to_body::<String>(None));
8813
8814 client.request(request.unwrap()).await
8815 };
8816
8817 match req_result {
8818 Err(err) => {
8819 if let common::Retry::After(d) = dlg.http_error(&err) {
8820 sleep(d).await;
8821 continue;
8822 }
8823 dlg.finished(false);
8824 return Err(common::Error::HttpError(err));
8825 }
8826 Ok(res) => {
8827 let (mut parts, body) = res.into_parts();
8828 let mut body = common::Body::new(body);
8829 if !parts.status.is_success() {
8830 let bytes = common::to_bytes(body).await.unwrap_or_default();
8831 let error = serde_json::from_str(&common::to_string(&bytes));
8832 let response = common::to_response(parts, bytes.into());
8833
8834 if let common::Retry::After(d) =
8835 dlg.http_failure(&response, error.as_ref().ok())
8836 {
8837 sleep(d).await;
8838 continue;
8839 }
8840
8841 dlg.finished(false);
8842
8843 return Err(match error {
8844 Ok(value) => common::Error::BadRequest(value),
8845 _ => common::Error::Failure(response),
8846 });
8847 }
8848 let response = {
8849 let bytes = common::to_bytes(body).await.unwrap_or_default();
8850 let encoded = common::to_string(&bytes);
8851 match serde_json::from_str(&encoded) {
8852 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8853 Err(error) => {
8854 dlg.response_json_decode_error(&encoded, &error);
8855 return Err(common::Error::JsonDecodeError(
8856 encoded.to_string(),
8857 error,
8858 ));
8859 }
8860 }
8861 };
8862
8863 dlg.finished(true);
8864 return Ok(response);
8865 }
8866 }
8867 }
8868 }
8869
8870 /// The ID of the leaderboard.
8871 ///
8872 /// Sets the *leaderboard id* path property to the given value.
8873 ///
8874 /// Even though the property as already been set when instantiating this call,
8875 /// we provide this method for API completeness.
8876 pub fn leaderboard_id(mut self, new_value: &str) -> LeaderboardGetCall<'a, C> {
8877 self._leaderboard_id = new_value.to_string();
8878 self
8879 }
8880 /// The preferred language to use for strings returned by this method.
8881 ///
8882 /// Sets the *language* query property to the given value.
8883 pub fn language(mut self, new_value: &str) -> LeaderboardGetCall<'a, C> {
8884 self._language = Some(new_value.to_string());
8885 self
8886 }
8887 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8888 /// while executing the actual API request.
8889 ///
8890 /// ````text
8891 /// It should be used to handle progress information, and to implement a certain level of resilience.
8892 /// ````
8893 ///
8894 /// Sets the *delegate* property to the given value.
8895 pub fn delegate(
8896 mut self,
8897 new_value: &'a mut dyn common::Delegate,
8898 ) -> LeaderboardGetCall<'a, C> {
8899 self._delegate = Some(new_value);
8900 self
8901 }
8902
8903 /// Set any additional parameter of the query string used in the request.
8904 /// It should be used to set parameters which are not yet available through their own
8905 /// setters.
8906 ///
8907 /// Please note that this method must not be used to set any of the known parameters
8908 /// which have their own setter method. If done anyway, the request will fail.
8909 ///
8910 /// # Additional Parameters
8911 ///
8912 /// * *$.xgafv* (query-string) - V1 error format.
8913 /// * *access_token* (query-string) - OAuth access token.
8914 /// * *alt* (query-string) - Data format for response.
8915 /// * *callback* (query-string) - JSONP
8916 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8917 /// * *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.
8918 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8919 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8920 /// * *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.
8921 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8922 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8923 pub fn param<T>(mut self, name: T, value: T) -> LeaderboardGetCall<'a, C>
8924 where
8925 T: AsRef<str>,
8926 {
8927 self._additional_params
8928 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8929 self
8930 }
8931
8932 /// Identifies the authorization scope for the method you are building.
8933 ///
8934 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8935 /// [`Scope::Full`].
8936 ///
8937 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8938 /// tokens for more than one scope.
8939 ///
8940 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8941 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8942 /// sufficient, a read-write scope will do as well.
8943 pub fn add_scope<St>(mut self, scope: St) -> LeaderboardGetCall<'a, C>
8944 where
8945 St: AsRef<str>,
8946 {
8947 self._scopes.insert(String::from(scope.as_ref()));
8948 self
8949 }
8950 /// Identifies the authorization scope(s) for the method you are building.
8951 ///
8952 /// See [`Self::add_scope()`] for details.
8953 pub fn add_scopes<I, St>(mut self, scopes: I) -> LeaderboardGetCall<'a, C>
8954 where
8955 I: IntoIterator<Item = St>,
8956 St: AsRef<str>,
8957 {
8958 self._scopes
8959 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8960 self
8961 }
8962
8963 /// Removes all scopes, and no default scope will be used either.
8964 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8965 /// for details).
8966 pub fn clear_scopes(mut self) -> LeaderboardGetCall<'a, C> {
8967 self._scopes.clear();
8968 self
8969 }
8970}
8971
8972/// Lists all the leaderboard metadata for your application.
8973///
8974/// A builder for the *list* method supported by a *leaderboard* resource.
8975/// It is not used directly, but through a [`LeaderboardMethods`] instance.
8976///
8977/// # Example
8978///
8979/// Instantiate a resource method builder
8980///
8981/// ```test_harness,no_run
8982/// # extern crate hyper;
8983/// # extern crate hyper_rustls;
8984/// # extern crate google_games1 as games1;
8985/// # async fn dox() {
8986/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8987///
8988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8990/// # .with_native_roots()
8991/// # .unwrap()
8992/// # .https_only()
8993/// # .enable_http2()
8994/// # .build();
8995///
8996/// # let executor = hyper_util::rt::TokioExecutor::new();
8997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8998/// # secret,
8999/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9000/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9001/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9002/// # ),
9003/// # ).build().await.unwrap();
9004///
9005/// # let client = hyper_util::client::legacy::Client::builder(
9006/// # hyper_util::rt::TokioExecutor::new()
9007/// # )
9008/// # .build(
9009/// # hyper_rustls::HttpsConnectorBuilder::new()
9010/// # .with_native_roots()
9011/// # .unwrap()
9012/// # .https_or_http()
9013/// # .enable_http2()
9014/// # .build()
9015/// # );
9016/// # let mut hub = Games::new(client, auth);
9017/// // You can configure optional parameters by calling the respective setters at will, and
9018/// // execute the final call using `doit()`.
9019/// // Values shown here are possibly random and not representative !
9020/// let result = hub.leaderboards().list()
9021/// .page_token("et")
9022/// .max_results(-43)
9023/// .language("et")
9024/// .doit().await;
9025/// # }
9026/// ```
9027pub struct LeaderboardListCall<'a, C>
9028where
9029 C: 'a,
9030{
9031 hub: &'a Games<C>,
9032 _page_token: Option<String>,
9033 _max_results: Option<i32>,
9034 _language: Option<String>,
9035 _delegate: Option<&'a mut dyn common::Delegate>,
9036 _additional_params: HashMap<String, String>,
9037 _scopes: BTreeSet<String>,
9038}
9039
9040impl<'a, C> common::CallBuilder for LeaderboardListCall<'a, C> {}
9041
9042impl<'a, C> LeaderboardListCall<'a, C>
9043where
9044 C: common::Connector,
9045{
9046 /// Perform the operation you have build so far.
9047 pub async fn doit(mut self) -> common::Result<(common::Response, LeaderboardListResponse)> {
9048 use std::borrow::Cow;
9049 use std::io::{Read, Seek};
9050
9051 use common::{url::Params, ToParts};
9052 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9053
9054 let mut dd = common::DefaultDelegate;
9055 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9056 dlg.begin(common::MethodInfo {
9057 id: "games.leaderboards.list",
9058 http_method: hyper::Method::GET,
9059 });
9060
9061 for &field in ["alt", "pageToken", "maxResults", "language"].iter() {
9062 if self._additional_params.contains_key(field) {
9063 dlg.finished(false);
9064 return Err(common::Error::FieldClash(field));
9065 }
9066 }
9067
9068 let mut params = Params::with_capacity(5 + self._additional_params.len());
9069 if let Some(value) = self._page_token.as_ref() {
9070 params.push("pageToken", value);
9071 }
9072 if let Some(value) = self._max_results.as_ref() {
9073 params.push("maxResults", value.to_string());
9074 }
9075 if let Some(value) = self._language.as_ref() {
9076 params.push("language", value);
9077 }
9078
9079 params.extend(self._additional_params.iter());
9080
9081 params.push("alt", "json");
9082 let mut url = self.hub._base_url.clone() + "games/v1/leaderboards";
9083 if self._scopes.is_empty() {
9084 self._scopes.insert(Scope::Full.as_ref().to_string());
9085 }
9086
9087 let url = params.parse_with_url(&url);
9088
9089 loop {
9090 let token = match self
9091 .hub
9092 .auth
9093 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9094 .await
9095 {
9096 Ok(token) => token,
9097 Err(e) => match dlg.token(e) {
9098 Ok(token) => token,
9099 Err(e) => {
9100 dlg.finished(false);
9101 return Err(common::Error::MissingToken(e));
9102 }
9103 },
9104 };
9105 let mut req_result = {
9106 let client = &self.hub.client;
9107 dlg.pre_request();
9108 let mut req_builder = hyper::Request::builder()
9109 .method(hyper::Method::GET)
9110 .uri(url.as_str())
9111 .header(USER_AGENT, self.hub._user_agent.clone());
9112
9113 if let Some(token) = token.as_ref() {
9114 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9115 }
9116
9117 let request = req_builder
9118 .header(CONTENT_LENGTH, 0_u64)
9119 .body(common::to_body::<String>(None));
9120
9121 client.request(request.unwrap()).await
9122 };
9123
9124 match req_result {
9125 Err(err) => {
9126 if let common::Retry::After(d) = dlg.http_error(&err) {
9127 sleep(d).await;
9128 continue;
9129 }
9130 dlg.finished(false);
9131 return Err(common::Error::HttpError(err));
9132 }
9133 Ok(res) => {
9134 let (mut parts, body) = res.into_parts();
9135 let mut body = common::Body::new(body);
9136 if !parts.status.is_success() {
9137 let bytes = common::to_bytes(body).await.unwrap_or_default();
9138 let error = serde_json::from_str(&common::to_string(&bytes));
9139 let response = common::to_response(parts, bytes.into());
9140
9141 if let common::Retry::After(d) =
9142 dlg.http_failure(&response, error.as_ref().ok())
9143 {
9144 sleep(d).await;
9145 continue;
9146 }
9147
9148 dlg.finished(false);
9149
9150 return Err(match error {
9151 Ok(value) => common::Error::BadRequest(value),
9152 _ => common::Error::Failure(response),
9153 });
9154 }
9155 let response = {
9156 let bytes = common::to_bytes(body).await.unwrap_or_default();
9157 let encoded = common::to_string(&bytes);
9158 match serde_json::from_str(&encoded) {
9159 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9160 Err(error) => {
9161 dlg.response_json_decode_error(&encoded, &error);
9162 return Err(common::Error::JsonDecodeError(
9163 encoded.to_string(),
9164 error,
9165 ));
9166 }
9167 }
9168 };
9169
9170 dlg.finished(true);
9171 return Ok(response);
9172 }
9173 }
9174 }
9175 }
9176
9177 /// The token returned by the previous request.
9178 ///
9179 /// Sets the *page token* query property to the given value.
9180 pub fn page_token(mut self, new_value: &str) -> LeaderboardListCall<'a, C> {
9181 self._page_token = Some(new_value.to_string());
9182 self
9183 }
9184 /// The maximum number of leaderboards to return in the response. For any response, the actual number of leaderboards returned may be less than the specified `maxResults`.
9185 ///
9186 /// Sets the *max results* query property to the given value.
9187 pub fn max_results(mut self, new_value: i32) -> LeaderboardListCall<'a, C> {
9188 self._max_results = Some(new_value);
9189 self
9190 }
9191 /// The preferred language to use for strings returned by this method.
9192 ///
9193 /// Sets the *language* query property to the given value.
9194 pub fn language(mut self, new_value: &str) -> LeaderboardListCall<'a, C> {
9195 self._language = Some(new_value.to_string());
9196 self
9197 }
9198 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9199 /// while executing the actual API request.
9200 ///
9201 /// ````text
9202 /// It should be used to handle progress information, and to implement a certain level of resilience.
9203 /// ````
9204 ///
9205 /// Sets the *delegate* property to the given value.
9206 pub fn delegate(
9207 mut self,
9208 new_value: &'a mut dyn common::Delegate,
9209 ) -> LeaderboardListCall<'a, C> {
9210 self._delegate = Some(new_value);
9211 self
9212 }
9213
9214 /// Set any additional parameter of the query string used in the request.
9215 /// It should be used to set parameters which are not yet available through their own
9216 /// setters.
9217 ///
9218 /// Please note that this method must not be used to set any of the known parameters
9219 /// which have their own setter method. If done anyway, the request will fail.
9220 ///
9221 /// # Additional Parameters
9222 ///
9223 /// * *$.xgafv* (query-string) - V1 error format.
9224 /// * *access_token* (query-string) - OAuth access token.
9225 /// * *alt* (query-string) - Data format for response.
9226 /// * *callback* (query-string) - JSONP
9227 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9228 /// * *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.
9229 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9230 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9231 /// * *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.
9232 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9233 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9234 pub fn param<T>(mut self, name: T, value: T) -> LeaderboardListCall<'a, C>
9235 where
9236 T: AsRef<str>,
9237 {
9238 self._additional_params
9239 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9240 self
9241 }
9242
9243 /// Identifies the authorization scope for the method you are building.
9244 ///
9245 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9246 /// [`Scope::Full`].
9247 ///
9248 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9249 /// tokens for more than one scope.
9250 ///
9251 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9252 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9253 /// sufficient, a read-write scope will do as well.
9254 pub fn add_scope<St>(mut self, scope: St) -> LeaderboardListCall<'a, C>
9255 where
9256 St: AsRef<str>,
9257 {
9258 self._scopes.insert(String::from(scope.as_ref()));
9259 self
9260 }
9261 /// Identifies the authorization scope(s) for the method you are building.
9262 ///
9263 /// See [`Self::add_scope()`] for details.
9264 pub fn add_scopes<I, St>(mut self, scopes: I) -> LeaderboardListCall<'a, C>
9265 where
9266 I: IntoIterator<Item = St>,
9267 St: AsRef<str>,
9268 {
9269 self._scopes
9270 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9271 self
9272 }
9273
9274 /// Removes all scopes, and no default scope will be used either.
9275 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9276 /// for details).
9277 pub fn clear_scopes(mut self) -> LeaderboardListCall<'a, C> {
9278 self._scopes.clear();
9279 self
9280 }
9281}
9282
9283/// Return the metagame configuration data for the calling application.
9284///
9285/// A builder for the *getMetagameConfig* method supported by a *metagame* resource.
9286/// It is not used directly, but through a [`MetagameMethods`] instance.
9287///
9288/// # Example
9289///
9290/// Instantiate a resource method builder
9291///
9292/// ```test_harness,no_run
9293/// # extern crate hyper;
9294/// # extern crate hyper_rustls;
9295/// # extern crate google_games1 as games1;
9296/// # async fn dox() {
9297/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9298///
9299/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9300/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9301/// # .with_native_roots()
9302/// # .unwrap()
9303/// # .https_only()
9304/// # .enable_http2()
9305/// # .build();
9306///
9307/// # let executor = hyper_util::rt::TokioExecutor::new();
9308/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9309/// # secret,
9310/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9311/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9312/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9313/// # ),
9314/// # ).build().await.unwrap();
9315///
9316/// # let client = hyper_util::client::legacy::Client::builder(
9317/// # hyper_util::rt::TokioExecutor::new()
9318/// # )
9319/// # .build(
9320/// # hyper_rustls::HttpsConnectorBuilder::new()
9321/// # .with_native_roots()
9322/// # .unwrap()
9323/// # .https_or_http()
9324/// # .enable_http2()
9325/// # .build()
9326/// # );
9327/// # let mut hub = Games::new(client, auth);
9328/// // You can configure optional parameters by calling the respective setters at will, and
9329/// // execute the final call using `doit()`.
9330/// // Values shown here are possibly random and not representative !
9331/// let result = hub.metagame().get_metagame_config()
9332/// .doit().await;
9333/// # }
9334/// ```
9335pub struct MetagameGetMetagameConfigCall<'a, C>
9336where
9337 C: 'a,
9338{
9339 hub: &'a Games<C>,
9340 _delegate: Option<&'a mut dyn common::Delegate>,
9341 _additional_params: HashMap<String, String>,
9342 _scopes: BTreeSet<String>,
9343}
9344
9345impl<'a, C> common::CallBuilder for MetagameGetMetagameConfigCall<'a, C> {}
9346
9347impl<'a, C> MetagameGetMetagameConfigCall<'a, C>
9348where
9349 C: common::Connector,
9350{
9351 /// Perform the operation you have build so far.
9352 pub async fn doit(mut self) -> common::Result<(common::Response, MetagameConfig)> {
9353 use std::borrow::Cow;
9354 use std::io::{Read, Seek};
9355
9356 use common::{url::Params, ToParts};
9357 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9358
9359 let mut dd = common::DefaultDelegate;
9360 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9361 dlg.begin(common::MethodInfo {
9362 id: "games.metagame.getMetagameConfig",
9363 http_method: hyper::Method::GET,
9364 });
9365
9366 for &field in ["alt"].iter() {
9367 if self._additional_params.contains_key(field) {
9368 dlg.finished(false);
9369 return Err(common::Error::FieldClash(field));
9370 }
9371 }
9372
9373 let mut params = Params::with_capacity(2 + self._additional_params.len());
9374
9375 params.extend(self._additional_params.iter());
9376
9377 params.push("alt", "json");
9378 let mut url = self.hub._base_url.clone() + "games/v1/metagameConfig";
9379 if self._scopes.is_empty() {
9380 self._scopes.insert(Scope::Full.as_ref().to_string());
9381 }
9382
9383 let url = params.parse_with_url(&url);
9384
9385 loop {
9386 let token = match self
9387 .hub
9388 .auth
9389 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9390 .await
9391 {
9392 Ok(token) => token,
9393 Err(e) => match dlg.token(e) {
9394 Ok(token) => token,
9395 Err(e) => {
9396 dlg.finished(false);
9397 return Err(common::Error::MissingToken(e));
9398 }
9399 },
9400 };
9401 let mut req_result = {
9402 let client = &self.hub.client;
9403 dlg.pre_request();
9404 let mut req_builder = hyper::Request::builder()
9405 .method(hyper::Method::GET)
9406 .uri(url.as_str())
9407 .header(USER_AGENT, self.hub._user_agent.clone());
9408
9409 if let Some(token) = token.as_ref() {
9410 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9411 }
9412
9413 let request = req_builder
9414 .header(CONTENT_LENGTH, 0_u64)
9415 .body(common::to_body::<String>(None));
9416
9417 client.request(request.unwrap()).await
9418 };
9419
9420 match req_result {
9421 Err(err) => {
9422 if let common::Retry::After(d) = dlg.http_error(&err) {
9423 sleep(d).await;
9424 continue;
9425 }
9426 dlg.finished(false);
9427 return Err(common::Error::HttpError(err));
9428 }
9429 Ok(res) => {
9430 let (mut parts, body) = res.into_parts();
9431 let mut body = common::Body::new(body);
9432 if !parts.status.is_success() {
9433 let bytes = common::to_bytes(body).await.unwrap_or_default();
9434 let error = serde_json::from_str(&common::to_string(&bytes));
9435 let response = common::to_response(parts, bytes.into());
9436
9437 if let common::Retry::After(d) =
9438 dlg.http_failure(&response, error.as_ref().ok())
9439 {
9440 sleep(d).await;
9441 continue;
9442 }
9443
9444 dlg.finished(false);
9445
9446 return Err(match error {
9447 Ok(value) => common::Error::BadRequest(value),
9448 _ => common::Error::Failure(response),
9449 });
9450 }
9451 let response = {
9452 let bytes = common::to_bytes(body).await.unwrap_or_default();
9453 let encoded = common::to_string(&bytes);
9454 match serde_json::from_str(&encoded) {
9455 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9456 Err(error) => {
9457 dlg.response_json_decode_error(&encoded, &error);
9458 return Err(common::Error::JsonDecodeError(
9459 encoded.to_string(),
9460 error,
9461 ));
9462 }
9463 }
9464 };
9465
9466 dlg.finished(true);
9467 return Ok(response);
9468 }
9469 }
9470 }
9471 }
9472
9473 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9474 /// while executing the actual API request.
9475 ///
9476 /// ````text
9477 /// It should be used to handle progress information, and to implement a certain level of resilience.
9478 /// ````
9479 ///
9480 /// Sets the *delegate* property to the given value.
9481 pub fn delegate(
9482 mut self,
9483 new_value: &'a mut dyn common::Delegate,
9484 ) -> MetagameGetMetagameConfigCall<'a, C> {
9485 self._delegate = Some(new_value);
9486 self
9487 }
9488
9489 /// Set any additional parameter of the query string used in the request.
9490 /// It should be used to set parameters which are not yet available through their own
9491 /// setters.
9492 ///
9493 /// Please note that this method must not be used to set any of the known parameters
9494 /// which have their own setter method. If done anyway, the request will fail.
9495 ///
9496 /// # Additional Parameters
9497 ///
9498 /// * *$.xgafv* (query-string) - V1 error format.
9499 /// * *access_token* (query-string) - OAuth access token.
9500 /// * *alt* (query-string) - Data format for response.
9501 /// * *callback* (query-string) - JSONP
9502 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9503 /// * *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.
9504 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9505 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9506 /// * *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.
9507 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9508 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9509 pub fn param<T>(mut self, name: T, value: T) -> MetagameGetMetagameConfigCall<'a, C>
9510 where
9511 T: AsRef<str>,
9512 {
9513 self._additional_params
9514 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9515 self
9516 }
9517
9518 /// Identifies the authorization scope for the method you are building.
9519 ///
9520 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9521 /// [`Scope::Full`].
9522 ///
9523 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9524 /// tokens for more than one scope.
9525 ///
9526 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9527 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9528 /// sufficient, a read-write scope will do as well.
9529 pub fn add_scope<St>(mut self, scope: St) -> MetagameGetMetagameConfigCall<'a, C>
9530 where
9531 St: AsRef<str>,
9532 {
9533 self._scopes.insert(String::from(scope.as_ref()));
9534 self
9535 }
9536 /// Identifies the authorization scope(s) for the method you are building.
9537 ///
9538 /// See [`Self::add_scope()`] for details.
9539 pub fn add_scopes<I, St>(mut self, scopes: I) -> MetagameGetMetagameConfigCall<'a, C>
9540 where
9541 I: IntoIterator<Item = St>,
9542 St: AsRef<str>,
9543 {
9544 self._scopes
9545 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9546 self
9547 }
9548
9549 /// Removes all scopes, and no default scope will be used either.
9550 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9551 /// for details).
9552 pub fn clear_scopes(mut self) -> MetagameGetMetagameConfigCall<'a, C> {
9553 self._scopes.clear();
9554 self
9555 }
9556}
9557
9558/// List play data aggregated per category for the player corresponding to `playerId`.
9559///
9560/// A builder for the *listCategoriesByPlayer* method supported by a *metagame* resource.
9561/// It is not used directly, but through a [`MetagameMethods`] instance.
9562///
9563/// # Example
9564///
9565/// Instantiate a resource method builder
9566///
9567/// ```test_harness,no_run
9568/// # extern crate hyper;
9569/// # extern crate hyper_rustls;
9570/// # extern crate google_games1 as games1;
9571/// # async fn dox() {
9572/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9573///
9574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9575/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9576/// # .with_native_roots()
9577/// # .unwrap()
9578/// # .https_only()
9579/// # .enable_http2()
9580/// # .build();
9581///
9582/// # let executor = hyper_util::rt::TokioExecutor::new();
9583/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9584/// # secret,
9585/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9586/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9587/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9588/// # ),
9589/// # ).build().await.unwrap();
9590///
9591/// # let client = hyper_util::client::legacy::Client::builder(
9592/// # hyper_util::rt::TokioExecutor::new()
9593/// # )
9594/// # .build(
9595/// # hyper_rustls::HttpsConnectorBuilder::new()
9596/// # .with_native_roots()
9597/// # .unwrap()
9598/// # .https_or_http()
9599/// # .enable_http2()
9600/// # .build()
9601/// # );
9602/// # let mut hub = Games::new(client, auth);
9603/// // You can configure optional parameters by calling the respective setters at will, and
9604/// // execute the final call using `doit()`.
9605/// // Values shown here are possibly random and not representative !
9606/// let result = hub.metagame().list_categories_by_player("playerId", "collection")
9607/// .page_token("erat")
9608/// .max_results(-93)
9609/// .language("duo")
9610/// .doit().await;
9611/// # }
9612/// ```
9613pub struct MetagameListCategoriesByPlayerCall<'a, C>
9614where
9615 C: 'a,
9616{
9617 hub: &'a Games<C>,
9618 _player_id: String,
9619 _collection: String,
9620 _page_token: Option<String>,
9621 _max_results: Option<i32>,
9622 _language: Option<String>,
9623 _delegate: Option<&'a mut dyn common::Delegate>,
9624 _additional_params: HashMap<String, String>,
9625 _scopes: BTreeSet<String>,
9626}
9627
9628impl<'a, C> common::CallBuilder for MetagameListCategoriesByPlayerCall<'a, C> {}
9629
9630impl<'a, C> MetagameListCategoriesByPlayerCall<'a, C>
9631where
9632 C: common::Connector,
9633{
9634 /// Perform the operation you have build so far.
9635 pub async fn doit(mut self) -> common::Result<(common::Response, CategoryListResponse)> {
9636 use std::borrow::Cow;
9637 use std::io::{Read, Seek};
9638
9639 use common::{url::Params, ToParts};
9640 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9641
9642 let mut dd = common::DefaultDelegate;
9643 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9644 dlg.begin(common::MethodInfo {
9645 id: "games.metagame.listCategoriesByPlayer",
9646 http_method: hyper::Method::GET,
9647 });
9648
9649 for &field in [
9650 "alt",
9651 "playerId",
9652 "collection",
9653 "pageToken",
9654 "maxResults",
9655 "language",
9656 ]
9657 .iter()
9658 {
9659 if self._additional_params.contains_key(field) {
9660 dlg.finished(false);
9661 return Err(common::Error::FieldClash(field));
9662 }
9663 }
9664
9665 let mut params = Params::with_capacity(7 + self._additional_params.len());
9666 params.push("playerId", self._player_id);
9667 params.push("collection", self._collection);
9668 if let Some(value) = self._page_token.as_ref() {
9669 params.push("pageToken", value);
9670 }
9671 if let Some(value) = self._max_results.as_ref() {
9672 params.push("maxResults", value.to_string());
9673 }
9674 if let Some(value) = self._language.as_ref() {
9675 params.push("language", value);
9676 }
9677
9678 params.extend(self._additional_params.iter());
9679
9680 params.push("alt", "json");
9681 let mut url =
9682 self.hub._base_url.clone() + "games/v1/players/{playerId}/categories/{collection}";
9683 if self._scopes.is_empty() {
9684 self._scopes.insert(Scope::Full.as_ref().to_string());
9685 }
9686
9687 #[allow(clippy::single_element_loop)]
9688 for &(find_this, param_name) in
9689 [("{playerId}", "playerId"), ("{collection}", "collection")].iter()
9690 {
9691 url = params.uri_replacement(url, param_name, find_this, false);
9692 }
9693 {
9694 let to_remove = ["collection", "playerId"];
9695 params.remove_params(&to_remove);
9696 }
9697
9698 let url = params.parse_with_url(&url);
9699
9700 loop {
9701 let token = match self
9702 .hub
9703 .auth
9704 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9705 .await
9706 {
9707 Ok(token) => token,
9708 Err(e) => match dlg.token(e) {
9709 Ok(token) => token,
9710 Err(e) => {
9711 dlg.finished(false);
9712 return Err(common::Error::MissingToken(e));
9713 }
9714 },
9715 };
9716 let mut req_result = {
9717 let client = &self.hub.client;
9718 dlg.pre_request();
9719 let mut req_builder = hyper::Request::builder()
9720 .method(hyper::Method::GET)
9721 .uri(url.as_str())
9722 .header(USER_AGENT, self.hub._user_agent.clone());
9723
9724 if let Some(token) = token.as_ref() {
9725 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9726 }
9727
9728 let request = req_builder
9729 .header(CONTENT_LENGTH, 0_u64)
9730 .body(common::to_body::<String>(None));
9731
9732 client.request(request.unwrap()).await
9733 };
9734
9735 match req_result {
9736 Err(err) => {
9737 if let common::Retry::After(d) = dlg.http_error(&err) {
9738 sleep(d).await;
9739 continue;
9740 }
9741 dlg.finished(false);
9742 return Err(common::Error::HttpError(err));
9743 }
9744 Ok(res) => {
9745 let (mut parts, body) = res.into_parts();
9746 let mut body = common::Body::new(body);
9747 if !parts.status.is_success() {
9748 let bytes = common::to_bytes(body).await.unwrap_or_default();
9749 let error = serde_json::from_str(&common::to_string(&bytes));
9750 let response = common::to_response(parts, bytes.into());
9751
9752 if let common::Retry::After(d) =
9753 dlg.http_failure(&response, error.as_ref().ok())
9754 {
9755 sleep(d).await;
9756 continue;
9757 }
9758
9759 dlg.finished(false);
9760
9761 return Err(match error {
9762 Ok(value) => common::Error::BadRequest(value),
9763 _ => common::Error::Failure(response),
9764 });
9765 }
9766 let response = {
9767 let bytes = common::to_bytes(body).await.unwrap_or_default();
9768 let encoded = common::to_string(&bytes);
9769 match serde_json::from_str(&encoded) {
9770 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9771 Err(error) => {
9772 dlg.response_json_decode_error(&encoded, &error);
9773 return Err(common::Error::JsonDecodeError(
9774 encoded.to_string(),
9775 error,
9776 ));
9777 }
9778 }
9779 };
9780
9781 dlg.finished(true);
9782 return Ok(response);
9783 }
9784 }
9785 }
9786 }
9787
9788 /// A player ID. A value of `me` may be used in place of the authenticated player's ID.
9789 ///
9790 /// Sets the *player id* path property to the given value.
9791 ///
9792 /// Even though the property as already been set when instantiating this call,
9793 /// we provide this method for API completeness.
9794 pub fn player_id(mut self, new_value: &str) -> MetagameListCategoriesByPlayerCall<'a, C> {
9795 self._player_id = new_value.to_string();
9796 self
9797 }
9798 /// The collection of categories for which data will be returned.
9799 ///
9800 /// Sets the *collection* path property to the given value.
9801 ///
9802 /// Even though the property as already been set when instantiating this call,
9803 /// we provide this method for API completeness.
9804 pub fn collection(mut self, new_value: &str) -> MetagameListCategoriesByPlayerCall<'a, C> {
9805 self._collection = new_value.to_string();
9806 self
9807 }
9808 /// The token returned by the previous request.
9809 ///
9810 /// Sets the *page token* query property to the given value.
9811 pub fn page_token(mut self, new_value: &str) -> MetagameListCategoriesByPlayerCall<'a, C> {
9812 self._page_token = Some(new_value.to_string());
9813 self
9814 }
9815 /// The maximum number of category resources to return in the response, used for paging. For any response, the actual number of category resources returned may be less than the specified `maxResults`.
9816 ///
9817 /// Sets the *max results* query property to the given value.
9818 pub fn max_results(mut self, new_value: i32) -> MetagameListCategoriesByPlayerCall<'a, C> {
9819 self._max_results = Some(new_value);
9820 self
9821 }
9822 /// The preferred language to use for strings returned by this method.
9823 ///
9824 /// Sets the *language* query property to the given value.
9825 pub fn language(mut self, new_value: &str) -> MetagameListCategoriesByPlayerCall<'a, C> {
9826 self._language = Some(new_value.to_string());
9827 self
9828 }
9829 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9830 /// while executing the actual API request.
9831 ///
9832 /// ````text
9833 /// It should be used to handle progress information, and to implement a certain level of resilience.
9834 /// ````
9835 ///
9836 /// Sets the *delegate* property to the given value.
9837 pub fn delegate(
9838 mut self,
9839 new_value: &'a mut dyn common::Delegate,
9840 ) -> MetagameListCategoriesByPlayerCall<'a, C> {
9841 self._delegate = Some(new_value);
9842 self
9843 }
9844
9845 /// Set any additional parameter of the query string used in the request.
9846 /// It should be used to set parameters which are not yet available through their own
9847 /// setters.
9848 ///
9849 /// Please note that this method must not be used to set any of the known parameters
9850 /// which have their own setter method. If done anyway, the request will fail.
9851 ///
9852 /// # Additional Parameters
9853 ///
9854 /// * *$.xgafv* (query-string) - V1 error format.
9855 /// * *access_token* (query-string) - OAuth access token.
9856 /// * *alt* (query-string) - Data format for response.
9857 /// * *callback* (query-string) - JSONP
9858 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9859 /// * *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.
9860 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9861 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9862 /// * *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.
9863 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9864 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9865 pub fn param<T>(mut self, name: T, value: T) -> MetagameListCategoriesByPlayerCall<'a, C>
9866 where
9867 T: AsRef<str>,
9868 {
9869 self._additional_params
9870 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9871 self
9872 }
9873
9874 /// Identifies the authorization scope for the method you are building.
9875 ///
9876 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9877 /// [`Scope::Full`].
9878 ///
9879 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9880 /// tokens for more than one scope.
9881 ///
9882 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9883 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9884 /// sufficient, a read-write scope will do as well.
9885 pub fn add_scope<St>(mut self, scope: St) -> MetagameListCategoriesByPlayerCall<'a, C>
9886 where
9887 St: AsRef<str>,
9888 {
9889 self._scopes.insert(String::from(scope.as_ref()));
9890 self
9891 }
9892 /// Identifies the authorization scope(s) for the method you are building.
9893 ///
9894 /// See [`Self::add_scope()`] for details.
9895 pub fn add_scopes<I, St>(mut self, scopes: I) -> MetagameListCategoriesByPlayerCall<'a, C>
9896 where
9897 I: IntoIterator<Item = St>,
9898 St: AsRef<str>,
9899 {
9900 self._scopes
9901 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9902 self
9903 }
9904
9905 /// Removes all scopes, and no default scope will be used either.
9906 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9907 /// for details).
9908 pub fn clear_scopes(mut self) -> MetagameListCategoriesByPlayerCall<'a, C> {
9909 self._scopes.clear();
9910 self
9911 }
9912}
9913
9914/// Retrieves the Player resource with the given ID. To retrieve the player for the currently authenticated user, set `playerId` to `me`.
9915///
9916/// A builder for the *get* method supported by a *player* resource.
9917/// It is not used directly, but through a [`PlayerMethods`] instance.
9918///
9919/// # Example
9920///
9921/// Instantiate a resource method builder
9922///
9923/// ```test_harness,no_run
9924/// # extern crate hyper;
9925/// # extern crate hyper_rustls;
9926/// # extern crate google_games1 as games1;
9927/// # async fn dox() {
9928/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9929///
9930/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9931/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9932/// # .with_native_roots()
9933/// # .unwrap()
9934/// # .https_only()
9935/// # .enable_http2()
9936/// # .build();
9937///
9938/// # let executor = hyper_util::rt::TokioExecutor::new();
9939/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9940/// # secret,
9941/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9942/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9943/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9944/// # ),
9945/// # ).build().await.unwrap();
9946///
9947/// # let client = hyper_util::client::legacy::Client::builder(
9948/// # hyper_util::rt::TokioExecutor::new()
9949/// # )
9950/// # .build(
9951/// # hyper_rustls::HttpsConnectorBuilder::new()
9952/// # .with_native_roots()
9953/// # .unwrap()
9954/// # .https_or_http()
9955/// # .enable_http2()
9956/// # .build()
9957/// # );
9958/// # let mut hub = Games::new(client, auth);
9959/// // You can configure optional parameters by calling the respective setters at will, and
9960/// // execute the final call using `doit()`.
9961/// // Values shown here are possibly random and not representative !
9962/// let result = hub.players().get("playerId")
9963/// .player_id_consistency_token("et")
9964/// .language("voluptua.")
9965/// .doit().await;
9966/// # }
9967/// ```
9968pub struct PlayerGetCall<'a, C>
9969where
9970 C: 'a,
9971{
9972 hub: &'a Games<C>,
9973 _player_id: String,
9974 _player_id_consistency_token: Option<String>,
9975 _language: Option<String>,
9976 _delegate: Option<&'a mut dyn common::Delegate>,
9977 _additional_params: HashMap<String, String>,
9978 _scopes: BTreeSet<String>,
9979}
9980
9981impl<'a, C> common::CallBuilder for PlayerGetCall<'a, C> {}
9982
9983impl<'a, C> PlayerGetCall<'a, C>
9984where
9985 C: common::Connector,
9986{
9987 /// Perform the operation you have build so far.
9988 pub async fn doit(mut self) -> common::Result<(common::Response, Player)> {
9989 use std::borrow::Cow;
9990 use std::io::{Read, Seek};
9991
9992 use common::{url::Params, ToParts};
9993 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9994
9995 let mut dd = common::DefaultDelegate;
9996 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9997 dlg.begin(common::MethodInfo {
9998 id: "games.players.get",
9999 http_method: hyper::Method::GET,
10000 });
10001
10002 for &field in ["alt", "playerId", "playerIdConsistencyToken", "language"].iter() {
10003 if self._additional_params.contains_key(field) {
10004 dlg.finished(false);
10005 return Err(common::Error::FieldClash(field));
10006 }
10007 }
10008
10009 let mut params = Params::with_capacity(5 + self._additional_params.len());
10010 params.push("playerId", self._player_id);
10011 if let Some(value) = self._player_id_consistency_token.as_ref() {
10012 params.push("playerIdConsistencyToken", value);
10013 }
10014 if let Some(value) = self._language.as_ref() {
10015 params.push("language", value);
10016 }
10017
10018 params.extend(self._additional_params.iter());
10019
10020 params.push("alt", "json");
10021 let mut url = self.hub._base_url.clone() + "games/v1/players/{playerId}";
10022 if self._scopes.is_empty() {
10023 self._scopes.insert(Scope::Full.as_ref().to_string());
10024 }
10025
10026 #[allow(clippy::single_element_loop)]
10027 for &(find_this, param_name) in [("{playerId}", "playerId")].iter() {
10028 url = params.uri_replacement(url, param_name, find_this, false);
10029 }
10030 {
10031 let to_remove = ["playerId"];
10032 params.remove_params(&to_remove);
10033 }
10034
10035 let url = params.parse_with_url(&url);
10036
10037 loop {
10038 let token = match self
10039 .hub
10040 .auth
10041 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10042 .await
10043 {
10044 Ok(token) => token,
10045 Err(e) => match dlg.token(e) {
10046 Ok(token) => token,
10047 Err(e) => {
10048 dlg.finished(false);
10049 return Err(common::Error::MissingToken(e));
10050 }
10051 },
10052 };
10053 let mut req_result = {
10054 let client = &self.hub.client;
10055 dlg.pre_request();
10056 let mut req_builder = hyper::Request::builder()
10057 .method(hyper::Method::GET)
10058 .uri(url.as_str())
10059 .header(USER_AGENT, self.hub._user_agent.clone());
10060
10061 if let Some(token) = token.as_ref() {
10062 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10063 }
10064
10065 let request = req_builder
10066 .header(CONTENT_LENGTH, 0_u64)
10067 .body(common::to_body::<String>(None));
10068
10069 client.request(request.unwrap()).await
10070 };
10071
10072 match req_result {
10073 Err(err) => {
10074 if let common::Retry::After(d) = dlg.http_error(&err) {
10075 sleep(d).await;
10076 continue;
10077 }
10078 dlg.finished(false);
10079 return Err(common::Error::HttpError(err));
10080 }
10081 Ok(res) => {
10082 let (mut parts, body) = res.into_parts();
10083 let mut body = common::Body::new(body);
10084 if !parts.status.is_success() {
10085 let bytes = common::to_bytes(body).await.unwrap_or_default();
10086 let error = serde_json::from_str(&common::to_string(&bytes));
10087 let response = common::to_response(parts, bytes.into());
10088
10089 if let common::Retry::After(d) =
10090 dlg.http_failure(&response, error.as_ref().ok())
10091 {
10092 sleep(d).await;
10093 continue;
10094 }
10095
10096 dlg.finished(false);
10097
10098 return Err(match error {
10099 Ok(value) => common::Error::BadRequest(value),
10100 _ => common::Error::Failure(response),
10101 });
10102 }
10103 let response = {
10104 let bytes = common::to_bytes(body).await.unwrap_or_default();
10105 let encoded = common::to_string(&bytes);
10106 match serde_json::from_str(&encoded) {
10107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10108 Err(error) => {
10109 dlg.response_json_decode_error(&encoded, &error);
10110 return Err(common::Error::JsonDecodeError(
10111 encoded.to_string(),
10112 error,
10113 ));
10114 }
10115 }
10116 };
10117
10118 dlg.finished(true);
10119 return Ok(response);
10120 }
10121 }
10122 }
10123 }
10124
10125 /// A player ID. A value of `me` may be used in place of the authenticated player's ID.
10126 ///
10127 /// Sets the *player id* path property to the given value.
10128 ///
10129 /// Even though the property as already been set when instantiating this call,
10130 /// we provide this method for API completeness.
10131 pub fn player_id(mut self, new_value: &str) -> PlayerGetCall<'a, C> {
10132 self._player_id = new_value.to_string();
10133 self
10134 }
10135 /// Consistency token of the player id. The call returns a 'not found' result when the token is present and invalid. Empty value is ignored. See also GlobalPlayerIdConsistencyTokenProto
10136 ///
10137 /// Sets the *player id consistency token* query property to the given value.
10138 pub fn player_id_consistency_token(mut self, new_value: &str) -> PlayerGetCall<'a, C> {
10139 self._player_id_consistency_token = Some(new_value.to_string());
10140 self
10141 }
10142 /// The preferred language to use for strings returned by this method.
10143 ///
10144 /// Sets the *language* query property to the given value.
10145 pub fn language(mut self, new_value: &str) -> PlayerGetCall<'a, C> {
10146 self._language = Some(new_value.to_string());
10147 self
10148 }
10149 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10150 /// while executing the actual API request.
10151 ///
10152 /// ````text
10153 /// It should be used to handle progress information, and to implement a certain level of resilience.
10154 /// ````
10155 ///
10156 /// Sets the *delegate* property to the given value.
10157 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PlayerGetCall<'a, C> {
10158 self._delegate = Some(new_value);
10159 self
10160 }
10161
10162 /// Set any additional parameter of the query string used in the request.
10163 /// It should be used to set parameters which are not yet available through their own
10164 /// setters.
10165 ///
10166 /// Please note that this method must not be used to set any of the known parameters
10167 /// which have their own setter method. If done anyway, the request will fail.
10168 ///
10169 /// # Additional Parameters
10170 ///
10171 /// * *$.xgafv* (query-string) - V1 error format.
10172 /// * *access_token* (query-string) - OAuth access token.
10173 /// * *alt* (query-string) - Data format for response.
10174 /// * *callback* (query-string) - JSONP
10175 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10176 /// * *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.
10177 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10178 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10179 /// * *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.
10180 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10181 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10182 pub fn param<T>(mut self, name: T, value: T) -> PlayerGetCall<'a, C>
10183 where
10184 T: AsRef<str>,
10185 {
10186 self._additional_params
10187 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10188 self
10189 }
10190
10191 /// Identifies the authorization scope for the method you are building.
10192 ///
10193 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10194 /// [`Scope::Full`].
10195 ///
10196 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10197 /// tokens for more than one scope.
10198 ///
10199 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10200 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10201 /// sufficient, a read-write scope will do as well.
10202 pub fn add_scope<St>(mut self, scope: St) -> PlayerGetCall<'a, C>
10203 where
10204 St: AsRef<str>,
10205 {
10206 self._scopes.insert(String::from(scope.as_ref()));
10207 self
10208 }
10209 /// Identifies the authorization scope(s) for the method you are building.
10210 ///
10211 /// See [`Self::add_scope()`] for details.
10212 pub fn add_scopes<I, St>(mut self, scopes: I) -> PlayerGetCall<'a, C>
10213 where
10214 I: IntoIterator<Item = St>,
10215 St: AsRef<str>,
10216 {
10217 self._scopes
10218 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10219 self
10220 }
10221
10222 /// Removes all scopes, and no default scope will be used either.
10223 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10224 /// for details).
10225 pub fn clear_scopes(mut self) -> PlayerGetCall<'a, C> {
10226 self._scopes.clear();
10227 self
10228 }
10229}
10230
10231/// Get the application player ids for the currently authenticated player across all requested games by the same developer as the calling application. This will only return ids for players that actually have an id (scoped or otherwise) with that game.
10232///
10233/// A builder for the *getMultipleApplicationPlayerIds* method supported by a *player* resource.
10234/// It is not used directly, but through a [`PlayerMethods`] instance.
10235///
10236/// # Example
10237///
10238/// Instantiate a resource method builder
10239///
10240/// ```test_harness,no_run
10241/// # extern crate hyper;
10242/// # extern crate hyper_rustls;
10243/// # extern crate google_games1 as games1;
10244/// # async fn dox() {
10245/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10246///
10247/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10248/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10249/// # .with_native_roots()
10250/// # .unwrap()
10251/// # .https_only()
10252/// # .enable_http2()
10253/// # .build();
10254///
10255/// # let executor = hyper_util::rt::TokioExecutor::new();
10256/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10257/// # secret,
10258/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10259/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10260/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10261/// # ),
10262/// # ).build().await.unwrap();
10263///
10264/// # let client = hyper_util::client::legacy::Client::builder(
10265/// # hyper_util::rt::TokioExecutor::new()
10266/// # )
10267/// # .build(
10268/// # hyper_rustls::HttpsConnectorBuilder::new()
10269/// # .with_native_roots()
10270/// # .unwrap()
10271/// # .https_or_http()
10272/// # .enable_http2()
10273/// # .build()
10274/// # );
10275/// # let mut hub = Games::new(client, auth);
10276/// // You can configure optional parameters by calling the respective setters at will, and
10277/// // execute the final call using `doit()`.
10278/// // Values shown here are possibly random and not representative !
10279/// let result = hub.players().get_multiple_application_player_ids()
10280/// .add_application_ids("amet.")
10281/// .doit().await;
10282/// # }
10283/// ```
10284pub struct PlayerGetMultipleApplicationPlayerIdCall<'a, C>
10285where
10286 C: 'a,
10287{
10288 hub: &'a Games<C>,
10289 _application_ids: Vec<String>,
10290 _delegate: Option<&'a mut dyn common::Delegate>,
10291 _additional_params: HashMap<String, String>,
10292 _scopes: BTreeSet<String>,
10293}
10294
10295impl<'a, C> common::CallBuilder for PlayerGetMultipleApplicationPlayerIdCall<'a, C> {}
10296
10297impl<'a, C> PlayerGetMultipleApplicationPlayerIdCall<'a, C>
10298where
10299 C: common::Connector,
10300{
10301 /// Perform the operation you have build so far.
10302 pub async fn doit(
10303 mut self,
10304 ) -> common::Result<(common::Response, GetMultipleApplicationPlayerIdsResponse)> {
10305 use std::borrow::Cow;
10306 use std::io::{Read, Seek};
10307
10308 use common::{url::Params, ToParts};
10309 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10310
10311 let mut dd = common::DefaultDelegate;
10312 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10313 dlg.begin(common::MethodInfo {
10314 id: "games.players.getMultipleApplicationPlayerIds",
10315 http_method: hyper::Method::GET,
10316 });
10317
10318 for &field in ["alt", "applicationIds"].iter() {
10319 if self._additional_params.contains_key(field) {
10320 dlg.finished(false);
10321 return Err(common::Error::FieldClash(field));
10322 }
10323 }
10324
10325 let mut params = Params::with_capacity(3 + self._additional_params.len());
10326 if !self._application_ids.is_empty() {
10327 for f in self._application_ids.iter() {
10328 params.push("applicationIds", f);
10329 }
10330 }
10331
10332 params.extend(self._additional_params.iter());
10333
10334 params.push("alt", "json");
10335 let mut url =
10336 self.hub._base_url.clone() + "games/v1/players/me/multipleApplicationPlayerIds";
10337 if self._scopes.is_empty() {
10338 self._scopes.insert(Scope::Full.as_ref().to_string());
10339 }
10340
10341 let url = params.parse_with_url(&url);
10342
10343 loop {
10344 let token = match self
10345 .hub
10346 .auth
10347 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10348 .await
10349 {
10350 Ok(token) => token,
10351 Err(e) => match dlg.token(e) {
10352 Ok(token) => token,
10353 Err(e) => {
10354 dlg.finished(false);
10355 return Err(common::Error::MissingToken(e));
10356 }
10357 },
10358 };
10359 let mut req_result = {
10360 let client = &self.hub.client;
10361 dlg.pre_request();
10362 let mut req_builder = hyper::Request::builder()
10363 .method(hyper::Method::GET)
10364 .uri(url.as_str())
10365 .header(USER_AGENT, self.hub._user_agent.clone());
10366
10367 if let Some(token) = token.as_ref() {
10368 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10369 }
10370
10371 let request = req_builder
10372 .header(CONTENT_LENGTH, 0_u64)
10373 .body(common::to_body::<String>(None));
10374
10375 client.request(request.unwrap()).await
10376 };
10377
10378 match req_result {
10379 Err(err) => {
10380 if let common::Retry::After(d) = dlg.http_error(&err) {
10381 sleep(d).await;
10382 continue;
10383 }
10384 dlg.finished(false);
10385 return Err(common::Error::HttpError(err));
10386 }
10387 Ok(res) => {
10388 let (mut parts, body) = res.into_parts();
10389 let mut body = common::Body::new(body);
10390 if !parts.status.is_success() {
10391 let bytes = common::to_bytes(body).await.unwrap_or_default();
10392 let error = serde_json::from_str(&common::to_string(&bytes));
10393 let response = common::to_response(parts, bytes.into());
10394
10395 if let common::Retry::After(d) =
10396 dlg.http_failure(&response, error.as_ref().ok())
10397 {
10398 sleep(d).await;
10399 continue;
10400 }
10401
10402 dlg.finished(false);
10403
10404 return Err(match error {
10405 Ok(value) => common::Error::BadRequest(value),
10406 _ => common::Error::Failure(response),
10407 });
10408 }
10409 let response = {
10410 let bytes = common::to_bytes(body).await.unwrap_or_default();
10411 let encoded = common::to_string(&bytes);
10412 match serde_json::from_str(&encoded) {
10413 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10414 Err(error) => {
10415 dlg.response_json_decode_error(&encoded, &error);
10416 return Err(common::Error::JsonDecodeError(
10417 encoded.to_string(),
10418 error,
10419 ));
10420 }
10421 }
10422 };
10423
10424 dlg.finished(true);
10425 return Ok(response);
10426 }
10427 }
10428 }
10429 }
10430
10431 /// Required. The application IDs from the Google Play developer console for the games to return scoped ids for.
10432 ///
10433 /// Append the given value to the *application ids* query property.
10434 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10435 pub fn add_application_ids(
10436 mut self,
10437 new_value: &str,
10438 ) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C> {
10439 self._application_ids.push(new_value.to_string());
10440 self
10441 }
10442 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10443 /// while executing the actual API request.
10444 ///
10445 /// ````text
10446 /// It should be used to handle progress information, and to implement a certain level of resilience.
10447 /// ````
10448 ///
10449 /// Sets the *delegate* property to the given value.
10450 pub fn delegate(
10451 mut self,
10452 new_value: &'a mut dyn common::Delegate,
10453 ) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C> {
10454 self._delegate = Some(new_value);
10455 self
10456 }
10457
10458 /// Set any additional parameter of the query string used in the request.
10459 /// It should be used to set parameters which are not yet available through their own
10460 /// setters.
10461 ///
10462 /// Please note that this method must not be used to set any of the known parameters
10463 /// which have their own setter method. If done anyway, the request will fail.
10464 ///
10465 /// # Additional Parameters
10466 ///
10467 /// * *$.xgafv* (query-string) - V1 error format.
10468 /// * *access_token* (query-string) - OAuth access token.
10469 /// * *alt* (query-string) - Data format for response.
10470 /// * *callback* (query-string) - JSONP
10471 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10472 /// * *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.
10473 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10474 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10475 /// * *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.
10476 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10477 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10478 pub fn param<T>(mut self, name: T, value: T) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C>
10479 where
10480 T: AsRef<str>,
10481 {
10482 self._additional_params
10483 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10484 self
10485 }
10486
10487 /// Identifies the authorization scope for the method you are building.
10488 ///
10489 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10490 /// [`Scope::Full`].
10491 ///
10492 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10493 /// tokens for more than one scope.
10494 ///
10495 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10496 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10497 /// sufficient, a read-write scope will do as well.
10498 pub fn add_scope<St>(mut self, scope: St) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C>
10499 where
10500 St: AsRef<str>,
10501 {
10502 self._scopes.insert(String::from(scope.as_ref()));
10503 self
10504 }
10505 /// Identifies the authorization scope(s) for the method you are building.
10506 ///
10507 /// See [`Self::add_scope()`] for details.
10508 pub fn add_scopes<I, St>(mut self, scopes: I) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C>
10509 where
10510 I: IntoIterator<Item = St>,
10511 St: AsRef<str>,
10512 {
10513 self._scopes
10514 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10515 self
10516 }
10517
10518 /// Removes all scopes, and no default scope will be used either.
10519 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10520 /// for details).
10521 pub fn clear_scopes(mut self) -> PlayerGetMultipleApplicationPlayerIdCall<'a, C> {
10522 self._scopes.clear();
10523 self
10524 }
10525}
10526
10527/// Retrieves scoped player identifiers for currently authenticated user.
10528///
10529/// A builder for the *getScopedPlayerIds* method supported by a *player* resource.
10530/// It is not used directly, but through a [`PlayerMethods`] instance.
10531///
10532/// # Example
10533///
10534/// Instantiate a resource method builder
10535///
10536/// ```test_harness,no_run
10537/// # extern crate hyper;
10538/// # extern crate hyper_rustls;
10539/// # extern crate google_games1 as games1;
10540/// # async fn dox() {
10541/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10542///
10543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10544/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10545/// # .with_native_roots()
10546/// # .unwrap()
10547/// # .https_only()
10548/// # .enable_http2()
10549/// # .build();
10550///
10551/// # let executor = hyper_util::rt::TokioExecutor::new();
10552/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10553/// # secret,
10554/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10555/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10556/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10557/// # ),
10558/// # ).build().await.unwrap();
10559///
10560/// # let client = hyper_util::client::legacy::Client::builder(
10561/// # hyper_util::rt::TokioExecutor::new()
10562/// # )
10563/// # .build(
10564/// # hyper_rustls::HttpsConnectorBuilder::new()
10565/// # .with_native_roots()
10566/// # .unwrap()
10567/// # .https_or_http()
10568/// # .enable_http2()
10569/// # .build()
10570/// # );
10571/// # let mut hub = Games::new(client, auth);
10572/// // You can configure optional parameters by calling the respective setters at will, and
10573/// // execute the final call using `doit()`.
10574/// // Values shown here are possibly random and not representative !
10575/// let result = hub.players().get_scoped_player_ids()
10576/// .doit().await;
10577/// # }
10578/// ```
10579pub struct PlayerGetScopedPlayerIdCall<'a, C>
10580where
10581 C: 'a,
10582{
10583 hub: &'a Games<C>,
10584 _delegate: Option<&'a mut dyn common::Delegate>,
10585 _additional_params: HashMap<String, String>,
10586 _scopes: BTreeSet<String>,
10587}
10588
10589impl<'a, C> common::CallBuilder for PlayerGetScopedPlayerIdCall<'a, C> {}
10590
10591impl<'a, C> PlayerGetScopedPlayerIdCall<'a, C>
10592where
10593 C: common::Connector,
10594{
10595 /// Perform the operation you have build so far.
10596 pub async fn doit(mut self) -> common::Result<(common::Response, ScopedPlayerIds)> {
10597 use std::borrow::Cow;
10598 use std::io::{Read, Seek};
10599
10600 use common::{url::Params, ToParts};
10601 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10602
10603 let mut dd = common::DefaultDelegate;
10604 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10605 dlg.begin(common::MethodInfo {
10606 id: "games.players.getScopedPlayerIds",
10607 http_method: hyper::Method::GET,
10608 });
10609
10610 for &field in ["alt"].iter() {
10611 if self._additional_params.contains_key(field) {
10612 dlg.finished(false);
10613 return Err(common::Error::FieldClash(field));
10614 }
10615 }
10616
10617 let mut params = Params::with_capacity(2 + self._additional_params.len());
10618
10619 params.extend(self._additional_params.iter());
10620
10621 params.push("alt", "json");
10622 let mut url = self.hub._base_url.clone() + "games/v1/players/me/scopedIds";
10623 if self._scopes.is_empty() {
10624 self._scopes.insert(Scope::Full.as_ref().to_string());
10625 }
10626
10627 let url = params.parse_with_url(&url);
10628
10629 loop {
10630 let token = match self
10631 .hub
10632 .auth
10633 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10634 .await
10635 {
10636 Ok(token) => token,
10637 Err(e) => match dlg.token(e) {
10638 Ok(token) => token,
10639 Err(e) => {
10640 dlg.finished(false);
10641 return Err(common::Error::MissingToken(e));
10642 }
10643 },
10644 };
10645 let mut req_result = {
10646 let client = &self.hub.client;
10647 dlg.pre_request();
10648 let mut req_builder = hyper::Request::builder()
10649 .method(hyper::Method::GET)
10650 .uri(url.as_str())
10651 .header(USER_AGENT, self.hub._user_agent.clone());
10652
10653 if let Some(token) = token.as_ref() {
10654 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10655 }
10656
10657 let request = req_builder
10658 .header(CONTENT_LENGTH, 0_u64)
10659 .body(common::to_body::<String>(None));
10660
10661 client.request(request.unwrap()).await
10662 };
10663
10664 match req_result {
10665 Err(err) => {
10666 if let common::Retry::After(d) = dlg.http_error(&err) {
10667 sleep(d).await;
10668 continue;
10669 }
10670 dlg.finished(false);
10671 return Err(common::Error::HttpError(err));
10672 }
10673 Ok(res) => {
10674 let (mut parts, body) = res.into_parts();
10675 let mut body = common::Body::new(body);
10676 if !parts.status.is_success() {
10677 let bytes = common::to_bytes(body).await.unwrap_or_default();
10678 let error = serde_json::from_str(&common::to_string(&bytes));
10679 let response = common::to_response(parts, bytes.into());
10680
10681 if let common::Retry::After(d) =
10682 dlg.http_failure(&response, error.as_ref().ok())
10683 {
10684 sleep(d).await;
10685 continue;
10686 }
10687
10688 dlg.finished(false);
10689
10690 return Err(match error {
10691 Ok(value) => common::Error::BadRequest(value),
10692 _ => common::Error::Failure(response),
10693 });
10694 }
10695 let response = {
10696 let bytes = common::to_bytes(body).await.unwrap_or_default();
10697 let encoded = common::to_string(&bytes);
10698 match serde_json::from_str(&encoded) {
10699 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10700 Err(error) => {
10701 dlg.response_json_decode_error(&encoded, &error);
10702 return Err(common::Error::JsonDecodeError(
10703 encoded.to_string(),
10704 error,
10705 ));
10706 }
10707 }
10708 };
10709
10710 dlg.finished(true);
10711 return Ok(response);
10712 }
10713 }
10714 }
10715 }
10716
10717 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10718 /// while executing the actual API request.
10719 ///
10720 /// ````text
10721 /// It should be used to handle progress information, and to implement a certain level of resilience.
10722 /// ````
10723 ///
10724 /// Sets the *delegate* property to the given value.
10725 pub fn delegate(
10726 mut self,
10727 new_value: &'a mut dyn common::Delegate,
10728 ) -> PlayerGetScopedPlayerIdCall<'a, C> {
10729 self._delegate = Some(new_value);
10730 self
10731 }
10732
10733 /// Set any additional parameter of the query string used in the request.
10734 /// It should be used to set parameters which are not yet available through their own
10735 /// setters.
10736 ///
10737 /// Please note that this method must not be used to set any of the known parameters
10738 /// which have their own setter method. If done anyway, the request will fail.
10739 ///
10740 /// # Additional Parameters
10741 ///
10742 /// * *$.xgafv* (query-string) - V1 error format.
10743 /// * *access_token* (query-string) - OAuth access token.
10744 /// * *alt* (query-string) - Data format for response.
10745 /// * *callback* (query-string) - JSONP
10746 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10747 /// * *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.
10748 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10749 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10750 /// * *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.
10751 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10752 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10753 pub fn param<T>(mut self, name: T, value: T) -> PlayerGetScopedPlayerIdCall<'a, C>
10754 where
10755 T: AsRef<str>,
10756 {
10757 self._additional_params
10758 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10759 self
10760 }
10761
10762 /// Identifies the authorization scope for the method you are building.
10763 ///
10764 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10765 /// [`Scope::Full`].
10766 ///
10767 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10768 /// tokens for more than one scope.
10769 ///
10770 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10771 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10772 /// sufficient, a read-write scope will do as well.
10773 pub fn add_scope<St>(mut self, scope: St) -> PlayerGetScopedPlayerIdCall<'a, C>
10774 where
10775 St: AsRef<str>,
10776 {
10777 self._scopes.insert(String::from(scope.as_ref()));
10778 self
10779 }
10780 /// Identifies the authorization scope(s) for the method you are building.
10781 ///
10782 /// See [`Self::add_scope()`] for details.
10783 pub fn add_scopes<I, St>(mut self, scopes: I) -> PlayerGetScopedPlayerIdCall<'a, C>
10784 where
10785 I: IntoIterator<Item = St>,
10786 St: AsRef<str>,
10787 {
10788 self._scopes
10789 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10790 self
10791 }
10792
10793 /// Removes all scopes, and no default scope will be used either.
10794 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10795 /// for details).
10796 pub fn clear_scopes(mut self) -> PlayerGetScopedPlayerIdCall<'a, C> {
10797 self._scopes.clear();
10798 self
10799 }
10800}
10801
10802/// Get the collection of players for the currently authenticated user.
10803///
10804/// A builder for the *list* method supported by a *player* resource.
10805/// It is not used directly, but through a [`PlayerMethods`] instance.
10806///
10807/// # Example
10808///
10809/// Instantiate a resource method builder
10810///
10811/// ```test_harness,no_run
10812/// # extern crate hyper;
10813/// # extern crate hyper_rustls;
10814/// # extern crate google_games1 as games1;
10815/// # async fn dox() {
10816/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10817///
10818/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10819/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10820/// # .with_native_roots()
10821/// # .unwrap()
10822/// # .https_only()
10823/// # .enable_http2()
10824/// # .build();
10825///
10826/// # let executor = hyper_util::rt::TokioExecutor::new();
10827/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10828/// # secret,
10829/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10830/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10831/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10832/// # ),
10833/// # ).build().await.unwrap();
10834///
10835/// # let client = hyper_util::client::legacy::Client::builder(
10836/// # hyper_util::rt::TokioExecutor::new()
10837/// # )
10838/// # .build(
10839/// # hyper_rustls::HttpsConnectorBuilder::new()
10840/// # .with_native_roots()
10841/// # .unwrap()
10842/// # .https_or_http()
10843/// # .enable_http2()
10844/// # .build()
10845/// # );
10846/// # let mut hub = Games::new(client, auth);
10847/// // You can configure optional parameters by calling the respective setters at will, and
10848/// // execute the final call using `doit()`.
10849/// // Values shown here are possibly random and not representative !
10850/// let result = hub.players().list("collection")
10851/// .page_token("diam")
10852/// .max_results(-49)
10853/// .language("et")
10854/// .doit().await;
10855/// # }
10856/// ```
10857pub struct PlayerListCall<'a, C>
10858where
10859 C: 'a,
10860{
10861 hub: &'a Games<C>,
10862 _collection: String,
10863 _page_token: Option<String>,
10864 _max_results: Option<i32>,
10865 _language: Option<String>,
10866 _delegate: Option<&'a mut dyn common::Delegate>,
10867 _additional_params: HashMap<String, String>,
10868 _scopes: BTreeSet<String>,
10869}
10870
10871impl<'a, C> common::CallBuilder for PlayerListCall<'a, C> {}
10872
10873impl<'a, C> PlayerListCall<'a, C>
10874where
10875 C: common::Connector,
10876{
10877 /// Perform the operation you have build so far.
10878 pub async fn doit(mut self) -> common::Result<(common::Response, PlayerListResponse)> {
10879 use std::borrow::Cow;
10880 use std::io::{Read, Seek};
10881
10882 use common::{url::Params, ToParts};
10883 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10884
10885 let mut dd = common::DefaultDelegate;
10886 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10887 dlg.begin(common::MethodInfo {
10888 id: "games.players.list",
10889 http_method: hyper::Method::GET,
10890 });
10891
10892 for &field in ["alt", "collection", "pageToken", "maxResults", "language"].iter() {
10893 if self._additional_params.contains_key(field) {
10894 dlg.finished(false);
10895 return Err(common::Error::FieldClash(field));
10896 }
10897 }
10898
10899 let mut params = Params::with_capacity(6 + self._additional_params.len());
10900 params.push("collection", self._collection);
10901 if let Some(value) = self._page_token.as_ref() {
10902 params.push("pageToken", value);
10903 }
10904 if let Some(value) = self._max_results.as_ref() {
10905 params.push("maxResults", value.to_string());
10906 }
10907 if let Some(value) = self._language.as_ref() {
10908 params.push("language", value);
10909 }
10910
10911 params.extend(self._additional_params.iter());
10912
10913 params.push("alt", "json");
10914 let mut url = self.hub._base_url.clone() + "games/v1/players/me/players/{collection}";
10915 if self._scopes.is_empty() {
10916 self._scopes.insert(Scope::Full.as_ref().to_string());
10917 }
10918
10919 #[allow(clippy::single_element_loop)]
10920 for &(find_this, param_name) in [("{collection}", "collection")].iter() {
10921 url = params.uri_replacement(url, param_name, find_this, false);
10922 }
10923 {
10924 let to_remove = ["collection"];
10925 params.remove_params(&to_remove);
10926 }
10927
10928 let url = params.parse_with_url(&url);
10929
10930 loop {
10931 let token = match self
10932 .hub
10933 .auth
10934 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10935 .await
10936 {
10937 Ok(token) => token,
10938 Err(e) => match dlg.token(e) {
10939 Ok(token) => token,
10940 Err(e) => {
10941 dlg.finished(false);
10942 return Err(common::Error::MissingToken(e));
10943 }
10944 },
10945 };
10946 let mut req_result = {
10947 let client = &self.hub.client;
10948 dlg.pre_request();
10949 let mut req_builder = hyper::Request::builder()
10950 .method(hyper::Method::GET)
10951 .uri(url.as_str())
10952 .header(USER_AGENT, self.hub._user_agent.clone());
10953
10954 if let Some(token) = token.as_ref() {
10955 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10956 }
10957
10958 let request = req_builder
10959 .header(CONTENT_LENGTH, 0_u64)
10960 .body(common::to_body::<String>(None));
10961
10962 client.request(request.unwrap()).await
10963 };
10964
10965 match req_result {
10966 Err(err) => {
10967 if let common::Retry::After(d) = dlg.http_error(&err) {
10968 sleep(d).await;
10969 continue;
10970 }
10971 dlg.finished(false);
10972 return Err(common::Error::HttpError(err));
10973 }
10974 Ok(res) => {
10975 let (mut parts, body) = res.into_parts();
10976 let mut body = common::Body::new(body);
10977 if !parts.status.is_success() {
10978 let bytes = common::to_bytes(body).await.unwrap_or_default();
10979 let error = serde_json::from_str(&common::to_string(&bytes));
10980 let response = common::to_response(parts, bytes.into());
10981
10982 if let common::Retry::After(d) =
10983 dlg.http_failure(&response, error.as_ref().ok())
10984 {
10985 sleep(d).await;
10986 continue;
10987 }
10988
10989 dlg.finished(false);
10990
10991 return Err(match error {
10992 Ok(value) => common::Error::BadRequest(value),
10993 _ => common::Error::Failure(response),
10994 });
10995 }
10996 let response = {
10997 let bytes = common::to_bytes(body).await.unwrap_or_default();
10998 let encoded = common::to_string(&bytes);
10999 match serde_json::from_str(&encoded) {
11000 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11001 Err(error) => {
11002 dlg.response_json_decode_error(&encoded, &error);
11003 return Err(common::Error::JsonDecodeError(
11004 encoded.to_string(),
11005 error,
11006 ));
11007 }
11008 }
11009 };
11010
11011 dlg.finished(true);
11012 return Ok(response);
11013 }
11014 }
11015 }
11016 }
11017
11018 /// Collection of players being retrieved
11019 ///
11020 /// Sets the *collection* path property to the given value.
11021 ///
11022 /// Even though the property as already been set when instantiating this call,
11023 /// we provide this method for API completeness.
11024 pub fn collection(mut self, new_value: &str) -> PlayerListCall<'a, C> {
11025 self._collection = new_value.to_string();
11026 self
11027 }
11028 /// The token returned by the previous request.
11029 ///
11030 /// Sets the *page token* query property to the given value.
11031 pub fn page_token(mut self, new_value: &str) -> PlayerListCall<'a, C> {
11032 self._page_token = Some(new_value.to_string());
11033 self
11034 }
11035 /// The maximum number of player resources to return in the response, used for paging. For any response, the actual number of player resources returned may be less than the specified `maxResults`.
11036 ///
11037 /// Sets the *max results* query property to the given value.
11038 pub fn max_results(mut self, new_value: i32) -> PlayerListCall<'a, C> {
11039 self._max_results = Some(new_value);
11040 self
11041 }
11042 /// The preferred language to use for strings returned by this method.
11043 ///
11044 /// Sets the *language* query property to the given value.
11045 pub fn language(mut self, new_value: &str) -> PlayerListCall<'a, C> {
11046 self._language = Some(new_value.to_string());
11047 self
11048 }
11049 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11050 /// while executing the actual API request.
11051 ///
11052 /// ````text
11053 /// It should be used to handle progress information, and to implement a certain level of resilience.
11054 /// ````
11055 ///
11056 /// Sets the *delegate* property to the given value.
11057 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PlayerListCall<'a, C> {
11058 self._delegate = Some(new_value);
11059 self
11060 }
11061
11062 /// Set any additional parameter of the query string used in the request.
11063 /// It should be used to set parameters which are not yet available through their own
11064 /// setters.
11065 ///
11066 /// Please note that this method must not be used to set any of the known parameters
11067 /// which have their own setter method. If done anyway, the request will fail.
11068 ///
11069 /// # Additional Parameters
11070 ///
11071 /// * *$.xgafv* (query-string) - V1 error format.
11072 /// * *access_token* (query-string) - OAuth access token.
11073 /// * *alt* (query-string) - Data format for response.
11074 /// * *callback* (query-string) - JSONP
11075 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11076 /// * *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.
11077 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11078 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11079 /// * *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.
11080 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11081 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11082 pub fn param<T>(mut self, name: T, value: T) -> PlayerListCall<'a, C>
11083 where
11084 T: AsRef<str>,
11085 {
11086 self._additional_params
11087 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11088 self
11089 }
11090
11091 /// Identifies the authorization scope for the method you are building.
11092 ///
11093 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11094 /// [`Scope::Full`].
11095 ///
11096 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11097 /// tokens for more than one scope.
11098 ///
11099 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11100 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11101 /// sufficient, a read-write scope will do as well.
11102 pub fn add_scope<St>(mut self, scope: St) -> PlayerListCall<'a, C>
11103 where
11104 St: AsRef<str>,
11105 {
11106 self._scopes.insert(String::from(scope.as_ref()));
11107 self
11108 }
11109 /// Identifies the authorization scope(s) for the method you are building.
11110 ///
11111 /// See [`Self::add_scope()`] for details.
11112 pub fn add_scopes<I, St>(mut self, scopes: I) -> PlayerListCall<'a, C>
11113 where
11114 I: IntoIterator<Item = St>,
11115 St: AsRef<str>,
11116 {
11117 self._scopes
11118 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11119 self
11120 }
11121
11122 /// Removes all scopes, and no default scope will be used either.
11123 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11124 /// for details).
11125 pub fn clear_scopes(mut self) -> PlayerListCall<'a, C> {
11126 self._scopes.clear();
11127 self
11128 }
11129}
11130
11131/// Retrieve the Recall tokens from all requested games that is associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have an active PGS Player profile.
11132///
11133/// A builder for the *gamesPlayerTokens* method supported by a *recall* resource.
11134/// It is not used directly, but through a [`RecallMethods`] instance.
11135///
11136/// # Example
11137///
11138/// Instantiate a resource method builder
11139///
11140/// ```test_harness,no_run
11141/// # extern crate hyper;
11142/// # extern crate hyper_rustls;
11143/// # extern crate google_games1 as games1;
11144/// # async fn dox() {
11145/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11146///
11147/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11148/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11149/// # .with_native_roots()
11150/// # .unwrap()
11151/// # .https_only()
11152/// # .enable_http2()
11153/// # .build();
11154///
11155/// # let executor = hyper_util::rt::TokioExecutor::new();
11156/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11157/// # secret,
11158/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11159/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11160/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11161/// # ),
11162/// # ).build().await.unwrap();
11163///
11164/// # let client = hyper_util::client::legacy::Client::builder(
11165/// # hyper_util::rt::TokioExecutor::new()
11166/// # )
11167/// # .build(
11168/// # hyper_rustls::HttpsConnectorBuilder::new()
11169/// # .with_native_roots()
11170/// # .unwrap()
11171/// # .https_or_http()
11172/// # .enable_http2()
11173/// # .build()
11174/// # );
11175/// # let mut hub = Games::new(client, auth);
11176/// // You can configure optional parameters by calling the respective setters at will, and
11177/// // execute the final call using `doit()`.
11178/// // Values shown here are possibly random and not representative !
11179/// let result = hub.recall().games_player_tokens("sessionId")
11180/// .add_application_ids("sadipscing")
11181/// .doit().await;
11182/// # }
11183/// ```
11184pub struct RecallGamesPlayerTokenCall<'a, C>
11185where
11186 C: 'a,
11187{
11188 hub: &'a Games<C>,
11189 _session_id: String,
11190 _application_ids: Vec<String>,
11191 _delegate: Option<&'a mut dyn common::Delegate>,
11192 _additional_params: HashMap<String, String>,
11193 _scopes: BTreeSet<String>,
11194}
11195
11196impl<'a, C> common::CallBuilder for RecallGamesPlayerTokenCall<'a, C> {}
11197
11198impl<'a, C> RecallGamesPlayerTokenCall<'a, C>
11199where
11200 C: common::Connector,
11201{
11202 /// Perform the operation you have build so far.
11203 pub async fn doit(
11204 mut self,
11205 ) -> common::Result<(common::Response, RetrieveGamesPlayerTokensResponse)> {
11206 use std::borrow::Cow;
11207 use std::io::{Read, Seek};
11208
11209 use common::{url::Params, ToParts};
11210 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11211
11212 let mut dd = common::DefaultDelegate;
11213 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11214 dlg.begin(common::MethodInfo {
11215 id: "games.recall.gamesPlayerTokens",
11216 http_method: hyper::Method::GET,
11217 });
11218
11219 for &field in ["alt", "sessionId", "applicationIds"].iter() {
11220 if self._additional_params.contains_key(field) {
11221 dlg.finished(false);
11222 return Err(common::Error::FieldClash(field));
11223 }
11224 }
11225
11226 let mut params = Params::with_capacity(4 + self._additional_params.len());
11227 params.push("sessionId", self._session_id);
11228 if !self._application_ids.is_empty() {
11229 for f in self._application_ids.iter() {
11230 params.push("applicationIds", f);
11231 }
11232 }
11233
11234 params.extend(self._additional_params.iter());
11235
11236 params.push("alt", "json");
11237 let mut url = self.hub._base_url.clone() + "games/v1/recall/gamesPlayerTokens/{sessionId}";
11238 if self._scopes.is_empty() {
11239 self._scopes
11240 .insert(Scope::Androidpublisher.as_ref().to_string());
11241 }
11242
11243 #[allow(clippy::single_element_loop)]
11244 for &(find_this, param_name) in [("{sessionId}", "sessionId")].iter() {
11245 url = params.uri_replacement(url, param_name, find_this, false);
11246 }
11247 {
11248 let to_remove = ["sessionId"];
11249 params.remove_params(&to_remove);
11250 }
11251
11252 let url = params.parse_with_url(&url);
11253
11254 loop {
11255 let token = match self
11256 .hub
11257 .auth
11258 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11259 .await
11260 {
11261 Ok(token) => token,
11262 Err(e) => match dlg.token(e) {
11263 Ok(token) => token,
11264 Err(e) => {
11265 dlg.finished(false);
11266 return Err(common::Error::MissingToken(e));
11267 }
11268 },
11269 };
11270 let mut req_result = {
11271 let client = &self.hub.client;
11272 dlg.pre_request();
11273 let mut req_builder = hyper::Request::builder()
11274 .method(hyper::Method::GET)
11275 .uri(url.as_str())
11276 .header(USER_AGENT, self.hub._user_agent.clone());
11277
11278 if let Some(token) = token.as_ref() {
11279 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11280 }
11281
11282 let request = req_builder
11283 .header(CONTENT_LENGTH, 0_u64)
11284 .body(common::to_body::<String>(None));
11285
11286 client.request(request.unwrap()).await
11287 };
11288
11289 match req_result {
11290 Err(err) => {
11291 if let common::Retry::After(d) = dlg.http_error(&err) {
11292 sleep(d).await;
11293 continue;
11294 }
11295 dlg.finished(false);
11296 return Err(common::Error::HttpError(err));
11297 }
11298 Ok(res) => {
11299 let (mut parts, body) = res.into_parts();
11300 let mut body = common::Body::new(body);
11301 if !parts.status.is_success() {
11302 let bytes = common::to_bytes(body).await.unwrap_or_default();
11303 let error = serde_json::from_str(&common::to_string(&bytes));
11304 let response = common::to_response(parts, bytes.into());
11305
11306 if let common::Retry::After(d) =
11307 dlg.http_failure(&response, error.as_ref().ok())
11308 {
11309 sleep(d).await;
11310 continue;
11311 }
11312
11313 dlg.finished(false);
11314
11315 return Err(match error {
11316 Ok(value) => common::Error::BadRequest(value),
11317 _ => common::Error::Failure(response),
11318 });
11319 }
11320 let response = {
11321 let bytes = common::to_bytes(body).await.unwrap_or_default();
11322 let encoded = common::to_string(&bytes);
11323 match serde_json::from_str(&encoded) {
11324 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11325 Err(error) => {
11326 dlg.response_json_decode_error(&encoded, &error);
11327 return Err(common::Error::JsonDecodeError(
11328 encoded.to_string(),
11329 error,
11330 ));
11331 }
11332 }
11333 };
11334
11335 dlg.finished(true);
11336 return Ok(response);
11337 }
11338 }
11339 }
11340 }
11341
11342 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
11343 ///
11344 /// Sets the *session id* path property to the given value.
11345 ///
11346 /// Even though the property as already been set when instantiating this call,
11347 /// we provide this method for API completeness.
11348 pub fn session_id(mut self, new_value: &str) -> RecallGamesPlayerTokenCall<'a, C> {
11349 self._session_id = new_value.to_string();
11350 self
11351 }
11352 /// Required. The application IDs from the Google Play developer console for the games to return scoped ids for.
11353 ///
11354 /// Append the given value to the *application ids* query property.
11355 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11356 pub fn add_application_ids(mut self, new_value: &str) -> RecallGamesPlayerTokenCall<'a, C> {
11357 self._application_ids.push(new_value.to_string());
11358 self
11359 }
11360 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11361 /// while executing the actual API request.
11362 ///
11363 /// ````text
11364 /// It should be used to handle progress information, and to implement a certain level of resilience.
11365 /// ````
11366 ///
11367 /// Sets the *delegate* property to the given value.
11368 pub fn delegate(
11369 mut self,
11370 new_value: &'a mut dyn common::Delegate,
11371 ) -> RecallGamesPlayerTokenCall<'a, C> {
11372 self._delegate = Some(new_value);
11373 self
11374 }
11375
11376 /// Set any additional parameter of the query string used in the request.
11377 /// It should be used to set parameters which are not yet available through their own
11378 /// setters.
11379 ///
11380 /// Please note that this method must not be used to set any of the known parameters
11381 /// which have their own setter method. If done anyway, the request will fail.
11382 ///
11383 /// # Additional Parameters
11384 ///
11385 /// * *$.xgafv* (query-string) - V1 error format.
11386 /// * *access_token* (query-string) - OAuth access token.
11387 /// * *alt* (query-string) - Data format for response.
11388 /// * *callback* (query-string) - JSONP
11389 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11390 /// * *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.
11391 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11392 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11393 /// * *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.
11394 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11395 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11396 pub fn param<T>(mut self, name: T, value: T) -> RecallGamesPlayerTokenCall<'a, C>
11397 where
11398 T: AsRef<str>,
11399 {
11400 self._additional_params
11401 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11402 self
11403 }
11404
11405 /// Identifies the authorization scope for the method you are building.
11406 ///
11407 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11408 /// [`Scope::Androidpublisher`].
11409 ///
11410 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11411 /// tokens for more than one scope.
11412 ///
11413 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11414 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11415 /// sufficient, a read-write scope will do as well.
11416 pub fn add_scope<St>(mut self, scope: St) -> RecallGamesPlayerTokenCall<'a, C>
11417 where
11418 St: AsRef<str>,
11419 {
11420 self._scopes.insert(String::from(scope.as_ref()));
11421 self
11422 }
11423 /// Identifies the authorization scope(s) for the method you are building.
11424 ///
11425 /// See [`Self::add_scope()`] for details.
11426 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallGamesPlayerTokenCall<'a, C>
11427 where
11428 I: IntoIterator<Item = St>,
11429 St: AsRef<str>,
11430 {
11431 self._scopes
11432 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11433 self
11434 }
11435
11436 /// Removes all scopes, and no default scope will be used either.
11437 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11438 /// for details).
11439 pub fn clear_scopes(mut self) -> RecallGamesPlayerTokenCall<'a, C> {
11440 self._scopes.clear();
11441 self
11442 }
11443}
11444
11445/// Retrieve the last Recall token from all developer games that is associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have active PGS Player profile.
11446///
11447/// A builder for the *lastTokenFromAllDeveloperGames* method supported by a *recall* resource.
11448/// It is not used directly, but through a [`RecallMethods`] instance.
11449///
11450/// # Example
11451///
11452/// Instantiate a resource method builder
11453///
11454/// ```test_harness,no_run
11455/// # extern crate hyper;
11456/// # extern crate hyper_rustls;
11457/// # extern crate google_games1 as games1;
11458/// # async fn dox() {
11459/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11460///
11461/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11462/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11463/// # .with_native_roots()
11464/// # .unwrap()
11465/// # .https_only()
11466/// # .enable_http2()
11467/// # .build();
11468///
11469/// # let executor = hyper_util::rt::TokioExecutor::new();
11470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11471/// # secret,
11472/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11473/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11474/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11475/// # ),
11476/// # ).build().await.unwrap();
11477///
11478/// # let client = hyper_util::client::legacy::Client::builder(
11479/// # hyper_util::rt::TokioExecutor::new()
11480/// # )
11481/// # .build(
11482/// # hyper_rustls::HttpsConnectorBuilder::new()
11483/// # .with_native_roots()
11484/// # .unwrap()
11485/// # .https_or_http()
11486/// # .enable_http2()
11487/// # .build()
11488/// # );
11489/// # let mut hub = Games::new(client, auth);
11490/// // You can configure optional parameters by calling the respective setters at will, and
11491/// // execute the final call using `doit()`.
11492/// // Values shown here are possibly random and not representative !
11493/// let result = hub.recall().last_token_from_all_developer_games("sessionId")
11494/// .doit().await;
11495/// # }
11496/// ```
11497pub struct RecallLastTokenFromAllDeveloperGameCall<'a, C>
11498where
11499 C: 'a,
11500{
11501 hub: &'a Games<C>,
11502 _session_id: String,
11503 _delegate: Option<&'a mut dyn common::Delegate>,
11504 _additional_params: HashMap<String, String>,
11505 _scopes: BTreeSet<String>,
11506}
11507
11508impl<'a, C> common::CallBuilder for RecallLastTokenFromAllDeveloperGameCall<'a, C> {}
11509
11510impl<'a, C> RecallLastTokenFromAllDeveloperGameCall<'a, C>
11511where
11512 C: common::Connector,
11513{
11514 /// Perform the operation you have build so far.
11515 pub async fn doit(
11516 mut self,
11517 ) -> common::Result<(
11518 common::Response,
11519 RetrieveDeveloperGamesLastPlayerTokenResponse,
11520 )> {
11521 use std::borrow::Cow;
11522 use std::io::{Read, Seek};
11523
11524 use common::{url::Params, ToParts};
11525 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11526
11527 let mut dd = common::DefaultDelegate;
11528 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11529 dlg.begin(common::MethodInfo {
11530 id: "games.recall.lastTokenFromAllDeveloperGames",
11531 http_method: hyper::Method::GET,
11532 });
11533
11534 for &field in ["alt", "sessionId"].iter() {
11535 if self._additional_params.contains_key(field) {
11536 dlg.finished(false);
11537 return Err(common::Error::FieldClash(field));
11538 }
11539 }
11540
11541 let mut params = Params::with_capacity(3 + self._additional_params.len());
11542 params.push("sessionId", self._session_id);
11543
11544 params.extend(self._additional_params.iter());
11545
11546 params.push("alt", "json");
11547 let mut url = self.hub._base_url.clone()
11548 + "games/v1/recall/developerGamesLastPlayerToken/{sessionId}";
11549 if self._scopes.is_empty() {
11550 self._scopes
11551 .insert(Scope::Androidpublisher.as_ref().to_string());
11552 }
11553
11554 #[allow(clippy::single_element_loop)]
11555 for &(find_this, param_name) in [("{sessionId}", "sessionId")].iter() {
11556 url = params.uri_replacement(url, param_name, find_this, false);
11557 }
11558 {
11559 let to_remove = ["sessionId"];
11560 params.remove_params(&to_remove);
11561 }
11562
11563 let url = params.parse_with_url(&url);
11564
11565 loop {
11566 let token = match self
11567 .hub
11568 .auth
11569 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11570 .await
11571 {
11572 Ok(token) => token,
11573 Err(e) => match dlg.token(e) {
11574 Ok(token) => token,
11575 Err(e) => {
11576 dlg.finished(false);
11577 return Err(common::Error::MissingToken(e));
11578 }
11579 },
11580 };
11581 let mut req_result = {
11582 let client = &self.hub.client;
11583 dlg.pre_request();
11584 let mut req_builder = hyper::Request::builder()
11585 .method(hyper::Method::GET)
11586 .uri(url.as_str())
11587 .header(USER_AGENT, self.hub._user_agent.clone());
11588
11589 if let Some(token) = token.as_ref() {
11590 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11591 }
11592
11593 let request = req_builder
11594 .header(CONTENT_LENGTH, 0_u64)
11595 .body(common::to_body::<String>(None));
11596
11597 client.request(request.unwrap()).await
11598 };
11599
11600 match req_result {
11601 Err(err) => {
11602 if let common::Retry::After(d) = dlg.http_error(&err) {
11603 sleep(d).await;
11604 continue;
11605 }
11606 dlg.finished(false);
11607 return Err(common::Error::HttpError(err));
11608 }
11609 Ok(res) => {
11610 let (mut parts, body) = res.into_parts();
11611 let mut body = common::Body::new(body);
11612 if !parts.status.is_success() {
11613 let bytes = common::to_bytes(body).await.unwrap_or_default();
11614 let error = serde_json::from_str(&common::to_string(&bytes));
11615 let response = common::to_response(parts, bytes.into());
11616
11617 if let common::Retry::After(d) =
11618 dlg.http_failure(&response, error.as_ref().ok())
11619 {
11620 sleep(d).await;
11621 continue;
11622 }
11623
11624 dlg.finished(false);
11625
11626 return Err(match error {
11627 Ok(value) => common::Error::BadRequest(value),
11628 _ => common::Error::Failure(response),
11629 });
11630 }
11631 let response = {
11632 let bytes = common::to_bytes(body).await.unwrap_or_default();
11633 let encoded = common::to_string(&bytes);
11634 match serde_json::from_str(&encoded) {
11635 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11636 Err(error) => {
11637 dlg.response_json_decode_error(&encoded, &error);
11638 return Err(common::Error::JsonDecodeError(
11639 encoded.to_string(),
11640 error,
11641 ));
11642 }
11643 }
11644 };
11645
11646 dlg.finished(true);
11647 return Ok(response);
11648 }
11649 }
11650 }
11651 }
11652
11653 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
11654 ///
11655 /// Sets the *session id* path property to the given value.
11656 ///
11657 /// Even though the property as already been set when instantiating this call,
11658 /// we provide this method for API completeness.
11659 pub fn session_id(mut self, new_value: &str) -> RecallLastTokenFromAllDeveloperGameCall<'a, C> {
11660 self._session_id = new_value.to_string();
11661 self
11662 }
11663 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11664 /// while executing the actual API request.
11665 ///
11666 /// ````text
11667 /// It should be used to handle progress information, and to implement a certain level of resilience.
11668 /// ````
11669 ///
11670 /// Sets the *delegate* property to the given value.
11671 pub fn delegate(
11672 mut self,
11673 new_value: &'a mut dyn common::Delegate,
11674 ) -> RecallLastTokenFromAllDeveloperGameCall<'a, C> {
11675 self._delegate = Some(new_value);
11676 self
11677 }
11678
11679 /// Set any additional parameter of the query string used in the request.
11680 /// It should be used to set parameters which are not yet available through their own
11681 /// setters.
11682 ///
11683 /// Please note that this method must not be used to set any of the known parameters
11684 /// which have their own setter method. If done anyway, the request will fail.
11685 ///
11686 /// # Additional Parameters
11687 ///
11688 /// * *$.xgafv* (query-string) - V1 error format.
11689 /// * *access_token* (query-string) - OAuth access token.
11690 /// * *alt* (query-string) - Data format for response.
11691 /// * *callback* (query-string) - JSONP
11692 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11693 /// * *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.
11694 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11695 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11696 /// * *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.
11697 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11698 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11699 pub fn param<T>(mut self, name: T, value: T) -> RecallLastTokenFromAllDeveloperGameCall<'a, C>
11700 where
11701 T: AsRef<str>,
11702 {
11703 self._additional_params
11704 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11705 self
11706 }
11707
11708 /// Identifies the authorization scope for the method you are building.
11709 ///
11710 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11711 /// [`Scope::Androidpublisher`].
11712 ///
11713 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11714 /// tokens for more than one scope.
11715 ///
11716 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11717 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11718 /// sufficient, a read-write scope will do as well.
11719 pub fn add_scope<St>(mut self, scope: St) -> RecallLastTokenFromAllDeveloperGameCall<'a, C>
11720 where
11721 St: AsRef<str>,
11722 {
11723 self._scopes.insert(String::from(scope.as_ref()));
11724 self
11725 }
11726 /// Identifies the authorization scope(s) for the method you are building.
11727 ///
11728 /// See [`Self::add_scope()`] for details.
11729 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallLastTokenFromAllDeveloperGameCall<'a, C>
11730 where
11731 I: IntoIterator<Item = St>,
11732 St: AsRef<str>,
11733 {
11734 self._scopes
11735 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11736 self
11737 }
11738
11739 /// Removes all scopes, and no default scope will be used either.
11740 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11741 /// for details).
11742 pub fn clear_scopes(mut self) -> RecallLastTokenFromAllDeveloperGameCall<'a, C> {
11743 self._scopes.clear();
11744 self
11745 }
11746}
11747
11748/// Associate the PGS Player principal encoded in the provided recall session id with an in-game account
11749///
11750/// A builder for the *linkPersona* method supported by a *recall* resource.
11751/// It is not used directly, but through a [`RecallMethods`] instance.
11752///
11753/// # Example
11754///
11755/// Instantiate a resource method builder
11756///
11757/// ```test_harness,no_run
11758/// # extern crate hyper;
11759/// # extern crate hyper_rustls;
11760/// # extern crate google_games1 as games1;
11761/// use games1::api::LinkPersonaRequest;
11762/// # async fn dox() {
11763/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11764///
11765/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11766/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11767/// # .with_native_roots()
11768/// # .unwrap()
11769/// # .https_only()
11770/// # .enable_http2()
11771/// # .build();
11772///
11773/// # let executor = hyper_util::rt::TokioExecutor::new();
11774/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11775/// # secret,
11776/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11777/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11778/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11779/// # ),
11780/// # ).build().await.unwrap();
11781///
11782/// # let client = hyper_util::client::legacy::Client::builder(
11783/// # hyper_util::rt::TokioExecutor::new()
11784/// # )
11785/// # .build(
11786/// # hyper_rustls::HttpsConnectorBuilder::new()
11787/// # .with_native_roots()
11788/// # .unwrap()
11789/// # .https_or_http()
11790/// # .enable_http2()
11791/// # .build()
11792/// # );
11793/// # let mut hub = Games::new(client, auth);
11794/// // As the method needs a request, you would usually fill it with the desired information
11795/// // into the respective structure. Some of the parts shown here might not be applicable !
11796/// // Values shown here are possibly random and not representative !
11797/// let mut req = LinkPersonaRequest::default();
11798///
11799/// // You can configure optional parameters by calling the respective setters at will, and
11800/// // execute the final call using `doit()`.
11801/// // Values shown here are possibly random and not representative !
11802/// let result = hub.recall().link_persona(req)
11803/// .doit().await;
11804/// # }
11805/// ```
11806pub struct RecallLinkPersonaCall<'a, C>
11807where
11808 C: 'a,
11809{
11810 hub: &'a Games<C>,
11811 _request: LinkPersonaRequest,
11812 _delegate: Option<&'a mut dyn common::Delegate>,
11813 _additional_params: HashMap<String, String>,
11814 _scopes: BTreeSet<String>,
11815}
11816
11817impl<'a, C> common::CallBuilder for RecallLinkPersonaCall<'a, C> {}
11818
11819impl<'a, C> RecallLinkPersonaCall<'a, C>
11820where
11821 C: common::Connector,
11822{
11823 /// Perform the operation you have build so far.
11824 pub async fn doit(mut self) -> common::Result<(common::Response, LinkPersonaResponse)> {
11825 use std::borrow::Cow;
11826 use std::io::{Read, Seek};
11827
11828 use common::{url::Params, ToParts};
11829 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11830
11831 let mut dd = common::DefaultDelegate;
11832 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11833 dlg.begin(common::MethodInfo {
11834 id: "games.recall.linkPersona",
11835 http_method: hyper::Method::POST,
11836 });
11837
11838 for &field in ["alt"].iter() {
11839 if self._additional_params.contains_key(field) {
11840 dlg.finished(false);
11841 return Err(common::Error::FieldClash(field));
11842 }
11843 }
11844
11845 let mut params = Params::with_capacity(3 + self._additional_params.len());
11846
11847 params.extend(self._additional_params.iter());
11848
11849 params.push("alt", "json");
11850 let mut url = self.hub._base_url.clone() + "games/v1/recall:linkPersona";
11851 if self._scopes.is_empty() {
11852 self._scopes
11853 .insert(Scope::Androidpublisher.as_ref().to_string());
11854 }
11855
11856 let url = params.parse_with_url(&url);
11857
11858 let mut json_mime_type = mime::APPLICATION_JSON;
11859 let mut request_value_reader = {
11860 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11861 common::remove_json_null_values(&mut value);
11862 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11863 serde_json::to_writer(&mut dst, &value).unwrap();
11864 dst
11865 };
11866 let request_size = request_value_reader
11867 .seek(std::io::SeekFrom::End(0))
11868 .unwrap();
11869 request_value_reader
11870 .seek(std::io::SeekFrom::Start(0))
11871 .unwrap();
11872
11873 loop {
11874 let token = match self
11875 .hub
11876 .auth
11877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11878 .await
11879 {
11880 Ok(token) => token,
11881 Err(e) => match dlg.token(e) {
11882 Ok(token) => token,
11883 Err(e) => {
11884 dlg.finished(false);
11885 return Err(common::Error::MissingToken(e));
11886 }
11887 },
11888 };
11889 request_value_reader
11890 .seek(std::io::SeekFrom::Start(0))
11891 .unwrap();
11892 let mut req_result = {
11893 let client = &self.hub.client;
11894 dlg.pre_request();
11895 let mut req_builder = hyper::Request::builder()
11896 .method(hyper::Method::POST)
11897 .uri(url.as_str())
11898 .header(USER_AGENT, self.hub._user_agent.clone());
11899
11900 if let Some(token) = token.as_ref() {
11901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11902 }
11903
11904 let request = req_builder
11905 .header(CONTENT_TYPE, json_mime_type.to_string())
11906 .header(CONTENT_LENGTH, request_size as u64)
11907 .body(common::to_body(
11908 request_value_reader.get_ref().clone().into(),
11909 ));
11910
11911 client.request(request.unwrap()).await
11912 };
11913
11914 match req_result {
11915 Err(err) => {
11916 if let common::Retry::After(d) = dlg.http_error(&err) {
11917 sleep(d).await;
11918 continue;
11919 }
11920 dlg.finished(false);
11921 return Err(common::Error::HttpError(err));
11922 }
11923 Ok(res) => {
11924 let (mut parts, body) = res.into_parts();
11925 let mut body = common::Body::new(body);
11926 if !parts.status.is_success() {
11927 let bytes = common::to_bytes(body).await.unwrap_or_default();
11928 let error = serde_json::from_str(&common::to_string(&bytes));
11929 let response = common::to_response(parts, bytes.into());
11930
11931 if let common::Retry::After(d) =
11932 dlg.http_failure(&response, error.as_ref().ok())
11933 {
11934 sleep(d).await;
11935 continue;
11936 }
11937
11938 dlg.finished(false);
11939
11940 return Err(match error {
11941 Ok(value) => common::Error::BadRequest(value),
11942 _ => common::Error::Failure(response),
11943 });
11944 }
11945 let response = {
11946 let bytes = common::to_bytes(body).await.unwrap_or_default();
11947 let encoded = common::to_string(&bytes);
11948 match serde_json::from_str(&encoded) {
11949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11950 Err(error) => {
11951 dlg.response_json_decode_error(&encoded, &error);
11952 return Err(common::Error::JsonDecodeError(
11953 encoded.to_string(),
11954 error,
11955 ));
11956 }
11957 }
11958 };
11959
11960 dlg.finished(true);
11961 return Ok(response);
11962 }
11963 }
11964 }
11965 }
11966
11967 ///
11968 /// Sets the *request* property to the given value.
11969 ///
11970 /// Even though the property as already been set when instantiating this call,
11971 /// we provide this method for API completeness.
11972 pub fn request(mut self, new_value: LinkPersonaRequest) -> RecallLinkPersonaCall<'a, C> {
11973 self._request = new_value;
11974 self
11975 }
11976 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11977 /// while executing the actual API request.
11978 ///
11979 /// ````text
11980 /// It should be used to handle progress information, and to implement a certain level of resilience.
11981 /// ````
11982 ///
11983 /// Sets the *delegate* property to the given value.
11984 pub fn delegate(
11985 mut self,
11986 new_value: &'a mut dyn common::Delegate,
11987 ) -> RecallLinkPersonaCall<'a, C> {
11988 self._delegate = Some(new_value);
11989 self
11990 }
11991
11992 /// Set any additional parameter of the query string used in the request.
11993 /// It should be used to set parameters which are not yet available through their own
11994 /// setters.
11995 ///
11996 /// Please note that this method must not be used to set any of the known parameters
11997 /// which have their own setter method. If done anyway, the request will fail.
11998 ///
11999 /// # Additional Parameters
12000 ///
12001 /// * *$.xgafv* (query-string) - V1 error format.
12002 /// * *access_token* (query-string) - OAuth access token.
12003 /// * *alt* (query-string) - Data format for response.
12004 /// * *callback* (query-string) - JSONP
12005 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12006 /// * *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.
12007 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12008 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12009 /// * *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.
12010 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12011 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12012 pub fn param<T>(mut self, name: T, value: T) -> RecallLinkPersonaCall<'a, C>
12013 where
12014 T: AsRef<str>,
12015 {
12016 self._additional_params
12017 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12018 self
12019 }
12020
12021 /// Identifies the authorization scope for the method you are building.
12022 ///
12023 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12024 /// [`Scope::Androidpublisher`].
12025 ///
12026 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12027 /// tokens for more than one scope.
12028 ///
12029 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12030 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12031 /// sufficient, a read-write scope will do as well.
12032 pub fn add_scope<St>(mut self, scope: St) -> RecallLinkPersonaCall<'a, C>
12033 where
12034 St: AsRef<str>,
12035 {
12036 self._scopes.insert(String::from(scope.as_ref()));
12037 self
12038 }
12039 /// Identifies the authorization scope(s) for the method you are building.
12040 ///
12041 /// See [`Self::add_scope()`] for details.
12042 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallLinkPersonaCall<'a, C>
12043 where
12044 I: IntoIterator<Item = St>,
12045 St: AsRef<str>,
12046 {
12047 self._scopes
12048 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12049 self
12050 }
12051
12052 /// Removes all scopes, and no default scope will be used either.
12053 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12054 /// for details).
12055 pub fn clear_scopes(mut self) -> RecallLinkPersonaCall<'a, C> {
12056 self._scopes.clear();
12057 self
12058 }
12059}
12060
12061/// Delete all Recall tokens linking the given persona to any player (with or without a profile).
12062///
12063/// A builder for the *resetPersona* method supported by a *recall* resource.
12064/// It is not used directly, but through a [`RecallMethods`] instance.
12065///
12066/// # Example
12067///
12068/// Instantiate a resource method builder
12069///
12070/// ```test_harness,no_run
12071/// # extern crate hyper;
12072/// # extern crate hyper_rustls;
12073/// # extern crate google_games1 as games1;
12074/// use games1::api::ResetPersonaRequest;
12075/// # async fn dox() {
12076/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12077///
12078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12079/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12080/// # .with_native_roots()
12081/// # .unwrap()
12082/// # .https_only()
12083/// # .enable_http2()
12084/// # .build();
12085///
12086/// # let executor = hyper_util::rt::TokioExecutor::new();
12087/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12088/// # secret,
12089/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12090/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12091/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12092/// # ),
12093/// # ).build().await.unwrap();
12094///
12095/// # let client = hyper_util::client::legacy::Client::builder(
12096/// # hyper_util::rt::TokioExecutor::new()
12097/// # )
12098/// # .build(
12099/// # hyper_rustls::HttpsConnectorBuilder::new()
12100/// # .with_native_roots()
12101/// # .unwrap()
12102/// # .https_or_http()
12103/// # .enable_http2()
12104/// # .build()
12105/// # );
12106/// # let mut hub = Games::new(client, auth);
12107/// // As the method needs a request, you would usually fill it with the desired information
12108/// // into the respective structure. Some of the parts shown here might not be applicable !
12109/// // Values shown here are possibly random and not representative !
12110/// let mut req = ResetPersonaRequest::default();
12111///
12112/// // You can configure optional parameters by calling the respective setters at will, and
12113/// // execute the final call using `doit()`.
12114/// // Values shown here are possibly random and not representative !
12115/// let result = hub.recall().reset_persona(req)
12116/// .doit().await;
12117/// # }
12118/// ```
12119pub struct RecallResetPersonaCall<'a, C>
12120where
12121 C: 'a,
12122{
12123 hub: &'a Games<C>,
12124 _request: ResetPersonaRequest,
12125 _delegate: Option<&'a mut dyn common::Delegate>,
12126 _additional_params: HashMap<String, String>,
12127 _scopes: BTreeSet<String>,
12128}
12129
12130impl<'a, C> common::CallBuilder for RecallResetPersonaCall<'a, C> {}
12131
12132impl<'a, C> RecallResetPersonaCall<'a, C>
12133where
12134 C: common::Connector,
12135{
12136 /// Perform the operation you have build so far.
12137 pub async fn doit(mut self) -> common::Result<(common::Response, ResetPersonaResponse)> {
12138 use std::borrow::Cow;
12139 use std::io::{Read, Seek};
12140
12141 use common::{url::Params, ToParts};
12142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12143
12144 let mut dd = common::DefaultDelegate;
12145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12146 dlg.begin(common::MethodInfo {
12147 id: "games.recall.resetPersona",
12148 http_method: hyper::Method::POST,
12149 });
12150
12151 for &field in ["alt"].iter() {
12152 if self._additional_params.contains_key(field) {
12153 dlg.finished(false);
12154 return Err(common::Error::FieldClash(field));
12155 }
12156 }
12157
12158 let mut params = Params::with_capacity(3 + self._additional_params.len());
12159
12160 params.extend(self._additional_params.iter());
12161
12162 params.push("alt", "json");
12163 let mut url = self.hub._base_url.clone() + "games/v1/recall:resetPersona";
12164 if self._scopes.is_empty() {
12165 self._scopes
12166 .insert(Scope::Androidpublisher.as_ref().to_string());
12167 }
12168
12169 let url = params.parse_with_url(&url);
12170
12171 let mut json_mime_type = mime::APPLICATION_JSON;
12172 let mut request_value_reader = {
12173 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12174 common::remove_json_null_values(&mut value);
12175 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12176 serde_json::to_writer(&mut dst, &value).unwrap();
12177 dst
12178 };
12179 let request_size = request_value_reader
12180 .seek(std::io::SeekFrom::End(0))
12181 .unwrap();
12182 request_value_reader
12183 .seek(std::io::SeekFrom::Start(0))
12184 .unwrap();
12185
12186 loop {
12187 let token = match self
12188 .hub
12189 .auth
12190 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12191 .await
12192 {
12193 Ok(token) => token,
12194 Err(e) => match dlg.token(e) {
12195 Ok(token) => token,
12196 Err(e) => {
12197 dlg.finished(false);
12198 return Err(common::Error::MissingToken(e));
12199 }
12200 },
12201 };
12202 request_value_reader
12203 .seek(std::io::SeekFrom::Start(0))
12204 .unwrap();
12205 let mut req_result = {
12206 let client = &self.hub.client;
12207 dlg.pre_request();
12208 let mut req_builder = hyper::Request::builder()
12209 .method(hyper::Method::POST)
12210 .uri(url.as_str())
12211 .header(USER_AGENT, self.hub._user_agent.clone());
12212
12213 if let Some(token) = token.as_ref() {
12214 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12215 }
12216
12217 let request = req_builder
12218 .header(CONTENT_TYPE, json_mime_type.to_string())
12219 .header(CONTENT_LENGTH, request_size as u64)
12220 .body(common::to_body(
12221 request_value_reader.get_ref().clone().into(),
12222 ));
12223
12224 client.request(request.unwrap()).await
12225 };
12226
12227 match req_result {
12228 Err(err) => {
12229 if let common::Retry::After(d) = dlg.http_error(&err) {
12230 sleep(d).await;
12231 continue;
12232 }
12233 dlg.finished(false);
12234 return Err(common::Error::HttpError(err));
12235 }
12236 Ok(res) => {
12237 let (mut parts, body) = res.into_parts();
12238 let mut body = common::Body::new(body);
12239 if !parts.status.is_success() {
12240 let bytes = common::to_bytes(body).await.unwrap_or_default();
12241 let error = serde_json::from_str(&common::to_string(&bytes));
12242 let response = common::to_response(parts, bytes.into());
12243
12244 if let common::Retry::After(d) =
12245 dlg.http_failure(&response, error.as_ref().ok())
12246 {
12247 sleep(d).await;
12248 continue;
12249 }
12250
12251 dlg.finished(false);
12252
12253 return Err(match error {
12254 Ok(value) => common::Error::BadRequest(value),
12255 _ => common::Error::Failure(response),
12256 });
12257 }
12258 let response = {
12259 let bytes = common::to_bytes(body).await.unwrap_or_default();
12260 let encoded = common::to_string(&bytes);
12261 match serde_json::from_str(&encoded) {
12262 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12263 Err(error) => {
12264 dlg.response_json_decode_error(&encoded, &error);
12265 return Err(common::Error::JsonDecodeError(
12266 encoded.to_string(),
12267 error,
12268 ));
12269 }
12270 }
12271 };
12272
12273 dlg.finished(true);
12274 return Ok(response);
12275 }
12276 }
12277 }
12278 }
12279
12280 ///
12281 /// Sets the *request* property to the given value.
12282 ///
12283 /// Even though the property as already been set when instantiating this call,
12284 /// we provide this method for API completeness.
12285 pub fn request(mut self, new_value: ResetPersonaRequest) -> RecallResetPersonaCall<'a, C> {
12286 self._request = new_value;
12287 self
12288 }
12289 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12290 /// while executing the actual API request.
12291 ///
12292 /// ````text
12293 /// It should be used to handle progress information, and to implement a certain level of resilience.
12294 /// ````
12295 ///
12296 /// Sets the *delegate* property to the given value.
12297 pub fn delegate(
12298 mut self,
12299 new_value: &'a mut dyn common::Delegate,
12300 ) -> RecallResetPersonaCall<'a, C> {
12301 self._delegate = Some(new_value);
12302 self
12303 }
12304
12305 /// Set any additional parameter of the query string used in the request.
12306 /// It should be used to set parameters which are not yet available through their own
12307 /// setters.
12308 ///
12309 /// Please note that this method must not be used to set any of the known parameters
12310 /// which have their own setter method. If done anyway, the request will fail.
12311 ///
12312 /// # Additional Parameters
12313 ///
12314 /// * *$.xgafv* (query-string) - V1 error format.
12315 /// * *access_token* (query-string) - OAuth access token.
12316 /// * *alt* (query-string) - Data format for response.
12317 /// * *callback* (query-string) - JSONP
12318 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12319 /// * *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.
12320 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12321 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12322 /// * *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.
12323 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12324 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12325 pub fn param<T>(mut self, name: T, value: T) -> RecallResetPersonaCall<'a, C>
12326 where
12327 T: AsRef<str>,
12328 {
12329 self._additional_params
12330 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12331 self
12332 }
12333
12334 /// Identifies the authorization scope for the method you are building.
12335 ///
12336 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12337 /// [`Scope::Androidpublisher`].
12338 ///
12339 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12340 /// tokens for more than one scope.
12341 ///
12342 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12343 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12344 /// sufficient, a read-write scope will do as well.
12345 pub fn add_scope<St>(mut self, scope: St) -> RecallResetPersonaCall<'a, C>
12346 where
12347 St: AsRef<str>,
12348 {
12349 self._scopes.insert(String::from(scope.as_ref()));
12350 self
12351 }
12352 /// Identifies the authorization scope(s) for the method you are building.
12353 ///
12354 /// See [`Self::add_scope()`] for details.
12355 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallResetPersonaCall<'a, C>
12356 where
12357 I: IntoIterator<Item = St>,
12358 St: AsRef<str>,
12359 {
12360 self._scopes
12361 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12362 self
12363 }
12364
12365 /// Removes all scopes, and no default scope will be used either.
12366 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12367 /// for details).
12368 pub fn clear_scopes(mut self) -> RecallResetPersonaCall<'a, C> {
12369 self._scopes.clear();
12370 self
12371 }
12372}
12373
12374/// Retrieve all Recall tokens associated with the PGS Player encoded in the provided recall session id. The API is only available for users that have active PGS Player profile.
12375///
12376/// A builder for the *retrieveTokens* method supported by a *recall* resource.
12377/// It is not used directly, but through a [`RecallMethods`] instance.
12378///
12379/// # Example
12380///
12381/// Instantiate a resource method builder
12382///
12383/// ```test_harness,no_run
12384/// # extern crate hyper;
12385/// # extern crate hyper_rustls;
12386/// # extern crate google_games1 as games1;
12387/// # async fn dox() {
12388/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12389///
12390/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12391/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12392/// # .with_native_roots()
12393/// # .unwrap()
12394/// # .https_only()
12395/// # .enable_http2()
12396/// # .build();
12397///
12398/// # let executor = hyper_util::rt::TokioExecutor::new();
12399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12400/// # secret,
12401/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12402/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12403/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12404/// # ),
12405/// # ).build().await.unwrap();
12406///
12407/// # let client = hyper_util::client::legacy::Client::builder(
12408/// # hyper_util::rt::TokioExecutor::new()
12409/// # )
12410/// # .build(
12411/// # hyper_rustls::HttpsConnectorBuilder::new()
12412/// # .with_native_roots()
12413/// # .unwrap()
12414/// # .https_or_http()
12415/// # .enable_http2()
12416/// # .build()
12417/// # );
12418/// # let mut hub = Games::new(client, auth);
12419/// // You can configure optional parameters by calling the respective setters at will, and
12420/// // execute the final call using `doit()`.
12421/// // Values shown here are possibly random and not representative !
12422/// let result = hub.recall().retrieve_tokens("sessionId")
12423/// .doit().await;
12424/// # }
12425/// ```
12426pub struct RecallRetrieveTokenCall<'a, C>
12427where
12428 C: 'a,
12429{
12430 hub: &'a Games<C>,
12431 _session_id: String,
12432 _delegate: Option<&'a mut dyn common::Delegate>,
12433 _additional_params: HashMap<String, String>,
12434 _scopes: BTreeSet<String>,
12435}
12436
12437impl<'a, C> common::CallBuilder for RecallRetrieveTokenCall<'a, C> {}
12438
12439impl<'a, C> RecallRetrieveTokenCall<'a, C>
12440where
12441 C: common::Connector,
12442{
12443 /// Perform the operation you have build so far.
12444 pub async fn doit(
12445 mut self,
12446 ) -> common::Result<(common::Response, RetrievePlayerTokensResponse)> {
12447 use std::borrow::Cow;
12448 use std::io::{Read, Seek};
12449
12450 use common::{url::Params, ToParts};
12451 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12452
12453 let mut dd = common::DefaultDelegate;
12454 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12455 dlg.begin(common::MethodInfo {
12456 id: "games.recall.retrieveTokens",
12457 http_method: hyper::Method::GET,
12458 });
12459
12460 for &field in ["alt", "sessionId"].iter() {
12461 if self._additional_params.contains_key(field) {
12462 dlg.finished(false);
12463 return Err(common::Error::FieldClash(field));
12464 }
12465 }
12466
12467 let mut params = Params::with_capacity(3 + self._additional_params.len());
12468 params.push("sessionId", self._session_id);
12469
12470 params.extend(self._additional_params.iter());
12471
12472 params.push("alt", "json");
12473 let mut url = self.hub._base_url.clone() + "games/v1/recall/tokens/{sessionId}";
12474 if self._scopes.is_empty() {
12475 self._scopes
12476 .insert(Scope::Androidpublisher.as_ref().to_string());
12477 }
12478
12479 #[allow(clippy::single_element_loop)]
12480 for &(find_this, param_name) in [("{sessionId}", "sessionId")].iter() {
12481 url = params.uri_replacement(url, param_name, find_this, false);
12482 }
12483 {
12484 let to_remove = ["sessionId"];
12485 params.remove_params(&to_remove);
12486 }
12487
12488 let url = params.parse_with_url(&url);
12489
12490 loop {
12491 let token = match self
12492 .hub
12493 .auth
12494 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12495 .await
12496 {
12497 Ok(token) => token,
12498 Err(e) => match dlg.token(e) {
12499 Ok(token) => token,
12500 Err(e) => {
12501 dlg.finished(false);
12502 return Err(common::Error::MissingToken(e));
12503 }
12504 },
12505 };
12506 let mut req_result = {
12507 let client = &self.hub.client;
12508 dlg.pre_request();
12509 let mut req_builder = hyper::Request::builder()
12510 .method(hyper::Method::GET)
12511 .uri(url.as_str())
12512 .header(USER_AGENT, self.hub._user_agent.clone());
12513
12514 if let Some(token) = token.as_ref() {
12515 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12516 }
12517
12518 let request = req_builder
12519 .header(CONTENT_LENGTH, 0_u64)
12520 .body(common::to_body::<String>(None));
12521
12522 client.request(request.unwrap()).await
12523 };
12524
12525 match req_result {
12526 Err(err) => {
12527 if let common::Retry::After(d) = dlg.http_error(&err) {
12528 sleep(d).await;
12529 continue;
12530 }
12531 dlg.finished(false);
12532 return Err(common::Error::HttpError(err));
12533 }
12534 Ok(res) => {
12535 let (mut parts, body) = res.into_parts();
12536 let mut body = common::Body::new(body);
12537 if !parts.status.is_success() {
12538 let bytes = common::to_bytes(body).await.unwrap_or_default();
12539 let error = serde_json::from_str(&common::to_string(&bytes));
12540 let response = common::to_response(parts, bytes.into());
12541
12542 if let common::Retry::After(d) =
12543 dlg.http_failure(&response, error.as_ref().ok())
12544 {
12545 sleep(d).await;
12546 continue;
12547 }
12548
12549 dlg.finished(false);
12550
12551 return Err(match error {
12552 Ok(value) => common::Error::BadRequest(value),
12553 _ => common::Error::Failure(response),
12554 });
12555 }
12556 let response = {
12557 let bytes = common::to_bytes(body).await.unwrap_or_default();
12558 let encoded = common::to_string(&bytes);
12559 match serde_json::from_str(&encoded) {
12560 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12561 Err(error) => {
12562 dlg.response_json_decode_error(&encoded, &error);
12563 return Err(common::Error::JsonDecodeError(
12564 encoded.to_string(),
12565 error,
12566 ));
12567 }
12568 }
12569 };
12570
12571 dlg.finished(true);
12572 return Ok(response);
12573 }
12574 }
12575 }
12576 }
12577
12578 /// Required. Opaque server-generated string that encodes all the necessary information to identify the PGS player / Google user and application.
12579 ///
12580 /// Sets the *session id* path property to the given value.
12581 ///
12582 /// Even though the property as already been set when instantiating this call,
12583 /// we provide this method for API completeness.
12584 pub fn session_id(mut self, new_value: &str) -> RecallRetrieveTokenCall<'a, C> {
12585 self._session_id = new_value.to_string();
12586 self
12587 }
12588 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12589 /// while executing the actual API request.
12590 ///
12591 /// ````text
12592 /// It should be used to handle progress information, and to implement a certain level of resilience.
12593 /// ````
12594 ///
12595 /// Sets the *delegate* property to the given value.
12596 pub fn delegate(
12597 mut self,
12598 new_value: &'a mut dyn common::Delegate,
12599 ) -> RecallRetrieveTokenCall<'a, C> {
12600 self._delegate = Some(new_value);
12601 self
12602 }
12603
12604 /// Set any additional parameter of the query string used in the request.
12605 /// It should be used to set parameters which are not yet available through their own
12606 /// setters.
12607 ///
12608 /// Please note that this method must not be used to set any of the known parameters
12609 /// which have their own setter method. If done anyway, the request will fail.
12610 ///
12611 /// # Additional Parameters
12612 ///
12613 /// * *$.xgafv* (query-string) - V1 error format.
12614 /// * *access_token* (query-string) - OAuth access token.
12615 /// * *alt* (query-string) - Data format for response.
12616 /// * *callback* (query-string) - JSONP
12617 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12618 /// * *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.
12619 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12620 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12621 /// * *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.
12622 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12623 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12624 pub fn param<T>(mut self, name: T, value: T) -> RecallRetrieveTokenCall<'a, C>
12625 where
12626 T: AsRef<str>,
12627 {
12628 self._additional_params
12629 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12630 self
12631 }
12632
12633 /// Identifies the authorization scope for the method you are building.
12634 ///
12635 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12636 /// [`Scope::Androidpublisher`].
12637 ///
12638 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12639 /// tokens for more than one scope.
12640 ///
12641 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12642 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12643 /// sufficient, a read-write scope will do as well.
12644 pub fn add_scope<St>(mut self, scope: St) -> RecallRetrieveTokenCall<'a, C>
12645 where
12646 St: AsRef<str>,
12647 {
12648 self._scopes.insert(String::from(scope.as_ref()));
12649 self
12650 }
12651 /// Identifies the authorization scope(s) for the method you are building.
12652 ///
12653 /// See [`Self::add_scope()`] for details.
12654 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallRetrieveTokenCall<'a, C>
12655 where
12656 I: IntoIterator<Item = St>,
12657 St: AsRef<str>,
12658 {
12659 self._scopes
12660 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12661 self
12662 }
12663
12664 /// Removes all scopes, and no default scope will be used either.
12665 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12666 /// for details).
12667 pub fn clear_scopes(mut self) -> RecallRetrieveTokenCall<'a, C> {
12668 self._scopes.clear();
12669 self
12670 }
12671}
12672
12673/// Delete a Recall token linking the PGS Player principal identified by the Recall session and an in-game account identified either by the 'persona' or by the token value.
12674///
12675/// A builder for the *unlinkPersona* method supported by a *recall* resource.
12676/// It is not used directly, but through a [`RecallMethods`] instance.
12677///
12678/// # Example
12679///
12680/// Instantiate a resource method builder
12681///
12682/// ```test_harness,no_run
12683/// # extern crate hyper;
12684/// # extern crate hyper_rustls;
12685/// # extern crate google_games1 as games1;
12686/// use games1::api::UnlinkPersonaRequest;
12687/// # async fn dox() {
12688/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12689///
12690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12691/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12692/// # .with_native_roots()
12693/// # .unwrap()
12694/// # .https_only()
12695/// # .enable_http2()
12696/// # .build();
12697///
12698/// # let executor = hyper_util::rt::TokioExecutor::new();
12699/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12700/// # secret,
12701/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12702/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12703/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12704/// # ),
12705/// # ).build().await.unwrap();
12706///
12707/// # let client = hyper_util::client::legacy::Client::builder(
12708/// # hyper_util::rt::TokioExecutor::new()
12709/// # )
12710/// # .build(
12711/// # hyper_rustls::HttpsConnectorBuilder::new()
12712/// # .with_native_roots()
12713/// # .unwrap()
12714/// # .https_or_http()
12715/// # .enable_http2()
12716/// # .build()
12717/// # );
12718/// # let mut hub = Games::new(client, auth);
12719/// // As the method needs a request, you would usually fill it with the desired information
12720/// // into the respective structure. Some of the parts shown here might not be applicable !
12721/// // Values shown here are possibly random and not representative !
12722/// let mut req = UnlinkPersonaRequest::default();
12723///
12724/// // You can configure optional parameters by calling the respective setters at will, and
12725/// // execute the final call using `doit()`.
12726/// // Values shown here are possibly random and not representative !
12727/// let result = hub.recall().unlink_persona(req)
12728/// .doit().await;
12729/// # }
12730/// ```
12731pub struct RecallUnlinkPersonaCall<'a, C>
12732where
12733 C: 'a,
12734{
12735 hub: &'a Games<C>,
12736 _request: UnlinkPersonaRequest,
12737 _delegate: Option<&'a mut dyn common::Delegate>,
12738 _additional_params: HashMap<String, String>,
12739 _scopes: BTreeSet<String>,
12740}
12741
12742impl<'a, C> common::CallBuilder for RecallUnlinkPersonaCall<'a, C> {}
12743
12744impl<'a, C> RecallUnlinkPersonaCall<'a, C>
12745where
12746 C: common::Connector,
12747{
12748 /// Perform the operation you have build so far.
12749 pub async fn doit(mut self) -> common::Result<(common::Response, UnlinkPersonaResponse)> {
12750 use std::borrow::Cow;
12751 use std::io::{Read, Seek};
12752
12753 use common::{url::Params, ToParts};
12754 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12755
12756 let mut dd = common::DefaultDelegate;
12757 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12758 dlg.begin(common::MethodInfo {
12759 id: "games.recall.unlinkPersona",
12760 http_method: hyper::Method::POST,
12761 });
12762
12763 for &field in ["alt"].iter() {
12764 if self._additional_params.contains_key(field) {
12765 dlg.finished(false);
12766 return Err(common::Error::FieldClash(field));
12767 }
12768 }
12769
12770 let mut params = Params::with_capacity(3 + self._additional_params.len());
12771
12772 params.extend(self._additional_params.iter());
12773
12774 params.push("alt", "json");
12775 let mut url = self.hub._base_url.clone() + "games/v1/recall:unlinkPersona";
12776 if self._scopes.is_empty() {
12777 self._scopes
12778 .insert(Scope::Androidpublisher.as_ref().to_string());
12779 }
12780
12781 let url = params.parse_with_url(&url);
12782
12783 let mut json_mime_type = mime::APPLICATION_JSON;
12784 let mut request_value_reader = {
12785 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12786 common::remove_json_null_values(&mut value);
12787 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12788 serde_json::to_writer(&mut dst, &value).unwrap();
12789 dst
12790 };
12791 let request_size = request_value_reader
12792 .seek(std::io::SeekFrom::End(0))
12793 .unwrap();
12794 request_value_reader
12795 .seek(std::io::SeekFrom::Start(0))
12796 .unwrap();
12797
12798 loop {
12799 let token = match self
12800 .hub
12801 .auth
12802 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12803 .await
12804 {
12805 Ok(token) => token,
12806 Err(e) => match dlg.token(e) {
12807 Ok(token) => token,
12808 Err(e) => {
12809 dlg.finished(false);
12810 return Err(common::Error::MissingToken(e));
12811 }
12812 },
12813 };
12814 request_value_reader
12815 .seek(std::io::SeekFrom::Start(0))
12816 .unwrap();
12817 let mut req_result = {
12818 let client = &self.hub.client;
12819 dlg.pre_request();
12820 let mut req_builder = hyper::Request::builder()
12821 .method(hyper::Method::POST)
12822 .uri(url.as_str())
12823 .header(USER_AGENT, self.hub._user_agent.clone());
12824
12825 if let Some(token) = token.as_ref() {
12826 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12827 }
12828
12829 let request = req_builder
12830 .header(CONTENT_TYPE, json_mime_type.to_string())
12831 .header(CONTENT_LENGTH, request_size as u64)
12832 .body(common::to_body(
12833 request_value_reader.get_ref().clone().into(),
12834 ));
12835
12836 client.request(request.unwrap()).await
12837 };
12838
12839 match req_result {
12840 Err(err) => {
12841 if let common::Retry::After(d) = dlg.http_error(&err) {
12842 sleep(d).await;
12843 continue;
12844 }
12845 dlg.finished(false);
12846 return Err(common::Error::HttpError(err));
12847 }
12848 Ok(res) => {
12849 let (mut parts, body) = res.into_parts();
12850 let mut body = common::Body::new(body);
12851 if !parts.status.is_success() {
12852 let bytes = common::to_bytes(body).await.unwrap_or_default();
12853 let error = serde_json::from_str(&common::to_string(&bytes));
12854 let response = common::to_response(parts, bytes.into());
12855
12856 if let common::Retry::After(d) =
12857 dlg.http_failure(&response, error.as_ref().ok())
12858 {
12859 sleep(d).await;
12860 continue;
12861 }
12862
12863 dlg.finished(false);
12864
12865 return Err(match error {
12866 Ok(value) => common::Error::BadRequest(value),
12867 _ => common::Error::Failure(response),
12868 });
12869 }
12870 let response = {
12871 let bytes = common::to_bytes(body).await.unwrap_or_default();
12872 let encoded = common::to_string(&bytes);
12873 match serde_json::from_str(&encoded) {
12874 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12875 Err(error) => {
12876 dlg.response_json_decode_error(&encoded, &error);
12877 return Err(common::Error::JsonDecodeError(
12878 encoded.to_string(),
12879 error,
12880 ));
12881 }
12882 }
12883 };
12884
12885 dlg.finished(true);
12886 return Ok(response);
12887 }
12888 }
12889 }
12890 }
12891
12892 ///
12893 /// Sets the *request* property to the given value.
12894 ///
12895 /// Even though the property as already been set when instantiating this call,
12896 /// we provide this method for API completeness.
12897 pub fn request(mut self, new_value: UnlinkPersonaRequest) -> RecallUnlinkPersonaCall<'a, C> {
12898 self._request = new_value;
12899 self
12900 }
12901 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12902 /// while executing the actual API request.
12903 ///
12904 /// ````text
12905 /// It should be used to handle progress information, and to implement a certain level of resilience.
12906 /// ````
12907 ///
12908 /// Sets the *delegate* property to the given value.
12909 pub fn delegate(
12910 mut self,
12911 new_value: &'a mut dyn common::Delegate,
12912 ) -> RecallUnlinkPersonaCall<'a, C> {
12913 self._delegate = Some(new_value);
12914 self
12915 }
12916
12917 /// Set any additional parameter of the query string used in the request.
12918 /// It should be used to set parameters which are not yet available through their own
12919 /// setters.
12920 ///
12921 /// Please note that this method must not be used to set any of the known parameters
12922 /// which have their own setter method. If done anyway, the request will fail.
12923 ///
12924 /// # Additional Parameters
12925 ///
12926 /// * *$.xgafv* (query-string) - V1 error format.
12927 /// * *access_token* (query-string) - OAuth access token.
12928 /// * *alt* (query-string) - Data format for response.
12929 /// * *callback* (query-string) - JSONP
12930 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12931 /// * *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.
12932 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12933 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12934 /// * *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.
12935 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12936 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12937 pub fn param<T>(mut self, name: T, value: T) -> RecallUnlinkPersonaCall<'a, C>
12938 where
12939 T: AsRef<str>,
12940 {
12941 self._additional_params
12942 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12943 self
12944 }
12945
12946 /// Identifies the authorization scope for the method you are building.
12947 ///
12948 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12949 /// [`Scope::Androidpublisher`].
12950 ///
12951 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12952 /// tokens for more than one scope.
12953 ///
12954 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12955 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12956 /// sufficient, a read-write scope will do as well.
12957 pub fn add_scope<St>(mut self, scope: St) -> RecallUnlinkPersonaCall<'a, C>
12958 where
12959 St: AsRef<str>,
12960 {
12961 self._scopes.insert(String::from(scope.as_ref()));
12962 self
12963 }
12964 /// Identifies the authorization scope(s) for the method you are building.
12965 ///
12966 /// See [`Self::add_scope()`] for details.
12967 pub fn add_scopes<I, St>(mut self, scopes: I) -> RecallUnlinkPersonaCall<'a, C>
12968 where
12969 I: IntoIterator<Item = St>,
12970 St: AsRef<str>,
12971 {
12972 self._scopes
12973 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12974 self
12975 }
12976
12977 /// Removes all scopes, and no default scope will be used either.
12978 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12979 /// for details).
12980 pub fn clear_scopes(mut self) -> RecallUnlinkPersonaCall<'a, C> {
12981 self._scopes.clear();
12982 self
12983 }
12984}
12985
12986/// Checks whether the games client is out of date.
12987///
12988/// A builder for the *check* method supported by a *revision* resource.
12989/// It is not used directly, but through a [`RevisionMethods`] instance.
12990///
12991/// # Example
12992///
12993/// Instantiate a resource method builder
12994///
12995/// ```test_harness,no_run
12996/// # extern crate hyper;
12997/// # extern crate hyper_rustls;
12998/// # extern crate google_games1 as games1;
12999/// # async fn dox() {
13000/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13001///
13002/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13003/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13004/// # .with_native_roots()
13005/// # .unwrap()
13006/// # .https_only()
13007/// # .enable_http2()
13008/// # .build();
13009///
13010/// # let executor = hyper_util::rt::TokioExecutor::new();
13011/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13012/// # secret,
13013/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13014/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13015/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13016/// # ),
13017/// # ).build().await.unwrap();
13018///
13019/// # let client = hyper_util::client::legacy::Client::builder(
13020/// # hyper_util::rt::TokioExecutor::new()
13021/// # )
13022/// # .build(
13023/// # hyper_rustls::HttpsConnectorBuilder::new()
13024/// # .with_native_roots()
13025/// # .unwrap()
13026/// # .https_or_http()
13027/// # .enable_http2()
13028/// # .build()
13029/// # );
13030/// # let mut hub = Games::new(client, auth);
13031/// // You can configure optional parameters by calling the respective setters at will, and
13032/// // execute the final call using `doit()`.
13033/// // Values shown here are possibly random and not representative !
13034/// let result = hub.revisions().check("clientRevision")
13035/// .doit().await;
13036/// # }
13037/// ```
13038pub struct RevisionCheckCall<'a, C>
13039where
13040 C: 'a,
13041{
13042 hub: &'a Games<C>,
13043 _client_revision: String,
13044 _delegate: Option<&'a mut dyn common::Delegate>,
13045 _additional_params: HashMap<String, String>,
13046 _scopes: BTreeSet<String>,
13047}
13048
13049impl<'a, C> common::CallBuilder for RevisionCheckCall<'a, C> {}
13050
13051impl<'a, C> RevisionCheckCall<'a, C>
13052where
13053 C: common::Connector,
13054{
13055 /// Perform the operation you have build so far.
13056 pub async fn doit(mut self) -> common::Result<(common::Response, RevisionCheckResponse)> {
13057 use std::borrow::Cow;
13058 use std::io::{Read, Seek};
13059
13060 use common::{url::Params, ToParts};
13061 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13062
13063 let mut dd = common::DefaultDelegate;
13064 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13065 dlg.begin(common::MethodInfo {
13066 id: "games.revisions.check",
13067 http_method: hyper::Method::GET,
13068 });
13069
13070 for &field in ["alt", "clientRevision"].iter() {
13071 if self._additional_params.contains_key(field) {
13072 dlg.finished(false);
13073 return Err(common::Error::FieldClash(field));
13074 }
13075 }
13076
13077 let mut params = Params::with_capacity(3 + self._additional_params.len());
13078 params.push("clientRevision", self._client_revision);
13079
13080 params.extend(self._additional_params.iter());
13081
13082 params.push("alt", "json");
13083 let mut url = self.hub._base_url.clone() + "games/v1/revisions/check";
13084 if self._scopes.is_empty() {
13085 self._scopes.insert(Scope::Full.as_ref().to_string());
13086 }
13087
13088 let url = params.parse_with_url(&url);
13089
13090 loop {
13091 let token = match self
13092 .hub
13093 .auth
13094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13095 .await
13096 {
13097 Ok(token) => token,
13098 Err(e) => match dlg.token(e) {
13099 Ok(token) => token,
13100 Err(e) => {
13101 dlg.finished(false);
13102 return Err(common::Error::MissingToken(e));
13103 }
13104 },
13105 };
13106 let mut req_result = {
13107 let client = &self.hub.client;
13108 dlg.pre_request();
13109 let mut req_builder = hyper::Request::builder()
13110 .method(hyper::Method::GET)
13111 .uri(url.as_str())
13112 .header(USER_AGENT, self.hub._user_agent.clone());
13113
13114 if let Some(token) = token.as_ref() {
13115 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13116 }
13117
13118 let request = req_builder
13119 .header(CONTENT_LENGTH, 0_u64)
13120 .body(common::to_body::<String>(None));
13121
13122 client.request(request.unwrap()).await
13123 };
13124
13125 match req_result {
13126 Err(err) => {
13127 if let common::Retry::After(d) = dlg.http_error(&err) {
13128 sleep(d).await;
13129 continue;
13130 }
13131 dlg.finished(false);
13132 return Err(common::Error::HttpError(err));
13133 }
13134 Ok(res) => {
13135 let (mut parts, body) = res.into_parts();
13136 let mut body = common::Body::new(body);
13137 if !parts.status.is_success() {
13138 let bytes = common::to_bytes(body).await.unwrap_or_default();
13139 let error = serde_json::from_str(&common::to_string(&bytes));
13140 let response = common::to_response(parts, bytes.into());
13141
13142 if let common::Retry::After(d) =
13143 dlg.http_failure(&response, error.as_ref().ok())
13144 {
13145 sleep(d).await;
13146 continue;
13147 }
13148
13149 dlg.finished(false);
13150
13151 return Err(match error {
13152 Ok(value) => common::Error::BadRequest(value),
13153 _ => common::Error::Failure(response),
13154 });
13155 }
13156 let response = {
13157 let bytes = common::to_bytes(body).await.unwrap_or_default();
13158 let encoded = common::to_string(&bytes);
13159 match serde_json::from_str(&encoded) {
13160 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13161 Err(error) => {
13162 dlg.response_json_decode_error(&encoded, &error);
13163 return Err(common::Error::JsonDecodeError(
13164 encoded.to_string(),
13165 error,
13166 ));
13167 }
13168 }
13169 };
13170
13171 dlg.finished(true);
13172 return Ok(response);
13173 }
13174 }
13175 }
13176 }
13177
13178 /// Required. The revision of the client SDK used by your application. Format: `[PLATFORM_TYPE]:[VERSION_NUMBER]`. Possible values of `PLATFORM_TYPE` are: * `ANDROID` - Client is running the Android SDK. * `IOS` - Client is running the iOS SDK. * `WEB_APP` - Client is running as a Web App.
13179 ///
13180 /// Sets the *client revision* query property to the given value.
13181 ///
13182 /// Even though the property as already been set when instantiating this call,
13183 /// we provide this method for API completeness.
13184 pub fn client_revision(mut self, new_value: &str) -> RevisionCheckCall<'a, C> {
13185 self._client_revision = new_value.to_string();
13186 self
13187 }
13188 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13189 /// while executing the actual API request.
13190 ///
13191 /// ````text
13192 /// It should be used to handle progress information, and to implement a certain level of resilience.
13193 /// ````
13194 ///
13195 /// Sets the *delegate* property to the given value.
13196 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RevisionCheckCall<'a, C> {
13197 self._delegate = Some(new_value);
13198 self
13199 }
13200
13201 /// Set any additional parameter of the query string used in the request.
13202 /// It should be used to set parameters which are not yet available through their own
13203 /// setters.
13204 ///
13205 /// Please note that this method must not be used to set any of the known parameters
13206 /// which have their own setter method. If done anyway, the request will fail.
13207 ///
13208 /// # Additional Parameters
13209 ///
13210 /// * *$.xgafv* (query-string) - V1 error format.
13211 /// * *access_token* (query-string) - OAuth access token.
13212 /// * *alt* (query-string) - Data format for response.
13213 /// * *callback* (query-string) - JSONP
13214 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13215 /// * *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.
13216 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13217 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13218 /// * *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.
13219 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13220 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13221 pub fn param<T>(mut self, name: T, value: T) -> RevisionCheckCall<'a, C>
13222 where
13223 T: AsRef<str>,
13224 {
13225 self._additional_params
13226 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13227 self
13228 }
13229
13230 /// Identifies the authorization scope for the method you are building.
13231 ///
13232 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13233 /// [`Scope::Full`].
13234 ///
13235 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13236 /// tokens for more than one scope.
13237 ///
13238 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13239 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13240 /// sufficient, a read-write scope will do as well.
13241 pub fn add_scope<St>(mut self, scope: St) -> RevisionCheckCall<'a, C>
13242 where
13243 St: AsRef<str>,
13244 {
13245 self._scopes.insert(String::from(scope.as_ref()));
13246 self
13247 }
13248 /// Identifies the authorization scope(s) for the method you are building.
13249 ///
13250 /// See [`Self::add_scope()`] for details.
13251 pub fn add_scopes<I, St>(mut self, scopes: I) -> RevisionCheckCall<'a, C>
13252 where
13253 I: IntoIterator<Item = St>,
13254 St: AsRef<str>,
13255 {
13256 self._scopes
13257 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13258 self
13259 }
13260
13261 /// Removes all scopes, and no default scope will be used either.
13262 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13263 /// for details).
13264 pub fn clear_scopes(mut self) -> RevisionCheckCall<'a, C> {
13265 self._scopes.clear();
13266 self
13267 }
13268}
13269
13270/// Get high scores, and optionally ranks, in leaderboards for the currently authenticated player. For a specific time span, `leaderboardId` can be set to `ALL` to retrieve data for all leaderboards in a given time span. `NOTE: You cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; only one parameter may be set to 'ALL'.
13271///
13272/// A builder for the *get* method supported by a *score* resource.
13273/// It is not used directly, but through a [`ScoreMethods`] instance.
13274///
13275/// # Example
13276///
13277/// Instantiate a resource method builder
13278///
13279/// ```test_harness,no_run
13280/// # extern crate hyper;
13281/// # extern crate hyper_rustls;
13282/// # extern crate google_games1 as games1;
13283/// # async fn dox() {
13284/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13285///
13286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13288/// # .with_native_roots()
13289/// # .unwrap()
13290/// # .https_only()
13291/// # .enable_http2()
13292/// # .build();
13293///
13294/// # let executor = hyper_util::rt::TokioExecutor::new();
13295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13296/// # secret,
13297/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13298/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13299/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13300/// # ),
13301/// # ).build().await.unwrap();
13302///
13303/// # let client = hyper_util::client::legacy::Client::builder(
13304/// # hyper_util::rt::TokioExecutor::new()
13305/// # )
13306/// # .build(
13307/// # hyper_rustls::HttpsConnectorBuilder::new()
13308/// # .with_native_roots()
13309/// # .unwrap()
13310/// # .https_or_http()
13311/// # .enable_http2()
13312/// # .build()
13313/// # );
13314/// # let mut hub = Games::new(client, auth);
13315/// // You can configure optional parameters by calling the respective setters at will, and
13316/// // execute the final call using `doit()`.
13317/// // Values shown here are possibly random and not representative !
13318/// let result = hub.scores().get("playerId", "leaderboardId", "timeSpan")
13319/// .page_token("Stet")
13320/// .max_results(-76)
13321/// .language("elitr")
13322/// .include_rank_type("Lorem")
13323/// .doit().await;
13324/// # }
13325/// ```
13326pub struct ScoreGetCall<'a, C>
13327where
13328 C: 'a,
13329{
13330 hub: &'a Games<C>,
13331 _player_id: String,
13332 _leaderboard_id: String,
13333 _time_span: String,
13334 _page_token: Option<String>,
13335 _max_results: Option<i32>,
13336 _language: Option<String>,
13337 _include_rank_type: Option<String>,
13338 _delegate: Option<&'a mut dyn common::Delegate>,
13339 _additional_params: HashMap<String, String>,
13340 _scopes: BTreeSet<String>,
13341}
13342
13343impl<'a, C> common::CallBuilder for ScoreGetCall<'a, C> {}
13344
13345impl<'a, C> ScoreGetCall<'a, C>
13346where
13347 C: common::Connector,
13348{
13349 /// Perform the operation you have build so far.
13350 pub async fn doit(
13351 mut self,
13352 ) -> common::Result<(common::Response, PlayerLeaderboardScoreListResponse)> {
13353 use std::borrow::Cow;
13354 use std::io::{Read, Seek};
13355
13356 use common::{url::Params, ToParts};
13357 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13358
13359 let mut dd = common::DefaultDelegate;
13360 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13361 dlg.begin(common::MethodInfo {
13362 id: "games.scores.get",
13363 http_method: hyper::Method::GET,
13364 });
13365
13366 for &field in [
13367 "alt",
13368 "playerId",
13369 "leaderboardId",
13370 "timeSpan",
13371 "pageToken",
13372 "maxResults",
13373 "language",
13374 "includeRankType",
13375 ]
13376 .iter()
13377 {
13378 if self._additional_params.contains_key(field) {
13379 dlg.finished(false);
13380 return Err(common::Error::FieldClash(field));
13381 }
13382 }
13383
13384 let mut params = Params::with_capacity(9 + self._additional_params.len());
13385 params.push("playerId", self._player_id);
13386 params.push("leaderboardId", self._leaderboard_id);
13387 params.push("timeSpan", self._time_span);
13388 if let Some(value) = self._page_token.as_ref() {
13389 params.push("pageToken", value);
13390 }
13391 if let Some(value) = self._max_results.as_ref() {
13392 params.push("maxResults", value.to_string());
13393 }
13394 if let Some(value) = self._language.as_ref() {
13395 params.push("language", value);
13396 }
13397 if let Some(value) = self._include_rank_type.as_ref() {
13398 params.push("includeRankType", value);
13399 }
13400
13401 params.extend(self._additional_params.iter());
13402
13403 params.push("alt", "json");
13404 let mut url = self.hub._base_url.clone()
13405 + "games/v1/players/{playerId}/leaderboards/{leaderboardId}/scores/{timeSpan}";
13406 if self._scopes.is_empty() {
13407 self._scopes.insert(Scope::Full.as_ref().to_string());
13408 }
13409
13410 #[allow(clippy::single_element_loop)]
13411 for &(find_this, param_name) in [
13412 ("{playerId}", "playerId"),
13413 ("{leaderboardId}", "leaderboardId"),
13414 ("{timeSpan}", "timeSpan"),
13415 ]
13416 .iter()
13417 {
13418 url = params.uri_replacement(url, param_name, find_this, false);
13419 }
13420 {
13421 let to_remove = ["timeSpan", "leaderboardId", "playerId"];
13422 params.remove_params(&to_remove);
13423 }
13424
13425 let url = params.parse_with_url(&url);
13426
13427 loop {
13428 let token = match self
13429 .hub
13430 .auth
13431 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13432 .await
13433 {
13434 Ok(token) => token,
13435 Err(e) => match dlg.token(e) {
13436 Ok(token) => token,
13437 Err(e) => {
13438 dlg.finished(false);
13439 return Err(common::Error::MissingToken(e));
13440 }
13441 },
13442 };
13443 let mut req_result = {
13444 let client = &self.hub.client;
13445 dlg.pre_request();
13446 let mut req_builder = hyper::Request::builder()
13447 .method(hyper::Method::GET)
13448 .uri(url.as_str())
13449 .header(USER_AGENT, self.hub._user_agent.clone());
13450
13451 if let Some(token) = token.as_ref() {
13452 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13453 }
13454
13455 let request = req_builder
13456 .header(CONTENT_LENGTH, 0_u64)
13457 .body(common::to_body::<String>(None));
13458
13459 client.request(request.unwrap()).await
13460 };
13461
13462 match req_result {
13463 Err(err) => {
13464 if let common::Retry::After(d) = dlg.http_error(&err) {
13465 sleep(d).await;
13466 continue;
13467 }
13468 dlg.finished(false);
13469 return Err(common::Error::HttpError(err));
13470 }
13471 Ok(res) => {
13472 let (mut parts, body) = res.into_parts();
13473 let mut body = common::Body::new(body);
13474 if !parts.status.is_success() {
13475 let bytes = common::to_bytes(body).await.unwrap_or_default();
13476 let error = serde_json::from_str(&common::to_string(&bytes));
13477 let response = common::to_response(parts, bytes.into());
13478
13479 if let common::Retry::After(d) =
13480 dlg.http_failure(&response, error.as_ref().ok())
13481 {
13482 sleep(d).await;
13483 continue;
13484 }
13485
13486 dlg.finished(false);
13487
13488 return Err(match error {
13489 Ok(value) => common::Error::BadRequest(value),
13490 _ => common::Error::Failure(response),
13491 });
13492 }
13493 let response = {
13494 let bytes = common::to_bytes(body).await.unwrap_or_default();
13495 let encoded = common::to_string(&bytes);
13496 match serde_json::from_str(&encoded) {
13497 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13498 Err(error) => {
13499 dlg.response_json_decode_error(&encoded, &error);
13500 return Err(common::Error::JsonDecodeError(
13501 encoded.to_string(),
13502 error,
13503 ));
13504 }
13505 }
13506 };
13507
13508 dlg.finished(true);
13509 return Ok(response);
13510 }
13511 }
13512 }
13513 }
13514
13515 /// A player ID. A value of `me` may be used in place of the authenticated player's ID.
13516 ///
13517 /// Sets the *player id* path property to the given value.
13518 ///
13519 /// Even though the property as already been set when instantiating this call,
13520 /// we provide this method for API completeness.
13521 pub fn player_id(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13522 self._player_id = new_value.to_string();
13523 self
13524 }
13525 /// The ID of the leaderboard. Can be set to 'ALL' to retrieve data for all leaderboards for this application.
13526 ///
13527 /// Sets the *leaderboard id* path property to the given value.
13528 ///
13529 /// Even though the property as already been set when instantiating this call,
13530 /// we provide this method for API completeness.
13531 pub fn leaderboard_id(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13532 self._leaderboard_id = new_value.to_string();
13533 self
13534 }
13535 /// The time span for the scores and ranks you're requesting.
13536 ///
13537 /// Sets the *time span* path property to the given value.
13538 ///
13539 /// Even though the property as already been set when instantiating this call,
13540 /// we provide this method for API completeness.
13541 pub fn time_span(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13542 self._time_span = new_value.to_string();
13543 self
13544 }
13545 /// The token returned by the previous request.
13546 ///
13547 /// Sets the *page token* query property to the given value.
13548 pub fn page_token(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13549 self._page_token = Some(new_value.to_string());
13550 self
13551 }
13552 /// The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified `maxResults`.
13553 ///
13554 /// Sets the *max results* query property to the given value.
13555 pub fn max_results(mut self, new_value: i32) -> ScoreGetCall<'a, C> {
13556 self._max_results = Some(new_value);
13557 self
13558 }
13559 /// The preferred language to use for strings returned by this method.
13560 ///
13561 /// Sets the *language* query property to the given value.
13562 pub fn language(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13563 self._language = Some(new_value.to_string());
13564 self
13565 }
13566 /// The types of ranks to return. If the parameter is omitted, no ranks will be returned.
13567 ///
13568 /// Sets the *include rank type* query property to the given value.
13569 pub fn include_rank_type(mut self, new_value: &str) -> ScoreGetCall<'a, C> {
13570 self._include_rank_type = Some(new_value.to_string());
13571 self
13572 }
13573 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13574 /// while executing the actual API request.
13575 ///
13576 /// ````text
13577 /// It should be used to handle progress information, and to implement a certain level of resilience.
13578 /// ````
13579 ///
13580 /// Sets the *delegate* property to the given value.
13581 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ScoreGetCall<'a, C> {
13582 self._delegate = Some(new_value);
13583 self
13584 }
13585
13586 /// Set any additional parameter of the query string used in the request.
13587 /// It should be used to set parameters which are not yet available through their own
13588 /// setters.
13589 ///
13590 /// Please note that this method must not be used to set any of the known parameters
13591 /// which have their own setter method. If done anyway, the request will fail.
13592 ///
13593 /// # Additional Parameters
13594 ///
13595 /// * *$.xgafv* (query-string) - V1 error format.
13596 /// * *access_token* (query-string) - OAuth access token.
13597 /// * *alt* (query-string) - Data format for response.
13598 /// * *callback* (query-string) - JSONP
13599 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13600 /// * *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.
13601 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13602 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13603 /// * *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.
13604 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13605 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13606 pub fn param<T>(mut self, name: T, value: T) -> ScoreGetCall<'a, C>
13607 where
13608 T: AsRef<str>,
13609 {
13610 self._additional_params
13611 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13612 self
13613 }
13614
13615 /// Identifies the authorization scope for the method you are building.
13616 ///
13617 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13618 /// [`Scope::Full`].
13619 ///
13620 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13621 /// tokens for more than one scope.
13622 ///
13623 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13624 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13625 /// sufficient, a read-write scope will do as well.
13626 pub fn add_scope<St>(mut self, scope: St) -> ScoreGetCall<'a, C>
13627 where
13628 St: AsRef<str>,
13629 {
13630 self._scopes.insert(String::from(scope.as_ref()));
13631 self
13632 }
13633 /// Identifies the authorization scope(s) for the method you are building.
13634 ///
13635 /// See [`Self::add_scope()`] for details.
13636 pub fn add_scopes<I, St>(mut self, scopes: I) -> ScoreGetCall<'a, C>
13637 where
13638 I: IntoIterator<Item = St>,
13639 St: AsRef<str>,
13640 {
13641 self._scopes
13642 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13643 self
13644 }
13645
13646 /// Removes all scopes, and no default scope will be used either.
13647 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13648 /// for details).
13649 pub fn clear_scopes(mut self) -> ScoreGetCall<'a, C> {
13650 self._scopes.clear();
13651 self
13652 }
13653}
13654
13655/// Lists the scores in a leaderboard, starting from the top.
13656///
13657/// A builder for the *list* method supported by a *score* resource.
13658/// It is not used directly, but through a [`ScoreMethods`] instance.
13659///
13660/// # Example
13661///
13662/// Instantiate a resource method builder
13663///
13664/// ```test_harness,no_run
13665/// # extern crate hyper;
13666/// # extern crate hyper_rustls;
13667/// # extern crate google_games1 as games1;
13668/// # async fn dox() {
13669/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13670///
13671/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13672/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13673/// # .with_native_roots()
13674/// # .unwrap()
13675/// # .https_only()
13676/// # .enable_http2()
13677/// # .build();
13678///
13679/// # let executor = hyper_util::rt::TokioExecutor::new();
13680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13681/// # secret,
13682/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13683/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13684/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13685/// # ),
13686/// # ).build().await.unwrap();
13687///
13688/// # let client = hyper_util::client::legacy::Client::builder(
13689/// # hyper_util::rt::TokioExecutor::new()
13690/// # )
13691/// # .build(
13692/// # hyper_rustls::HttpsConnectorBuilder::new()
13693/// # .with_native_roots()
13694/// # .unwrap()
13695/// # .https_or_http()
13696/// # .enable_http2()
13697/// # .build()
13698/// # );
13699/// # let mut hub = Games::new(client, auth);
13700/// // You can configure optional parameters by calling the respective setters at will, and
13701/// // execute the final call using `doit()`.
13702/// // Values shown here are possibly random and not representative !
13703/// let result = hub.scores().list("leaderboardId", "collection", "timeSpan")
13704/// .page_token("accusam")
13705/// .max_results(-59)
13706/// .language("consetetur")
13707/// .doit().await;
13708/// # }
13709/// ```
13710pub struct ScoreListCall<'a, C>
13711where
13712 C: 'a,
13713{
13714 hub: &'a Games<C>,
13715 _leaderboard_id: String,
13716 _collection: String,
13717 _time_span: String,
13718 _page_token: Option<String>,
13719 _max_results: Option<i32>,
13720 _language: Option<String>,
13721 _delegate: Option<&'a mut dyn common::Delegate>,
13722 _additional_params: HashMap<String, String>,
13723 _scopes: BTreeSet<String>,
13724}
13725
13726impl<'a, C> common::CallBuilder for ScoreListCall<'a, C> {}
13727
13728impl<'a, C> ScoreListCall<'a, C>
13729where
13730 C: common::Connector,
13731{
13732 /// Perform the operation you have build so far.
13733 pub async fn doit(mut self) -> common::Result<(common::Response, LeaderboardScores)> {
13734 use std::borrow::Cow;
13735 use std::io::{Read, Seek};
13736
13737 use common::{url::Params, ToParts};
13738 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13739
13740 let mut dd = common::DefaultDelegate;
13741 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13742 dlg.begin(common::MethodInfo {
13743 id: "games.scores.list",
13744 http_method: hyper::Method::GET,
13745 });
13746
13747 for &field in [
13748 "alt",
13749 "leaderboardId",
13750 "collection",
13751 "timeSpan",
13752 "pageToken",
13753 "maxResults",
13754 "language",
13755 ]
13756 .iter()
13757 {
13758 if self._additional_params.contains_key(field) {
13759 dlg.finished(false);
13760 return Err(common::Error::FieldClash(field));
13761 }
13762 }
13763
13764 let mut params = Params::with_capacity(8 + self._additional_params.len());
13765 params.push("leaderboardId", self._leaderboard_id);
13766 params.push("collection", self._collection);
13767 params.push("timeSpan", self._time_span);
13768 if let Some(value) = self._page_token.as_ref() {
13769 params.push("pageToken", value);
13770 }
13771 if let Some(value) = self._max_results.as_ref() {
13772 params.push("maxResults", value.to_string());
13773 }
13774 if let Some(value) = self._language.as_ref() {
13775 params.push("language", value);
13776 }
13777
13778 params.extend(self._additional_params.iter());
13779
13780 params.push("alt", "json");
13781 let mut url = self.hub._base_url.clone()
13782 + "games/v1/leaderboards/{leaderboardId}/scores/{collection}";
13783 if self._scopes.is_empty() {
13784 self._scopes.insert(Scope::Full.as_ref().to_string());
13785 }
13786
13787 #[allow(clippy::single_element_loop)]
13788 for &(find_this, param_name) in [
13789 ("{leaderboardId}", "leaderboardId"),
13790 ("{collection}", "collection"),
13791 ]
13792 .iter()
13793 {
13794 url = params.uri_replacement(url, param_name, find_this, false);
13795 }
13796 {
13797 let to_remove = ["collection", "leaderboardId"];
13798 params.remove_params(&to_remove);
13799 }
13800
13801 let url = params.parse_with_url(&url);
13802
13803 loop {
13804 let token = match self
13805 .hub
13806 .auth
13807 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13808 .await
13809 {
13810 Ok(token) => token,
13811 Err(e) => match dlg.token(e) {
13812 Ok(token) => token,
13813 Err(e) => {
13814 dlg.finished(false);
13815 return Err(common::Error::MissingToken(e));
13816 }
13817 },
13818 };
13819 let mut req_result = {
13820 let client = &self.hub.client;
13821 dlg.pre_request();
13822 let mut req_builder = hyper::Request::builder()
13823 .method(hyper::Method::GET)
13824 .uri(url.as_str())
13825 .header(USER_AGENT, self.hub._user_agent.clone());
13826
13827 if let Some(token) = token.as_ref() {
13828 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13829 }
13830
13831 let request = req_builder
13832 .header(CONTENT_LENGTH, 0_u64)
13833 .body(common::to_body::<String>(None));
13834
13835 client.request(request.unwrap()).await
13836 };
13837
13838 match req_result {
13839 Err(err) => {
13840 if let common::Retry::After(d) = dlg.http_error(&err) {
13841 sleep(d).await;
13842 continue;
13843 }
13844 dlg.finished(false);
13845 return Err(common::Error::HttpError(err));
13846 }
13847 Ok(res) => {
13848 let (mut parts, body) = res.into_parts();
13849 let mut body = common::Body::new(body);
13850 if !parts.status.is_success() {
13851 let bytes = common::to_bytes(body).await.unwrap_or_default();
13852 let error = serde_json::from_str(&common::to_string(&bytes));
13853 let response = common::to_response(parts, bytes.into());
13854
13855 if let common::Retry::After(d) =
13856 dlg.http_failure(&response, error.as_ref().ok())
13857 {
13858 sleep(d).await;
13859 continue;
13860 }
13861
13862 dlg.finished(false);
13863
13864 return Err(match error {
13865 Ok(value) => common::Error::BadRequest(value),
13866 _ => common::Error::Failure(response),
13867 });
13868 }
13869 let response = {
13870 let bytes = common::to_bytes(body).await.unwrap_or_default();
13871 let encoded = common::to_string(&bytes);
13872 match serde_json::from_str(&encoded) {
13873 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13874 Err(error) => {
13875 dlg.response_json_decode_error(&encoded, &error);
13876 return Err(common::Error::JsonDecodeError(
13877 encoded.to_string(),
13878 error,
13879 ));
13880 }
13881 }
13882 };
13883
13884 dlg.finished(true);
13885 return Ok(response);
13886 }
13887 }
13888 }
13889 }
13890
13891 /// The ID of the leaderboard.
13892 ///
13893 /// Sets the *leaderboard id* path property to the given value.
13894 ///
13895 /// Even though the property as already been set when instantiating this call,
13896 /// we provide this method for API completeness.
13897 pub fn leaderboard_id(mut self, new_value: &str) -> ScoreListCall<'a, C> {
13898 self._leaderboard_id = new_value.to_string();
13899 self
13900 }
13901 /// The collection of scores you're requesting.
13902 ///
13903 /// Sets the *collection* path property to the given value.
13904 ///
13905 /// Even though the property as already been set when instantiating this call,
13906 /// we provide this method for API completeness.
13907 pub fn collection(mut self, new_value: &str) -> ScoreListCall<'a, C> {
13908 self._collection = new_value.to_string();
13909 self
13910 }
13911 /// Required. The time span for the scores and ranks you're requesting.
13912 ///
13913 /// Sets the *time span* query property to the given value.
13914 ///
13915 /// Even though the property as already been set when instantiating this call,
13916 /// we provide this method for API completeness.
13917 pub fn time_span(mut self, new_value: &str) -> ScoreListCall<'a, C> {
13918 self._time_span = new_value.to_string();
13919 self
13920 }
13921 /// The token returned by the previous request.
13922 ///
13923 /// Sets the *page token* query property to the given value.
13924 pub fn page_token(mut self, new_value: &str) -> ScoreListCall<'a, C> {
13925 self._page_token = Some(new_value.to_string());
13926 self
13927 }
13928 /// The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified `maxResults`.
13929 ///
13930 /// Sets the *max results* query property to the given value.
13931 pub fn max_results(mut self, new_value: i32) -> ScoreListCall<'a, C> {
13932 self._max_results = Some(new_value);
13933 self
13934 }
13935 /// The preferred language to use for strings returned by this method.
13936 ///
13937 /// Sets the *language* query property to the given value.
13938 pub fn language(mut self, new_value: &str) -> ScoreListCall<'a, C> {
13939 self._language = Some(new_value.to_string());
13940 self
13941 }
13942 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13943 /// while executing the actual API request.
13944 ///
13945 /// ````text
13946 /// It should be used to handle progress information, and to implement a certain level of resilience.
13947 /// ````
13948 ///
13949 /// Sets the *delegate* property to the given value.
13950 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ScoreListCall<'a, C> {
13951 self._delegate = Some(new_value);
13952 self
13953 }
13954
13955 /// Set any additional parameter of the query string used in the request.
13956 /// It should be used to set parameters which are not yet available through their own
13957 /// setters.
13958 ///
13959 /// Please note that this method must not be used to set any of the known parameters
13960 /// which have their own setter method. If done anyway, the request will fail.
13961 ///
13962 /// # Additional Parameters
13963 ///
13964 /// * *$.xgafv* (query-string) - V1 error format.
13965 /// * *access_token* (query-string) - OAuth access token.
13966 /// * *alt* (query-string) - Data format for response.
13967 /// * *callback* (query-string) - JSONP
13968 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13969 /// * *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.
13970 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13971 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13972 /// * *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.
13973 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13974 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13975 pub fn param<T>(mut self, name: T, value: T) -> ScoreListCall<'a, C>
13976 where
13977 T: AsRef<str>,
13978 {
13979 self._additional_params
13980 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13981 self
13982 }
13983
13984 /// Identifies the authorization scope for the method you are building.
13985 ///
13986 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13987 /// [`Scope::Full`].
13988 ///
13989 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13990 /// tokens for more than one scope.
13991 ///
13992 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13993 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13994 /// sufficient, a read-write scope will do as well.
13995 pub fn add_scope<St>(mut self, scope: St) -> ScoreListCall<'a, C>
13996 where
13997 St: AsRef<str>,
13998 {
13999 self._scopes.insert(String::from(scope.as_ref()));
14000 self
14001 }
14002 /// Identifies the authorization scope(s) for the method you are building.
14003 ///
14004 /// See [`Self::add_scope()`] for details.
14005 pub fn add_scopes<I, St>(mut self, scopes: I) -> ScoreListCall<'a, C>
14006 where
14007 I: IntoIterator<Item = St>,
14008 St: AsRef<str>,
14009 {
14010 self._scopes
14011 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14012 self
14013 }
14014
14015 /// Removes all scopes, and no default scope will be used either.
14016 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14017 /// for details).
14018 pub fn clear_scopes(mut self) -> ScoreListCall<'a, C> {
14019 self._scopes.clear();
14020 self
14021 }
14022}
14023
14024/// Lists the scores in a leaderboard around (and including) a player's score.
14025///
14026/// A builder for the *listWindow* method supported by a *score* resource.
14027/// It is not used directly, but through a [`ScoreMethods`] instance.
14028///
14029/// # Example
14030///
14031/// Instantiate a resource method builder
14032///
14033/// ```test_harness,no_run
14034/// # extern crate hyper;
14035/// # extern crate hyper_rustls;
14036/// # extern crate google_games1 as games1;
14037/// # async fn dox() {
14038/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14039///
14040/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14041/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14042/// # .with_native_roots()
14043/// # .unwrap()
14044/// # .https_only()
14045/// # .enable_http2()
14046/// # .build();
14047///
14048/// # let executor = hyper_util::rt::TokioExecutor::new();
14049/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14050/// # secret,
14051/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14052/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14053/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14054/// # ),
14055/// # ).build().await.unwrap();
14056///
14057/// # let client = hyper_util::client::legacy::Client::builder(
14058/// # hyper_util::rt::TokioExecutor::new()
14059/// # )
14060/// # .build(
14061/// # hyper_rustls::HttpsConnectorBuilder::new()
14062/// # .with_native_roots()
14063/// # .unwrap()
14064/// # .https_or_http()
14065/// # .enable_http2()
14066/// # .build()
14067/// # );
14068/// # let mut hub = Games::new(client, auth);
14069/// // You can configure optional parameters by calling the respective setters at will, and
14070/// // execute the final call using `doit()`.
14071/// // Values shown here are possibly random and not representative !
14072/// let result = hub.scores().list_window("leaderboardId", "collection", "timeSpan")
14073/// .return_top_if_absent(false)
14074/// .results_above(-2)
14075/// .page_token("sed")
14076/// .max_results(-9)
14077/// .language("dolores")
14078/// .doit().await;
14079/// # }
14080/// ```
14081pub struct ScoreListWindowCall<'a, C>
14082where
14083 C: 'a,
14084{
14085 hub: &'a Games<C>,
14086 _leaderboard_id: String,
14087 _collection: String,
14088 _time_span: String,
14089 _return_top_if_absent: Option<bool>,
14090 _results_above: Option<i32>,
14091 _page_token: Option<String>,
14092 _max_results: Option<i32>,
14093 _language: Option<String>,
14094 _delegate: Option<&'a mut dyn common::Delegate>,
14095 _additional_params: HashMap<String, String>,
14096 _scopes: BTreeSet<String>,
14097}
14098
14099impl<'a, C> common::CallBuilder for ScoreListWindowCall<'a, C> {}
14100
14101impl<'a, C> ScoreListWindowCall<'a, C>
14102where
14103 C: common::Connector,
14104{
14105 /// Perform the operation you have build so far.
14106 pub async fn doit(mut self) -> common::Result<(common::Response, LeaderboardScores)> {
14107 use std::borrow::Cow;
14108 use std::io::{Read, Seek};
14109
14110 use common::{url::Params, ToParts};
14111 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14112
14113 let mut dd = common::DefaultDelegate;
14114 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14115 dlg.begin(common::MethodInfo {
14116 id: "games.scores.listWindow",
14117 http_method: hyper::Method::GET,
14118 });
14119
14120 for &field in [
14121 "alt",
14122 "leaderboardId",
14123 "collection",
14124 "timeSpan",
14125 "returnTopIfAbsent",
14126 "resultsAbove",
14127 "pageToken",
14128 "maxResults",
14129 "language",
14130 ]
14131 .iter()
14132 {
14133 if self._additional_params.contains_key(field) {
14134 dlg.finished(false);
14135 return Err(common::Error::FieldClash(field));
14136 }
14137 }
14138
14139 let mut params = Params::with_capacity(10 + self._additional_params.len());
14140 params.push("leaderboardId", self._leaderboard_id);
14141 params.push("collection", self._collection);
14142 params.push("timeSpan", self._time_span);
14143 if let Some(value) = self._return_top_if_absent.as_ref() {
14144 params.push("returnTopIfAbsent", value.to_string());
14145 }
14146 if let Some(value) = self._results_above.as_ref() {
14147 params.push("resultsAbove", value.to_string());
14148 }
14149 if let Some(value) = self._page_token.as_ref() {
14150 params.push("pageToken", value);
14151 }
14152 if let Some(value) = self._max_results.as_ref() {
14153 params.push("maxResults", value.to_string());
14154 }
14155 if let Some(value) = self._language.as_ref() {
14156 params.push("language", value);
14157 }
14158
14159 params.extend(self._additional_params.iter());
14160
14161 params.push("alt", "json");
14162 let mut url = self.hub._base_url.clone()
14163 + "games/v1/leaderboards/{leaderboardId}/window/{collection}";
14164 if self._scopes.is_empty() {
14165 self._scopes.insert(Scope::Full.as_ref().to_string());
14166 }
14167
14168 #[allow(clippy::single_element_loop)]
14169 for &(find_this, param_name) in [
14170 ("{leaderboardId}", "leaderboardId"),
14171 ("{collection}", "collection"),
14172 ]
14173 .iter()
14174 {
14175 url = params.uri_replacement(url, param_name, find_this, false);
14176 }
14177 {
14178 let to_remove = ["collection", "leaderboardId"];
14179 params.remove_params(&to_remove);
14180 }
14181
14182 let url = params.parse_with_url(&url);
14183
14184 loop {
14185 let token = match self
14186 .hub
14187 .auth
14188 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14189 .await
14190 {
14191 Ok(token) => token,
14192 Err(e) => match dlg.token(e) {
14193 Ok(token) => token,
14194 Err(e) => {
14195 dlg.finished(false);
14196 return Err(common::Error::MissingToken(e));
14197 }
14198 },
14199 };
14200 let mut req_result = {
14201 let client = &self.hub.client;
14202 dlg.pre_request();
14203 let mut req_builder = hyper::Request::builder()
14204 .method(hyper::Method::GET)
14205 .uri(url.as_str())
14206 .header(USER_AGENT, self.hub._user_agent.clone());
14207
14208 if let Some(token) = token.as_ref() {
14209 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14210 }
14211
14212 let request = req_builder
14213 .header(CONTENT_LENGTH, 0_u64)
14214 .body(common::to_body::<String>(None));
14215
14216 client.request(request.unwrap()).await
14217 };
14218
14219 match req_result {
14220 Err(err) => {
14221 if let common::Retry::After(d) = dlg.http_error(&err) {
14222 sleep(d).await;
14223 continue;
14224 }
14225 dlg.finished(false);
14226 return Err(common::Error::HttpError(err));
14227 }
14228 Ok(res) => {
14229 let (mut parts, body) = res.into_parts();
14230 let mut body = common::Body::new(body);
14231 if !parts.status.is_success() {
14232 let bytes = common::to_bytes(body).await.unwrap_or_default();
14233 let error = serde_json::from_str(&common::to_string(&bytes));
14234 let response = common::to_response(parts, bytes.into());
14235
14236 if let common::Retry::After(d) =
14237 dlg.http_failure(&response, error.as_ref().ok())
14238 {
14239 sleep(d).await;
14240 continue;
14241 }
14242
14243 dlg.finished(false);
14244
14245 return Err(match error {
14246 Ok(value) => common::Error::BadRequest(value),
14247 _ => common::Error::Failure(response),
14248 });
14249 }
14250 let response = {
14251 let bytes = common::to_bytes(body).await.unwrap_or_default();
14252 let encoded = common::to_string(&bytes);
14253 match serde_json::from_str(&encoded) {
14254 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14255 Err(error) => {
14256 dlg.response_json_decode_error(&encoded, &error);
14257 return Err(common::Error::JsonDecodeError(
14258 encoded.to_string(),
14259 error,
14260 ));
14261 }
14262 }
14263 };
14264
14265 dlg.finished(true);
14266 return Ok(response);
14267 }
14268 }
14269 }
14270 }
14271
14272 /// The ID of the leaderboard.
14273 ///
14274 /// Sets the *leaderboard id* path property to the given value.
14275 ///
14276 /// Even though the property as already been set when instantiating this call,
14277 /// we provide this method for API completeness.
14278 pub fn leaderboard_id(mut self, new_value: &str) -> ScoreListWindowCall<'a, C> {
14279 self._leaderboard_id = new_value.to_string();
14280 self
14281 }
14282 /// The collection of scores you're requesting.
14283 ///
14284 /// Sets the *collection* path property to the given value.
14285 ///
14286 /// Even though the property as already been set when instantiating this call,
14287 /// we provide this method for API completeness.
14288 pub fn collection(mut self, new_value: &str) -> ScoreListWindowCall<'a, C> {
14289 self._collection = new_value.to_string();
14290 self
14291 }
14292 /// Required. The time span for the scores and ranks you're requesting.
14293 ///
14294 /// Sets the *time span* query property to the given value.
14295 ///
14296 /// Even though the property as already been set when instantiating this call,
14297 /// we provide this method for API completeness.
14298 pub fn time_span(mut self, new_value: &str) -> ScoreListWindowCall<'a, C> {
14299 self._time_span = new_value.to_string();
14300 self
14301 }
14302 /// True if the top scores should be returned when the player is not in the leaderboard. Defaults to true.
14303 ///
14304 /// Sets the *return top if absent* query property to the given value.
14305 pub fn return_top_if_absent(mut self, new_value: bool) -> ScoreListWindowCall<'a, C> {
14306 self._return_top_if_absent = Some(new_value);
14307 self
14308 }
14309 /// The preferred number of scores to return above the player's score. More scores may be returned if the player is at the bottom of the leaderboard; fewer may be returned if the player is at the top. Must be less than or equal to maxResults.
14310 ///
14311 /// Sets the *results above* query property to the given value.
14312 pub fn results_above(mut self, new_value: i32) -> ScoreListWindowCall<'a, C> {
14313 self._results_above = Some(new_value);
14314 self
14315 }
14316 /// The token returned by the previous request.
14317 ///
14318 /// Sets the *page token* query property to the given value.
14319 pub fn page_token(mut self, new_value: &str) -> ScoreListWindowCall<'a, C> {
14320 self._page_token = Some(new_value.to_string());
14321 self
14322 }
14323 /// The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified `maxResults`.
14324 ///
14325 /// Sets the *max results* query property to the given value.
14326 pub fn max_results(mut self, new_value: i32) -> ScoreListWindowCall<'a, C> {
14327 self._max_results = Some(new_value);
14328 self
14329 }
14330 /// The preferred language to use for strings returned by this method.
14331 ///
14332 /// Sets the *language* query property to the given value.
14333 pub fn language(mut self, new_value: &str) -> ScoreListWindowCall<'a, C> {
14334 self._language = Some(new_value.to_string());
14335 self
14336 }
14337 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14338 /// while executing the actual API request.
14339 ///
14340 /// ````text
14341 /// It should be used to handle progress information, and to implement a certain level of resilience.
14342 /// ````
14343 ///
14344 /// Sets the *delegate* property to the given value.
14345 pub fn delegate(
14346 mut self,
14347 new_value: &'a mut dyn common::Delegate,
14348 ) -> ScoreListWindowCall<'a, C> {
14349 self._delegate = Some(new_value);
14350 self
14351 }
14352
14353 /// Set any additional parameter of the query string used in the request.
14354 /// It should be used to set parameters which are not yet available through their own
14355 /// setters.
14356 ///
14357 /// Please note that this method must not be used to set any of the known parameters
14358 /// which have their own setter method. If done anyway, the request will fail.
14359 ///
14360 /// # Additional Parameters
14361 ///
14362 /// * *$.xgafv* (query-string) - V1 error format.
14363 /// * *access_token* (query-string) - OAuth access token.
14364 /// * *alt* (query-string) - Data format for response.
14365 /// * *callback* (query-string) - JSONP
14366 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14367 /// * *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.
14368 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14369 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14370 /// * *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.
14371 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14372 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14373 pub fn param<T>(mut self, name: T, value: T) -> ScoreListWindowCall<'a, C>
14374 where
14375 T: AsRef<str>,
14376 {
14377 self._additional_params
14378 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14379 self
14380 }
14381
14382 /// Identifies the authorization scope for the method you are building.
14383 ///
14384 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14385 /// [`Scope::Full`].
14386 ///
14387 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14388 /// tokens for more than one scope.
14389 ///
14390 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14391 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14392 /// sufficient, a read-write scope will do as well.
14393 pub fn add_scope<St>(mut self, scope: St) -> ScoreListWindowCall<'a, C>
14394 where
14395 St: AsRef<str>,
14396 {
14397 self._scopes.insert(String::from(scope.as_ref()));
14398 self
14399 }
14400 /// Identifies the authorization scope(s) for the method you are building.
14401 ///
14402 /// See [`Self::add_scope()`] for details.
14403 pub fn add_scopes<I, St>(mut self, scopes: I) -> ScoreListWindowCall<'a, C>
14404 where
14405 I: IntoIterator<Item = St>,
14406 St: AsRef<str>,
14407 {
14408 self._scopes
14409 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14410 self
14411 }
14412
14413 /// Removes all scopes, and no default scope will be used either.
14414 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14415 /// for details).
14416 pub fn clear_scopes(mut self) -> ScoreListWindowCall<'a, C> {
14417 self._scopes.clear();
14418 self
14419 }
14420}
14421
14422/// Submits a score to the specified leaderboard.
14423///
14424/// A builder for the *submit* method supported by a *score* resource.
14425/// It is not used directly, but through a [`ScoreMethods`] instance.
14426///
14427/// # Example
14428///
14429/// Instantiate a resource method builder
14430///
14431/// ```test_harness,no_run
14432/// # extern crate hyper;
14433/// # extern crate hyper_rustls;
14434/// # extern crate google_games1 as games1;
14435/// # async fn dox() {
14436/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14437///
14438/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14439/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14440/// # .with_native_roots()
14441/// # .unwrap()
14442/// # .https_only()
14443/// # .enable_http2()
14444/// # .build();
14445///
14446/// # let executor = hyper_util::rt::TokioExecutor::new();
14447/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14448/// # secret,
14449/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14450/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14451/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14452/// # ),
14453/// # ).build().await.unwrap();
14454///
14455/// # let client = hyper_util::client::legacy::Client::builder(
14456/// # hyper_util::rt::TokioExecutor::new()
14457/// # )
14458/// # .build(
14459/// # hyper_rustls::HttpsConnectorBuilder::new()
14460/// # .with_native_roots()
14461/// # .unwrap()
14462/// # .https_or_http()
14463/// # .enable_http2()
14464/// # .build()
14465/// # );
14466/// # let mut hub = Games::new(client, auth);
14467/// // You can configure optional parameters by calling the respective setters at will, and
14468/// // execute the final call using `doit()`.
14469/// // Values shown here are possibly random and not representative !
14470/// let result = hub.scores().submit("leaderboardId", -74)
14471/// .score_tag("accusam")
14472/// .language("voluptua.")
14473/// .doit().await;
14474/// # }
14475/// ```
14476pub struct ScoreSubmitCall<'a, C>
14477where
14478 C: 'a,
14479{
14480 hub: &'a Games<C>,
14481 _leaderboard_id: String,
14482 _score: i64,
14483 _score_tag: Option<String>,
14484 _language: Option<String>,
14485 _delegate: Option<&'a mut dyn common::Delegate>,
14486 _additional_params: HashMap<String, String>,
14487 _scopes: BTreeSet<String>,
14488}
14489
14490impl<'a, C> common::CallBuilder for ScoreSubmitCall<'a, C> {}
14491
14492impl<'a, C> ScoreSubmitCall<'a, C>
14493where
14494 C: common::Connector,
14495{
14496 /// Perform the operation you have build so far.
14497 pub async fn doit(mut self) -> common::Result<(common::Response, PlayerScoreResponse)> {
14498 use std::borrow::Cow;
14499 use std::io::{Read, Seek};
14500
14501 use common::{url::Params, ToParts};
14502 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14503
14504 let mut dd = common::DefaultDelegate;
14505 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14506 dlg.begin(common::MethodInfo {
14507 id: "games.scores.submit",
14508 http_method: hyper::Method::POST,
14509 });
14510
14511 for &field in ["alt", "leaderboardId", "score", "scoreTag", "language"].iter() {
14512 if self._additional_params.contains_key(field) {
14513 dlg.finished(false);
14514 return Err(common::Error::FieldClash(field));
14515 }
14516 }
14517
14518 let mut params = Params::with_capacity(6 + self._additional_params.len());
14519 params.push("leaderboardId", self._leaderboard_id);
14520 params.push("score", self._score.to_string());
14521 if let Some(value) = self._score_tag.as_ref() {
14522 params.push("scoreTag", value);
14523 }
14524 if let Some(value) = self._language.as_ref() {
14525 params.push("language", value);
14526 }
14527
14528 params.extend(self._additional_params.iter());
14529
14530 params.push("alt", "json");
14531 let mut url = self.hub._base_url.clone() + "games/v1/leaderboards/{leaderboardId}/scores";
14532 if self._scopes.is_empty() {
14533 self._scopes.insert(Scope::Full.as_ref().to_string());
14534 }
14535
14536 #[allow(clippy::single_element_loop)]
14537 for &(find_this, param_name) in [("{leaderboardId}", "leaderboardId")].iter() {
14538 url = params.uri_replacement(url, param_name, find_this, false);
14539 }
14540 {
14541 let to_remove = ["leaderboardId"];
14542 params.remove_params(&to_remove);
14543 }
14544
14545 let url = params.parse_with_url(&url);
14546
14547 loop {
14548 let token = match self
14549 .hub
14550 .auth
14551 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14552 .await
14553 {
14554 Ok(token) => token,
14555 Err(e) => match dlg.token(e) {
14556 Ok(token) => token,
14557 Err(e) => {
14558 dlg.finished(false);
14559 return Err(common::Error::MissingToken(e));
14560 }
14561 },
14562 };
14563 let mut req_result = {
14564 let client = &self.hub.client;
14565 dlg.pre_request();
14566 let mut req_builder = hyper::Request::builder()
14567 .method(hyper::Method::POST)
14568 .uri(url.as_str())
14569 .header(USER_AGENT, self.hub._user_agent.clone());
14570
14571 if let Some(token) = token.as_ref() {
14572 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14573 }
14574
14575 let request = req_builder
14576 .header(CONTENT_LENGTH, 0_u64)
14577 .body(common::to_body::<String>(None));
14578
14579 client.request(request.unwrap()).await
14580 };
14581
14582 match req_result {
14583 Err(err) => {
14584 if let common::Retry::After(d) = dlg.http_error(&err) {
14585 sleep(d).await;
14586 continue;
14587 }
14588 dlg.finished(false);
14589 return Err(common::Error::HttpError(err));
14590 }
14591 Ok(res) => {
14592 let (mut parts, body) = res.into_parts();
14593 let mut body = common::Body::new(body);
14594 if !parts.status.is_success() {
14595 let bytes = common::to_bytes(body).await.unwrap_or_default();
14596 let error = serde_json::from_str(&common::to_string(&bytes));
14597 let response = common::to_response(parts, bytes.into());
14598
14599 if let common::Retry::After(d) =
14600 dlg.http_failure(&response, error.as_ref().ok())
14601 {
14602 sleep(d).await;
14603 continue;
14604 }
14605
14606 dlg.finished(false);
14607
14608 return Err(match error {
14609 Ok(value) => common::Error::BadRequest(value),
14610 _ => common::Error::Failure(response),
14611 });
14612 }
14613 let response = {
14614 let bytes = common::to_bytes(body).await.unwrap_or_default();
14615 let encoded = common::to_string(&bytes);
14616 match serde_json::from_str(&encoded) {
14617 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14618 Err(error) => {
14619 dlg.response_json_decode_error(&encoded, &error);
14620 return Err(common::Error::JsonDecodeError(
14621 encoded.to_string(),
14622 error,
14623 ));
14624 }
14625 }
14626 };
14627
14628 dlg.finished(true);
14629 return Ok(response);
14630 }
14631 }
14632 }
14633 }
14634
14635 /// The ID of the leaderboard.
14636 ///
14637 /// Sets the *leaderboard id* path property to the given value.
14638 ///
14639 /// Even though the property as already been set when instantiating this call,
14640 /// we provide this method for API completeness.
14641 pub fn leaderboard_id(mut self, new_value: &str) -> ScoreSubmitCall<'a, C> {
14642 self._leaderboard_id = new_value.to_string();
14643 self
14644 }
14645 /// Required. The score you're submitting. The submitted score is ignored if it is worse than a previously submitted score, where worse depends on the leaderboard sort order. The meaning of the score value depends on the leaderboard format type. For fixed-point, the score represents the raw value. For time, the score represents elapsed time in milliseconds. For currency, the score represents a value in micro units.
14646 ///
14647 /// Sets the *score* query property to the given value.
14648 ///
14649 /// Even though the property as already been set when instantiating this call,
14650 /// we provide this method for API completeness.
14651 pub fn score(mut self, new_value: i64) -> ScoreSubmitCall<'a, C> {
14652 self._score = new_value;
14653 self
14654 }
14655 /// Additional information about the score you're submitting. Values must contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
14656 ///
14657 /// Sets the *score tag* query property to the given value.
14658 pub fn score_tag(mut self, new_value: &str) -> ScoreSubmitCall<'a, C> {
14659 self._score_tag = Some(new_value.to_string());
14660 self
14661 }
14662 /// The preferred language to use for strings returned by this method.
14663 ///
14664 /// Sets the *language* query property to the given value.
14665 pub fn language(mut self, new_value: &str) -> ScoreSubmitCall<'a, C> {
14666 self._language = Some(new_value.to_string());
14667 self
14668 }
14669 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14670 /// while executing the actual API request.
14671 ///
14672 /// ````text
14673 /// It should be used to handle progress information, and to implement a certain level of resilience.
14674 /// ````
14675 ///
14676 /// Sets the *delegate* property to the given value.
14677 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ScoreSubmitCall<'a, C> {
14678 self._delegate = Some(new_value);
14679 self
14680 }
14681
14682 /// Set any additional parameter of the query string used in the request.
14683 /// It should be used to set parameters which are not yet available through their own
14684 /// setters.
14685 ///
14686 /// Please note that this method must not be used to set any of the known parameters
14687 /// which have their own setter method. If done anyway, the request will fail.
14688 ///
14689 /// # Additional Parameters
14690 ///
14691 /// * *$.xgafv* (query-string) - V1 error format.
14692 /// * *access_token* (query-string) - OAuth access token.
14693 /// * *alt* (query-string) - Data format for response.
14694 /// * *callback* (query-string) - JSONP
14695 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14696 /// * *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.
14697 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14698 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14699 /// * *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.
14700 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14701 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14702 pub fn param<T>(mut self, name: T, value: T) -> ScoreSubmitCall<'a, C>
14703 where
14704 T: AsRef<str>,
14705 {
14706 self._additional_params
14707 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14708 self
14709 }
14710
14711 /// Identifies the authorization scope for the method you are building.
14712 ///
14713 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14714 /// [`Scope::Full`].
14715 ///
14716 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14717 /// tokens for more than one scope.
14718 ///
14719 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14720 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14721 /// sufficient, a read-write scope will do as well.
14722 pub fn add_scope<St>(mut self, scope: St) -> ScoreSubmitCall<'a, C>
14723 where
14724 St: AsRef<str>,
14725 {
14726 self._scopes.insert(String::from(scope.as_ref()));
14727 self
14728 }
14729 /// Identifies the authorization scope(s) for the method you are building.
14730 ///
14731 /// See [`Self::add_scope()`] for details.
14732 pub fn add_scopes<I, St>(mut self, scopes: I) -> ScoreSubmitCall<'a, C>
14733 where
14734 I: IntoIterator<Item = St>,
14735 St: AsRef<str>,
14736 {
14737 self._scopes
14738 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14739 self
14740 }
14741
14742 /// Removes all scopes, and no default scope will be used either.
14743 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14744 /// for details).
14745 pub fn clear_scopes(mut self) -> ScoreSubmitCall<'a, C> {
14746 self._scopes.clear();
14747 self
14748 }
14749}
14750
14751/// Submits multiple scores to leaderboards.
14752///
14753/// A builder for the *submitMultiple* method supported by a *score* resource.
14754/// It is not used directly, but through a [`ScoreMethods`] instance.
14755///
14756/// # Example
14757///
14758/// Instantiate a resource method builder
14759///
14760/// ```test_harness,no_run
14761/// # extern crate hyper;
14762/// # extern crate hyper_rustls;
14763/// # extern crate google_games1 as games1;
14764/// use games1::api::PlayerScoreSubmissionList;
14765/// # async fn dox() {
14766/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14767///
14768/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14769/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14770/// # .with_native_roots()
14771/// # .unwrap()
14772/// # .https_only()
14773/// # .enable_http2()
14774/// # .build();
14775///
14776/// # let executor = hyper_util::rt::TokioExecutor::new();
14777/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14778/// # secret,
14779/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14780/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14781/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14782/// # ),
14783/// # ).build().await.unwrap();
14784///
14785/// # let client = hyper_util::client::legacy::Client::builder(
14786/// # hyper_util::rt::TokioExecutor::new()
14787/// # )
14788/// # .build(
14789/// # hyper_rustls::HttpsConnectorBuilder::new()
14790/// # .with_native_roots()
14791/// # .unwrap()
14792/// # .https_or_http()
14793/// # .enable_http2()
14794/// # .build()
14795/// # );
14796/// # let mut hub = Games::new(client, auth);
14797/// // As the method needs a request, you would usually fill it with the desired information
14798/// // into the respective structure. Some of the parts shown here might not be applicable !
14799/// // Values shown here are possibly random and not representative !
14800/// let mut req = PlayerScoreSubmissionList::default();
14801///
14802/// // You can configure optional parameters by calling the respective setters at will, and
14803/// // execute the final call using `doit()`.
14804/// // Values shown here are possibly random and not representative !
14805/// let result = hub.scores().submit_multiple(req)
14806/// .language("dolore")
14807/// .doit().await;
14808/// # }
14809/// ```
14810pub struct ScoreSubmitMultipleCall<'a, C>
14811where
14812 C: 'a,
14813{
14814 hub: &'a Games<C>,
14815 _request: PlayerScoreSubmissionList,
14816 _language: Option<String>,
14817 _delegate: Option<&'a mut dyn common::Delegate>,
14818 _additional_params: HashMap<String, String>,
14819 _scopes: BTreeSet<String>,
14820}
14821
14822impl<'a, C> common::CallBuilder for ScoreSubmitMultipleCall<'a, C> {}
14823
14824impl<'a, C> ScoreSubmitMultipleCall<'a, C>
14825where
14826 C: common::Connector,
14827{
14828 /// Perform the operation you have build so far.
14829 pub async fn doit(mut self) -> common::Result<(common::Response, PlayerScoreListResponse)> {
14830 use std::borrow::Cow;
14831 use std::io::{Read, Seek};
14832
14833 use common::{url::Params, ToParts};
14834 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14835
14836 let mut dd = common::DefaultDelegate;
14837 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14838 dlg.begin(common::MethodInfo {
14839 id: "games.scores.submitMultiple",
14840 http_method: hyper::Method::POST,
14841 });
14842
14843 for &field in ["alt", "language"].iter() {
14844 if self._additional_params.contains_key(field) {
14845 dlg.finished(false);
14846 return Err(common::Error::FieldClash(field));
14847 }
14848 }
14849
14850 let mut params = Params::with_capacity(4 + self._additional_params.len());
14851 if let Some(value) = self._language.as_ref() {
14852 params.push("language", value);
14853 }
14854
14855 params.extend(self._additional_params.iter());
14856
14857 params.push("alt", "json");
14858 let mut url = self.hub._base_url.clone() + "games/v1/leaderboards/scores";
14859 if self._scopes.is_empty() {
14860 self._scopes.insert(Scope::Full.as_ref().to_string());
14861 }
14862
14863 let url = params.parse_with_url(&url);
14864
14865 let mut json_mime_type = mime::APPLICATION_JSON;
14866 let mut request_value_reader = {
14867 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14868 common::remove_json_null_values(&mut value);
14869 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14870 serde_json::to_writer(&mut dst, &value).unwrap();
14871 dst
14872 };
14873 let request_size = request_value_reader
14874 .seek(std::io::SeekFrom::End(0))
14875 .unwrap();
14876 request_value_reader
14877 .seek(std::io::SeekFrom::Start(0))
14878 .unwrap();
14879
14880 loop {
14881 let token = match self
14882 .hub
14883 .auth
14884 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14885 .await
14886 {
14887 Ok(token) => token,
14888 Err(e) => match dlg.token(e) {
14889 Ok(token) => token,
14890 Err(e) => {
14891 dlg.finished(false);
14892 return Err(common::Error::MissingToken(e));
14893 }
14894 },
14895 };
14896 request_value_reader
14897 .seek(std::io::SeekFrom::Start(0))
14898 .unwrap();
14899 let mut req_result = {
14900 let client = &self.hub.client;
14901 dlg.pre_request();
14902 let mut req_builder = hyper::Request::builder()
14903 .method(hyper::Method::POST)
14904 .uri(url.as_str())
14905 .header(USER_AGENT, self.hub._user_agent.clone());
14906
14907 if let Some(token) = token.as_ref() {
14908 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14909 }
14910
14911 let request = req_builder
14912 .header(CONTENT_TYPE, json_mime_type.to_string())
14913 .header(CONTENT_LENGTH, request_size as u64)
14914 .body(common::to_body(
14915 request_value_reader.get_ref().clone().into(),
14916 ));
14917
14918 client.request(request.unwrap()).await
14919 };
14920
14921 match req_result {
14922 Err(err) => {
14923 if let common::Retry::After(d) = dlg.http_error(&err) {
14924 sleep(d).await;
14925 continue;
14926 }
14927 dlg.finished(false);
14928 return Err(common::Error::HttpError(err));
14929 }
14930 Ok(res) => {
14931 let (mut parts, body) = res.into_parts();
14932 let mut body = common::Body::new(body);
14933 if !parts.status.is_success() {
14934 let bytes = common::to_bytes(body).await.unwrap_or_default();
14935 let error = serde_json::from_str(&common::to_string(&bytes));
14936 let response = common::to_response(parts, bytes.into());
14937
14938 if let common::Retry::After(d) =
14939 dlg.http_failure(&response, error.as_ref().ok())
14940 {
14941 sleep(d).await;
14942 continue;
14943 }
14944
14945 dlg.finished(false);
14946
14947 return Err(match error {
14948 Ok(value) => common::Error::BadRequest(value),
14949 _ => common::Error::Failure(response),
14950 });
14951 }
14952 let response = {
14953 let bytes = common::to_bytes(body).await.unwrap_or_default();
14954 let encoded = common::to_string(&bytes);
14955 match serde_json::from_str(&encoded) {
14956 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14957 Err(error) => {
14958 dlg.response_json_decode_error(&encoded, &error);
14959 return Err(common::Error::JsonDecodeError(
14960 encoded.to_string(),
14961 error,
14962 ));
14963 }
14964 }
14965 };
14966
14967 dlg.finished(true);
14968 return Ok(response);
14969 }
14970 }
14971 }
14972 }
14973
14974 ///
14975 /// Sets the *request* property to the given value.
14976 ///
14977 /// Even though the property as already been set when instantiating this call,
14978 /// we provide this method for API completeness.
14979 pub fn request(
14980 mut self,
14981 new_value: PlayerScoreSubmissionList,
14982 ) -> ScoreSubmitMultipleCall<'a, C> {
14983 self._request = new_value;
14984 self
14985 }
14986 /// The preferred language to use for strings returned by this method.
14987 ///
14988 /// Sets the *language* query property to the given value.
14989 pub fn language(mut self, new_value: &str) -> ScoreSubmitMultipleCall<'a, C> {
14990 self._language = Some(new_value.to_string());
14991 self
14992 }
14993 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14994 /// while executing the actual API request.
14995 ///
14996 /// ````text
14997 /// It should be used to handle progress information, and to implement a certain level of resilience.
14998 /// ````
14999 ///
15000 /// Sets the *delegate* property to the given value.
15001 pub fn delegate(
15002 mut self,
15003 new_value: &'a mut dyn common::Delegate,
15004 ) -> ScoreSubmitMultipleCall<'a, C> {
15005 self._delegate = Some(new_value);
15006 self
15007 }
15008
15009 /// Set any additional parameter of the query string used in the request.
15010 /// It should be used to set parameters which are not yet available through their own
15011 /// setters.
15012 ///
15013 /// Please note that this method must not be used to set any of the known parameters
15014 /// which have their own setter method. If done anyway, the request will fail.
15015 ///
15016 /// # Additional Parameters
15017 ///
15018 /// * *$.xgafv* (query-string) - V1 error format.
15019 /// * *access_token* (query-string) - OAuth access token.
15020 /// * *alt* (query-string) - Data format for response.
15021 /// * *callback* (query-string) - JSONP
15022 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15023 /// * *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.
15024 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15025 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15026 /// * *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.
15027 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15028 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15029 pub fn param<T>(mut self, name: T, value: T) -> ScoreSubmitMultipleCall<'a, C>
15030 where
15031 T: AsRef<str>,
15032 {
15033 self._additional_params
15034 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15035 self
15036 }
15037
15038 /// Identifies the authorization scope for the method you are building.
15039 ///
15040 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15041 /// [`Scope::Full`].
15042 ///
15043 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15044 /// tokens for more than one scope.
15045 ///
15046 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15047 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15048 /// sufficient, a read-write scope will do as well.
15049 pub fn add_scope<St>(mut self, scope: St) -> ScoreSubmitMultipleCall<'a, C>
15050 where
15051 St: AsRef<str>,
15052 {
15053 self._scopes.insert(String::from(scope.as_ref()));
15054 self
15055 }
15056 /// Identifies the authorization scope(s) for the method you are building.
15057 ///
15058 /// See [`Self::add_scope()`] for details.
15059 pub fn add_scopes<I, St>(mut self, scopes: I) -> ScoreSubmitMultipleCall<'a, C>
15060 where
15061 I: IntoIterator<Item = St>,
15062 St: AsRef<str>,
15063 {
15064 self._scopes
15065 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15066 self
15067 }
15068
15069 /// Removes all scopes, and no default scope will be used either.
15070 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15071 /// for details).
15072 pub fn clear_scopes(mut self) -> ScoreSubmitMultipleCall<'a, C> {
15073 self._scopes.clear();
15074 self
15075 }
15076}
15077
15078/// Retrieves the metadata for a given snapshot ID.
15079///
15080/// A builder for the *get* method supported by a *snapshot* resource.
15081/// It is not used directly, but through a [`SnapshotMethods`] instance.
15082///
15083/// # Example
15084///
15085/// Instantiate a resource method builder
15086///
15087/// ```test_harness,no_run
15088/// # extern crate hyper;
15089/// # extern crate hyper_rustls;
15090/// # extern crate google_games1 as games1;
15091/// # async fn dox() {
15092/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15093///
15094/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15095/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15096/// # .with_native_roots()
15097/// # .unwrap()
15098/// # .https_only()
15099/// # .enable_http2()
15100/// # .build();
15101///
15102/// # let executor = hyper_util::rt::TokioExecutor::new();
15103/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15104/// # secret,
15105/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15106/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15107/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15108/// # ),
15109/// # ).build().await.unwrap();
15110///
15111/// # let client = hyper_util::client::legacy::Client::builder(
15112/// # hyper_util::rt::TokioExecutor::new()
15113/// # )
15114/// # .build(
15115/// # hyper_rustls::HttpsConnectorBuilder::new()
15116/// # .with_native_roots()
15117/// # .unwrap()
15118/// # .https_or_http()
15119/// # .enable_http2()
15120/// # .build()
15121/// # );
15122/// # let mut hub = Games::new(client, auth);
15123/// // You can configure optional parameters by calling the respective setters at will, and
15124/// // execute the final call using `doit()`.
15125/// // Values shown here are possibly random and not representative !
15126/// let result = hub.snapshots().get("snapshotId")
15127/// .language("dolore")
15128/// .doit().await;
15129/// # }
15130/// ```
15131pub struct SnapshotGetCall<'a, C>
15132where
15133 C: 'a,
15134{
15135 hub: &'a Games<C>,
15136 _snapshot_id: String,
15137 _language: Option<String>,
15138 _delegate: Option<&'a mut dyn common::Delegate>,
15139 _additional_params: HashMap<String, String>,
15140 _scopes: BTreeSet<String>,
15141}
15142
15143impl<'a, C> common::CallBuilder for SnapshotGetCall<'a, C> {}
15144
15145impl<'a, C> SnapshotGetCall<'a, C>
15146where
15147 C: common::Connector,
15148{
15149 /// Perform the operation you have build so far.
15150 pub async fn doit(mut self) -> common::Result<(common::Response, Snapshot)> {
15151 use std::borrow::Cow;
15152 use std::io::{Read, Seek};
15153
15154 use common::{url::Params, ToParts};
15155 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15156
15157 let mut dd = common::DefaultDelegate;
15158 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15159 dlg.begin(common::MethodInfo {
15160 id: "games.snapshots.get",
15161 http_method: hyper::Method::GET,
15162 });
15163
15164 for &field in ["alt", "snapshotId", "language"].iter() {
15165 if self._additional_params.contains_key(field) {
15166 dlg.finished(false);
15167 return Err(common::Error::FieldClash(field));
15168 }
15169 }
15170
15171 let mut params = Params::with_capacity(4 + self._additional_params.len());
15172 params.push("snapshotId", self._snapshot_id);
15173 if let Some(value) = self._language.as_ref() {
15174 params.push("language", value);
15175 }
15176
15177 params.extend(self._additional_params.iter());
15178
15179 params.push("alt", "json");
15180 let mut url = self.hub._base_url.clone() + "games/v1/snapshots/{snapshotId}";
15181 if self._scopes.is_empty() {
15182 self._scopes
15183 .insert(Scope::DriveAppdata.as_ref().to_string());
15184 }
15185
15186 #[allow(clippy::single_element_loop)]
15187 for &(find_this, param_name) in [("{snapshotId}", "snapshotId")].iter() {
15188 url = params.uri_replacement(url, param_name, find_this, false);
15189 }
15190 {
15191 let to_remove = ["snapshotId"];
15192 params.remove_params(&to_remove);
15193 }
15194
15195 let url = params.parse_with_url(&url);
15196
15197 loop {
15198 let token = match self
15199 .hub
15200 .auth
15201 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15202 .await
15203 {
15204 Ok(token) => token,
15205 Err(e) => match dlg.token(e) {
15206 Ok(token) => token,
15207 Err(e) => {
15208 dlg.finished(false);
15209 return Err(common::Error::MissingToken(e));
15210 }
15211 },
15212 };
15213 let mut req_result = {
15214 let client = &self.hub.client;
15215 dlg.pre_request();
15216 let mut req_builder = hyper::Request::builder()
15217 .method(hyper::Method::GET)
15218 .uri(url.as_str())
15219 .header(USER_AGENT, self.hub._user_agent.clone());
15220
15221 if let Some(token) = token.as_ref() {
15222 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15223 }
15224
15225 let request = req_builder
15226 .header(CONTENT_LENGTH, 0_u64)
15227 .body(common::to_body::<String>(None));
15228
15229 client.request(request.unwrap()).await
15230 };
15231
15232 match req_result {
15233 Err(err) => {
15234 if let common::Retry::After(d) = dlg.http_error(&err) {
15235 sleep(d).await;
15236 continue;
15237 }
15238 dlg.finished(false);
15239 return Err(common::Error::HttpError(err));
15240 }
15241 Ok(res) => {
15242 let (mut parts, body) = res.into_parts();
15243 let mut body = common::Body::new(body);
15244 if !parts.status.is_success() {
15245 let bytes = common::to_bytes(body).await.unwrap_or_default();
15246 let error = serde_json::from_str(&common::to_string(&bytes));
15247 let response = common::to_response(parts, bytes.into());
15248
15249 if let common::Retry::After(d) =
15250 dlg.http_failure(&response, error.as_ref().ok())
15251 {
15252 sleep(d).await;
15253 continue;
15254 }
15255
15256 dlg.finished(false);
15257
15258 return Err(match error {
15259 Ok(value) => common::Error::BadRequest(value),
15260 _ => common::Error::Failure(response),
15261 });
15262 }
15263 let response = {
15264 let bytes = common::to_bytes(body).await.unwrap_or_default();
15265 let encoded = common::to_string(&bytes);
15266 match serde_json::from_str(&encoded) {
15267 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15268 Err(error) => {
15269 dlg.response_json_decode_error(&encoded, &error);
15270 return Err(common::Error::JsonDecodeError(
15271 encoded.to_string(),
15272 error,
15273 ));
15274 }
15275 }
15276 };
15277
15278 dlg.finished(true);
15279 return Ok(response);
15280 }
15281 }
15282 }
15283 }
15284
15285 /// The ID of the snapshot.
15286 ///
15287 /// Sets the *snapshot id* path property to the given value.
15288 ///
15289 /// Even though the property as already been set when instantiating this call,
15290 /// we provide this method for API completeness.
15291 pub fn snapshot_id(mut self, new_value: &str) -> SnapshotGetCall<'a, C> {
15292 self._snapshot_id = new_value.to_string();
15293 self
15294 }
15295 /// The preferred language to use for strings returned by this method.
15296 ///
15297 /// Sets the *language* query property to the given value.
15298 pub fn language(mut self, new_value: &str) -> SnapshotGetCall<'a, C> {
15299 self._language = Some(new_value.to_string());
15300 self
15301 }
15302 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15303 /// while executing the actual API request.
15304 ///
15305 /// ````text
15306 /// It should be used to handle progress information, and to implement a certain level of resilience.
15307 /// ````
15308 ///
15309 /// Sets the *delegate* property to the given value.
15310 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SnapshotGetCall<'a, C> {
15311 self._delegate = Some(new_value);
15312 self
15313 }
15314
15315 /// Set any additional parameter of the query string used in the request.
15316 /// It should be used to set parameters which are not yet available through their own
15317 /// setters.
15318 ///
15319 /// Please note that this method must not be used to set any of the known parameters
15320 /// which have their own setter method. If done anyway, the request will fail.
15321 ///
15322 /// # Additional Parameters
15323 ///
15324 /// * *$.xgafv* (query-string) - V1 error format.
15325 /// * *access_token* (query-string) - OAuth access token.
15326 /// * *alt* (query-string) - Data format for response.
15327 /// * *callback* (query-string) - JSONP
15328 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15329 /// * *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.
15330 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15331 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15332 /// * *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.
15333 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15334 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15335 pub fn param<T>(mut self, name: T, value: T) -> SnapshotGetCall<'a, C>
15336 where
15337 T: AsRef<str>,
15338 {
15339 self._additional_params
15340 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15341 self
15342 }
15343
15344 /// Identifies the authorization scope for the method you are building.
15345 ///
15346 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15347 /// [`Scope::DriveAppdata`].
15348 ///
15349 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15350 /// tokens for more than one scope.
15351 ///
15352 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15353 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15354 /// sufficient, a read-write scope will do as well.
15355 pub fn add_scope<St>(mut self, scope: St) -> SnapshotGetCall<'a, C>
15356 where
15357 St: AsRef<str>,
15358 {
15359 self._scopes.insert(String::from(scope.as_ref()));
15360 self
15361 }
15362 /// Identifies the authorization scope(s) for the method you are building.
15363 ///
15364 /// See [`Self::add_scope()`] for details.
15365 pub fn add_scopes<I, St>(mut self, scopes: I) -> SnapshotGetCall<'a, C>
15366 where
15367 I: IntoIterator<Item = St>,
15368 St: AsRef<str>,
15369 {
15370 self._scopes
15371 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15372 self
15373 }
15374
15375 /// Removes all scopes, and no default scope will be used either.
15376 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15377 /// for details).
15378 pub fn clear_scopes(mut self) -> SnapshotGetCall<'a, C> {
15379 self._scopes.clear();
15380 self
15381 }
15382}
15383
15384/// Retrieves a list of snapshots created by your application for the player corresponding to the player ID.
15385///
15386/// A builder for the *list* method supported by a *snapshot* resource.
15387/// It is not used directly, but through a [`SnapshotMethods`] instance.
15388///
15389/// # Example
15390///
15391/// Instantiate a resource method builder
15392///
15393/// ```test_harness,no_run
15394/// # extern crate hyper;
15395/// # extern crate hyper_rustls;
15396/// # extern crate google_games1 as games1;
15397/// # async fn dox() {
15398/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15399///
15400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15401/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15402/// # .with_native_roots()
15403/// # .unwrap()
15404/// # .https_only()
15405/// # .enable_http2()
15406/// # .build();
15407///
15408/// # let executor = hyper_util::rt::TokioExecutor::new();
15409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15410/// # secret,
15411/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15412/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15413/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15414/// # ),
15415/// # ).build().await.unwrap();
15416///
15417/// # let client = hyper_util::client::legacy::Client::builder(
15418/// # hyper_util::rt::TokioExecutor::new()
15419/// # )
15420/// # .build(
15421/// # hyper_rustls::HttpsConnectorBuilder::new()
15422/// # .with_native_roots()
15423/// # .unwrap()
15424/// # .https_or_http()
15425/// # .enable_http2()
15426/// # .build()
15427/// # );
15428/// # let mut hub = Games::new(client, auth);
15429/// // You can configure optional parameters by calling the respective setters at will, and
15430/// // execute the final call using `doit()`.
15431/// // Values shown here are possibly random and not representative !
15432/// let result = hub.snapshots().list("playerId")
15433/// .page_token("amet.")
15434/// .max_results(-17)
15435/// .language("sadipscing")
15436/// .doit().await;
15437/// # }
15438/// ```
15439pub struct SnapshotListCall<'a, C>
15440where
15441 C: 'a,
15442{
15443 hub: &'a Games<C>,
15444 _player_id: String,
15445 _page_token: Option<String>,
15446 _max_results: Option<i32>,
15447 _language: Option<String>,
15448 _delegate: Option<&'a mut dyn common::Delegate>,
15449 _additional_params: HashMap<String, String>,
15450 _scopes: BTreeSet<String>,
15451}
15452
15453impl<'a, C> common::CallBuilder for SnapshotListCall<'a, C> {}
15454
15455impl<'a, C> SnapshotListCall<'a, C>
15456where
15457 C: common::Connector,
15458{
15459 /// Perform the operation you have build so far.
15460 pub async fn doit(mut self) -> common::Result<(common::Response, SnapshotListResponse)> {
15461 use std::borrow::Cow;
15462 use std::io::{Read, Seek};
15463
15464 use common::{url::Params, ToParts};
15465 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15466
15467 let mut dd = common::DefaultDelegate;
15468 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15469 dlg.begin(common::MethodInfo {
15470 id: "games.snapshots.list",
15471 http_method: hyper::Method::GET,
15472 });
15473
15474 for &field in ["alt", "playerId", "pageToken", "maxResults", "language"].iter() {
15475 if self._additional_params.contains_key(field) {
15476 dlg.finished(false);
15477 return Err(common::Error::FieldClash(field));
15478 }
15479 }
15480
15481 let mut params = Params::with_capacity(6 + self._additional_params.len());
15482 params.push("playerId", self._player_id);
15483 if let Some(value) = self._page_token.as_ref() {
15484 params.push("pageToken", value);
15485 }
15486 if let Some(value) = self._max_results.as_ref() {
15487 params.push("maxResults", value.to_string());
15488 }
15489 if let Some(value) = self._language.as_ref() {
15490 params.push("language", value);
15491 }
15492
15493 params.extend(self._additional_params.iter());
15494
15495 params.push("alt", "json");
15496 let mut url = self.hub._base_url.clone() + "games/v1/players/{playerId}/snapshots";
15497 if self._scopes.is_empty() {
15498 self._scopes
15499 .insert(Scope::DriveAppdata.as_ref().to_string());
15500 }
15501
15502 #[allow(clippy::single_element_loop)]
15503 for &(find_this, param_name) in [("{playerId}", "playerId")].iter() {
15504 url = params.uri_replacement(url, param_name, find_this, false);
15505 }
15506 {
15507 let to_remove = ["playerId"];
15508 params.remove_params(&to_remove);
15509 }
15510
15511 let url = params.parse_with_url(&url);
15512
15513 loop {
15514 let token = match self
15515 .hub
15516 .auth
15517 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15518 .await
15519 {
15520 Ok(token) => token,
15521 Err(e) => match dlg.token(e) {
15522 Ok(token) => token,
15523 Err(e) => {
15524 dlg.finished(false);
15525 return Err(common::Error::MissingToken(e));
15526 }
15527 },
15528 };
15529 let mut req_result = {
15530 let client = &self.hub.client;
15531 dlg.pre_request();
15532 let mut req_builder = hyper::Request::builder()
15533 .method(hyper::Method::GET)
15534 .uri(url.as_str())
15535 .header(USER_AGENT, self.hub._user_agent.clone());
15536
15537 if let Some(token) = token.as_ref() {
15538 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15539 }
15540
15541 let request = req_builder
15542 .header(CONTENT_LENGTH, 0_u64)
15543 .body(common::to_body::<String>(None));
15544
15545 client.request(request.unwrap()).await
15546 };
15547
15548 match req_result {
15549 Err(err) => {
15550 if let common::Retry::After(d) = dlg.http_error(&err) {
15551 sleep(d).await;
15552 continue;
15553 }
15554 dlg.finished(false);
15555 return Err(common::Error::HttpError(err));
15556 }
15557 Ok(res) => {
15558 let (mut parts, body) = res.into_parts();
15559 let mut body = common::Body::new(body);
15560 if !parts.status.is_success() {
15561 let bytes = common::to_bytes(body).await.unwrap_or_default();
15562 let error = serde_json::from_str(&common::to_string(&bytes));
15563 let response = common::to_response(parts, bytes.into());
15564
15565 if let common::Retry::After(d) =
15566 dlg.http_failure(&response, error.as_ref().ok())
15567 {
15568 sleep(d).await;
15569 continue;
15570 }
15571
15572 dlg.finished(false);
15573
15574 return Err(match error {
15575 Ok(value) => common::Error::BadRequest(value),
15576 _ => common::Error::Failure(response),
15577 });
15578 }
15579 let response = {
15580 let bytes = common::to_bytes(body).await.unwrap_or_default();
15581 let encoded = common::to_string(&bytes);
15582 match serde_json::from_str(&encoded) {
15583 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15584 Err(error) => {
15585 dlg.response_json_decode_error(&encoded, &error);
15586 return Err(common::Error::JsonDecodeError(
15587 encoded.to_string(),
15588 error,
15589 ));
15590 }
15591 }
15592 };
15593
15594 dlg.finished(true);
15595 return Ok(response);
15596 }
15597 }
15598 }
15599 }
15600
15601 /// A player ID. A value of `me` may be used in place of the authenticated player's ID.
15602 ///
15603 /// Sets the *player id* path property to the given value.
15604 ///
15605 /// Even though the property as already been set when instantiating this call,
15606 /// we provide this method for API completeness.
15607 pub fn player_id(mut self, new_value: &str) -> SnapshotListCall<'a, C> {
15608 self._player_id = new_value.to_string();
15609 self
15610 }
15611 /// The token returned by the previous request.
15612 ///
15613 /// Sets the *page token* query property to the given value.
15614 pub fn page_token(mut self, new_value: &str) -> SnapshotListCall<'a, C> {
15615 self._page_token = Some(new_value.to_string());
15616 self
15617 }
15618 /// The maximum number of snapshot resources to return in the response, used for paging. For any response, the actual number of snapshot resources returned may be less than the specified `maxResults`.
15619 ///
15620 /// Sets the *max results* query property to the given value.
15621 pub fn max_results(mut self, new_value: i32) -> SnapshotListCall<'a, C> {
15622 self._max_results = Some(new_value);
15623 self
15624 }
15625 /// The preferred language to use for strings returned by this method.
15626 ///
15627 /// Sets the *language* query property to the given value.
15628 pub fn language(mut self, new_value: &str) -> SnapshotListCall<'a, C> {
15629 self._language = Some(new_value.to_string());
15630 self
15631 }
15632 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15633 /// while executing the actual API request.
15634 ///
15635 /// ````text
15636 /// It should be used to handle progress information, and to implement a certain level of resilience.
15637 /// ````
15638 ///
15639 /// Sets the *delegate* property to the given value.
15640 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SnapshotListCall<'a, C> {
15641 self._delegate = Some(new_value);
15642 self
15643 }
15644
15645 /// Set any additional parameter of the query string used in the request.
15646 /// It should be used to set parameters which are not yet available through their own
15647 /// setters.
15648 ///
15649 /// Please note that this method must not be used to set any of the known parameters
15650 /// which have their own setter method. If done anyway, the request will fail.
15651 ///
15652 /// # Additional Parameters
15653 ///
15654 /// * *$.xgafv* (query-string) - V1 error format.
15655 /// * *access_token* (query-string) - OAuth access token.
15656 /// * *alt* (query-string) - Data format for response.
15657 /// * *callback* (query-string) - JSONP
15658 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15659 /// * *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.
15660 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15661 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15662 /// * *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.
15663 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15664 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15665 pub fn param<T>(mut self, name: T, value: T) -> SnapshotListCall<'a, C>
15666 where
15667 T: AsRef<str>,
15668 {
15669 self._additional_params
15670 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15671 self
15672 }
15673
15674 /// Identifies the authorization scope for the method you are building.
15675 ///
15676 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15677 /// [`Scope::DriveAppdata`].
15678 ///
15679 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15680 /// tokens for more than one scope.
15681 ///
15682 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15683 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15684 /// sufficient, a read-write scope will do as well.
15685 pub fn add_scope<St>(mut self, scope: St) -> SnapshotListCall<'a, C>
15686 where
15687 St: AsRef<str>,
15688 {
15689 self._scopes.insert(String::from(scope.as_ref()));
15690 self
15691 }
15692 /// Identifies the authorization scope(s) for the method you are building.
15693 ///
15694 /// See [`Self::add_scope()`] for details.
15695 pub fn add_scopes<I, St>(mut self, scopes: I) -> SnapshotListCall<'a, C>
15696 where
15697 I: IntoIterator<Item = St>,
15698 St: AsRef<str>,
15699 {
15700 self._scopes
15701 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15702 self
15703 }
15704
15705 /// Removes all scopes, and no default scope will be used either.
15706 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15707 /// for details).
15708 pub fn clear_scopes(mut self) -> SnapshotListCall<'a, C> {
15709 self._scopes.clear();
15710 self
15711 }
15712}
15713
15714/// Returns engagement and spend statistics in this application for the currently authenticated user.
15715///
15716/// A builder for the *get* method supported by a *stat* resource.
15717/// It is not used directly, but through a [`StatMethods`] instance.
15718///
15719/// # Example
15720///
15721/// Instantiate a resource method builder
15722///
15723/// ```test_harness,no_run
15724/// # extern crate hyper;
15725/// # extern crate hyper_rustls;
15726/// # extern crate google_games1 as games1;
15727/// # async fn dox() {
15728/// # use games1::{Games, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15729///
15730/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15731/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15732/// # .with_native_roots()
15733/// # .unwrap()
15734/// # .https_only()
15735/// # .enable_http2()
15736/// # .build();
15737///
15738/// # let executor = hyper_util::rt::TokioExecutor::new();
15739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15740/// # secret,
15741/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15742/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15743/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15744/// # ),
15745/// # ).build().await.unwrap();
15746///
15747/// # let client = hyper_util::client::legacy::Client::builder(
15748/// # hyper_util::rt::TokioExecutor::new()
15749/// # )
15750/// # .build(
15751/// # hyper_rustls::HttpsConnectorBuilder::new()
15752/// # .with_native_roots()
15753/// # .unwrap()
15754/// # .https_or_http()
15755/// # .enable_http2()
15756/// # .build()
15757/// # );
15758/// # let mut hub = Games::new(client, auth);
15759/// // You can configure optional parameters by calling the respective setters at will, and
15760/// // execute the final call using `doit()`.
15761/// // Values shown here are possibly random and not representative !
15762/// let result = hub.stats().get()
15763/// .doit().await;
15764/// # }
15765/// ```
15766pub struct StatGetCall<'a, C>
15767where
15768 C: 'a,
15769{
15770 hub: &'a Games<C>,
15771 _delegate: Option<&'a mut dyn common::Delegate>,
15772 _additional_params: HashMap<String, String>,
15773 _scopes: BTreeSet<String>,
15774}
15775
15776impl<'a, C> common::CallBuilder for StatGetCall<'a, C> {}
15777
15778impl<'a, C> StatGetCall<'a, C>
15779where
15780 C: common::Connector,
15781{
15782 /// Perform the operation you have build so far.
15783 pub async fn doit(mut self) -> common::Result<(common::Response, StatsResponse)> {
15784 use std::borrow::Cow;
15785 use std::io::{Read, Seek};
15786
15787 use common::{url::Params, ToParts};
15788 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15789
15790 let mut dd = common::DefaultDelegate;
15791 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15792 dlg.begin(common::MethodInfo {
15793 id: "games.stats.get",
15794 http_method: hyper::Method::GET,
15795 });
15796
15797 for &field in ["alt"].iter() {
15798 if self._additional_params.contains_key(field) {
15799 dlg.finished(false);
15800 return Err(common::Error::FieldClash(field));
15801 }
15802 }
15803
15804 let mut params = Params::with_capacity(2 + self._additional_params.len());
15805
15806 params.extend(self._additional_params.iter());
15807
15808 params.push("alt", "json");
15809 let mut url = self.hub._base_url.clone() + "games/v1/stats";
15810 if self._scopes.is_empty() {
15811 self._scopes.insert(Scope::Full.as_ref().to_string());
15812 }
15813
15814 let url = params.parse_with_url(&url);
15815
15816 loop {
15817 let token = match self
15818 .hub
15819 .auth
15820 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15821 .await
15822 {
15823 Ok(token) => token,
15824 Err(e) => match dlg.token(e) {
15825 Ok(token) => token,
15826 Err(e) => {
15827 dlg.finished(false);
15828 return Err(common::Error::MissingToken(e));
15829 }
15830 },
15831 };
15832 let mut req_result = {
15833 let client = &self.hub.client;
15834 dlg.pre_request();
15835 let mut req_builder = hyper::Request::builder()
15836 .method(hyper::Method::GET)
15837 .uri(url.as_str())
15838 .header(USER_AGENT, self.hub._user_agent.clone());
15839
15840 if let Some(token) = token.as_ref() {
15841 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15842 }
15843
15844 let request = req_builder
15845 .header(CONTENT_LENGTH, 0_u64)
15846 .body(common::to_body::<String>(None));
15847
15848 client.request(request.unwrap()).await
15849 };
15850
15851 match req_result {
15852 Err(err) => {
15853 if let common::Retry::After(d) = dlg.http_error(&err) {
15854 sleep(d).await;
15855 continue;
15856 }
15857 dlg.finished(false);
15858 return Err(common::Error::HttpError(err));
15859 }
15860 Ok(res) => {
15861 let (mut parts, body) = res.into_parts();
15862 let mut body = common::Body::new(body);
15863 if !parts.status.is_success() {
15864 let bytes = common::to_bytes(body).await.unwrap_or_default();
15865 let error = serde_json::from_str(&common::to_string(&bytes));
15866 let response = common::to_response(parts, bytes.into());
15867
15868 if let common::Retry::After(d) =
15869 dlg.http_failure(&response, error.as_ref().ok())
15870 {
15871 sleep(d).await;
15872 continue;
15873 }
15874
15875 dlg.finished(false);
15876
15877 return Err(match error {
15878 Ok(value) => common::Error::BadRequest(value),
15879 _ => common::Error::Failure(response),
15880 });
15881 }
15882 let response = {
15883 let bytes = common::to_bytes(body).await.unwrap_or_default();
15884 let encoded = common::to_string(&bytes);
15885 match serde_json::from_str(&encoded) {
15886 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15887 Err(error) => {
15888 dlg.response_json_decode_error(&encoded, &error);
15889 return Err(common::Error::JsonDecodeError(
15890 encoded.to_string(),
15891 error,
15892 ));
15893 }
15894 }
15895 };
15896
15897 dlg.finished(true);
15898 return Ok(response);
15899 }
15900 }
15901 }
15902 }
15903
15904 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15905 /// while executing the actual API request.
15906 ///
15907 /// ````text
15908 /// It should be used to handle progress information, and to implement a certain level of resilience.
15909 /// ````
15910 ///
15911 /// Sets the *delegate* property to the given value.
15912 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> StatGetCall<'a, C> {
15913 self._delegate = Some(new_value);
15914 self
15915 }
15916
15917 /// Set any additional parameter of the query string used in the request.
15918 /// It should be used to set parameters which are not yet available through their own
15919 /// setters.
15920 ///
15921 /// Please note that this method must not be used to set any of the known parameters
15922 /// which have their own setter method. If done anyway, the request will fail.
15923 ///
15924 /// # Additional Parameters
15925 ///
15926 /// * *$.xgafv* (query-string) - V1 error format.
15927 /// * *access_token* (query-string) - OAuth access token.
15928 /// * *alt* (query-string) - Data format for response.
15929 /// * *callback* (query-string) - JSONP
15930 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15931 /// * *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.
15932 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15933 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15934 /// * *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.
15935 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15936 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15937 pub fn param<T>(mut self, name: T, value: T) -> StatGetCall<'a, C>
15938 where
15939 T: AsRef<str>,
15940 {
15941 self._additional_params
15942 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15943 self
15944 }
15945
15946 /// Identifies the authorization scope for the method you are building.
15947 ///
15948 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15949 /// [`Scope::Full`].
15950 ///
15951 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15952 /// tokens for more than one scope.
15953 ///
15954 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15955 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15956 /// sufficient, a read-write scope will do as well.
15957 pub fn add_scope<St>(mut self, scope: St) -> StatGetCall<'a, C>
15958 where
15959 St: AsRef<str>,
15960 {
15961 self._scopes.insert(String::from(scope.as_ref()));
15962 self
15963 }
15964 /// Identifies the authorization scope(s) for the method you are building.
15965 ///
15966 /// See [`Self::add_scope()`] for details.
15967 pub fn add_scopes<I, St>(mut self, scopes: I) -> StatGetCall<'a, C>
15968 where
15969 I: IntoIterator<Item = St>,
15970 St: AsRef<str>,
15971 {
15972 self._scopes
15973 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15974 self
15975 }
15976
15977 /// Removes all scopes, and no default scope will be used either.
15978 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15979 /// for details).
15980 pub fn clear_scopes(mut self) -> StatGetCall<'a, C> {
15981 self._scopes.clear();
15982 self
15983 }
15984}