google_playintegrity1/
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    /// Private Service: https://www.googleapis.com/auth/playintegrity
17    Full,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::Full => "https://www.googleapis.com/auth/playintegrity",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::Full
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all PlayIntegrity related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_playintegrity1 as playintegrity1;
49/// use playintegrity1::api::WriteDeviceRecallRequest;
50/// use playintegrity1::{Result, Error};
51/// # async fn dox() {
52/// use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = PlayIntegrity::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = WriteDeviceRecallRequest::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.device_recall().write(req, "packageName")
99///              .doit().await;
100///
101/// match result {
102///     Err(e) => match e {
103///         // The Error enum provides details about what exactly happened.
104///         // You can also just use its `Debug`, `Display` or `Error` traits
105///          Error::HttpError(_)
106///         |Error::Io(_)
107///         |Error::MissingAPIKey
108///         |Error::MissingToken(_)
109///         |Error::Cancelled
110///         |Error::UploadSizeLimitExceeded(_, _)
111///         |Error::Failure(_)
112///         |Error::BadRequest(_)
113///         |Error::FieldClash(_)
114///         |Error::JsonDecodeError(_, _) => println!("{}", e),
115///     },
116///     Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct PlayIntegrity<C> {
122    pub client: common::Client<C>,
123    pub auth: Box<dyn common::GetToken>,
124    _user_agent: String,
125    _base_url: String,
126    _root_url: String,
127}
128
129impl<C> common::Hub for PlayIntegrity<C> {}
130
131impl<'a, C> PlayIntegrity<C> {
132    pub fn new<A: 'static + common::GetToken>(
133        client: common::Client<C>,
134        auth: A,
135    ) -> PlayIntegrity<C> {
136        PlayIntegrity {
137            client,
138            auth: Box::new(auth),
139            _user_agent: "google-api-rust-client/7.0.0".to_string(),
140            _base_url: "https://playintegrity.googleapis.com/".to_string(),
141            _root_url: "https://playintegrity.googleapis.com/".to_string(),
142        }
143    }
144
145    pub fn device_recall(&'a self) -> DeviceRecallMethods<'a, C> {
146        DeviceRecallMethods { hub: self }
147    }
148    pub fn methods(&'a self) -> MethodMethods<'a, C> {
149        MethodMethods { hub: self }
150    }
151
152    /// Set the user-agent header field to use in all requests to the server.
153    /// It defaults to `google-api-rust-client/7.0.0`.
154    ///
155    /// Returns the previously set user-agent.
156    pub fn user_agent(&mut self, agent_name: String) -> String {
157        std::mem::replace(&mut self._user_agent, agent_name)
158    }
159
160    /// Set the base url to use in all requests to the server.
161    /// It defaults to `https://playintegrity.googleapis.com/`.
162    ///
163    /// Returns the previously set base url.
164    pub fn base_url(&mut self, new_base_url: String) -> String {
165        std::mem::replace(&mut self._base_url, new_base_url)
166    }
167
168    /// Set the root url to use in all requests to the server.
169    /// It defaults to `https://playintegrity.googleapis.com/`.
170    ///
171    /// Returns the previously set root url.
172    pub fn root_url(&mut self, new_root_url: String) -> String {
173        std::mem::replace(&mut self._root_url, new_root_url)
174    }
175}
176
177// ############
178// SCHEMAS ###
179// ##########
180/// (Restricted Access) Contains a signal helping apps differentiating between likely genuine and likely non-genuine user traffic.
181///
182/// This type is not used in any activity, and only used as *part* of another schema.
183///
184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
185#[serde_with::serde_as]
186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
187pub struct AccountActivity {
188    /// Required. Indicates the activity level of the account.
189    #[serde(rename = "activityLevel")]
190    pub activity_level: Option<String>,
191}
192
193impl common::Part for AccountActivity {}
194
195/// Contains the account information such as the licensing status for the user in the scope.
196///
197/// This type is not used in any activity, and only used as *part* of another schema.
198///
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct AccountDetails {
203    /// (Restricted Access) Details about the account activity for the user in the scope.
204    #[serde(rename = "accountActivity")]
205    pub account_activity: Option<AccountActivity>,
206    /// Required. Details about the licensing status of the user for the app in the scope.
207    #[serde(rename = "appLicensingVerdict")]
208    pub app_licensing_verdict: Option<String>,
209}
210
211impl common::Part for AccountDetails {}
212
213/// Contains signals about others apps on the device which could be used to access or control the requesting app.
214///
215/// This type is not used in any activity, and only used as *part* of another schema.
216///
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct AppAccessRiskVerdict {
221    /// List of detected app types signalled for App Access Risk.
222    #[serde(rename = "appsDetected")]
223    pub apps_detected: Option<Vec<String>>,
224}
225
226impl common::Part for AppAccessRiskVerdict {}
227
228/// Contains the application integrity information.
229///
230/// This type is not used in any activity, and only used as *part* of another schema.
231///
232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
233#[serde_with::serde_as]
234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
235pub struct AppIntegrity {
236    /// Required. Details about the app recognition verdict
237    #[serde(rename = "appRecognitionVerdict")]
238    pub app_recognition_verdict: Option<String>,
239    /// The SHA256 hash of the requesting app's signing certificates (base64 web-safe encoded). Set iff app_recognition_verdict != UNEVALUATED.
240    #[serde(rename = "certificateSha256Digest")]
241    pub certificate_sha256_digest: Option<Vec<String>>,
242    /// Package name of the application under attestation. Set iff app_recognition_verdict != UNEVALUATED.
243    #[serde(rename = "packageName")]
244    pub package_name: Option<String>,
245    /// Version code of the application. Set iff app_recognition_verdict != UNEVALUATED.
246    #[serde(rename = "versionCode")]
247    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
248    pub version_code: Option<i64>,
249}
250
251impl common::Part for AppIntegrity {}
252
253/// Request to decode the integrity token.
254///
255/// # Activities
256///
257/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
258/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
259///
260/// * [decode integrity token](MethodDecodeIntegrityTokenCall) (request)
261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
262#[serde_with::serde_as]
263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
264pub struct DecodeIntegrityTokenRequest {
265    /// Encoded integrity token.
266    #[serde(rename = "integrityToken")]
267    pub integrity_token: Option<String>,
268}
269
270impl common::RequestValue for DecodeIntegrityTokenRequest {}
271
272/// Response containing the decoded integrity payload.
273///
274/// # Activities
275///
276/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
277/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
278///
279/// * [decode integrity token](MethodDecodeIntegrityTokenCall) (response)
280#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
281#[serde_with::serde_as]
282#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
283pub struct DecodeIntegrityTokenResponse {
284    /// Plain token payload generated from the decoded integrity token.
285    #[serde(rename = "tokenPayloadExternal")]
286    pub token_payload_external: Option<TokenPayloadExternal>,
287}
288
289impl common::ResponseResult for DecodeIntegrityTokenResponse {}
290
291/// Request to decode the PC integrity token.
292///
293/// # Activities
294///
295/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
296/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
297///
298/// * [decode pc integrity token](MethodDecodePcIntegrityTokenCall) (request)
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct DecodePcIntegrityTokenRequest {
303    /// Encoded integrity token.
304    #[serde(rename = "integrityToken")]
305    pub integrity_token: Option<String>,
306}
307
308impl common::RequestValue for DecodePcIntegrityTokenRequest {}
309
310/// Response containing the decoded PC integrity payload.
311///
312/// # Activities
313///
314/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
315/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
316///
317/// * [decode pc integrity token](MethodDecodePcIntegrityTokenCall) (response)
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct DecodePcIntegrityTokenResponse {
322    /// Plain token payload generated from the decoded integrity token.
323    #[serde(rename = "tokenPayloadExternal")]
324    pub token_payload_external: Option<PcTokenPayloadExternal>,
325}
326
327impl common::ResponseResult for DecodePcIntegrityTokenResponse {}
328
329/// Contains information about the device for which the integrity token was generated, e.g. Android SDK version.
330///
331/// This type is not used in any activity, and only used as *part* of another schema.
332///
333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
334#[serde_with::serde_as]
335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
336pub struct DeviceAttributes {
337    /// Android SDK version of the device, as defined in the public Android documentation: https://developer.android.com/reference/android/os/Build.VERSION_CODES. It won't be set if a necessary requirement was missed. For example DeviceIntegrity did not meet the minimum bar.
338    #[serde(rename = "sdkVersion")]
339    pub sdk_version: Option<i32>,
340}
341
342impl common::Part for DeviceAttributes {}
343
344/// Contains the device attestation information.
345///
346/// This type is not used in any activity, and only used as *part* of another schema.
347///
348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
349#[serde_with::serde_as]
350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
351pub struct DeviceIntegrity {
352    /// Attributes of the device where the integrity token was generated.
353    #[serde(rename = "deviceAttributes")]
354    pub device_attributes: Option<DeviceAttributes>,
355    /// Details about the device recall bits set by the developer.
356    #[serde(rename = "deviceRecall")]
357    pub device_recall: Option<DeviceRecall>,
358    /// Details about the integrity of the device the app is running on.
359    #[serde(rename = "deviceRecognitionVerdict")]
360    pub device_recognition_verdict: Option<Vec<String>>,
361    /// Contains legacy details about the integrity of the device the app is running on. Only for devices with Android version T or higher and only for apps opted in to the new verdicts. Only available during the transition period to the new verdicts system and will be removed afterwards.
362    #[serde(rename = "legacyDeviceRecognitionVerdict")]
363    pub legacy_device_recognition_verdict: Option<Vec<String>>,
364    /// Details about the device activity of the device the app is running on.
365    #[serde(rename = "recentDeviceActivity")]
366    pub recent_device_activity: Option<RecentDeviceActivity>,
367}
368
369impl common::Part for DeviceIntegrity {}
370
371/// Contains the recall bits per device set by the developer.
372///
373/// This type is not used in any activity, and only used as *part* of another schema.
374///
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct DeviceRecall {
379    /// Required. Contains the recall bits values.
380    pub values: Option<Values>,
381    /// Required. Contains the recall bits write dates.
382    #[serde(rename = "writeDates")]
383    pub write_dates: Option<WriteDates>,
384}
385
386impl common::Part for DeviceRecall {}
387
388/// Contains information about the environment Play Integrity API runs in, e.g. Play Protect verdict.
389///
390/// This type is not used in any activity, and only used as *part* of another schema.
391///
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct EnvironmentDetails {
396    /// The evaluation of the App Access Risk verdicts.
397    #[serde(rename = "appAccessRiskVerdict")]
398    pub app_access_risk_verdict: Option<AppAccessRiskVerdict>,
399    /// The evaluation of Play Protect verdict.
400    #[serde(rename = "playProtectVerdict")]
401    pub play_protect_verdict: Option<String>,
402}
403
404impl common::Part for EnvironmentDetails {}
405
406/// Contains the account information such as the licensing status for the user in the scope.
407///
408/// This type is not used in any activity, and only used as *part* of another schema.
409///
410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
411#[serde_with::serde_as]
412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
413pub struct PcAccountDetails {
414    /// Required. Details about the licensing status of the user for the app in the scope.
415    #[serde(rename = "appLicensingVerdict")]
416    pub app_licensing_verdict: Option<String>,
417}
418
419impl common::Part for PcAccountDetails {}
420
421/// Contains the device attestation information.
422///
423/// This type is not used in any activity, and only used as *part* of another schema.
424///
425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
426#[serde_with::serde_as]
427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
428pub struct PcDeviceIntegrity {
429    /// Details about the integrity of the device the app is running on.
430    #[serde(rename = "deviceRecognitionVerdict")]
431    pub device_recognition_verdict: Option<Vec<String>>,
432}
433
434impl common::Part for PcDeviceIntegrity {}
435
436/// Contains the integrity request information.
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct PcRequestDetails {
444    /// Request hash that was provided in the request.
445    #[serde(rename = "requestHash")]
446    pub request_hash: Option<String>,
447    /// Required. Application package name this attestation was requested for. Note: This field makes no guarantees or promises on the caller integrity.
448    #[serde(rename = "requestPackageName")]
449    pub request_package_name: Option<String>,
450    /// Required. Timestamp, of the integrity application request.
451    #[serde(rename = "requestTime")]
452    pub request_time: Option<chrono::DateTime<chrono::offset::Utc>>,
453}
454
455impl common::Part for PcRequestDetails {}
456
457/// Contains additional information generated for testing responses.
458///
459/// This type is not used in any activity, and only used as *part* of another schema.
460///
461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
462#[serde_with::serde_as]
463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
464pub struct PcTestingDetails {
465    /// Indicates that the information contained in this payload is a testing response that is statically overridden for a tester.
466    #[serde(rename = "isTestingResponse")]
467    pub is_testing_response: Option<bool>,
468}
469
470impl common::Part for PcTestingDetails {}
471
472/// Contains PC device attestation details.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct PcTokenPayloadExternal {
480    /// Details about the account information such as the licensing status.
481    #[serde(rename = "accountDetails")]
482    pub account_details: Option<PcAccountDetails>,
483    /// Required. Details about the device integrity.
484    #[serde(rename = "deviceIntegrity")]
485    pub device_integrity: Option<PcDeviceIntegrity>,
486    /// Required. Details about the integrity request.
487    #[serde(rename = "requestDetails")]
488    pub request_details: Option<PcRequestDetails>,
489    /// Indicates that this payload is generated for testing purposes and contains any additional data that is linked with testing status.
490    #[serde(rename = "testingDetails")]
491    pub testing_details: Option<PcTestingDetails>,
492}
493
494impl common::Part for PcTokenPayloadExternal {}
495
496/// Recent device activity can help developers identify devices that have exhibited hyperactive attestation activity, which could be a sign of an attack or token farming.
497///
498/// This type is not used in any activity, and only used as *part* of another schema.
499///
500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
501#[serde_with::serde_as]
502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
503pub struct RecentDeviceActivity {
504    /// Required. Indicates the activity level of the device.
505    #[serde(rename = "deviceActivityLevel")]
506    pub device_activity_level: Option<String>,
507}
508
509impl common::Part for RecentDeviceActivity {}
510
511/// Contains the integrity request information.
512///
513/// This type is not used in any activity, and only used as *part* of another schema.
514///
515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
516#[serde_with::serde_as]
517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
518pub struct RequestDetails {
519    /// Nonce that was provided in the request (which is base64 web-safe no-wrap).
520    pub nonce: Option<String>,
521    /// Request hash that was provided in the request.
522    #[serde(rename = "requestHash")]
523    pub request_hash: Option<String>,
524    /// Required. Application package name this attestation was requested for. Note: This field makes no guarantees or promises on the caller integrity. For details on application integrity, check application_integrity.
525    #[serde(rename = "requestPackageName")]
526    pub request_package_name: Option<String>,
527    /// Required. Timestamp, in milliseconds, of the integrity application request.
528    #[serde(rename = "timestampMillis")]
529    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
530    pub timestamp_millis: Option<i64>,
531}
532
533impl common::Part for RequestDetails {}
534
535/// Contains additional information generated for testing responses.
536///
537/// This type is not used in any activity, and only used as *part* of another schema.
538///
539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
540#[serde_with::serde_as]
541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
542pub struct TestingDetails {
543    /// Required. Indicates that the information contained in this payload is a testing response that is statically overridden for a tester.
544    #[serde(rename = "isTestingResponse")]
545    pub is_testing_response: Option<bool>,
546}
547
548impl common::Part for TestingDetails {}
549
550/// Contains basic app information and integrity signals like device attestation and licensing details.
551///
552/// This type is not used in any activity, and only used as *part* of another schema.
553///
554#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
555#[serde_with::serde_as]
556#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
557pub struct TokenPayloadExternal {
558    /// Required. Details about the Play Store account.
559    #[serde(rename = "accountDetails")]
560    pub account_details: Option<AccountDetails>,
561    /// Required. Details about the application integrity.
562    #[serde(rename = "appIntegrity")]
563    pub app_integrity: Option<AppIntegrity>,
564    /// Required. Details about the device integrity.
565    #[serde(rename = "deviceIntegrity")]
566    pub device_integrity: Option<DeviceIntegrity>,
567    /// Details of the environment Play Integrity API runs in.
568    #[serde(rename = "environmentDetails")]
569    pub environment_details: Option<EnvironmentDetails>,
570    /// Required. Details about the integrity request.
571    #[serde(rename = "requestDetails")]
572    pub request_details: Option<RequestDetails>,
573    /// Indicates that this payload is generated for testing purposes and contains any additional data that is linked with testing status.
574    #[serde(rename = "testingDetails")]
575    pub testing_details: Option<TestingDetails>,
576}
577
578impl common::Part for TokenPayloadExternal {}
579
580/// Contains the recall bits values.
581///
582/// This type is not used in any activity, and only used as *part* of another schema.
583///
584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
585#[serde_with::serde_as]
586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
587pub struct Values {
588    /// Required. First recall bit value.
589    #[serde(rename = "bitFirst")]
590    pub bit_first: Option<bool>,
591    /// Required. Second recall bit value.
592    #[serde(rename = "bitSecond")]
593    pub bit_second: Option<bool>,
594    /// Required. Third recall bit value.
595    #[serde(rename = "bitThird")]
596    pub bit_third: Option<bool>,
597}
598
599impl common::Part for Values {}
600
601/// Contains the recall bits write dates.
602///
603/// This type is not used in any activity, and only used as *part* of another schema.
604///
605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
606#[serde_with::serde_as]
607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
608pub struct WriteDates {
609    /// Optional. Write time in YYYYMM format (in UTC, e.g. 202402) for the first bit. Note that this value won't be set if the first bit is false.
610    #[serde(rename = "yyyymmFirst")]
611    pub yyyymm_first: Option<i32>,
612    /// Optional. Write time in YYYYMM format (in UTC, e.g. 202402) for the second bit. Note that this value won't be set if the second bit is false.
613    #[serde(rename = "yyyymmSecond")]
614    pub yyyymm_second: Option<i32>,
615    /// Optional. Write time in YYYYMM format (in UTC, e.g. 202402) for the third bit. Note that this value won't be set if the third bit is false.
616    #[serde(rename = "yyyymmThird")]
617    pub yyyymm_third: Option<i32>,
618}
619
620impl common::Part for WriteDates {}
621
622/// Request to write device recall bits.
623///
624/// # Activities
625///
626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
628///
629/// * [write device recall](DeviceRecallWriteCall) (request)
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct WriteDeviceRecallRequest {
634    /// Required. Integrity token obtained from calling Play Integrity API.
635    #[serde(rename = "integrityToken")]
636    pub integrity_token: Option<String>,
637    /// Required. The new values for the device recall bits to be written.
638    #[serde(rename = "newValues")]
639    pub new_values: Option<Values>,
640}
641
642impl common::RequestValue for WriteDeviceRecallRequest {}
643
644/// Response for the Write Device Recall action. Currently empty.
645///
646/// # Activities
647///
648/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
649/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
650///
651/// * [write device recall](DeviceRecallWriteCall) (response)
652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
653#[serde_with::serde_as]
654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
655pub struct WriteDeviceRecallResponse {
656    _never_set: Option<bool>,
657}
658
659impl common::ResponseResult for WriteDeviceRecallResponse {}
660
661// ###################
662// MethodBuilders ###
663// #################
664
665/// A builder providing access to all methods supported on *deviceRecall* resources.
666/// It is not used directly, but through the [`PlayIntegrity`] hub.
667///
668/// # Example
669///
670/// Instantiate a resource builder
671///
672/// ```test_harness,no_run
673/// extern crate hyper;
674/// extern crate hyper_rustls;
675/// extern crate google_playintegrity1 as playintegrity1;
676///
677/// # async fn dox() {
678/// use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
679///
680/// let secret: yup_oauth2::ApplicationSecret = Default::default();
681/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
682///     .with_native_roots()
683///     .unwrap()
684///     .https_only()
685///     .enable_http2()
686///     .build();
687///
688/// let executor = hyper_util::rt::TokioExecutor::new();
689/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
690///     secret,
691///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
692///     yup_oauth2::client::CustomHyperClientBuilder::from(
693///         hyper_util::client::legacy::Client::builder(executor).build(connector),
694///     ),
695/// ).build().await.unwrap();
696///
697/// let client = hyper_util::client::legacy::Client::builder(
698///     hyper_util::rt::TokioExecutor::new()
699/// )
700/// .build(
701///     hyper_rustls::HttpsConnectorBuilder::new()
702///         .with_native_roots()
703///         .unwrap()
704///         .https_or_http()
705///         .enable_http2()
706///         .build()
707/// );
708/// let mut hub = PlayIntegrity::new(client, auth);
709/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
710/// // like `write(...)`
711/// // to build up your call.
712/// let rb = hub.device_recall();
713/// # }
714/// ```
715pub struct DeviceRecallMethods<'a, C>
716where
717    C: 'a,
718{
719    hub: &'a PlayIntegrity<C>,
720}
721
722impl<'a, C> common::MethodsBuilder for DeviceRecallMethods<'a, C> {}
723
724impl<'a, C> DeviceRecallMethods<'a, C> {
725    /// Create a builder to help you perform the following task:
726    ///
727    /// Writes recall bits for the device where Play Integrity API token is obtained. The endpoint is available to select Play partners in an early access program (EAP).
728    ///
729    /// # Arguments
730    ///
731    /// * `request` - No description provided.
732    /// * `packageName` - Required. Package name of the app the attached integrity token belongs to.
733    pub fn write(
734        &self,
735        request: WriteDeviceRecallRequest,
736        package_name: &str,
737    ) -> DeviceRecallWriteCall<'a, C> {
738        DeviceRecallWriteCall {
739            hub: self.hub,
740            _request: request,
741            _package_name: package_name.to_string(),
742            _delegate: Default::default(),
743            _additional_params: Default::default(),
744            _scopes: Default::default(),
745        }
746    }
747}
748
749/// A builder providing access to all free methods, which are not associated with a particular resource.
750/// It is not used directly, but through the [`PlayIntegrity`] hub.
751///
752/// # Example
753///
754/// Instantiate a resource builder
755///
756/// ```test_harness,no_run
757/// extern crate hyper;
758/// extern crate hyper_rustls;
759/// extern crate google_playintegrity1 as playintegrity1;
760///
761/// # async fn dox() {
762/// use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
763///
764/// let secret: yup_oauth2::ApplicationSecret = Default::default();
765/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
766///     .with_native_roots()
767///     .unwrap()
768///     .https_only()
769///     .enable_http2()
770///     .build();
771///
772/// let executor = hyper_util::rt::TokioExecutor::new();
773/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
774///     secret,
775///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
776///     yup_oauth2::client::CustomHyperClientBuilder::from(
777///         hyper_util::client::legacy::Client::builder(executor).build(connector),
778///     ),
779/// ).build().await.unwrap();
780///
781/// let client = hyper_util::client::legacy::Client::builder(
782///     hyper_util::rt::TokioExecutor::new()
783/// )
784/// .build(
785///     hyper_rustls::HttpsConnectorBuilder::new()
786///         .with_native_roots()
787///         .unwrap()
788///         .https_or_http()
789///         .enable_http2()
790///         .build()
791/// );
792/// let mut hub = PlayIntegrity::new(client, auth);
793/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
794/// // like `decode_integrity_token(...)` and `decode_pc_integrity_token(...)`
795/// // to build up your call.
796/// let rb = hub.methods();
797/// # }
798/// ```
799pub struct MethodMethods<'a, C>
800where
801    C: 'a,
802{
803    hub: &'a PlayIntegrity<C>,
804}
805
806impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
807
808impl<'a, C> MethodMethods<'a, C> {
809    /// Create a builder to help you perform the following task:
810    ///
811    /// Decodes the integrity token and returns the token payload.
812    ///
813    /// # Arguments
814    ///
815    /// * `request` - No description provided.
816    /// * `packageName` -  Package name of the app the attached integrity token belongs to.
817    pub fn decode_integrity_token(
818        &self,
819        request: DecodeIntegrityTokenRequest,
820        package_name: &str,
821    ) -> MethodDecodeIntegrityTokenCall<'a, C> {
822        MethodDecodeIntegrityTokenCall {
823            hub: self.hub,
824            _request: request,
825            _package_name: package_name.to_string(),
826            _delegate: Default::default(),
827            _additional_params: Default::default(),
828            _scopes: Default::default(),
829        }
830    }
831
832    /// Create a builder to help you perform the following task:
833    ///
834    /// Decodes the PC integrity token and returns the PC token payload.
835    ///
836    /// # Arguments
837    ///
838    /// * `request` - No description provided.
839    /// * `packageName` - Package name of the app the attached integrity token belongs to.
840    pub fn decode_pc_integrity_token(
841        &self,
842        request: DecodePcIntegrityTokenRequest,
843        package_name: &str,
844    ) -> MethodDecodePcIntegrityTokenCall<'a, C> {
845        MethodDecodePcIntegrityTokenCall {
846            hub: self.hub,
847            _request: request,
848            _package_name: package_name.to_string(),
849            _delegate: Default::default(),
850            _additional_params: Default::default(),
851            _scopes: Default::default(),
852        }
853    }
854}
855
856// ###################
857// CallBuilders   ###
858// #################
859
860/// Writes recall bits for the device where Play Integrity API token is obtained. The endpoint is available to select Play partners in an early access program (EAP).
861///
862/// A builder for the *write* method supported by a *deviceRecall* resource.
863/// It is not used directly, but through a [`DeviceRecallMethods`] instance.
864///
865/// # Example
866///
867/// Instantiate a resource method builder
868///
869/// ```test_harness,no_run
870/// # extern crate hyper;
871/// # extern crate hyper_rustls;
872/// # extern crate google_playintegrity1 as playintegrity1;
873/// use playintegrity1::api::WriteDeviceRecallRequest;
874/// # async fn dox() {
875/// # use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
876///
877/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
878/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
879/// #     .with_native_roots()
880/// #     .unwrap()
881/// #     .https_only()
882/// #     .enable_http2()
883/// #     .build();
884///
885/// # let executor = hyper_util::rt::TokioExecutor::new();
886/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
887/// #     secret,
888/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
889/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
890/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
891/// #     ),
892/// # ).build().await.unwrap();
893///
894/// # let client = hyper_util::client::legacy::Client::builder(
895/// #     hyper_util::rt::TokioExecutor::new()
896/// # )
897/// # .build(
898/// #     hyper_rustls::HttpsConnectorBuilder::new()
899/// #         .with_native_roots()
900/// #         .unwrap()
901/// #         .https_or_http()
902/// #         .enable_http2()
903/// #         .build()
904/// # );
905/// # let mut hub = PlayIntegrity::new(client, auth);
906/// // As the method needs a request, you would usually fill it with the desired information
907/// // into the respective structure. Some of the parts shown here might not be applicable !
908/// // Values shown here are possibly random and not representative !
909/// let mut req = WriteDeviceRecallRequest::default();
910///
911/// // You can configure optional parameters by calling the respective setters at will, and
912/// // execute the final call using `doit()`.
913/// // Values shown here are possibly random and not representative !
914/// let result = hub.device_recall().write(req, "packageName")
915///              .doit().await;
916/// # }
917/// ```
918pub struct DeviceRecallWriteCall<'a, C>
919where
920    C: 'a,
921{
922    hub: &'a PlayIntegrity<C>,
923    _request: WriteDeviceRecallRequest,
924    _package_name: String,
925    _delegate: Option<&'a mut dyn common::Delegate>,
926    _additional_params: HashMap<String, String>,
927    _scopes: BTreeSet<String>,
928}
929
930impl<'a, C> common::CallBuilder for DeviceRecallWriteCall<'a, C> {}
931
932impl<'a, C> DeviceRecallWriteCall<'a, C>
933where
934    C: common::Connector,
935{
936    /// Perform the operation you have build so far.
937    pub async fn doit(mut self) -> common::Result<(common::Response, WriteDeviceRecallResponse)> {
938        use std::borrow::Cow;
939        use std::io::{Read, Seek};
940
941        use common::{url::Params, ToParts};
942        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
943
944        let mut dd = common::DefaultDelegate;
945        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
946        dlg.begin(common::MethodInfo {
947            id: "playintegrity.deviceRecall.write",
948            http_method: hyper::Method::POST,
949        });
950
951        for &field in ["alt", "packageName"].iter() {
952            if self._additional_params.contains_key(field) {
953                dlg.finished(false);
954                return Err(common::Error::FieldClash(field));
955            }
956        }
957
958        let mut params = Params::with_capacity(4 + self._additional_params.len());
959        params.push("packageName", self._package_name);
960
961        params.extend(self._additional_params.iter());
962
963        params.push("alt", "json");
964        let mut url = self.hub._base_url.clone() + "v1/{+packageName}/deviceRecall:write";
965        if self._scopes.is_empty() {
966            self._scopes.insert(Scope::Full.as_ref().to_string());
967        }
968
969        #[allow(clippy::single_element_loop)]
970        for &(find_this, param_name) in [("{+packageName}", "packageName")].iter() {
971            url = params.uri_replacement(url, param_name, find_this, true);
972        }
973        {
974            let to_remove = ["packageName"];
975            params.remove_params(&to_remove);
976        }
977
978        let url = params.parse_with_url(&url);
979
980        let mut json_mime_type = mime::APPLICATION_JSON;
981        let mut request_value_reader = {
982            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
983            common::remove_json_null_values(&mut value);
984            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
985            serde_json::to_writer(&mut dst, &value).unwrap();
986            dst
987        };
988        let request_size = request_value_reader
989            .seek(std::io::SeekFrom::End(0))
990            .unwrap();
991        request_value_reader
992            .seek(std::io::SeekFrom::Start(0))
993            .unwrap();
994
995        loop {
996            let token = match self
997                .hub
998                .auth
999                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1000                .await
1001            {
1002                Ok(token) => token,
1003                Err(e) => match dlg.token(e) {
1004                    Ok(token) => token,
1005                    Err(e) => {
1006                        dlg.finished(false);
1007                        return Err(common::Error::MissingToken(e));
1008                    }
1009                },
1010            };
1011            request_value_reader
1012                .seek(std::io::SeekFrom::Start(0))
1013                .unwrap();
1014            let mut req_result = {
1015                let client = &self.hub.client;
1016                dlg.pre_request();
1017                let mut req_builder = hyper::Request::builder()
1018                    .method(hyper::Method::POST)
1019                    .uri(url.as_str())
1020                    .header(USER_AGENT, self.hub._user_agent.clone());
1021
1022                if let Some(token) = token.as_ref() {
1023                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1024                }
1025
1026                let request = req_builder
1027                    .header(CONTENT_TYPE, json_mime_type.to_string())
1028                    .header(CONTENT_LENGTH, request_size as u64)
1029                    .body(common::to_body(
1030                        request_value_reader.get_ref().clone().into(),
1031                    ));
1032
1033                client.request(request.unwrap()).await
1034            };
1035
1036            match req_result {
1037                Err(err) => {
1038                    if let common::Retry::After(d) = dlg.http_error(&err) {
1039                        sleep(d).await;
1040                        continue;
1041                    }
1042                    dlg.finished(false);
1043                    return Err(common::Error::HttpError(err));
1044                }
1045                Ok(res) => {
1046                    let (mut parts, body) = res.into_parts();
1047                    let mut body = common::Body::new(body);
1048                    if !parts.status.is_success() {
1049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1050                        let error = serde_json::from_str(&common::to_string(&bytes));
1051                        let response = common::to_response(parts, bytes.into());
1052
1053                        if let common::Retry::After(d) =
1054                            dlg.http_failure(&response, error.as_ref().ok())
1055                        {
1056                            sleep(d).await;
1057                            continue;
1058                        }
1059
1060                        dlg.finished(false);
1061
1062                        return Err(match error {
1063                            Ok(value) => common::Error::BadRequest(value),
1064                            _ => common::Error::Failure(response),
1065                        });
1066                    }
1067                    let response = {
1068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1069                        let encoded = common::to_string(&bytes);
1070                        match serde_json::from_str(&encoded) {
1071                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1072                            Err(error) => {
1073                                dlg.response_json_decode_error(&encoded, &error);
1074                                return Err(common::Error::JsonDecodeError(
1075                                    encoded.to_string(),
1076                                    error,
1077                                ));
1078                            }
1079                        }
1080                    };
1081
1082                    dlg.finished(true);
1083                    return Ok(response);
1084                }
1085            }
1086        }
1087    }
1088
1089    ///
1090    /// Sets the *request* property to the given value.
1091    ///
1092    /// Even though the property as already been set when instantiating this call,
1093    /// we provide this method for API completeness.
1094    pub fn request(mut self, new_value: WriteDeviceRecallRequest) -> DeviceRecallWriteCall<'a, C> {
1095        self._request = new_value;
1096        self
1097    }
1098    /// Required. Package name of the app the attached integrity token belongs to.
1099    ///
1100    /// Sets the *package name* path property to the given value.
1101    ///
1102    /// Even though the property as already been set when instantiating this call,
1103    /// we provide this method for API completeness.
1104    pub fn package_name(mut self, new_value: &str) -> DeviceRecallWriteCall<'a, C> {
1105        self._package_name = new_value.to_string();
1106        self
1107    }
1108    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1109    /// while executing the actual API request.
1110    ///
1111    /// ````text
1112    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1113    /// ````
1114    ///
1115    /// Sets the *delegate* property to the given value.
1116    pub fn delegate(
1117        mut self,
1118        new_value: &'a mut dyn common::Delegate,
1119    ) -> DeviceRecallWriteCall<'a, C> {
1120        self._delegate = Some(new_value);
1121        self
1122    }
1123
1124    /// Set any additional parameter of the query string used in the request.
1125    /// It should be used to set parameters which are not yet available through their own
1126    /// setters.
1127    ///
1128    /// Please note that this method must not be used to set any of the known parameters
1129    /// which have their own setter method. If done anyway, the request will fail.
1130    ///
1131    /// # Additional Parameters
1132    ///
1133    /// * *$.xgafv* (query-string) - V1 error format.
1134    /// * *access_token* (query-string) - OAuth access token.
1135    /// * *alt* (query-string) - Data format for response.
1136    /// * *callback* (query-string) - JSONP
1137    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1138    /// * *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.
1139    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1140    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1141    /// * *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.
1142    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1143    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1144    pub fn param<T>(mut self, name: T, value: T) -> DeviceRecallWriteCall<'a, C>
1145    where
1146        T: AsRef<str>,
1147    {
1148        self._additional_params
1149            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1150        self
1151    }
1152
1153    /// Identifies the authorization scope for the method you are building.
1154    ///
1155    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1156    /// [`Scope::Full`].
1157    ///
1158    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1159    /// tokens for more than one scope.
1160    ///
1161    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1162    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1163    /// sufficient, a read-write scope will do as well.
1164    pub fn add_scope<St>(mut self, scope: St) -> DeviceRecallWriteCall<'a, C>
1165    where
1166        St: AsRef<str>,
1167    {
1168        self._scopes.insert(String::from(scope.as_ref()));
1169        self
1170    }
1171    /// Identifies the authorization scope(s) for the method you are building.
1172    ///
1173    /// See [`Self::add_scope()`] for details.
1174    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceRecallWriteCall<'a, C>
1175    where
1176        I: IntoIterator<Item = St>,
1177        St: AsRef<str>,
1178    {
1179        self._scopes
1180            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1181        self
1182    }
1183
1184    /// Removes all scopes, and no default scope will be used either.
1185    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1186    /// for details).
1187    pub fn clear_scopes(mut self) -> DeviceRecallWriteCall<'a, C> {
1188        self._scopes.clear();
1189        self
1190    }
1191}
1192
1193/// Decodes the integrity token and returns the token payload.
1194///
1195/// A builder for the *decodeIntegrityToken* method.
1196/// It is not used directly, but through a [`MethodMethods`] instance.
1197///
1198/// # Example
1199///
1200/// Instantiate a resource method builder
1201///
1202/// ```test_harness,no_run
1203/// # extern crate hyper;
1204/// # extern crate hyper_rustls;
1205/// # extern crate google_playintegrity1 as playintegrity1;
1206/// use playintegrity1::api::DecodeIntegrityTokenRequest;
1207/// # async fn dox() {
1208/// # use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1209///
1210/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1211/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1212/// #     .with_native_roots()
1213/// #     .unwrap()
1214/// #     .https_only()
1215/// #     .enable_http2()
1216/// #     .build();
1217///
1218/// # let executor = hyper_util::rt::TokioExecutor::new();
1219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1220/// #     secret,
1221/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1222/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1223/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1224/// #     ),
1225/// # ).build().await.unwrap();
1226///
1227/// # let client = hyper_util::client::legacy::Client::builder(
1228/// #     hyper_util::rt::TokioExecutor::new()
1229/// # )
1230/// # .build(
1231/// #     hyper_rustls::HttpsConnectorBuilder::new()
1232/// #         .with_native_roots()
1233/// #         .unwrap()
1234/// #         .https_or_http()
1235/// #         .enable_http2()
1236/// #         .build()
1237/// # );
1238/// # let mut hub = PlayIntegrity::new(client, auth);
1239/// // As the method needs a request, you would usually fill it with the desired information
1240/// // into the respective structure. Some of the parts shown here might not be applicable !
1241/// // Values shown here are possibly random and not representative !
1242/// let mut req = DecodeIntegrityTokenRequest::default();
1243///
1244/// // You can configure optional parameters by calling the respective setters at will, and
1245/// // execute the final call using `doit()`.
1246/// // Values shown here are possibly random and not representative !
1247/// let result = hub.methods().decode_integrity_token(req, "packageName")
1248///              .doit().await;
1249/// # }
1250/// ```
1251pub struct MethodDecodeIntegrityTokenCall<'a, C>
1252where
1253    C: 'a,
1254{
1255    hub: &'a PlayIntegrity<C>,
1256    _request: DecodeIntegrityTokenRequest,
1257    _package_name: String,
1258    _delegate: Option<&'a mut dyn common::Delegate>,
1259    _additional_params: HashMap<String, String>,
1260    _scopes: BTreeSet<String>,
1261}
1262
1263impl<'a, C> common::CallBuilder for MethodDecodeIntegrityTokenCall<'a, C> {}
1264
1265impl<'a, C> MethodDecodeIntegrityTokenCall<'a, C>
1266where
1267    C: common::Connector,
1268{
1269    /// Perform the operation you have build so far.
1270    pub async fn doit(
1271        mut self,
1272    ) -> common::Result<(common::Response, DecodeIntegrityTokenResponse)> {
1273        use std::borrow::Cow;
1274        use std::io::{Read, Seek};
1275
1276        use common::{url::Params, ToParts};
1277        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1278
1279        let mut dd = common::DefaultDelegate;
1280        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1281        dlg.begin(common::MethodInfo {
1282            id: "playintegrity.decodeIntegrityToken",
1283            http_method: hyper::Method::POST,
1284        });
1285
1286        for &field in ["alt", "packageName"].iter() {
1287            if self._additional_params.contains_key(field) {
1288                dlg.finished(false);
1289                return Err(common::Error::FieldClash(field));
1290            }
1291        }
1292
1293        let mut params = Params::with_capacity(4 + self._additional_params.len());
1294        params.push("packageName", self._package_name);
1295
1296        params.extend(self._additional_params.iter());
1297
1298        params.push("alt", "json");
1299        let mut url = self.hub._base_url.clone() + "v1/{+packageName}:decodeIntegrityToken";
1300        if self._scopes.is_empty() {
1301            self._scopes.insert(Scope::Full.as_ref().to_string());
1302        }
1303
1304        #[allow(clippy::single_element_loop)]
1305        for &(find_this, param_name) in [("{+packageName}", "packageName")].iter() {
1306            url = params.uri_replacement(url, param_name, find_this, true);
1307        }
1308        {
1309            let to_remove = ["packageName"];
1310            params.remove_params(&to_remove);
1311        }
1312
1313        let url = params.parse_with_url(&url);
1314
1315        let mut json_mime_type = mime::APPLICATION_JSON;
1316        let mut request_value_reader = {
1317            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1318            common::remove_json_null_values(&mut value);
1319            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1320            serde_json::to_writer(&mut dst, &value).unwrap();
1321            dst
1322        };
1323        let request_size = request_value_reader
1324            .seek(std::io::SeekFrom::End(0))
1325            .unwrap();
1326        request_value_reader
1327            .seek(std::io::SeekFrom::Start(0))
1328            .unwrap();
1329
1330        loop {
1331            let token = match self
1332                .hub
1333                .auth
1334                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1335                .await
1336            {
1337                Ok(token) => token,
1338                Err(e) => match dlg.token(e) {
1339                    Ok(token) => token,
1340                    Err(e) => {
1341                        dlg.finished(false);
1342                        return Err(common::Error::MissingToken(e));
1343                    }
1344                },
1345            };
1346            request_value_reader
1347                .seek(std::io::SeekFrom::Start(0))
1348                .unwrap();
1349            let mut req_result = {
1350                let client = &self.hub.client;
1351                dlg.pre_request();
1352                let mut req_builder = hyper::Request::builder()
1353                    .method(hyper::Method::POST)
1354                    .uri(url.as_str())
1355                    .header(USER_AGENT, self.hub._user_agent.clone());
1356
1357                if let Some(token) = token.as_ref() {
1358                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1359                }
1360
1361                let request = req_builder
1362                    .header(CONTENT_TYPE, json_mime_type.to_string())
1363                    .header(CONTENT_LENGTH, request_size as u64)
1364                    .body(common::to_body(
1365                        request_value_reader.get_ref().clone().into(),
1366                    ));
1367
1368                client.request(request.unwrap()).await
1369            };
1370
1371            match req_result {
1372                Err(err) => {
1373                    if let common::Retry::After(d) = dlg.http_error(&err) {
1374                        sleep(d).await;
1375                        continue;
1376                    }
1377                    dlg.finished(false);
1378                    return Err(common::Error::HttpError(err));
1379                }
1380                Ok(res) => {
1381                    let (mut parts, body) = res.into_parts();
1382                    let mut body = common::Body::new(body);
1383                    if !parts.status.is_success() {
1384                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1385                        let error = serde_json::from_str(&common::to_string(&bytes));
1386                        let response = common::to_response(parts, bytes.into());
1387
1388                        if let common::Retry::After(d) =
1389                            dlg.http_failure(&response, error.as_ref().ok())
1390                        {
1391                            sleep(d).await;
1392                            continue;
1393                        }
1394
1395                        dlg.finished(false);
1396
1397                        return Err(match error {
1398                            Ok(value) => common::Error::BadRequest(value),
1399                            _ => common::Error::Failure(response),
1400                        });
1401                    }
1402                    let response = {
1403                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1404                        let encoded = common::to_string(&bytes);
1405                        match serde_json::from_str(&encoded) {
1406                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1407                            Err(error) => {
1408                                dlg.response_json_decode_error(&encoded, &error);
1409                                return Err(common::Error::JsonDecodeError(
1410                                    encoded.to_string(),
1411                                    error,
1412                                ));
1413                            }
1414                        }
1415                    };
1416
1417                    dlg.finished(true);
1418                    return Ok(response);
1419                }
1420            }
1421        }
1422    }
1423
1424    ///
1425    /// Sets the *request* property to the given value.
1426    ///
1427    /// Even though the property as already been set when instantiating this call,
1428    /// we provide this method for API completeness.
1429    pub fn request(
1430        mut self,
1431        new_value: DecodeIntegrityTokenRequest,
1432    ) -> MethodDecodeIntegrityTokenCall<'a, C> {
1433        self._request = new_value;
1434        self
1435    }
1436    ///  Package name of the app the attached integrity token belongs to.
1437    ///
1438    /// Sets the *package name* path property to the given value.
1439    ///
1440    /// Even though the property as already been set when instantiating this call,
1441    /// we provide this method for API completeness.
1442    pub fn package_name(mut self, new_value: &str) -> MethodDecodeIntegrityTokenCall<'a, C> {
1443        self._package_name = new_value.to_string();
1444        self
1445    }
1446    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1447    /// while executing the actual API request.
1448    ///
1449    /// ````text
1450    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1451    /// ````
1452    ///
1453    /// Sets the *delegate* property to the given value.
1454    pub fn delegate(
1455        mut self,
1456        new_value: &'a mut dyn common::Delegate,
1457    ) -> MethodDecodeIntegrityTokenCall<'a, C> {
1458        self._delegate = Some(new_value);
1459        self
1460    }
1461
1462    /// Set any additional parameter of the query string used in the request.
1463    /// It should be used to set parameters which are not yet available through their own
1464    /// setters.
1465    ///
1466    /// Please note that this method must not be used to set any of the known parameters
1467    /// which have their own setter method. If done anyway, the request will fail.
1468    ///
1469    /// # Additional Parameters
1470    ///
1471    /// * *$.xgafv* (query-string) - V1 error format.
1472    /// * *access_token* (query-string) - OAuth access token.
1473    /// * *alt* (query-string) - Data format for response.
1474    /// * *callback* (query-string) - JSONP
1475    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1476    /// * *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.
1477    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1478    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1479    /// * *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.
1480    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1481    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1482    pub fn param<T>(mut self, name: T, value: T) -> MethodDecodeIntegrityTokenCall<'a, C>
1483    where
1484        T: AsRef<str>,
1485    {
1486        self._additional_params
1487            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1488        self
1489    }
1490
1491    /// Identifies the authorization scope for the method you are building.
1492    ///
1493    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1494    /// [`Scope::Full`].
1495    ///
1496    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1497    /// tokens for more than one scope.
1498    ///
1499    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1500    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1501    /// sufficient, a read-write scope will do as well.
1502    pub fn add_scope<St>(mut self, scope: St) -> MethodDecodeIntegrityTokenCall<'a, C>
1503    where
1504        St: AsRef<str>,
1505    {
1506        self._scopes.insert(String::from(scope.as_ref()));
1507        self
1508    }
1509    /// Identifies the authorization scope(s) for the method you are building.
1510    ///
1511    /// See [`Self::add_scope()`] for details.
1512    pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodDecodeIntegrityTokenCall<'a, C>
1513    where
1514        I: IntoIterator<Item = St>,
1515        St: AsRef<str>,
1516    {
1517        self._scopes
1518            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1519        self
1520    }
1521
1522    /// Removes all scopes, and no default scope will be used either.
1523    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1524    /// for details).
1525    pub fn clear_scopes(mut self) -> MethodDecodeIntegrityTokenCall<'a, C> {
1526        self._scopes.clear();
1527        self
1528    }
1529}
1530
1531/// Decodes the PC integrity token and returns the PC token payload.
1532///
1533/// A builder for the *decodePcIntegrityToken* method.
1534/// It is not used directly, but through a [`MethodMethods`] instance.
1535///
1536/// # Example
1537///
1538/// Instantiate a resource method builder
1539///
1540/// ```test_harness,no_run
1541/// # extern crate hyper;
1542/// # extern crate hyper_rustls;
1543/// # extern crate google_playintegrity1 as playintegrity1;
1544/// use playintegrity1::api::DecodePcIntegrityTokenRequest;
1545/// # async fn dox() {
1546/// # use playintegrity1::{PlayIntegrity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1547///
1548/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1549/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1550/// #     .with_native_roots()
1551/// #     .unwrap()
1552/// #     .https_only()
1553/// #     .enable_http2()
1554/// #     .build();
1555///
1556/// # let executor = hyper_util::rt::TokioExecutor::new();
1557/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1558/// #     secret,
1559/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1560/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1561/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1562/// #     ),
1563/// # ).build().await.unwrap();
1564///
1565/// # let client = hyper_util::client::legacy::Client::builder(
1566/// #     hyper_util::rt::TokioExecutor::new()
1567/// # )
1568/// # .build(
1569/// #     hyper_rustls::HttpsConnectorBuilder::new()
1570/// #         .with_native_roots()
1571/// #         .unwrap()
1572/// #         .https_or_http()
1573/// #         .enable_http2()
1574/// #         .build()
1575/// # );
1576/// # let mut hub = PlayIntegrity::new(client, auth);
1577/// // As the method needs a request, you would usually fill it with the desired information
1578/// // into the respective structure. Some of the parts shown here might not be applicable !
1579/// // Values shown here are possibly random and not representative !
1580/// let mut req = DecodePcIntegrityTokenRequest::default();
1581///
1582/// // You can configure optional parameters by calling the respective setters at will, and
1583/// // execute the final call using `doit()`.
1584/// // Values shown here are possibly random and not representative !
1585/// let result = hub.methods().decode_pc_integrity_token(req, "packageName")
1586///              .doit().await;
1587/// # }
1588/// ```
1589pub struct MethodDecodePcIntegrityTokenCall<'a, C>
1590where
1591    C: 'a,
1592{
1593    hub: &'a PlayIntegrity<C>,
1594    _request: DecodePcIntegrityTokenRequest,
1595    _package_name: String,
1596    _delegate: Option<&'a mut dyn common::Delegate>,
1597    _additional_params: HashMap<String, String>,
1598    _scopes: BTreeSet<String>,
1599}
1600
1601impl<'a, C> common::CallBuilder for MethodDecodePcIntegrityTokenCall<'a, C> {}
1602
1603impl<'a, C> MethodDecodePcIntegrityTokenCall<'a, C>
1604where
1605    C: common::Connector,
1606{
1607    /// Perform the operation you have build so far.
1608    pub async fn doit(
1609        mut self,
1610    ) -> common::Result<(common::Response, DecodePcIntegrityTokenResponse)> {
1611        use std::borrow::Cow;
1612        use std::io::{Read, Seek};
1613
1614        use common::{url::Params, ToParts};
1615        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1616
1617        let mut dd = common::DefaultDelegate;
1618        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1619        dlg.begin(common::MethodInfo {
1620            id: "playintegrity.decodePcIntegrityToken",
1621            http_method: hyper::Method::POST,
1622        });
1623
1624        for &field in ["alt", "packageName"].iter() {
1625            if self._additional_params.contains_key(field) {
1626                dlg.finished(false);
1627                return Err(common::Error::FieldClash(field));
1628            }
1629        }
1630
1631        let mut params = Params::with_capacity(4 + self._additional_params.len());
1632        params.push("packageName", self._package_name);
1633
1634        params.extend(self._additional_params.iter());
1635
1636        params.push("alt", "json");
1637        let mut url = self.hub._base_url.clone() + "v1/{+packageName}:decodePcIntegrityToken";
1638        if self._scopes.is_empty() {
1639            self._scopes.insert(Scope::Full.as_ref().to_string());
1640        }
1641
1642        #[allow(clippy::single_element_loop)]
1643        for &(find_this, param_name) in [("{+packageName}", "packageName")].iter() {
1644            url = params.uri_replacement(url, param_name, find_this, true);
1645        }
1646        {
1647            let to_remove = ["packageName"];
1648            params.remove_params(&to_remove);
1649        }
1650
1651        let url = params.parse_with_url(&url);
1652
1653        let mut json_mime_type = mime::APPLICATION_JSON;
1654        let mut request_value_reader = {
1655            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1656            common::remove_json_null_values(&mut value);
1657            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1658            serde_json::to_writer(&mut dst, &value).unwrap();
1659            dst
1660        };
1661        let request_size = request_value_reader
1662            .seek(std::io::SeekFrom::End(0))
1663            .unwrap();
1664        request_value_reader
1665            .seek(std::io::SeekFrom::Start(0))
1666            .unwrap();
1667
1668        loop {
1669            let token = match self
1670                .hub
1671                .auth
1672                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1673                .await
1674            {
1675                Ok(token) => token,
1676                Err(e) => match dlg.token(e) {
1677                    Ok(token) => token,
1678                    Err(e) => {
1679                        dlg.finished(false);
1680                        return Err(common::Error::MissingToken(e));
1681                    }
1682                },
1683            };
1684            request_value_reader
1685                .seek(std::io::SeekFrom::Start(0))
1686                .unwrap();
1687            let mut req_result = {
1688                let client = &self.hub.client;
1689                dlg.pre_request();
1690                let mut req_builder = hyper::Request::builder()
1691                    .method(hyper::Method::POST)
1692                    .uri(url.as_str())
1693                    .header(USER_AGENT, self.hub._user_agent.clone());
1694
1695                if let Some(token) = token.as_ref() {
1696                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1697                }
1698
1699                let request = req_builder
1700                    .header(CONTENT_TYPE, json_mime_type.to_string())
1701                    .header(CONTENT_LENGTH, request_size as u64)
1702                    .body(common::to_body(
1703                        request_value_reader.get_ref().clone().into(),
1704                    ));
1705
1706                client.request(request.unwrap()).await
1707            };
1708
1709            match req_result {
1710                Err(err) => {
1711                    if let common::Retry::After(d) = dlg.http_error(&err) {
1712                        sleep(d).await;
1713                        continue;
1714                    }
1715                    dlg.finished(false);
1716                    return Err(common::Error::HttpError(err));
1717                }
1718                Ok(res) => {
1719                    let (mut parts, body) = res.into_parts();
1720                    let mut body = common::Body::new(body);
1721                    if !parts.status.is_success() {
1722                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1723                        let error = serde_json::from_str(&common::to_string(&bytes));
1724                        let response = common::to_response(parts, bytes.into());
1725
1726                        if let common::Retry::After(d) =
1727                            dlg.http_failure(&response, error.as_ref().ok())
1728                        {
1729                            sleep(d).await;
1730                            continue;
1731                        }
1732
1733                        dlg.finished(false);
1734
1735                        return Err(match error {
1736                            Ok(value) => common::Error::BadRequest(value),
1737                            _ => common::Error::Failure(response),
1738                        });
1739                    }
1740                    let response = {
1741                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1742                        let encoded = common::to_string(&bytes);
1743                        match serde_json::from_str(&encoded) {
1744                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1745                            Err(error) => {
1746                                dlg.response_json_decode_error(&encoded, &error);
1747                                return Err(common::Error::JsonDecodeError(
1748                                    encoded.to_string(),
1749                                    error,
1750                                ));
1751                            }
1752                        }
1753                    };
1754
1755                    dlg.finished(true);
1756                    return Ok(response);
1757                }
1758            }
1759        }
1760    }
1761
1762    ///
1763    /// Sets the *request* property to the given value.
1764    ///
1765    /// Even though the property as already been set when instantiating this call,
1766    /// we provide this method for API completeness.
1767    pub fn request(
1768        mut self,
1769        new_value: DecodePcIntegrityTokenRequest,
1770    ) -> MethodDecodePcIntegrityTokenCall<'a, C> {
1771        self._request = new_value;
1772        self
1773    }
1774    /// Package name of the app the attached integrity token belongs to.
1775    ///
1776    /// Sets the *package name* path property to the given value.
1777    ///
1778    /// Even though the property as already been set when instantiating this call,
1779    /// we provide this method for API completeness.
1780    pub fn package_name(mut self, new_value: &str) -> MethodDecodePcIntegrityTokenCall<'a, C> {
1781        self._package_name = new_value.to_string();
1782        self
1783    }
1784    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1785    /// while executing the actual API request.
1786    ///
1787    /// ````text
1788    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1789    /// ````
1790    ///
1791    /// Sets the *delegate* property to the given value.
1792    pub fn delegate(
1793        mut self,
1794        new_value: &'a mut dyn common::Delegate,
1795    ) -> MethodDecodePcIntegrityTokenCall<'a, C> {
1796        self._delegate = Some(new_value);
1797        self
1798    }
1799
1800    /// Set any additional parameter of the query string used in the request.
1801    /// It should be used to set parameters which are not yet available through their own
1802    /// setters.
1803    ///
1804    /// Please note that this method must not be used to set any of the known parameters
1805    /// which have their own setter method. If done anyway, the request will fail.
1806    ///
1807    /// # Additional Parameters
1808    ///
1809    /// * *$.xgafv* (query-string) - V1 error format.
1810    /// * *access_token* (query-string) - OAuth access token.
1811    /// * *alt* (query-string) - Data format for response.
1812    /// * *callback* (query-string) - JSONP
1813    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1814    /// * *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.
1815    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1816    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1817    /// * *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.
1818    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1819    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1820    pub fn param<T>(mut self, name: T, value: T) -> MethodDecodePcIntegrityTokenCall<'a, C>
1821    where
1822        T: AsRef<str>,
1823    {
1824        self._additional_params
1825            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1826        self
1827    }
1828
1829    /// Identifies the authorization scope for the method you are building.
1830    ///
1831    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1832    /// [`Scope::Full`].
1833    ///
1834    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1835    /// tokens for more than one scope.
1836    ///
1837    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1838    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1839    /// sufficient, a read-write scope will do as well.
1840    pub fn add_scope<St>(mut self, scope: St) -> MethodDecodePcIntegrityTokenCall<'a, C>
1841    where
1842        St: AsRef<str>,
1843    {
1844        self._scopes.insert(String::from(scope.as_ref()));
1845        self
1846    }
1847    /// Identifies the authorization scope(s) for the method you are building.
1848    ///
1849    /// See [`Self::add_scope()`] for details.
1850    pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodDecodePcIntegrityTokenCall<'a, C>
1851    where
1852        I: IntoIterator<Item = St>,
1853        St: AsRef<str>,
1854    {
1855        self._scopes
1856            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1857        self
1858    }
1859
1860    /// Removes all scopes, and no default scope will be used either.
1861    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1862    /// for details).
1863    pub fn clear_scopes(mut self) -> MethodDecodePcIntegrityTokenCall<'a, C> {
1864        self._scopes.clear();
1865        self
1866    }
1867}