google_firebaseappcheck1_beta/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18
19    /// View and administer all your Firebase data and settings
20    Firebase,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::Firebase => "https://www.googleapis.com/auth/firebase",
28        }
29    }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34    fn default() -> Scope {
35        Scope::Firebase
36    }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all Firebaseappcheck related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
53/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
54/// use firebaseappcheck1_beta::{Result, Error};
55/// # async fn dox() {
56/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57///
58/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
59/// // `client_secret`, among other things.
60/// let secret: yup_oauth2::ApplicationSecret = Default::default();
61/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
62/// // unless you replace  `None` with the desired Flow.
63/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
64/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
65/// // retrieve them from storage.
66/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
67///     .with_native_roots()
68///     .unwrap()
69///     .https_only()
70///     .enable_http2()
71///     .build();
72///
73/// let executor = hyper_util::rt::TokioExecutor::new();
74/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
75///     secret,
76///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77///     yup_oauth2::client::CustomHyperClientBuilder::from(
78///         hyper_util::client::legacy::Client::builder(executor).build(connector),
79///     ),
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83///     hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86///     hyper_rustls::HttpsConnectorBuilder::new()
87///         .with_native_roots()
88///         .unwrap()
89///         .https_or_http()
90///         .enable_http2()
91///         .build()
92/// );
93/// let mut hub = Firebaseappcheck::new(client, auth);
94/// // As the method needs a request, you would usually fill it with the desired information
95/// // into the respective structure. Some of the parts shown here might not be applicable !
96/// // Values shown here are possibly random and not representative !
97/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
98///
99/// // You can configure optional parameters by calling the respective setters at will, and
100/// // execute the final call using `doit()`.
101/// // Values shown here are possibly random and not representative !
102/// let result = hub.oauth_clients().exchange_app_attest_assertion(req, "app")
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 Firebaseappcheck<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 Firebaseappcheck<C> {}
134
135impl<'a, C> Firebaseappcheck<C> {
136    pub fn new<A: 'static + common::GetToken>(
137        client: common::Client<C>,
138        auth: A,
139    ) -> Firebaseappcheck<C> {
140        Firebaseappcheck {
141            client,
142            auth: Box::new(auth),
143            _user_agent: "google-api-rust-client/7.0.0".to_string(),
144            _base_url: "https://firebaseappcheck.googleapis.com/".to_string(),
145            _root_url: "https://firebaseappcheck.googleapis.com/".to_string(),
146        }
147    }
148
149    pub fn jwks(&'a self) -> JwkMethods<'a, C> {
150        JwkMethods { hub: self }
151    }
152    pub fn oauth_clients(&'a self) -> OauthClientMethods<'a, C> {
153        OauthClientMethods { hub: self }
154    }
155    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
156        ProjectMethods { hub: self }
157    }
158
159    /// Set the user-agent header field to use in all requests to the server.
160    /// It defaults to `google-api-rust-client/7.0.0`.
161    ///
162    /// Returns the previously set user-agent.
163    pub fn user_agent(&mut self, agent_name: String) -> String {
164        std::mem::replace(&mut self._user_agent, agent_name)
165    }
166
167    /// Set the base url to use in all requests to the server.
168    /// It defaults to `https://firebaseappcheck.googleapis.com/`.
169    ///
170    /// Returns the previously set base url.
171    pub fn base_url(&mut self, new_base_url: String) -> String {
172        std::mem::replace(&mut self._base_url, new_base_url)
173    }
174
175    /// Set the root url to use in all requests to the server.
176    /// It defaults to `https://firebaseappcheck.googleapis.com/`.
177    ///
178    /// Returns the previously set root url.
179    pub fn root_url(&mut self, new_root_url: String) -> String {
180        std::mem::replace(&mut self._root_url, new_root_url)
181    }
182}
183
184// ############
185// SCHEMAS ###
186// ##########
187/// An app’s App Attest configuration object. This configuration controls certain properties of the `AppCheckToken` returned by ExchangeAppAttestAttestation and ExchangeAppAttestAssertion, such as its ttl. Note that the Team ID registered with your app is used as part of the validation process. Please register it via the Firebase Console or programmatically via the [Firebase Management Service](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.iosApps/patch).
188///
189/// # Activities
190///
191/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
192/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
193///
194/// * [apps app attest config get projects](ProjectAppAppAttestConfigGetCall) (response)
195/// * [apps app attest config patch projects](ProjectAppAppAttestConfigPatchCall) (request|response)
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct GoogleFirebaseAppcheckV1betaAppAttestConfig {
200    /// Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
201    pub name: Option<String>,
202    /// Specifies the duration for which App Check tokens exchanged from App Attest artifacts will be valid. If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive.
203    #[serde(rename = "tokenTtl")]
204    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
205    pub token_ttl: Option<chrono::Duration>,
206}
207
208impl common::RequestValue for GoogleFirebaseAppcheckV1betaAppAttestConfig {}
209impl common::ResponseResult for GoogleFirebaseAppcheckV1betaAppAttestConfig {}
210
211/// Encapsulates an *App Check token*, which are used to access backend services protected by App Check.
212///
213/// # Activities
214///
215/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
216/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
217///
218/// * [exchange app attest assertion oauth clients](OauthClientExchangeAppAttestAssertionCall) (response)
219/// * [exchange debug token oauth clients](OauthClientExchangeDebugTokenCall) (response)
220/// * [apps exchange app attest assertion projects](ProjectAppExchangeAppAttestAssertionCall) (response)
221/// * [apps exchange custom token projects](ProjectAppExchangeCustomTokenCall) (response)
222/// * [apps exchange debug token projects](ProjectAppExchangeDebugTokenCall) (response)
223/// * [apps exchange device check token projects](ProjectAppExchangeDeviceCheckTokenCall) (response)
224/// * [apps exchange play integrity token projects](ProjectAppExchangePlayIntegrityTokenCall) (response)
225/// * [apps exchange recaptcha enterprise token projects](ProjectAppExchangeRecaptchaEnterpriseTokenCall) (response)
226/// * [apps exchange recaptcha token projects](ProjectAppExchangeRecaptchaTokenCall) (response)
227/// * [apps exchange recaptcha v3 token projects](ProjectAppExchangeRecaptchaV3TokenCall) (response)
228/// * [apps exchange safety net token projects](ProjectAppExchangeSafetyNetTokenCall) (response)
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct GoogleFirebaseAppcheckV1betaAppCheckToken {
233    /// The App Check token. App Check tokens are signed [JWTs](https://tools.ietf.org/html/rfc7519) containing claims that identify the attested app and GCP project. This token is used to access Google services protected by App Check. These tokens can also be [verified by your own custom backends](https://firebase.google.com/docs/app-check/custom-resource-backend) using the Firebase Admin SDK or third-party libraries.
234    #[serde(rename = "attestationToken")]
235    pub attestation_token: Option<String>,
236    /// The App Check token. App Check tokens are signed [JWTs](https://tools.ietf.org/html/rfc7519) containing claims that identify the attested app and GCP project. This token is used to access Google services protected by App Check. These tokens can also be [verified by your own custom backends](https://firebase.google.com/docs/app-check/custom-resource-backend) using the Firebase Admin SDK or third-party libraries.
237    pub token: Option<String>,
238    /// The duration from the time this token is minted until its expiration. This field is intended to ease client-side token management, since the client may have clock skew, but is still able to accurately measure a duration.
239    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
240    pub ttl: Option<chrono::Duration>,
241}
242
243impl common::ResponseResult for GoogleFirebaseAppcheckV1betaAppCheckToken {}
244
245/// Encapsulates an *App Check token*, which are used to access Firebase services protected by App Check.
246///
247/// This type is not used in any activity, and only used as *part* of another schema.
248///
249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
250#[serde_with::serde_as]
251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
252pub struct GoogleFirebaseAppcheckV1betaAttestationTokenResponse {
253    /// An App Check token. App Check tokens are signed [JWTs](https://tools.ietf.org/html/rfc7519) containing claims that identify the attested app and Firebase project. This token is used to access Firebase services protected by App Check.
254    #[serde(rename = "attestationToken")]
255    pub attestation_token: Option<String>,
256    /// The duration from the time this token is minted until its expiration. This field is intended to ease client-side token management, since the client may have clock skew, but is still able to accurately measure a duration.
257    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
258    pub ttl: Option<chrono::Duration>,
259}
260
261impl common::Part for GoogleFirebaseAppcheckV1betaAttestationTokenResponse {}
262
263/// Response message for the BatchGetAppAttestConfigs method.
264///
265/// # Activities
266///
267/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
268/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
269///
270/// * [apps app attest config batch get projects](ProjectAppAppAttestConfigBatchGetCall) (response)
271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
272#[serde_with::serde_as]
273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
274pub struct GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse {
275    /// AppAttestConfigs retrieved.
276    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaAppAttestConfig>>,
277}
278
279impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse {}
280
281/// Response message for the BatchGetDeviceCheckConfigs method.
282///
283/// # Activities
284///
285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
287///
288/// * [apps device check config batch get projects](ProjectAppDeviceCheckConfigBatchGetCall) (response)
289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
290#[serde_with::serde_as]
291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
292pub struct GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse {
293    /// DeviceCheckConfigs retrieved.
294    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaDeviceCheckConfig>>,
295}
296
297impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse {}
298
299/// Response message for the BatchGetPlayIntegrityConfigs method.
300///
301/// # Activities
302///
303/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
304/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
305///
306/// * [apps play integrity config batch get projects](ProjectAppPlayIntegrityConfigBatchGetCall) (response)
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse {
311    /// PlayIntegrityConfigs retrieved.
312    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaPlayIntegrityConfig>>,
313}
314
315impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse {}
316
317/// Response message for the BatchGetRecaptchaConfigs method.
318///
319/// # Activities
320///
321/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
322/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
323///
324/// * [apps recaptcha config batch get projects](ProjectAppRecaptchaConfigBatchGetCall) (response)
325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
326#[serde_with::serde_as]
327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
328pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse {
329    /// RecaptchaConfigs retrieved.
330    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaConfig>>,
331}
332
333impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse {}
334
335/// Response message for the BatchGetRecaptchaEnterpriseConfigs method.
336///
337/// # Activities
338///
339/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
341///
342/// * [apps recaptcha enterprise config batch get projects](ProjectAppRecaptchaEnterpriseConfigBatchGetCall) (response)
343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
344#[serde_with::serde_as]
345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
346pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse {
347    /// RecaptchaEnterpriseConfigs retrieved.
348    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig>>,
349}
350
351impl common::ResponseResult
352    for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse
353{
354}
355
356/// Response message for the BatchGetRecaptchaV3Configs method.
357///
358/// # Activities
359///
360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
362///
363/// * [apps recaptcha v3 config batch get projects](ProjectAppRecaptchaV3ConfigBatchGetCall) (response)
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse {
368    /// RecaptchaV3Configs retrieved.
369    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaV3Config>>,
370}
371
372impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse {}
373
374/// Response message for the BatchGetSafetyNetConfigs method.
375///
376/// # Activities
377///
378/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
379/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
380///
381/// * [apps safety net config batch get projects](ProjectAppSafetyNetConfigBatchGetCall) (response)
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse {
386    /// SafetyNetConfigs retrieved.
387    pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaSafetyNetConfig>>,
388}
389
390impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse {}
391
392/// Request message for the BatchUpdateResourcePolicies method.
393///
394/// # Activities
395///
396/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
397/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
398///
399/// * [services resource policies batch update projects](ProjectServiceResourcePolicyBatchUpdateCall) (request)
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest {
404    /// Required. The request messages specifying the ResourcePolicy objects to update. A maximum of 100 objects can be updated in a batch.
405    pub requests: Option<Vec<GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest>>,
406    /// Optional. A comma-separated list of names of fields in the ResourcePolicy objects to update. Example: `enforcement_mode`. If this field is present, the `update_mask` field in the UpdateResourcePolicyRequest messages must all match this field, or the entire batch fails and no updates will be committed.
407    #[serde(rename = "updateMask")]
408    pub update_mask: Option<common::FieldMask>,
409}
410
411impl common::RequestValue for GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest {}
412
413/// Response message for the BatchUpdateResourcePolicies method.
414///
415/// # Activities
416///
417/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
418/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
419///
420/// * [services resource policies batch update projects](ProjectServiceResourcePolicyBatchUpdateCall) (response)
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse {
425    /// ResourcePolicy objects after the updates have been applied.
426    #[serde(rename = "resourcePolicies")]
427    pub resource_policies: Option<Vec<GoogleFirebaseAppcheckV1betaResourcePolicy>>,
428}
429
430impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse {}
431
432/// Request message for the BatchUpdateServices method.
433///
434/// # Activities
435///
436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
438///
439/// * [services batch update projects](ProjectServiceBatchUpdateCall) (request)
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest {
444    /// Required. The request messages specifying the Services to update. A maximum of 100 objects can be updated in a batch.
445    pub requests: Option<Vec<GoogleFirebaseAppcheckV1betaUpdateServiceRequest>>,
446    /// Optional. A comma-separated list of names of fields in the Services to update. Example: `display_name`. If the `update_mask` field is set in both this request and any of the UpdateServiceRequest messages, they must match or the entire batch fails and no updates will be committed.
447    #[serde(rename = "updateMask")]
448    pub update_mask: Option<common::FieldMask>,
449}
450
451impl common::RequestValue for GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest {}
452
453/// Response message for the BatchUpdateServices method.
454///
455/// # Activities
456///
457/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
458/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
459///
460/// * [services batch update projects](ProjectServiceBatchUpdateCall) (response)
461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
462#[serde_with::serde_as]
463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
464pub struct GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse {
465    /// Service objects after the updates have been applied.
466    pub services: Option<Vec<GoogleFirebaseAppcheckV1betaService>>,
467}
468
469impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse {}
470
471/// A *debug token* is a secret used during the development or integration testing of an app. It essentially allows the development or integration testing to bypass app attestation while still allowing App Check to enforce protection on supported production Firebase services.
472///
473/// # Activities
474///
475/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
476/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
477///
478/// * [apps debug tokens create projects](ProjectAppDebugTokenCreateCall) (request|response)
479/// * [apps debug tokens get projects](ProjectAppDebugTokenGetCall) (response)
480/// * [apps debug tokens patch projects](ProjectAppDebugTokenPatchCall) (request|response)
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct GoogleFirebaseAppcheckV1betaDebugToken {
485    /// Required. A human readable display name used to identify this debug token.
486    #[serde(rename = "displayName")]
487    pub display_name: Option<String>,
488    /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
489    pub name: Option<String>,
490    /// Required. Input only. Immutable. The secret token itself. Must be provided during creation, and must be a UUID4, case insensitive. This field is immutable once set, and cannot be provided during an UpdateDebugToken request. You can, however, delete this debug token using DeleteDebugToken to revoke it. For security reasons, this field will never be populated in any response.
491    pub token: Option<String>,
492    /// Output only. Timestamp when this debug token was most recently updated.
493    #[serde(rename = "updateTime")]
494    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
495}
496
497impl common::RequestValue for GoogleFirebaseAppcheckV1betaDebugToken {}
498impl common::ResponseResult for GoogleFirebaseAppcheckV1betaDebugToken {}
499
500/// An app’s DeviceCheck configuration object. This configuration is used by ExchangeDeviceCheckToken to validate device tokens issued to apps by DeviceCheck. It also controls certain properties of the returned `AppCheckToken`, such as its ttl. Note that the Team ID registered with your app is used as part of the validation process. Please register it via the Firebase Console or programmatically via the [Firebase Management Service](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.iosApps/patch).
501///
502/// # Activities
503///
504/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
505/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
506///
507/// * [apps device check config get projects](ProjectAppDeviceCheckConfigGetCall) (response)
508/// * [apps device check config patch projects](ProjectAppDeviceCheckConfigPatchCall) (request|response)
509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
510#[serde_with::serde_as]
511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
512pub struct GoogleFirebaseAppcheckV1betaDeviceCheckConfig {
513    /// Required. The key identifier of a private key enabled with DeviceCheck, created in your Apple Developer account.
514    #[serde(rename = "keyId")]
515    pub key_id: Option<String>,
516    /// Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
517    pub name: Option<String>,
518    /// Required. Input only. The contents of the private key (`.p8`) file associated with the key specified by `key_id`. For security reasons, this field will never be populated in any response.
519    #[serde(rename = "privateKey")]
520    pub private_key: Option<String>,
521    /// Output only. Whether the `private_key` field was previously set. Since we will never return the `private_key` field, this field is the only way to find out whether it was previously set.
522    #[serde(rename = "privateKeySet")]
523    pub private_key_set: Option<bool>,
524    /// Specifies the duration for which App Check tokens exchanged from DeviceCheck tokens will be valid. If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive.
525    #[serde(rename = "tokenTtl")]
526    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
527    pub token_ttl: Option<chrono::Duration>,
528}
529
530impl common::RequestValue for GoogleFirebaseAppcheckV1betaDeviceCheckConfig {}
531impl common::ResponseResult for GoogleFirebaseAppcheckV1betaDeviceCheckConfig {}
532
533/// Request message for the ExchangeAppAttestAssertion method.
534///
535/// # Activities
536///
537/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
538/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
539///
540/// * [exchange app attest assertion oauth clients](OauthClientExchangeAppAttestAssertionCall) (request)
541/// * [apps exchange app attest assertion projects](ProjectAppExchangeAppAttestAssertionCall) (request)
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest {
546    /// Required. The artifact returned by a previous call to ExchangeAppAttestAttestation.
547    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
548    pub artifact: Option<Vec<u8>>,
549    /// Required. The CBOR-encoded assertion returned by the client-side App Attest API.
550    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
551    pub assertion: Option<Vec<u8>>,
552    /// Required. A one-time challenge returned by an immediately prior call to GenerateAppAttestChallenge.
553    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
554    pub challenge: Option<Vec<u8>>,
555    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
556    #[serde(rename = "limitedUse")]
557    pub limited_use: Option<bool>,
558}
559
560impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest {}
561
562/// Request message for the ExchangeAppAttestAttestation method.
563///
564/// # Activities
565///
566/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
567/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
568///
569/// * [exchange app attest attestation oauth clients](OauthClientExchangeAppAttestAttestationCall) (request)
570/// * [apps exchange app attest attestation projects](ProjectAppExchangeAppAttestAttestationCall) (request)
571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
572#[serde_with::serde_as]
573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
574pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest {
575    /// Required. The App Attest statement returned by the client-side App Attest API. This is a base64url encoded CBOR object in the JSON response.
576    #[serde(rename = "attestationStatement")]
577    #[serde_as(as = "Option<common::serde::urlsafe_base64::Wrapper>")]
578    pub attestation_statement: Option<Vec<u8>>,
579    /// Required. A one-time challenge returned by an immediately prior call to GenerateAppAttestChallenge.
580    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
581    pub challenge: Option<Vec<u8>>,
582    /// Required. The key ID generated by App Attest for the client app.
583    #[serde(rename = "keyId")]
584    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
585    pub key_id: Option<Vec<u8>>,
586    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
587    #[serde(rename = "limitedUse")]
588    pub limited_use: Option<bool>,
589}
590
591impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest {}
592
593/// Response message for the ExchangeAppAttestAttestation method.
594///
595/// # Activities
596///
597/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
598/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
599///
600/// * [exchange app attest attestation oauth clients](OauthClientExchangeAppAttestAttestationCall) (response)
601/// * [apps exchange app attest attestation projects](ProjectAppExchangeAppAttestAttestationCall) (response)
602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
603#[serde_with::serde_as]
604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
605pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse {
606    /// Encapsulates an App Check token.
607    #[serde(rename = "appCheckToken")]
608    pub app_check_token: Option<GoogleFirebaseAppcheckV1betaAppCheckToken>,
609    /// An artifact that can be used in future calls to ExchangeAppAttestAssertion.
610    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
611    pub artifact: Option<Vec<u8>>,
612    /// Encapsulates an App Check token.
613    #[serde(rename = "attestationToken")]
614    pub attestation_token: Option<GoogleFirebaseAppcheckV1betaAttestationTokenResponse>,
615}
616
617impl common::ResponseResult for GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse {}
618
619/// Request message for the ExchangeCustomToken method.
620///
621/// # Activities
622///
623/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
624/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
625///
626/// * [apps exchange custom token projects](ProjectAppExchangeCustomTokenCall) (request)
627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
628#[serde_with::serde_as]
629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
630pub struct GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest {
631    /// Required. A custom token signed using your project's Admin SDK service account credentials.
632    #[serde(rename = "customToken")]
633    pub custom_token: Option<String>,
634    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
635    #[serde(rename = "limitedUse")]
636    pub limited_use: Option<bool>,
637}
638
639impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest {}
640
641/// Request message for the ExchangeDebugToken method.
642///
643/// # Activities
644///
645/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
646/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
647///
648/// * [exchange debug token oauth clients](OauthClientExchangeDebugTokenCall) (request)
649/// * [apps exchange debug token projects](ProjectAppExchangeDebugTokenCall) (request)
650#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
651#[serde_with::serde_as]
652#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
653pub struct GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest {
654    /// Required. A debug token secret. This string must match a debug token secret previously created using CreateDebugToken.
655    #[serde(rename = "debugToken")]
656    pub debug_token: Option<String>,
657    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
658    #[serde(rename = "limitedUse")]
659    pub limited_use: Option<bool>,
660}
661
662impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest {}
663
664/// Request message for the ExchangeDeviceCheckToken method.
665///
666/// # Activities
667///
668/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
669/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
670///
671/// * [apps exchange device check token projects](ProjectAppExchangeDeviceCheckTokenCall) (request)
672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
673#[serde_with::serde_as]
674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
675pub struct GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest {
676    /// Required. The `device_token` as returned by Apple's client-side [DeviceCheck API](https://developer.apple.com/documentation/devicecheck/dcdevice). This is the base64 encoded `Data` (Swift) or `NSData` (ObjC) object.
677    #[serde(rename = "deviceToken")]
678    pub device_token: Option<String>,
679    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
680    #[serde(rename = "limitedUse")]
681    pub limited_use: Option<bool>,
682}
683
684impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest {}
685
686/// Request message for the ExchangePlayIntegrityToken method.
687///
688/// # Activities
689///
690/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
691/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
692///
693/// * [apps exchange play integrity token projects](ProjectAppExchangePlayIntegrityTokenCall) (request)
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest {
698    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
699    #[serde(rename = "limitedUse")]
700    pub limited_use: Option<bool>,
701    /// Required. The [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify) issued to your app.
702    #[serde(rename = "playIntegrityToken")]
703    pub play_integrity_token: Option<String>,
704}
705
706impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest {}
707
708/// Request message for the ExchangeRecaptchaEnterpriseToken method.
709///
710/// # Activities
711///
712/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
713/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
714///
715/// * [apps exchange recaptcha enterprise token projects](ProjectAppExchangeRecaptchaEnterpriseTokenCall) (request)
716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
717#[serde_with::serde_as]
718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
719pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest {
720    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
721    #[serde(rename = "limitedUse")]
722    pub limited_use: Option<bool>,
723    /// Required. The reCAPTCHA token as returned by the [reCAPTCHA Enterprise JavaScript API](https://cloud.google.com/recaptcha-enterprise/docs/instrument-web-pages).
724    #[serde(rename = "recaptchaEnterpriseToken")]
725    pub recaptcha_enterprise_token: Option<String>,
726}
727
728impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest {}
729
730/// Request message for the ExchangeRecaptchaToken method.
731///
732/// # Activities
733///
734/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
735/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
736///
737/// * [apps exchange recaptcha token projects](ProjectAppExchangeRecaptchaTokenCall) (request)
738#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
739#[serde_with::serde_as]
740#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
741pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest {
742    /// Required. The reCAPTCHA token as returned by the [reCAPTCHA v3 JavaScript API](https://developers.google.com/recaptcha/docs/v3).
743    #[serde(rename = "recaptchaToken")]
744    pub recaptcha_token: Option<String>,
745}
746
747impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest {}
748
749/// Request message for the ExchangeRecaptchaV3Token method.
750///
751/// # Activities
752///
753/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
754/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
755///
756/// * [apps exchange recaptcha v3 token projects](ProjectAppExchangeRecaptchaV3TokenCall) (request)
757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
758#[serde_with::serde_as]
759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
760pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest {
761    /// Specifies whether this attestation is for use in a *limited use* (`true`) or *session based* (`false`) context. To enable this attestation to be used with the *replay protection* feature, set this to `true`. The default value is `false`.
762    #[serde(rename = "limitedUse")]
763    pub limited_use: Option<bool>,
764    /// Required. The reCAPTCHA token as returned by the [reCAPTCHA v3 JavaScript API](https://developers.google.com/recaptcha/docs/v3).
765    #[serde(rename = "recaptchaV3Token")]
766    pub recaptcha_v3_token: Option<String>,
767}
768
769impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest {}
770
771/// Request message for the ExchangeSafetyNetToken method.
772///
773/// # Activities
774///
775/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
776/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
777///
778/// * [apps exchange safety net token projects](ProjectAppExchangeSafetyNetTokenCall) (request)
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest {
783    /// Required. The [SafetyNet attestation response](https://developer.android.com/training/safetynet/attestation#request-attestation-step) issued to your app.
784    #[serde(rename = "safetyNetToken")]
785    pub safety_net_token: Option<String>,
786}
787
788impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest {}
789
790/// Request message for the GenerateAppAttestChallenge method.
791///
792/// # Activities
793///
794/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
795/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
796///
797/// * [generate app attest challenge oauth clients](OauthClientGenerateAppAttestChallengeCall) (request)
798/// * [apps generate app attest challenge projects](ProjectAppGenerateAppAttestChallengeCall) (request)
799#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
800#[serde_with::serde_as]
801#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
802pub struct GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest {
803    _never_set: Option<bool>,
804}
805
806impl common::RequestValue for GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest {}
807
808/// Response message for the GenerateAppAttestChallenge method.
809///
810/// # Activities
811///
812/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
813/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
814///
815/// * [generate app attest challenge oauth clients](OauthClientGenerateAppAttestChallengeCall) (response)
816/// * [apps generate app attest challenge projects](ProjectAppGenerateAppAttestChallengeCall) (response)
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse {
821    /// A one-time use challenge for the client to pass to the App Attest API.
822    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
823    pub challenge: Option<Vec<u8>>,
824    /// The duration from the time this challenge is minted until its expiration. This field is intended to ease client-side token management, since the client may have clock skew, but is still able to accurately measure a duration.
825    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
826    pub ttl: Option<chrono::Duration>,
827}
828
829impl common::ResponseResult for GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse {}
830
831/// Request message for the GeneratePlayIntegrityChallenge method.
832///
833/// # Activities
834///
835/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
836/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
837///
838/// * [apps generate play integrity challenge projects](ProjectAppGeneratePlayIntegrityChallengeCall) (request)
839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
840#[serde_with::serde_as]
841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
842pub struct GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest {
843    _never_set: Option<bool>,
844}
845
846impl common::RequestValue for GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest {}
847
848/// Response message for the GeneratePlayIntegrityChallenge method.
849///
850/// # Activities
851///
852/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
853/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
854///
855/// * [apps generate play integrity challenge projects](ProjectAppGeneratePlayIntegrityChallengeCall) (response)
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse {
860    /// A one-time use [challenge](https://developer.android.com/google/play/integrity/verdict#protect-against-replay-attacks) for the client to pass to the Play Integrity API.
861    pub challenge: Option<String>,
862    /// The duration from the time this challenge is minted until its expiration. This field is intended to ease client-side token management, since the client may have clock skew, but is still able to accurately measure a duration.
863    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
864    pub ttl: Option<chrono::Duration>,
865}
866
867impl common::ResponseResult for GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse {}
868
869/// Response message for the ListDebugTokens method.
870///
871/// # Activities
872///
873/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
874/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
875///
876/// * [apps debug tokens list projects](ProjectAppDebugTokenListCall) (response)
877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
878#[serde_with::serde_as]
879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
880pub struct GoogleFirebaseAppcheckV1betaListDebugTokensResponse {
881    /// The DebugTokens retrieved.
882    #[serde(rename = "debugTokens")]
883    pub debug_tokens: Option<Vec<GoogleFirebaseAppcheckV1betaDebugToken>>,
884    /// If the result list is too large to fit in a single response, then a token is returned. If the string is empty or omitted, then this response is the last page of results. This token can be used in a subsequent call to ListDebugTokens to find the next group of DebugTokens. Page tokens are short-lived and should not be persisted.
885    #[serde(rename = "nextPageToken")]
886    pub next_page_token: Option<String>,
887}
888
889impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListDebugTokensResponse {}
890
891/// Response message for the ListResourcePolicies method.
892///
893/// # Activities
894///
895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
897///
898/// * [services resource policies list projects](ProjectServiceResourcePolicyListCall) (response)
899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
900#[serde_with::serde_as]
901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse {
903    /// If the result list is too large to fit in a single response, then a token is returned. If the string is empty or omitted, then this response is the last page of results. This token can be used in a subsequent call to ListResourcePolicies to find the next group of ResourcePolicy objects. Page tokens are short-lived and should not be persisted.
904    #[serde(rename = "nextPageToken")]
905    pub next_page_token: Option<String>,
906    /// The ResourcePolicy objects retrieved.
907    #[serde(rename = "resourcePolicies")]
908    pub resource_policies: Option<Vec<GoogleFirebaseAppcheckV1betaResourcePolicy>>,
909}
910
911impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse {}
912
913/// Response message for the ListServices method.
914///
915/// # Activities
916///
917/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
918/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
919///
920/// * [services list projects](ProjectServiceListCall) (response)
921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
922#[serde_with::serde_as]
923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
924pub struct GoogleFirebaseAppcheckV1betaListServicesResponse {
925    /// If the result list is too large to fit in a single response, then a token is returned. If the string is empty or omitted, then this response is the last page of results. This token can be used in a subsequent call to ListServices to find the next group of Services. Page tokens are short-lived and should not be persisted.
926    #[serde(rename = "nextPageToken")]
927    pub next_page_token: Option<String>,
928    /// The Services retrieved.
929    pub services: Option<Vec<GoogleFirebaseAppcheckV1betaService>>,
930}
931
932impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListServicesResponse {}
933
934/// An app’s Play Integrity configuration object. This configuration controls certain properties of the `AppCheckToken` returned by ExchangePlayIntegrityToken, such as its ttl. Note that your registered SHA-256 certificate fingerprints are used to validate tokens issued by the Play Integrity API; please register them via the Firebase Console or programmatically via the [Firebase Management Service](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.androidApps.sha/create).
935///
936/// # Activities
937///
938/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
939/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
940///
941/// * [apps play integrity config get projects](ProjectAppPlayIntegrityConfigGetCall) (response)
942/// * [apps play integrity config patch projects](ProjectAppPlayIntegrityConfigPatchCall) (request|response)
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {
947    /// Specifies account requirements for Android devices running your app. These settings correspond to requirements on the [**account details** field](https://developer.android.com/google/play/integrity/verdicts#account-details-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. The default values for these settings work for most apps, and are recommended.
948    #[serde(rename = "accountDetails")]
949    pub account_details: Option<GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAccountDetails>,
950    /// Specifies application integrity requirements for Android devices running your app. These settings correspond to requirements on the [**application integrity** field](https://developer.android.com/google/play/integrity/verdicts#application-integrity-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. The default values for these settings work for most apps, and are recommended.
951    #[serde(rename = "appIntegrity")]
952    pub app_integrity: Option<GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAppIntegrity>,
953    /// Specifies device integrity requirements for Android devices running your app. These settings correspond to requirements on the [**device integrity** field](https://developer.android.com/google/play/integrity/verdicts#device-integrity-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. Warning: There are also [conditional](https://developer.android.com/google/play/integrity/setup#conditional) as well as [optional](https://developer.android.com/google/play/integrity/setup#optional_device_information) responses that you can receive, but requires additional explicit opt-in from you. The App Check API is **not** responsible for any such opt-ins. The default values for these settings work for most apps, and are recommended.
954    #[serde(rename = "deviceIntegrity")]
955    pub device_integrity: Option<GoogleFirebaseAppcheckV1betaPlayIntegrityConfigDeviceIntegrity>,
956    /// Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
957    pub name: Option<String>,
958    /// Specifies the duration for which App Check tokens exchanged from Play Integrity tokens will be valid. If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive.
959    #[serde(rename = "tokenTtl")]
960    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
961    pub token_ttl: Option<chrono::Duration>,
962}
963
964impl common::RequestValue for GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {}
965impl common::ResponseResult for GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {}
966
967/// A settings object specifying account requirements for Android devices running your app. These settings correspond to requirements on the [**account details** field](https://developer.android.com/google/play/integrity/verdicts#account-details-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. The default values for these settings work for most apps, and are recommended.
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAccountDetails {
975    /// Specifies whether the caller must have received the [`LICENSED` verdict](https://developer.android.com/google/play/integrity/verdicts#account-details-field). For additional details about scenarios where your users will receive this `LICENSED` label, see [the default responses table](https://developer.android.com/google/play/integrity/setup#default). If set to `true`, apps without the `LICENSED` app licensing verdict will be rejected. If set to `false`, any app licensing verdict is allowed. The default value is `false`.
976    #[serde(rename = "requireLicensed")]
977    pub require_licensed: Option<bool>,
978}
979
980impl common::Part for GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAccountDetails {}
981
982/// A settings object specifying application integrity requirements for Android devices running your app. These settings correspond to requirements on the [**application integrity** field](https://developer.android.com/google/play/integrity/verdicts#application-integrity-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. The default values for these settings work for most apps, and are recommended.
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 GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAppIntegrity {
990    /// Specifies whether your running app is allowed to have the `UNRECOGNIZED_VERSION` [app recognition verdict](https://developer.android.com/google/play/integrity/verdicts#application-integrity-field). Note that the app recognition verdict `PLAY_RECOGNIZED` is a strong, comprehensive integrity signal that takes into account various other signals, including conditional and optional device integrity responses that you have opted into. If your app is published off-Play, this field should be set to `true` to allow instances of your app installed from off-Play sources to function. If set to `false`, only `PLAY_RECOGNIZED` verdicts are allowed, and both `UNRECOGNIZED_VERSION` and `UNEVALUATED` will be rejected. If set to `true`, any app recognition verdict is allowed. The default value is `false`.
991    #[serde(rename = "allowUnrecognizedVersion")]
992    pub allow_unrecognized_version: Option<bool>,
993}
994
995impl common::Part for GoogleFirebaseAppcheckV1betaPlayIntegrityConfigAppIntegrity {}
996
997/// A settings object specifying device integrity requirements for Android devices running your app. These settings correspond to requirements on the [**device integrity** field](https://developer.android.com/google/play/integrity/verdicts#device-integrity-field) obtained from the Play Integrity API. See the [default responses table](https://developer.android.com/google/play/integrity/setup#default) for a quick summary. Warning: There are also [conditional](https://developer.android.com/google/play/integrity/setup#conditional) as well as [optional](https://developer.android.com/google/play/integrity/setup#optional_device_information) responses that you can receive, but requires additional explicit opt-in from you. The App Check API is **not** responsible for any such opt-ins. The default values for these settings work for most apps, and are recommended.
998///
999/// This type is not used in any activity, and only used as *part* of another schema.
1000///
1001#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1002#[serde_with::serde_as]
1003#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1004pub struct GoogleFirebaseAppcheckV1betaPlayIntegrityConfigDeviceIntegrity {
1005    /// Specifies the minimum device integrity level in order for the device to be considered valid. Any device with a device recognition verdict lower than this level will be rejected. If this is unspecified, the default level is `NO_INTEGRITY`.
1006    #[serde(rename = "minDeviceRecognitionLevel")]
1007    pub min_device_recognition_level: Option<String>,
1008}
1009
1010impl common::Part for GoogleFirebaseAppcheckV1betaPlayIntegrityConfigDeviceIntegrity {}
1011
1012/// A JWK as specified by [section 4 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4) and [section 6.3.1 of RFC 7518](https://tools.ietf.org/html/rfc7518#section-6.3.1).
1013///
1014/// This type is not used in any activity, and only used as *part* of another schema.
1015///
1016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1017#[serde_with::serde_as]
1018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1019pub struct GoogleFirebaseAppcheckV1betaPublicJwk {
1020    /// See [section 4.4 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.4).
1021    pub alg: Option<String>,
1022    /// See [section 6.3.1.2 of RFC 7518](https://tools.ietf.org/html/rfc7518#section-6.3.1.2).
1023    pub e: Option<String>,
1024    /// See [section 4.5 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.5).
1025    pub kid: Option<String>,
1026    /// See [section 4.1 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.1).
1027    pub kty: Option<String>,
1028    /// See [section 6.3.1.1 of RFC 7518](https://tools.ietf.org/html/rfc7518#section-6.3.1.1).
1029    pub n: Option<String>,
1030    /// See [section 4.2 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.2).
1031    #[serde(rename = "use")]
1032    pub use_: Option<String>,
1033}
1034
1035impl common::Part for GoogleFirebaseAppcheckV1betaPublicJwk {}
1036
1037/// The currently active set of public keys that can be used to verify App Check tokens. This object is a JWK set as specified by [section 5 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-5). For security, the response **must not** be cached for longer than six hours.
1038///
1039/// # Activities
1040///
1041/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1042/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1043///
1044/// * [get jwks](JwkGetCall) (response)
1045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1046#[serde_with::serde_as]
1047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1048pub struct GoogleFirebaseAppcheckV1betaPublicJwkSet {
1049    /// The set of public keys. See [section 5.1 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-5).
1050    pub keys: Option<Vec<GoogleFirebaseAppcheckV1betaPublicJwk>>,
1051}
1052
1053impl common::ResponseResult for GoogleFirebaseAppcheckV1betaPublicJwkSet {}
1054
1055/// An app’s reCAPTCHA v3 configuration object. This configuration is used by ExchangeRecaptchaToken to validate reCAPTCHA tokens issued to apps by reCAPTCHA v3. It also controls certain properties of the returned `AppCheckToken`, such as its ttl.
1056///
1057/// # Activities
1058///
1059/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1060/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1061///
1062/// * [apps recaptcha config get projects](ProjectAppRecaptchaConfigGetCall) (response)
1063/// * [apps recaptcha config patch projects](ProjectAppRecaptchaConfigPatchCall) (request|response)
1064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1065#[serde_with::serde_as]
1066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1067pub struct GoogleFirebaseAppcheckV1betaRecaptchaConfig {
1068    /// Specifies a minimum score required for a reCAPTCHA token to be considered valid. If its score is greater than or equal to this value, it will be accepted; otherwise, it will be rejected. The value must be between 0.0 and 1.0. The default value is 0.5.
1069    #[serde(rename = "minValidScore")]
1070    pub min_valid_score: Option<f32>,
1071    /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1072    pub name: Option<String>,
1073    /// Required. Input only. The site secret used to identify your service for reCAPTCHA v3 verification. For security reasons, this field will never be populated in any response.
1074    #[serde(rename = "siteSecret")]
1075    pub site_secret: Option<String>,
1076    /// Output only. Whether the `site_secret` field was previously set. Since we will never return the `site_secret` field, this field is the only way to find out whether it was previously set.
1077    #[serde(rename = "siteSecretSet")]
1078    pub site_secret_set: Option<bool>,
1079    /// Specifies the duration for which App Check tokens exchanged from reCAPTCHA tokens will be valid. If unset, a default value of 1 day is assumed. Must be between 30 minutes and 7 days, inclusive.
1080    #[serde(rename = "tokenTtl")]
1081    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1082    pub token_ttl: Option<chrono::Duration>,
1083}
1084
1085impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaConfig {}
1086impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaConfig {}
1087
1088/// An app’s reCAPTCHA Enterprise configuration object. This configuration is used by ExchangeRecaptchaEnterpriseToken to validate reCAPTCHA tokens issued to apps by reCAPTCHA Enterprise. It also controls certain properties of the returned `AppCheckToken`, such as its ttl.
1089///
1090/// # Activities
1091///
1092/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1093/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1094///
1095/// * [apps recaptcha enterprise config get projects](ProjectAppRecaptchaEnterpriseConfigGetCall) (response)
1096/// * [apps recaptcha enterprise config patch projects](ProjectAppRecaptchaEnterpriseConfigPatchCall) (request|response)
1097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1098#[serde_with::serde_as]
1099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1100pub struct GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {
1101    /// Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
1102    pub name: Option<String>,
1103    /// Specifies risk tolerance and requirements for your application. These settings correspond to requirements on the [**`riskAnalysis`**](https://cloud.google.com/recaptcha/docs/interpret-assessment-website#interpret_assessment) tuple in the assessment obtained from reCAPTCHA Enterprise. The default values for these settings work for most apps, and are recommended.
1104    #[serde(rename = "riskAnalysis")]
1105    pub risk_analysis: Option<GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfigRiskAnalysis>,
1106    /// The score-based site key [created in reCAPTCHA Enterprise](https://cloud.google.com/recaptcha-enterprise/docs/create-key#creating_a_site_key) used to [invoke reCAPTCHA and generate the reCAPTCHA tokens](https://cloud.google.com/recaptcha-enterprise/docs/instrument-web-pages) for your application. Important: This is *not* the `site_secret` (as it is in reCAPTCHA v3), but rather your score-based reCAPTCHA Enterprise site key.
1107    #[serde(rename = "siteKey")]
1108    pub site_key: Option<String>,
1109    /// Specifies the duration for which App Check tokens exchanged from reCAPTCHA Enterprise tokens will be valid. If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive.
1110    #[serde(rename = "tokenTtl")]
1111    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1112    pub token_ttl: Option<chrono::Duration>,
1113}
1114
1115impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {}
1116impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {}
1117
1118/// A settings object specifying risk tolerance and requirements for your application. These settings correspond to requirements on the [**`riskAnalysis`**](https://cloud.google.com/recaptcha/docs/interpret-assessment-website#interpret_assessment) tuple in the assessment obtained from reCAPTCHA Enterprise. The default values for these settings work for most apps, and are recommended.
1119///
1120/// This type is not used in any activity, and only used as *part* of another schema.
1121///
1122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1123#[serde_with::serde_as]
1124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1125pub struct GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfigRiskAnalysis {
1126    /// Specifies a minimum score required for a reCAPTCHA token to be considered valid. If its score is greater than or equal to this value, it will be accepted; otherwise, it will be rejected. The value must be between 0.0 and 1.0. The default value is 0.5.
1127    #[serde(rename = "minValidScore")]
1128    pub min_valid_score: Option<f32>,
1129}
1130
1131impl common::Part for GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfigRiskAnalysis {}
1132
1133/// An app’s reCAPTCHA v3 configuration object. This configuration is used by ExchangeRecaptchaV3Token to validate reCAPTCHA tokens issued to apps by reCAPTCHA v3. It also controls certain properties of the returned `AppCheckToken`, such as its ttl.
1134///
1135/// # Activities
1136///
1137/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1138/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1139///
1140/// * [apps recaptcha v3 config get projects](ProjectAppRecaptchaV3ConfigGetCall) (response)
1141/// * [apps recaptcha v3 config patch projects](ProjectAppRecaptchaV3ConfigPatchCall) (request|response)
1142#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1143#[serde_with::serde_as]
1144#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1145pub struct GoogleFirebaseAppcheckV1betaRecaptchaV3Config {
1146    /// Specifies a minimum score required for a reCAPTCHA token to be considered valid. If its score is greater than or equal to this value, it will be accepted; otherwise, it will be rejected. The value must be between 0.0 and 1.0. The default value is 0.5.
1147    #[serde(rename = "minValidScore")]
1148    pub min_valid_score: Option<f32>,
1149    /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
1150    pub name: Option<String>,
1151    /// Required. Input only. The site secret used to identify your service for reCAPTCHA v3 verification. For security reasons, this field will never be populated in any response.
1152    #[serde(rename = "siteSecret")]
1153    pub site_secret: Option<String>,
1154    /// Output only. Whether the `site_secret` field was previously set. Since we will never return the `site_secret` field, this field is the only way to find out whether it was previously set.
1155    #[serde(rename = "siteSecretSet")]
1156    pub site_secret_set: Option<bool>,
1157    /// Specifies the duration for which App Check tokens exchanged from reCAPTCHA tokens will be valid. If unset, a default value of 1 day is assumed. Must be between 30 minutes and 7 days, inclusive.
1158    #[serde(rename = "tokenTtl")]
1159    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1160    pub token_ttl: Option<chrono::Duration>,
1161}
1162
1163impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaV3Config {}
1164impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaV3Config {}
1165
1166/// App Check enforcement policy for a specific resource of a Google service supported by App Check. Note that this policy will override the service-level configuration.
1167///
1168/// # Activities
1169///
1170/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1171/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1172///
1173/// * [services resource policies create projects](ProjectServiceResourcePolicyCreateCall) (request|response)
1174/// * [services resource policies get projects](ProjectServiceResourcePolicyGetCall) (response)
1175/// * [services resource policies patch projects](ProjectServiceResourcePolicyPatchCall) (request|response)
1176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1177#[serde_with::serde_as]
1178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1179pub struct GoogleFirebaseAppcheckV1betaResourcePolicy {
1180    /// Required. The App Check enforcement mode for this resource. This will override the EnforcementMode setting on the parent service.
1181    #[serde(rename = "enforcementMode")]
1182    pub enforcement_mode: Option<String>,
1183    /// This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. This etag is strongly validated as defined by RFC 7232.
1184    pub etag: Option<String>,
1185    /// Required. Identifier. The relative name of the resource policy object, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS) `resource_policy_id` is a system-generated UID.
1186    pub name: Option<String>,
1187    /// Required. Service specific name of the resource object to which this policy applies, in the format: * **iOS OAuth clients** (Google Identity for iOS): `//oauth2.googleapis.com/projects/{project_number}/oauthClients/{oauth_client_id}` Note that the resource must belong to the service specified in the `name` and be from the same project as this policy, but the resource is allowed to be missing at the time of creation of this policy; in that case, we make a best-effort attempt at respecting this policy, but it may not have any effect until the resource is fully created.
1188    #[serde(rename = "targetResource")]
1189    pub target_resource: Option<String>,
1190    /// Output only. Timestamp when this resource policy configuration object was most recently updated.
1191    #[serde(rename = "updateTime")]
1192    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1193}
1194
1195impl common::RequestValue for GoogleFirebaseAppcheckV1betaResourcePolicy {}
1196impl common::ResponseResult for GoogleFirebaseAppcheckV1betaResourcePolicy {}
1197
1198/// An app’s SafetyNet configuration object. This configuration controls certain properties of the `AppCheckToken` returned by ExchangeSafetyNetToken, such as its ttl. Note that your registered SHA-256 certificate fingerprints are used to validate tokens issued by SafetyNet; please register them via the Firebase Console or programmatically via the [Firebase Management Service](https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.androidApps.sha/create).
1199///
1200/// # Activities
1201///
1202/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1203/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1204///
1205/// * [apps safety net config get projects](ProjectAppSafetyNetConfigGetCall) (response)
1206/// * [apps safety net config patch projects](ProjectAppSafetyNetConfigPatchCall) (request|response)
1207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1208#[serde_with::serde_as]
1209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1210pub struct GoogleFirebaseAppcheckV1betaSafetyNetConfig {
1211    /// Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
1212    pub name: Option<String>,
1213    /// Specifies the duration for which App Check tokens exchanged from SafetyNet tokens will be valid. If unset, a default value of 1 hour is assumed. Must be between 30 minutes and 7 days, inclusive.
1214    #[serde(rename = "tokenTtl")]
1215    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1216    pub token_ttl: Option<chrono::Duration>,
1217}
1218
1219impl common::RequestValue for GoogleFirebaseAppcheckV1betaSafetyNetConfig {}
1220impl common::ResponseResult for GoogleFirebaseAppcheckV1betaSafetyNetConfig {}
1221
1222/// The enforcement configuration for a Firebase service supported by App Check.
1223///
1224/// # Activities
1225///
1226/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1227/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1228///
1229/// * [services get projects](ProjectServiceGetCall) (response)
1230/// * [services patch projects](ProjectServicePatchCall) (request|response)
1231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1232#[serde_with::serde_as]
1233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1234pub struct GoogleFirebaseAppcheckV1betaService {
1235    /// Required. The App Check enforcement mode for this service.
1236    #[serde(rename = "enforcementMode")]
1237    pub enforcement_mode: Option<String>,
1238    /// This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. This etag is strongly validated as defined by RFC 7232.
1239    pub etag: Option<String>,
1240    /// Required. The relative resource name of the service configuration object, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS)
1241    pub name: Option<String>,
1242    /// Output only. Timestamp when this service configuration object was most recently updated.
1243    #[serde(rename = "updateTime")]
1244    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1245}
1246
1247impl common::RequestValue for GoogleFirebaseAppcheckV1betaService {}
1248impl common::ResponseResult for GoogleFirebaseAppcheckV1betaService {}
1249
1250/// Request message for the UpdateResourcePolicy method as well as an individual update message for the BatchUpdateResourcePolicies method.
1251///
1252/// This type is not used in any activity, and only used as *part* of another schema.
1253///
1254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1255#[serde_with::serde_as]
1256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1257pub struct GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest {
1258    /// Required. The ResourcePolicy to update. The ResourcePolicy's `name` field is used to identify the ResourcePolicy to be updated, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
1259    #[serde(rename = "resourcePolicy")]
1260    pub resource_policy: Option<GoogleFirebaseAppcheckV1betaResourcePolicy>,
1261    /// Required. A comma-separated list of names of fields in the ResourcePolicy to update. Example: `enforcement_mode`.
1262    #[serde(rename = "updateMask")]
1263    pub update_mask: Option<common::FieldMask>,
1264}
1265
1266impl common::Part for GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest {}
1267
1268/// Request message for the UpdateService method as well as an individual update message for the BatchUpdateServices method.
1269///
1270/// This type is not used in any activity, and only used as *part* of another schema.
1271///
1272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1273#[serde_with::serde_as]
1274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1275pub struct GoogleFirebaseAppcheckV1betaUpdateServiceRequest {
1276    /// Required. The Service to update. The Service's `name` field is used to identify the Service to be updated, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS) For Firebase Authentication to work with App Check, you must first upgrade to [Firebase Authentication with Identity Platform](https://firebase.google.com/docs/auth#identity-platform).
1277    pub service: Option<GoogleFirebaseAppcheckV1betaService>,
1278    /// Required. A comma-separated list of names of fields in the Service to update. Example: `enforcement_mode`.
1279    #[serde(rename = "updateMask")]
1280    pub update_mask: Option<common::FieldMask>,
1281}
1282
1283impl common::Part for GoogleFirebaseAppcheckV1betaUpdateServiceRequest {}
1284
1285/// Request message for the VerifyAppCheckToken method.
1286///
1287/// # Activities
1288///
1289/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1290/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1291///
1292/// * [verify app check token projects](ProjectVerifyAppCheckTokenCall) (request)
1293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1294#[serde_with::serde_as]
1295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1296pub struct GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest {
1297    /// Required. The App Check token to verify. App Check tokens exchanged from the SafetyNet provider are not supported; an HTTP 400 error will be returned.
1298    #[serde(rename = "appCheckToken")]
1299    pub app_check_token: Option<String>,
1300}
1301
1302impl common::RequestValue for GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest {}
1303
1304/// Response message for the VerifyAppCheckToken method.
1305///
1306/// # Activities
1307///
1308/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1309/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1310///
1311/// * [verify app check token projects](ProjectVerifyAppCheckTokenCall) (response)
1312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1313#[serde_with::serde_as]
1314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1315pub struct GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse {
1316    /// Whether this token was already consumed. If this is the first time this method has seen the given App Check token, this field will be omitted from the response. The given token will then be marked as `already_consumed` (set to `true`) for all future invocations of this method for that token. Note that if the given App Check token is invalid, an HTTP 403 error is returned instead of a response containing this field, regardless whether the token was already consumed.
1317    #[serde(rename = "alreadyConsumed")]
1318    pub already_consumed: Option<bool>,
1319}
1320
1321impl common::ResponseResult for GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse {}
1322
1323/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
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/// * [apps debug tokens delete projects](ProjectAppDebugTokenDeleteCall) (response)
1331/// * [services resource policies delete projects](ProjectServiceResourcePolicyDeleteCall) (response)
1332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1333#[serde_with::serde_as]
1334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1335pub struct GoogleProtobufEmpty {
1336    _never_set: Option<bool>,
1337}
1338
1339impl common::ResponseResult for GoogleProtobufEmpty {}
1340
1341// ###################
1342// MethodBuilders ###
1343// #################
1344
1345/// A builder providing access to all methods supported on *jwk* resources.
1346/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1347///
1348/// # Example
1349///
1350/// Instantiate a resource builder
1351///
1352/// ```test_harness,no_run
1353/// extern crate hyper;
1354/// extern crate hyper_rustls;
1355/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1356///
1357/// # async fn dox() {
1358/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1359///
1360/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1361/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1362///     .with_native_roots()
1363///     .unwrap()
1364///     .https_only()
1365///     .enable_http2()
1366///     .build();
1367///
1368/// let executor = hyper_util::rt::TokioExecutor::new();
1369/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1370///     secret,
1371///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1372///     yup_oauth2::client::CustomHyperClientBuilder::from(
1373///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1374///     ),
1375/// ).build().await.unwrap();
1376///
1377/// let client = hyper_util::client::legacy::Client::builder(
1378///     hyper_util::rt::TokioExecutor::new()
1379/// )
1380/// .build(
1381///     hyper_rustls::HttpsConnectorBuilder::new()
1382///         .with_native_roots()
1383///         .unwrap()
1384///         .https_or_http()
1385///         .enable_http2()
1386///         .build()
1387/// );
1388/// let mut hub = Firebaseappcheck::new(client, auth);
1389/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1390/// // like `get(...)`
1391/// // to build up your call.
1392/// let rb = hub.jwks();
1393/// # }
1394/// ```
1395pub struct JwkMethods<'a, C>
1396where
1397    C: 'a,
1398{
1399    hub: &'a Firebaseappcheck<C>,
1400}
1401
1402impl<'a, C> common::MethodsBuilder for JwkMethods<'a, C> {}
1403
1404impl<'a, C> JwkMethods<'a, C> {
1405    /// Create a builder to help you perform the following task:
1406    ///
1407    /// Returns a public JWK set as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517) that can be used to verify App Check tokens. Exactly one of the public keys in the returned set will successfully validate any App Check token that is currently valid.
1408    ///
1409    /// # Arguments
1410    ///
1411    /// * `name` - Required. The relative resource name to the public JWK set. Must always be exactly the string `jwks`.
1412    pub fn get(&self, name: &str) -> JwkGetCall<'a, C> {
1413        JwkGetCall {
1414            hub: self.hub,
1415            _name: name.to_string(),
1416            _delegate: Default::default(),
1417            _additional_params: Default::default(),
1418            _scopes: Default::default(),
1419        }
1420    }
1421}
1422
1423/// A builder providing access to all methods supported on *oauthClient* resources.
1424/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1425///
1426/// # Example
1427///
1428/// Instantiate a resource builder
1429///
1430/// ```test_harness,no_run
1431/// extern crate hyper;
1432/// extern crate hyper_rustls;
1433/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1434///
1435/// # async fn dox() {
1436/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1437///
1438/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1439/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1440///     .with_native_roots()
1441///     .unwrap()
1442///     .https_only()
1443///     .enable_http2()
1444///     .build();
1445///
1446/// let executor = hyper_util::rt::TokioExecutor::new();
1447/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1448///     secret,
1449///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1450///     yup_oauth2::client::CustomHyperClientBuilder::from(
1451///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1452///     ),
1453/// ).build().await.unwrap();
1454///
1455/// let client = hyper_util::client::legacy::Client::builder(
1456///     hyper_util::rt::TokioExecutor::new()
1457/// )
1458/// .build(
1459///     hyper_rustls::HttpsConnectorBuilder::new()
1460///         .with_native_roots()
1461///         .unwrap()
1462///         .https_or_http()
1463///         .enable_http2()
1464///         .build()
1465/// );
1466/// let mut hub = Firebaseappcheck::new(client, auth);
1467/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1468/// // like `exchange_app_attest_assertion(...)`, `exchange_app_attest_attestation(...)`, `exchange_debug_token(...)` and `generate_app_attest_challenge(...)`
1469/// // to build up your call.
1470/// let rb = hub.oauth_clients();
1471/// # }
1472/// ```
1473pub struct OauthClientMethods<'a, C>
1474where
1475    C: 'a,
1476{
1477    hub: &'a Firebaseappcheck<C>,
1478}
1479
1480impl<'a, C> common::MethodsBuilder for OauthClientMethods<'a, C> {}
1481
1482impl<'a, C> OauthClientMethods<'a, C> {
1483    /// Create a builder to help you perform the following task:
1484    ///
1485    /// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
1486    ///
1487    /// # Arguments
1488    ///
1489    /// * `request` - No description provided.
1490    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
1491    pub fn exchange_app_attest_assertion(
1492        &self,
1493        request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
1494        app: &str,
1495    ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
1496        OauthClientExchangeAppAttestAssertionCall {
1497            hub: self.hub,
1498            _request: request,
1499            _app: app.to_string(),
1500            _delegate: Default::default(),
1501            _additional_params: Default::default(),
1502            _scopes: Default::default(),
1503        }
1504    }
1505
1506    /// Create a builder to help you perform the following task:
1507    ///
1508    /// Accepts an App Attest CBOR attestation and verifies it with Apple using your preconfigured team and bundle IDs. If valid, returns an attestation artifact that can later be exchanged for an AppCheckToken using ExchangeAppAttestAssertion. For convenience and performance, this method's response object will also contain an AppCheckToken (if the verification is successful).
1509    ///
1510    /// # Arguments
1511    ///
1512    /// * `request` - No description provided.
1513    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
1514    pub fn exchange_app_attest_attestation(
1515        &self,
1516        request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
1517        app: &str,
1518    ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
1519        OauthClientExchangeAppAttestAttestationCall {
1520            hub: self.hub,
1521            _request: request,
1522            _app: app.to_string(),
1523            _delegate: Default::default(),
1524            _additional_params: Default::default(),
1525            _scopes: Default::default(),
1526        }
1527    }
1528
1529    /// Create a builder to help you perform the following task:
1530    ///
1531    /// Validates a debug token secret that you have previously created using CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive quota is enforced on this method to prevent accidental exposure of the app to abuse.
1532    ///
1533    /// # Arguments
1534    ///
1535    /// * `request` - No description provided.
1536    /// * `app` - Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
1537    pub fn exchange_debug_token(
1538        &self,
1539        request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
1540        app: &str,
1541    ) -> OauthClientExchangeDebugTokenCall<'a, C> {
1542        OauthClientExchangeDebugTokenCall {
1543            hub: self.hub,
1544            _request: request,
1545            _app: app.to_string(),
1546            _delegate: Default::default(),
1547            _additional_params: Default::default(),
1548            _scopes: Default::default(),
1549        }
1550    }
1551
1552    /// Create a builder to help you perform the following task:
1553    ///
1554    /// Generates a challenge that protects the integrity of an immediately following call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A challenge should not be reused for multiple calls.
1555    ///
1556    /// # Arguments
1557    ///
1558    /// * `request` - No description provided.
1559    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
1560    pub fn generate_app_attest_challenge(
1561        &self,
1562        request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
1563        app: &str,
1564    ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
1565        OauthClientGenerateAppAttestChallengeCall {
1566            hub: self.hub,
1567            _request: request,
1568            _app: app.to_string(),
1569            _delegate: Default::default(),
1570            _additional_params: Default::default(),
1571            _scopes: Default::default(),
1572        }
1573    }
1574}
1575
1576/// A builder providing access to all methods supported on *project* resources.
1577/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1578///
1579/// # Example
1580///
1581/// Instantiate a resource builder
1582///
1583/// ```test_harness,no_run
1584/// extern crate hyper;
1585/// extern crate hyper_rustls;
1586/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1587///
1588/// # async fn dox() {
1589/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1590///
1591/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1592/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1593///     .with_native_roots()
1594///     .unwrap()
1595///     .https_only()
1596///     .enable_http2()
1597///     .build();
1598///
1599/// let executor = hyper_util::rt::TokioExecutor::new();
1600/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1601///     secret,
1602///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1603///     yup_oauth2::client::CustomHyperClientBuilder::from(
1604///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1605///     ),
1606/// ).build().await.unwrap();
1607///
1608/// let client = hyper_util::client::legacy::Client::builder(
1609///     hyper_util::rt::TokioExecutor::new()
1610/// )
1611/// .build(
1612///     hyper_rustls::HttpsConnectorBuilder::new()
1613///         .with_native_roots()
1614///         .unwrap()
1615///         .https_or_http()
1616///         .enable_http2()
1617///         .build()
1618/// );
1619/// let mut hub = Firebaseappcheck::new(client, auth);
1620/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1621/// // like `apps_app_attest_config_batch_get(...)`, `apps_app_attest_config_get(...)`, `apps_app_attest_config_patch(...)`, `apps_debug_tokens_create(...)`, `apps_debug_tokens_delete(...)`, `apps_debug_tokens_get(...)`, `apps_debug_tokens_list(...)`, `apps_debug_tokens_patch(...)`, `apps_device_check_config_batch_get(...)`, `apps_device_check_config_get(...)`, `apps_device_check_config_patch(...)`, `apps_exchange_app_attest_assertion(...)`, `apps_exchange_app_attest_attestation(...)`, `apps_exchange_custom_token(...)`, `apps_exchange_debug_token(...)`, `apps_exchange_device_check_token(...)`, `apps_exchange_play_integrity_token(...)`, `apps_exchange_recaptcha_enterprise_token(...)`, `apps_exchange_recaptcha_token(...)`, `apps_exchange_recaptcha_v3_token(...)`, `apps_exchange_safety_net_token(...)`, `apps_generate_app_attest_challenge(...)`, `apps_generate_play_integrity_challenge(...)`, `apps_play_integrity_config_batch_get(...)`, `apps_play_integrity_config_get(...)`, `apps_play_integrity_config_patch(...)`, `apps_recaptcha_config_batch_get(...)`, `apps_recaptcha_config_get(...)`, `apps_recaptcha_config_patch(...)`, `apps_recaptcha_enterprise_config_batch_get(...)`, `apps_recaptcha_enterprise_config_get(...)`, `apps_recaptcha_enterprise_config_patch(...)`, `apps_recaptcha_v3_config_batch_get(...)`, `apps_recaptcha_v3_config_get(...)`, `apps_recaptcha_v3_config_patch(...)`, `apps_safety_net_config_batch_get(...)`, `apps_safety_net_config_get(...)`, `apps_safety_net_config_patch(...)`, `services_batch_update(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_resource_policies_batch_update(...)`, `services_resource_policies_create(...)`, `services_resource_policies_delete(...)`, `services_resource_policies_get(...)`, `services_resource_policies_list(...)`, `services_resource_policies_patch(...)` and `verify_app_check_token(...)`
1622/// // to build up your call.
1623/// let rb = hub.projects();
1624/// # }
1625/// ```
1626pub struct ProjectMethods<'a, C>
1627where
1628    C: 'a,
1629{
1630    hub: &'a Firebaseappcheck<C>,
1631}
1632
1633impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1634
1635impl<'a, C> ProjectMethods<'a, C> {
1636    /// Create a builder to help you perform the following task:
1637    ///
1638    /// Atomically gets the AppAttestConfigs for the specified list of apps.
1639    ///
1640    /// # Arguments
1641    ///
1642    /// * `parent` - Required. The parent project name shared by all AppAttestConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
1643    pub fn apps_app_attest_config_batch_get(
1644        &self,
1645        parent: &str,
1646    ) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
1647        ProjectAppAppAttestConfigBatchGetCall {
1648            hub: self.hub,
1649            _parent: parent.to_string(),
1650            _names: Default::default(),
1651            _delegate: Default::default(),
1652            _additional_params: Default::default(),
1653            _scopes: Default::default(),
1654        }
1655    }
1656
1657    /// Create a builder to help you perform the following task:
1658    ///
1659    /// Gets the AppAttestConfig for the specified app.
1660    ///
1661    /// # Arguments
1662    ///
1663    /// * `name` - Required. The relative resource name of the AppAttestConfig, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
1664    pub fn apps_app_attest_config_get(
1665        &self,
1666        name: &str,
1667    ) -> ProjectAppAppAttestConfigGetCall<'a, C> {
1668        ProjectAppAppAttestConfigGetCall {
1669            hub: self.hub,
1670            _name: name.to_string(),
1671            _delegate: Default::default(),
1672            _additional_params: Default::default(),
1673            _scopes: Default::default(),
1674        }
1675    }
1676
1677    /// Create a builder to help you perform the following task:
1678    ///
1679    /// Updates the AppAttestConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange AppAttest tokens for App Check tokens.
1680    ///
1681    /// # Arguments
1682    ///
1683    /// * `request` - No description provided.
1684    /// * `name` - Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
1685    pub fn apps_app_attest_config_patch(
1686        &self,
1687        request: GoogleFirebaseAppcheckV1betaAppAttestConfig,
1688        name: &str,
1689    ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
1690        ProjectAppAppAttestConfigPatchCall {
1691            hub: self.hub,
1692            _request: request,
1693            _name: name.to_string(),
1694            _update_mask: Default::default(),
1695            _delegate: Default::default(),
1696            _additional_params: Default::default(),
1697            _scopes: Default::default(),
1698        }
1699    }
1700
1701    /// Create a builder to help you perform the following task:
1702    ///
1703    /// Creates a new DebugToken for the specified app. For security reasons, after the creation operation completes, the `token` field cannot be updated or retrieved, but you can revoke the debug token using DeleteDebugToken. Each app can have a maximum of 20 debug tokens.
1704    ///
1705    /// # Arguments
1706    ///
1707    /// * `request` - No description provided.
1708    /// * `parent` - Required. The relative resource name of the parent app in which the specified DebugToken will be created, in the format: ``` projects/{project_number}/apps/{app_id} ```
1709    pub fn apps_debug_tokens_create(
1710        &self,
1711        request: GoogleFirebaseAppcheckV1betaDebugToken,
1712        parent: &str,
1713    ) -> ProjectAppDebugTokenCreateCall<'a, C> {
1714        ProjectAppDebugTokenCreateCall {
1715            hub: self.hub,
1716            _request: request,
1717            _parent: parent.to_string(),
1718            _delegate: Default::default(),
1719            _additional_params: Default::default(),
1720            _scopes: Default::default(),
1721        }
1722    }
1723
1724    /// Create a builder to help you perform the following task:
1725    ///
1726    /// Deletes the specified DebugToken. A deleted debug token cannot be used to exchange for an App Check token. Use this method when you suspect the secret `token` has been compromised or when you no longer need the debug token.
1727    ///
1728    /// # Arguments
1729    ///
1730    /// * `name` - Required. The relative resource name of the DebugToken to delete, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1731    pub fn apps_debug_tokens_delete(&self, name: &str) -> ProjectAppDebugTokenDeleteCall<'a, C> {
1732        ProjectAppDebugTokenDeleteCall {
1733            hub: self.hub,
1734            _name: name.to_string(),
1735            _delegate: Default::default(),
1736            _additional_params: Default::default(),
1737            _scopes: Default::default(),
1738        }
1739    }
1740
1741    /// Create a builder to help you perform the following task:
1742    ///
1743    /// Gets the specified DebugToken. For security reasons, the `token` field is never populated in the response.
1744    ///
1745    /// # Arguments
1746    ///
1747    /// * `name` - Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1748    pub fn apps_debug_tokens_get(&self, name: &str) -> ProjectAppDebugTokenGetCall<'a, C> {
1749        ProjectAppDebugTokenGetCall {
1750            hub: self.hub,
1751            _name: name.to_string(),
1752            _delegate: Default::default(),
1753            _additional_params: Default::default(),
1754            _scopes: Default::default(),
1755        }
1756    }
1757
1758    /// Create a builder to help you perform the following task:
1759    ///
1760    /// Lists all DebugTokens for the specified app. For security reasons, the `token` field is never populated in the response.
1761    ///
1762    /// # Arguments
1763    ///
1764    /// * `parent` - Required. The relative resource name of the parent app for which to list each associated DebugToken, in the format: ``` projects/{project_number}/apps/{app_id} ```
1765    pub fn apps_debug_tokens_list(&self, parent: &str) -> ProjectAppDebugTokenListCall<'a, C> {
1766        ProjectAppDebugTokenListCall {
1767            hub: self.hub,
1768            _parent: parent.to_string(),
1769            _page_token: Default::default(),
1770            _page_size: Default::default(),
1771            _delegate: Default::default(),
1772            _additional_params: Default::default(),
1773            _scopes: Default::default(),
1774        }
1775    }
1776
1777    /// Create a builder to help you perform the following task:
1778    ///
1779    /// Updates the specified DebugToken. For security reasons, the `token` field cannot be updated, nor will it be populated in the response, but you can revoke the debug token using DeleteDebugToken.
1780    ///
1781    /// # Arguments
1782    ///
1783    /// * `request` - No description provided.
1784    /// * `name` - Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1785    pub fn apps_debug_tokens_patch(
1786        &self,
1787        request: GoogleFirebaseAppcheckV1betaDebugToken,
1788        name: &str,
1789    ) -> ProjectAppDebugTokenPatchCall<'a, C> {
1790        ProjectAppDebugTokenPatchCall {
1791            hub: self.hub,
1792            _request: request,
1793            _name: name.to_string(),
1794            _update_mask: Default::default(),
1795            _delegate: Default::default(),
1796            _additional_params: Default::default(),
1797            _scopes: Default::default(),
1798        }
1799    }
1800
1801    /// Create a builder to help you perform the following task:
1802    ///
1803    /// Atomically gets the DeviceCheckConfigs for the specified list of apps. For security reasons, the `private_key` field is never populated in the response.
1804    ///
1805    /// # Arguments
1806    ///
1807    /// * `parent` - Required. The parent project name shared by all DeviceCheckConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
1808    pub fn apps_device_check_config_batch_get(
1809        &self,
1810        parent: &str,
1811    ) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
1812        ProjectAppDeviceCheckConfigBatchGetCall {
1813            hub: self.hub,
1814            _parent: parent.to_string(),
1815            _names: Default::default(),
1816            _delegate: Default::default(),
1817            _additional_params: Default::default(),
1818            _scopes: Default::default(),
1819        }
1820    }
1821
1822    /// Create a builder to help you perform the following task:
1823    ///
1824    /// Gets the DeviceCheckConfig for the specified app. For security reasons, the `private_key` field is never populated in the response.
1825    ///
1826    /// # Arguments
1827    ///
1828    /// * `name` - Required. The relative resource name of the DeviceCheckConfig, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
1829    pub fn apps_device_check_config_get(
1830        &self,
1831        name: &str,
1832    ) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
1833        ProjectAppDeviceCheckConfigGetCall {
1834            hub: self.hub,
1835            _name: name.to_string(),
1836            _delegate: Default::default(),
1837            _additional_params: Default::default(),
1838            _scopes: Default::default(),
1839        }
1840    }
1841
1842    /// Create a builder to help you perform the following task:
1843    ///
1844    /// Updates the DeviceCheckConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange DeviceCheck tokens for App Check tokens. For security reasons, the `private_key` field is never populated in the response.
1845    ///
1846    /// # Arguments
1847    ///
1848    /// * `request` - No description provided.
1849    /// * `name` - Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
1850    pub fn apps_device_check_config_patch(
1851        &self,
1852        request: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
1853        name: &str,
1854    ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
1855        ProjectAppDeviceCheckConfigPatchCall {
1856            hub: self.hub,
1857            _request: request,
1858            _name: name.to_string(),
1859            _update_mask: Default::default(),
1860            _delegate: Default::default(),
1861            _additional_params: Default::default(),
1862            _scopes: Default::default(),
1863        }
1864    }
1865
1866    /// Create a builder to help you perform the following task:
1867    ///
1868    /// Atomically gets the PlayIntegrityConfigs for the specified list of apps.
1869    ///
1870    /// # Arguments
1871    ///
1872    /// * `parent` - Required. The parent project name shared by all PlayIntegrityConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
1873    pub fn apps_play_integrity_config_batch_get(
1874        &self,
1875        parent: &str,
1876    ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
1877        ProjectAppPlayIntegrityConfigBatchGetCall {
1878            hub: self.hub,
1879            _parent: parent.to_string(),
1880            _names: Default::default(),
1881            _delegate: Default::default(),
1882            _additional_params: Default::default(),
1883            _scopes: Default::default(),
1884        }
1885    }
1886
1887    /// Create a builder to help you perform the following task:
1888    ///
1889    /// Gets the PlayIntegrityConfig for the specified app.
1890    ///
1891    /// # Arguments
1892    ///
1893    /// * `name` - Required. The relative resource name of the PlayIntegrityConfig, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
1894    pub fn apps_play_integrity_config_get(
1895        &self,
1896        name: &str,
1897    ) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
1898        ProjectAppPlayIntegrityConfigGetCall {
1899            hub: self.hub,
1900            _name: name.to_string(),
1901            _delegate: Default::default(),
1902            _additional_params: Default::default(),
1903            _scopes: Default::default(),
1904        }
1905    }
1906
1907    /// Create a builder to help you perform the following task:
1908    ///
1909    /// Updates the PlayIntegrityConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange Play Integrity tokens for App Check tokens.
1910    ///
1911    /// # Arguments
1912    ///
1913    /// * `request` - No description provided.
1914    /// * `name` - Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
1915    pub fn apps_play_integrity_config_patch(
1916        &self,
1917        request: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
1918        name: &str,
1919    ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
1920        ProjectAppPlayIntegrityConfigPatchCall {
1921            hub: self.hub,
1922            _request: request,
1923            _name: name.to_string(),
1924            _update_mask: Default::default(),
1925            _delegate: Default::default(),
1926            _additional_params: Default::default(),
1927            _scopes: Default::default(),
1928        }
1929    }
1930
1931    /// Create a builder to help you perform the following task:
1932    ///
1933    /// Atomically gets the RecaptchaConfigs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
1934    ///
1935    /// # Arguments
1936    ///
1937    /// * `parent` - Required. The parent project name shared by all RecaptchaConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
1938    pub fn apps_recaptcha_config_batch_get(
1939        &self,
1940        parent: &str,
1941    ) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
1942        ProjectAppRecaptchaConfigBatchGetCall {
1943            hub: self.hub,
1944            _parent: parent.to_string(),
1945            _names: Default::default(),
1946            _delegate: Default::default(),
1947            _additional_params: Default::default(),
1948            _scopes: Default::default(),
1949        }
1950    }
1951
1952    /// Create a builder to help you perform the following task:
1953    ///
1954    /// Gets the RecaptchaConfig for the specified app. For security reasons, the `site_secret` field is never populated in the response.
1955    ///
1956    /// # Arguments
1957    ///
1958    /// * `name` - Required. The relative resource name of the RecaptchaConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1959    pub fn apps_recaptcha_config_get(&self, name: &str) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
1960        ProjectAppRecaptchaConfigGetCall {
1961            hub: self.hub,
1962            _name: name.to_string(),
1963            _delegate: Default::default(),
1964            _additional_params: Default::default(),
1965            _scopes: Default::default(),
1966        }
1967    }
1968
1969    /// Create a builder to help you perform the following task:
1970    ///
1971    /// Updates the RecaptchaConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA tokens for App Check tokens. For security reasons, the `site_secret` field is never populated in the response.
1972    ///
1973    /// # Arguments
1974    ///
1975    /// * `request` - No description provided.
1976    /// * `name` - Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1977    pub fn apps_recaptcha_config_patch(
1978        &self,
1979        request: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
1980        name: &str,
1981    ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
1982        ProjectAppRecaptchaConfigPatchCall {
1983            hub: self.hub,
1984            _request: request,
1985            _name: name.to_string(),
1986            _update_mask: Default::default(),
1987            _delegate: Default::default(),
1988            _additional_params: Default::default(),
1989            _scopes: Default::default(),
1990        }
1991    }
1992
1993    /// Create a builder to help you perform the following task:
1994    ///
1995    /// Atomically gets the RecaptchaEnterpriseConfigs for the specified list of apps.
1996    ///
1997    /// # Arguments
1998    ///
1999    /// * `parent` - Required. The parent project name shared by all RecaptchaEnterpriseConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
2000    pub fn apps_recaptcha_enterprise_config_batch_get(
2001        &self,
2002        parent: &str,
2003    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
2004        ProjectAppRecaptchaEnterpriseConfigBatchGetCall {
2005            hub: self.hub,
2006            _parent: parent.to_string(),
2007            _names: Default::default(),
2008            _delegate: Default::default(),
2009            _additional_params: Default::default(),
2010            _scopes: Default::default(),
2011        }
2012    }
2013
2014    /// Create a builder to help you perform the following task:
2015    ///
2016    /// Gets the RecaptchaEnterpriseConfig for the specified app.
2017    ///
2018    /// # Arguments
2019    ///
2020    /// * `name` - Required. The relative resource name of the RecaptchaEnterpriseConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
2021    pub fn apps_recaptcha_enterprise_config_get(
2022        &self,
2023        name: &str,
2024    ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
2025        ProjectAppRecaptchaEnterpriseConfigGetCall {
2026            hub: self.hub,
2027            _name: name.to_string(),
2028            _delegate: Default::default(),
2029            _additional_params: Default::default(),
2030            _scopes: Default::default(),
2031        }
2032    }
2033
2034    /// Create a builder to help you perform the following task:
2035    ///
2036    /// Updates the RecaptchaEnterpriseConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA Enterprise tokens for App Check tokens.
2037    ///
2038    /// # Arguments
2039    ///
2040    /// * `request` - No description provided.
2041    /// * `name` - Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
2042    pub fn apps_recaptcha_enterprise_config_patch(
2043        &self,
2044        request: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
2045        name: &str,
2046    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
2047        ProjectAppRecaptchaEnterpriseConfigPatchCall {
2048            hub: self.hub,
2049            _request: request,
2050            _name: name.to_string(),
2051            _update_mask: Default::default(),
2052            _delegate: Default::default(),
2053            _additional_params: Default::default(),
2054            _scopes: Default::default(),
2055        }
2056    }
2057
2058    /// Create a builder to help you perform the following task:
2059    ///
2060    /// Atomically gets the RecaptchaV3Configs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
2061    ///
2062    /// # Arguments
2063    ///
2064    /// * `parent` - Required. The parent project name shared by all RecaptchaV3Configs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
2065    pub fn apps_recaptcha_v3_config_batch_get(
2066        &self,
2067        parent: &str,
2068    ) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
2069        ProjectAppRecaptchaV3ConfigBatchGetCall {
2070            hub: self.hub,
2071            _parent: parent.to_string(),
2072            _names: Default::default(),
2073            _delegate: Default::default(),
2074            _additional_params: Default::default(),
2075            _scopes: Default::default(),
2076        }
2077    }
2078
2079    /// Create a builder to help you perform the following task:
2080    ///
2081    /// Gets the RecaptchaV3Config for the specified app. For security reasons, the `site_secret` field is never populated in the response.
2082    ///
2083    /// # Arguments
2084    ///
2085    /// * `name` - Required. The relative resource name of the RecaptchaV3Config, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
2086    pub fn apps_recaptcha_v3_config_get(
2087        &self,
2088        name: &str,
2089    ) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
2090        ProjectAppRecaptchaV3ConfigGetCall {
2091            hub: self.hub,
2092            _name: name.to_string(),
2093            _delegate: Default::default(),
2094            _additional_params: Default::default(),
2095            _scopes: Default::default(),
2096        }
2097    }
2098
2099    /// Create a builder to help you perform the following task:
2100    ///
2101    /// Updates the RecaptchaV3Config for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA V3 tokens for App Check tokens. For security reasons, the `site_secret` field is never populated in the response.
2102    ///
2103    /// # Arguments
2104    ///
2105    /// * `request` - No description provided.
2106    /// * `name` - Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
2107    pub fn apps_recaptcha_v3_config_patch(
2108        &self,
2109        request: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
2110        name: &str,
2111    ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
2112        ProjectAppRecaptchaV3ConfigPatchCall {
2113            hub: self.hub,
2114            _request: request,
2115            _name: name.to_string(),
2116            _update_mask: Default::default(),
2117            _delegate: Default::default(),
2118            _additional_params: Default::default(),
2119            _scopes: Default::default(),
2120        }
2121    }
2122
2123    /// Create a builder to help you perform the following task:
2124    ///
2125    /// Atomically gets the SafetyNetConfigs for the specified list of apps.
2126    ///
2127    /// # Arguments
2128    ///
2129    /// * `parent` - Required. The parent project name shared by all SafetyNetConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
2130    pub fn apps_safety_net_config_batch_get(
2131        &self,
2132        parent: &str,
2133    ) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
2134        ProjectAppSafetyNetConfigBatchGetCall {
2135            hub: self.hub,
2136            _parent: parent.to_string(),
2137            _names: Default::default(),
2138            _delegate: Default::default(),
2139            _additional_params: Default::default(),
2140            _scopes: Default::default(),
2141        }
2142    }
2143
2144    /// Create a builder to help you perform the following task:
2145    ///
2146    /// Gets the SafetyNetConfig for the specified app.
2147    ///
2148    /// # Arguments
2149    ///
2150    /// * `name` - Required. The relative resource name of the SafetyNetConfig, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
2151    pub fn apps_safety_net_config_get(
2152        &self,
2153        name: &str,
2154    ) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
2155        ProjectAppSafetyNetConfigGetCall {
2156            hub: self.hub,
2157            _name: name.to_string(),
2158            _delegate: Default::default(),
2159            _additional_params: Default::default(),
2160            _scopes: Default::default(),
2161        }
2162    }
2163
2164    /// Create a builder to help you perform the following task:
2165    ///
2166    /// Updates the SafetyNetConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange SafetyNet tokens for App Check tokens.
2167    ///
2168    /// # Arguments
2169    ///
2170    /// * `request` - No description provided.
2171    /// * `name` - Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
2172    pub fn apps_safety_net_config_patch(
2173        &self,
2174        request: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
2175        name: &str,
2176    ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
2177        ProjectAppSafetyNetConfigPatchCall {
2178            hub: self.hub,
2179            _request: request,
2180            _name: name.to_string(),
2181            _update_mask: Default::default(),
2182            _delegate: Default::default(),
2183            _additional_params: Default::default(),
2184            _scopes: Default::default(),
2185        }
2186    }
2187
2188    /// Create a builder to help you perform the following task:
2189    ///
2190    /// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
2191    ///
2192    /// # Arguments
2193    ///
2194    /// * `request` - No description provided.
2195    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
2196    pub fn apps_exchange_app_attest_assertion(
2197        &self,
2198        request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
2199        app: &str,
2200    ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
2201        ProjectAppExchangeAppAttestAssertionCall {
2202            hub: self.hub,
2203            _request: request,
2204            _app: app.to_string(),
2205            _delegate: Default::default(),
2206            _additional_params: Default::default(),
2207            _scopes: Default::default(),
2208        }
2209    }
2210
2211    /// Create a builder to help you perform the following task:
2212    ///
2213    /// Accepts an App Attest CBOR attestation and verifies it with Apple using your preconfigured team and bundle IDs. If valid, returns an attestation artifact that can later be exchanged for an AppCheckToken using ExchangeAppAttestAssertion. For convenience and performance, this method's response object will also contain an AppCheckToken (if the verification is successful).
2214    ///
2215    /// # Arguments
2216    ///
2217    /// * `request` - No description provided.
2218    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
2219    pub fn apps_exchange_app_attest_attestation(
2220        &self,
2221        request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
2222        app: &str,
2223    ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
2224        ProjectAppExchangeAppAttestAttestationCall {
2225            hub: self.hub,
2226            _request: request,
2227            _app: app.to_string(),
2228            _delegate: Default::default(),
2229            _additional_params: Default::default(),
2230            _scopes: Default::default(),
2231        }
2232    }
2233
2234    /// Create a builder to help you perform the following task:
2235    ///
2236    /// Validates a custom token signed using your project's Admin SDK service account credentials. If valid, returns an AppCheckToken.
2237    ///
2238    /// # Arguments
2239    ///
2240    /// * `request` - No description provided.
2241    /// * `app` - Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2242    pub fn apps_exchange_custom_token(
2243        &self,
2244        request: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
2245        app: &str,
2246    ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
2247        ProjectAppExchangeCustomTokenCall {
2248            hub: self.hub,
2249            _request: request,
2250            _app: app.to_string(),
2251            _delegate: Default::default(),
2252            _additional_params: Default::default(),
2253            _scopes: Default::default(),
2254        }
2255    }
2256
2257    /// Create a builder to help you perform the following task:
2258    ///
2259    /// Validates a debug token secret that you have previously created using CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive quota is enforced on this method to prevent accidental exposure of the app to abuse.
2260    ///
2261    /// # Arguments
2262    ///
2263    /// * `request` - No description provided.
2264    /// * `app` - Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
2265    pub fn apps_exchange_debug_token(
2266        &self,
2267        request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
2268        app: &str,
2269    ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
2270        ProjectAppExchangeDebugTokenCall {
2271            hub: self.hub,
2272            _request: request,
2273            _app: app.to_string(),
2274            _delegate: Default::default(),
2275            _additional_params: Default::default(),
2276            _scopes: Default::default(),
2277        }
2278    }
2279
2280    /// Create a builder to help you perform the following task:
2281    ///
2282    /// Accepts a [`device_token`](https://developer.apple.com/documentation/devicecheck/dcdevice) issued by DeviceCheck, and attempts to validate it with Apple. If valid, returns an AppCheckToken.
2283    ///
2284    /// # Arguments
2285    ///
2286    /// * `request` - No description provided.
2287    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2288    pub fn apps_exchange_device_check_token(
2289        &self,
2290        request: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
2291        app: &str,
2292    ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
2293        ProjectAppExchangeDeviceCheckTokenCall {
2294            hub: self.hub,
2295            _request: request,
2296            _app: app.to_string(),
2297            _delegate: Default::default(),
2298            _additional_params: Default::default(),
2299            _scopes: Default::default(),
2300        }
2301    }
2302
2303    /// Create a builder to help you perform the following task:
2304    ///
2305    /// Validates an [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify). If valid, returns an AppCheckToken.
2306    ///
2307    /// # Arguments
2308    ///
2309    /// * `request` - No description provided.
2310    /// * `app` - Required. The relative resource name of the Android app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2311    pub fn apps_exchange_play_integrity_token(
2312        &self,
2313        request: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
2314        app: &str,
2315    ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
2316        ProjectAppExchangePlayIntegrityTokenCall {
2317            hub: self.hub,
2318            _request: request,
2319            _app: app.to_string(),
2320            _delegate: Default::default(),
2321            _additional_params: Default::default(),
2322            _scopes: Default::default(),
2323        }
2324    }
2325
2326    /// Create a builder to help you perform the following task:
2327    ///
2328    /// Validates a [reCAPTCHA Enterprise response token](https://cloud.google.com/recaptcha-enterprise/docs/create-assessment#retrieve_token). If valid, returns an App Check token AppCheckToken.
2329    ///
2330    /// # Arguments
2331    ///
2332    /// * `request` - No description provided.
2333    /// * `app` - Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2334    pub fn apps_exchange_recaptcha_enterprise_token(
2335        &self,
2336        request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
2337        app: &str,
2338    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
2339        ProjectAppExchangeRecaptchaEnterpriseTokenCall {
2340            hub: self.hub,
2341            _request: request,
2342            _app: app.to_string(),
2343            _delegate: Default::default(),
2344            _additional_params: Default::default(),
2345            _scopes: Default::default(),
2346        }
2347    }
2348
2349    /// Create a builder to help you perform the following task:
2350    ///
2351    /// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
2352    ///
2353    /// # Arguments
2354    ///
2355    /// * `request` - No description provided.
2356    /// * `app` - Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2357    pub fn apps_exchange_recaptcha_token(
2358        &self,
2359        request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
2360        app: &str,
2361    ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
2362        ProjectAppExchangeRecaptchaTokenCall {
2363            hub: self.hub,
2364            _request: request,
2365            _app: app.to_string(),
2366            _delegate: Default::default(),
2367            _additional_params: Default::default(),
2368            _scopes: Default::default(),
2369        }
2370    }
2371
2372    /// Create a builder to help you perform the following task:
2373    ///
2374    /// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
2375    ///
2376    /// # Arguments
2377    ///
2378    /// * `request` - No description provided.
2379    /// * `app` - Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2380    pub fn apps_exchange_recaptcha_v3_token(
2381        &self,
2382        request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
2383        app: &str,
2384    ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
2385        ProjectAppExchangeRecaptchaV3TokenCall {
2386            hub: self.hub,
2387            _request: request,
2388            _app: app.to_string(),
2389            _delegate: Default::default(),
2390            _additional_params: Default::default(),
2391            _scopes: Default::default(),
2392        }
2393    }
2394
2395    /// Create a builder to help you perform the following task:
2396    ///
2397    /// Validates a [SafetyNet token](https://developer.android.com/training/safetynet/attestation#request-attestation-step). If valid, returns an AppCheckToken.
2398    ///
2399    /// # Arguments
2400    ///
2401    /// * `request` - No description provided.
2402    /// * `app` - Required. The relative resource name of the Android app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2403    pub fn apps_exchange_safety_net_token(
2404        &self,
2405        request: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
2406        app: &str,
2407    ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
2408        ProjectAppExchangeSafetyNetTokenCall {
2409            hub: self.hub,
2410            _request: request,
2411            _app: app.to_string(),
2412            _delegate: Default::default(),
2413            _additional_params: Default::default(),
2414            _scopes: Default::default(),
2415        }
2416    }
2417
2418    /// Create a builder to help you perform the following task:
2419    ///
2420    /// Generates a challenge that protects the integrity of an immediately following call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A challenge should not be reused for multiple calls.
2421    ///
2422    /// # Arguments
2423    ///
2424    /// * `request` - No description provided.
2425    /// * `app` - Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
2426    pub fn apps_generate_app_attest_challenge(
2427        &self,
2428        request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
2429        app: &str,
2430    ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
2431        ProjectAppGenerateAppAttestChallengeCall {
2432            hub: self.hub,
2433            _request: request,
2434            _app: app.to_string(),
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    /// Generates a challenge that protects the integrity of an immediately following integrity verdict request to the Play Integrity API. The next call to ExchangePlayIntegrityToken using the resulting integrity token will verify the presence and validity of the challenge. A challenge should not be reused for multiple calls.
2444    ///
2445    /// # Arguments
2446    ///
2447    /// * `request` - No description provided.
2448    /// * `app` - Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2449    pub fn apps_generate_play_integrity_challenge(
2450        &self,
2451        request: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
2452        app: &str,
2453    ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
2454        ProjectAppGeneratePlayIntegrityChallengeCall {
2455            hub: self.hub,
2456            _request: request,
2457            _app: app.to_string(),
2458            _delegate: Default::default(),
2459            _additional_params: Default::default(),
2460            _scopes: Default::default(),
2461        }
2462    }
2463
2464    /// Create a builder to help you perform the following task:
2465    ///
2466    /// Atomically updates the specified ResourcePolicy configurations.
2467    ///
2468    /// # Arguments
2469    ///
2470    /// * `request` - No description provided.
2471    /// * `parent` - Required. The parent service name, in the format ``` projects/{project_number}/services/{service_id} ``` The parent collection in the `name` field of any resource being updated must match this field, or the entire batch fails.
2472    pub fn services_resource_policies_batch_update(
2473        &self,
2474        request: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
2475        parent: &str,
2476    ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
2477        ProjectServiceResourcePolicyBatchUpdateCall {
2478            hub: self.hub,
2479            _request: request,
2480            _parent: parent.to_string(),
2481            _delegate: Default::default(),
2482            _additional_params: Default::default(),
2483            _scopes: Default::default(),
2484        }
2485    }
2486
2487    /// Create a builder to help you perform the following task:
2488    ///
2489    /// Creates the specified ResourcePolicy configuration.
2490    ///
2491    /// # Arguments
2492    ///
2493    /// * `request` - No description provided.
2494    /// * `parent` - Required. The relative resource name of the parent Service in which the specified ResourcePolicy will be created, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
2495    pub fn services_resource_policies_create(
2496        &self,
2497        request: GoogleFirebaseAppcheckV1betaResourcePolicy,
2498        parent: &str,
2499    ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
2500        ProjectServiceResourcePolicyCreateCall {
2501            hub: self.hub,
2502            _request: request,
2503            _parent: parent.to_string(),
2504            _delegate: Default::default(),
2505            _additional_params: Default::default(),
2506            _scopes: Default::default(),
2507        }
2508    }
2509
2510    /// Create a builder to help you perform the following task:
2511    ///
2512    /// Deletes the specified ResourcePolicy configuration.
2513    ///
2514    /// # Arguments
2515    ///
2516    /// * `name` - Required. The relative resource name of the ResourcePolicy to delete, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ```
2517    pub fn services_resource_policies_delete(
2518        &self,
2519        name: &str,
2520    ) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
2521        ProjectServiceResourcePolicyDeleteCall {
2522            hub: self.hub,
2523            _name: name.to_string(),
2524            _etag: Default::default(),
2525            _delegate: Default::default(),
2526            _additional_params: Default::default(),
2527            _scopes: Default::default(),
2528        }
2529    }
2530
2531    /// Create a builder to help you perform the following task:
2532    ///
2533    /// Gets the requested ResourcePolicy configuration.
2534    ///
2535    /// # Arguments
2536    ///
2537    /// * `name` - Required. The relative resource name of the ResourcePolicy to retrieve, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
2538    pub fn services_resource_policies_get(
2539        &self,
2540        name: &str,
2541    ) -> ProjectServiceResourcePolicyGetCall<'a, C> {
2542        ProjectServiceResourcePolicyGetCall {
2543            hub: self.hub,
2544            _name: name.to_string(),
2545            _delegate: Default::default(),
2546            _additional_params: Default::default(),
2547            _scopes: Default::default(),
2548        }
2549    }
2550
2551    /// Create a builder to help you perform the following task:
2552    ///
2553    /// Lists all ResourcePolicy configurations for the specified project and service.
2554    ///
2555    /// # Arguments
2556    ///
2557    /// * `parent` - Required. The relative resource name of the parent Service for which to list each associated ResourcePolicy, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
2558    pub fn services_resource_policies_list(
2559        &self,
2560        parent: &str,
2561    ) -> ProjectServiceResourcePolicyListCall<'a, C> {
2562        ProjectServiceResourcePolicyListCall {
2563            hub: self.hub,
2564            _parent: parent.to_string(),
2565            _page_token: Default::default(),
2566            _page_size: Default::default(),
2567            _filter: Default::default(),
2568            _delegate: Default::default(),
2569            _additional_params: Default::default(),
2570            _scopes: Default::default(),
2571        }
2572    }
2573
2574    /// Create a builder to help you perform the following task:
2575    ///
2576    /// Updates the specified ResourcePolicy configuration.
2577    ///
2578    /// # Arguments
2579    ///
2580    /// * `request` - No description provided.
2581    /// * `name` - Required. Identifier. The relative name of the resource policy object, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS) `resource_policy_id` is a system-generated UID.
2582    pub fn services_resource_policies_patch(
2583        &self,
2584        request: GoogleFirebaseAppcheckV1betaResourcePolicy,
2585        name: &str,
2586    ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
2587        ProjectServiceResourcePolicyPatchCall {
2588            hub: self.hub,
2589            _request: request,
2590            _name: name.to_string(),
2591            _update_mask: 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    /// Atomically updates the specified Service configurations.
2601    ///
2602    /// # Arguments
2603    ///
2604    /// * `request` - No description provided.
2605    /// * `parent` - Required. The parent project name shared by all Service configurations being updated, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being updated must match this field, or the entire batch fails.
2606    pub fn services_batch_update(
2607        &self,
2608        request: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
2609        parent: &str,
2610    ) -> ProjectServiceBatchUpdateCall<'a, C> {
2611        ProjectServiceBatchUpdateCall {
2612            hub: self.hub,
2613            _request: request,
2614            _parent: parent.to_string(),
2615            _delegate: Default::default(),
2616            _additional_params: Default::default(),
2617            _scopes: Default::default(),
2618        }
2619    }
2620
2621    /// Create a builder to help you perform the following task:
2622    ///
2623    /// Gets the Service configuration for the specified service name.
2624    ///
2625    /// # Arguments
2626    ///
2627    /// * `name` - Required. The relative resource name of the Service to retrieve, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS)
2628    pub fn services_get(&self, name: &str) -> ProjectServiceGetCall<'a, C> {
2629        ProjectServiceGetCall {
2630            hub: self.hub,
2631            _name: name.to_string(),
2632            _delegate: Default::default(),
2633            _additional_params: Default::default(),
2634            _scopes: Default::default(),
2635        }
2636    }
2637
2638    /// Create a builder to help you perform the following task:
2639    ///
2640    /// Lists all Service configurations for the specified project. Only Services which were explicitly configured using UpdateService or BatchUpdateServices will be returned.
2641    ///
2642    /// # Arguments
2643    ///
2644    /// * `parent` - Required. The relative resource name of the parent project for which to list each associated Service, in the format: ``` projects/{project_number} ```
2645    pub fn services_list(&self, parent: &str) -> ProjectServiceListCall<'a, C> {
2646        ProjectServiceListCall {
2647            hub: self.hub,
2648            _parent: parent.to_string(),
2649            _page_token: Default::default(),
2650            _page_size: Default::default(),
2651            _delegate: Default::default(),
2652            _additional_params: Default::default(),
2653            _scopes: Default::default(),
2654        }
2655    }
2656
2657    /// Create a builder to help you perform the following task:
2658    ///
2659    /// Updates the specified Service configuration.
2660    ///
2661    /// # Arguments
2662    ///
2663    /// * `request` - No description provided.
2664    /// * `name` - Required. The relative resource name of the service configuration object, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS)
2665    pub fn services_patch(
2666        &self,
2667        request: GoogleFirebaseAppcheckV1betaService,
2668        name: &str,
2669    ) -> ProjectServicePatchCall<'a, C> {
2670        ProjectServicePatchCall {
2671            hub: self.hub,
2672            _request: request,
2673            _name: name.to_string(),
2674            _update_mask: Default::default(),
2675            _delegate: Default::default(),
2676            _additional_params: Default::default(),
2677            _scopes: Default::default(),
2678        }
2679    }
2680
2681    /// Create a builder to help you perform the following task:
2682    ///
2683    /// Verifies the given App Check token and returns token usage signals that callers may act upon. This method currently only supports App Check tokens exchanged from the following attestation providers: * Play Integrity API * App Attest * DeviceCheck (`DCDevice` tokens) * reCAPTCHA Enterprise * reCAPTCHA v3 * Custom providers App Check tokens exchanged from debug secrets are also supported. Calling this method on an otherwise valid App Check token with an unsupported provider will cause an HTTP 400 error to be returned. Returns whether this token was already consumed before this call. If this is the first time this method has seen the given App Check token, the field `already_consumed` in the response will be absent. The given token will then be marked as `already_consumed` (set to `true`) for all future invocations of this method for that token. Note that if the given App Check token is invalid, an HTTP 403 error is returned instead of a response object, regardless whether the token was already consumed. Currently, when evaluating whether an App Check token was already consumed, only calls to this exact method are counted. Use of the App Check token elsewhere will not mark the token as being already consumed. The caller must have the [`firebaseappcheck.appCheckTokens.verify`](https://firebase.google.com/docs/projects/iam/permissions#app-check) permission to call this method. This permission is part of the [Firebase App Check Token Verifier role](https://firebase.google.com/docs/projects/iam/roles-predefined-product#app-check).
2684    ///
2685    /// # Arguments
2686    ///
2687    /// * `request` - No description provided.
2688    /// * `project` - Required. The relative resource name of the project for which the token was minted, in the format: ``` projects/{project_number} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
2689    pub fn verify_app_check_token(
2690        &self,
2691        request: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
2692        project: &str,
2693    ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
2694        ProjectVerifyAppCheckTokenCall {
2695            hub: self.hub,
2696            _request: request,
2697            _project: project.to_string(),
2698            _delegate: Default::default(),
2699            _additional_params: Default::default(),
2700            _scopes: Default::default(),
2701        }
2702    }
2703}
2704
2705// ###################
2706// CallBuilders   ###
2707// #################
2708
2709/// Returns a public JWK set as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517) that can be used to verify App Check tokens. Exactly one of the public keys in the returned set will successfully validate any App Check token that is currently valid.
2710///
2711/// A builder for the *get* method supported by a *jwk* resource.
2712/// It is not used directly, but through a [`JwkMethods`] instance.
2713///
2714/// # Example
2715///
2716/// Instantiate a resource method builder
2717///
2718/// ```test_harness,no_run
2719/// # extern crate hyper;
2720/// # extern crate hyper_rustls;
2721/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
2722/// # async fn dox() {
2723/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2724///
2725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2726/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2727/// #     .with_native_roots()
2728/// #     .unwrap()
2729/// #     .https_only()
2730/// #     .enable_http2()
2731/// #     .build();
2732///
2733/// # let executor = hyper_util::rt::TokioExecutor::new();
2734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2735/// #     secret,
2736/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2737/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2738/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2739/// #     ),
2740/// # ).build().await.unwrap();
2741///
2742/// # let client = hyper_util::client::legacy::Client::builder(
2743/// #     hyper_util::rt::TokioExecutor::new()
2744/// # )
2745/// # .build(
2746/// #     hyper_rustls::HttpsConnectorBuilder::new()
2747/// #         .with_native_roots()
2748/// #         .unwrap()
2749/// #         .https_or_http()
2750/// #         .enable_http2()
2751/// #         .build()
2752/// # );
2753/// # let mut hub = Firebaseappcheck::new(client, auth);
2754/// // You can configure optional parameters by calling the respective setters at will, and
2755/// // execute the final call using `doit()`.
2756/// // Values shown here are possibly random and not representative !
2757/// let result = hub.jwks().get("name")
2758///              .doit().await;
2759/// # }
2760/// ```
2761pub struct JwkGetCall<'a, C>
2762where
2763    C: 'a,
2764{
2765    hub: &'a Firebaseappcheck<C>,
2766    _name: String,
2767    _delegate: Option<&'a mut dyn common::Delegate>,
2768    _additional_params: HashMap<String, String>,
2769    _scopes: BTreeSet<String>,
2770}
2771
2772impl<'a, C> common::CallBuilder for JwkGetCall<'a, C> {}
2773
2774impl<'a, C> JwkGetCall<'a, C>
2775where
2776    C: common::Connector,
2777{
2778    /// Perform the operation you have build so far.
2779    pub async fn doit(
2780        mut self,
2781    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaPublicJwkSet)> {
2782        use std::borrow::Cow;
2783        use std::io::{Read, Seek};
2784
2785        use common::{url::Params, ToParts};
2786        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2787
2788        let mut dd = common::DefaultDelegate;
2789        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2790        dlg.begin(common::MethodInfo {
2791            id: "firebaseappcheck.jwks.get",
2792            http_method: hyper::Method::GET,
2793        });
2794
2795        for &field in ["alt", "name"].iter() {
2796            if self._additional_params.contains_key(field) {
2797                dlg.finished(false);
2798                return Err(common::Error::FieldClash(field));
2799            }
2800        }
2801
2802        let mut params = Params::with_capacity(3 + self._additional_params.len());
2803        params.push("name", self._name);
2804
2805        params.extend(self._additional_params.iter());
2806
2807        params.push("alt", "json");
2808        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
2809        if self._scopes.is_empty() {
2810            self._scopes
2811                .insert(Scope::CloudPlatform.as_ref().to_string());
2812        }
2813
2814        #[allow(clippy::single_element_loop)]
2815        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2816            url = params.uri_replacement(url, param_name, find_this, true);
2817        }
2818        {
2819            let to_remove = ["name"];
2820            params.remove_params(&to_remove);
2821        }
2822
2823        let url = params.parse_with_url(&url);
2824
2825        loop {
2826            let token = match self
2827                .hub
2828                .auth
2829                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2830                .await
2831            {
2832                Ok(token) => token,
2833                Err(e) => match dlg.token(e) {
2834                    Ok(token) => token,
2835                    Err(e) => {
2836                        dlg.finished(false);
2837                        return Err(common::Error::MissingToken(e));
2838                    }
2839                },
2840            };
2841            let mut req_result = {
2842                let client = &self.hub.client;
2843                dlg.pre_request();
2844                let mut req_builder = hyper::Request::builder()
2845                    .method(hyper::Method::GET)
2846                    .uri(url.as_str())
2847                    .header(USER_AGENT, self.hub._user_agent.clone());
2848
2849                if let Some(token) = token.as_ref() {
2850                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2851                }
2852
2853                let request = req_builder
2854                    .header(CONTENT_LENGTH, 0_u64)
2855                    .body(common::to_body::<String>(None));
2856
2857                client.request(request.unwrap()).await
2858            };
2859
2860            match req_result {
2861                Err(err) => {
2862                    if let common::Retry::After(d) = dlg.http_error(&err) {
2863                        sleep(d).await;
2864                        continue;
2865                    }
2866                    dlg.finished(false);
2867                    return Err(common::Error::HttpError(err));
2868                }
2869                Ok(res) => {
2870                    let (mut parts, body) = res.into_parts();
2871                    let mut body = common::Body::new(body);
2872                    if !parts.status.is_success() {
2873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2874                        let error = serde_json::from_str(&common::to_string(&bytes));
2875                        let response = common::to_response(parts, bytes.into());
2876
2877                        if let common::Retry::After(d) =
2878                            dlg.http_failure(&response, error.as_ref().ok())
2879                        {
2880                            sleep(d).await;
2881                            continue;
2882                        }
2883
2884                        dlg.finished(false);
2885
2886                        return Err(match error {
2887                            Ok(value) => common::Error::BadRequest(value),
2888                            _ => common::Error::Failure(response),
2889                        });
2890                    }
2891                    let response = {
2892                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2893                        let encoded = common::to_string(&bytes);
2894                        match serde_json::from_str(&encoded) {
2895                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2896                            Err(error) => {
2897                                dlg.response_json_decode_error(&encoded, &error);
2898                                return Err(common::Error::JsonDecodeError(
2899                                    encoded.to_string(),
2900                                    error,
2901                                ));
2902                            }
2903                        }
2904                    };
2905
2906                    dlg.finished(true);
2907                    return Ok(response);
2908                }
2909            }
2910        }
2911    }
2912
2913    /// Required. The relative resource name to the public JWK set. Must always be exactly the string `jwks`.
2914    ///
2915    /// Sets the *name* path property to the given value.
2916    ///
2917    /// Even though the property as already been set when instantiating this call,
2918    /// we provide this method for API completeness.
2919    pub fn name(mut self, new_value: &str) -> JwkGetCall<'a, C> {
2920        self._name = new_value.to_string();
2921        self
2922    }
2923    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2924    /// while executing the actual API request.
2925    ///
2926    /// ````text
2927    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2928    /// ````
2929    ///
2930    /// Sets the *delegate* property to the given value.
2931    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JwkGetCall<'a, C> {
2932        self._delegate = Some(new_value);
2933        self
2934    }
2935
2936    /// Set any additional parameter of the query string used in the request.
2937    /// It should be used to set parameters which are not yet available through their own
2938    /// setters.
2939    ///
2940    /// Please note that this method must not be used to set any of the known parameters
2941    /// which have their own setter method. If done anyway, the request will fail.
2942    ///
2943    /// # Additional Parameters
2944    ///
2945    /// * *$.xgafv* (query-string) - V1 error format.
2946    /// * *access_token* (query-string) - OAuth access token.
2947    /// * *alt* (query-string) - Data format for response.
2948    /// * *callback* (query-string) - JSONP
2949    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2950    /// * *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.
2951    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2952    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2953    /// * *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.
2954    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2955    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2956    pub fn param<T>(mut self, name: T, value: T) -> JwkGetCall<'a, C>
2957    where
2958        T: AsRef<str>,
2959    {
2960        self._additional_params
2961            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2962        self
2963    }
2964
2965    /// Identifies the authorization scope for the method you are building.
2966    ///
2967    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2968    /// [`Scope::CloudPlatform`].
2969    ///
2970    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2971    /// tokens for more than one scope.
2972    ///
2973    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2974    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2975    /// sufficient, a read-write scope will do as well.
2976    pub fn add_scope<St>(mut self, scope: St) -> JwkGetCall<'a, C>
2977    where
2978        St: AsRef<str>,
2979    {
2980        self._scopes.insert(String::from(scope.as_ref()));
2981        self
2982    }
2983    /// Identifies the authorization scope(s) for the method you are building.
2984    ///
2985    /// See [`Self::add_scope()`] for details.
2986    pub fn add_scopes<I, St>(mut self, scopes: I) -> JwkGetCall<'a, C>
2987    where
2988        I: IntoIterator<Item = St>,
2989        St: AsRef<str>,
2990    {
2991        self._scopes
2992            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2993        self
2994    }
2995
2996    /// Removes all scopes, and no default scope will be used either.
2997    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2998    /// for details).
2999    pub fn clear_scopes(mut self) -> JwkGetCall<'a, C> {
3000        self._scopes.clear();
3001        self
3002    }
3003}
3004
3005/// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
3006///
3007/// A builder for the *exchangeAppAttestAssertion* method supported by a *oauthClient* resource.
3008/// It is not used directly, but through a [`OauthClientMethods`] instance.
3009///
3010/// # Example
3011///
3012/// Instantiate a resource method builder
3013///
3014/// ```test_harness,no_run
3015/// # extern crate hyper;
3016/// # extern crate hyper_rustls;
3017/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3018/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
3019/// # async fn dox() {
3020/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3021///
3022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3023/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3024/// #     .with_native_roots()
3025/// #     .unwrap()
3026/// #     .https_only()
3027/// #     .enable_http2()
3028/// #     .build();
3029///
3030/// # let executor = hyper_util::rt::TokioExecutor::new();
3031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3032/// #     secret,
3033/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3034/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3035/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3036/// #     ),
3037/// # ).build().await.unwrap();
3038///
3039/// # let client = hyper_util::client::legacy::Client::builder(
3040/// #     hyper_util::rt::TokioExecutor::new()
3041/// # )
3042/// # .build(
3043/// #     hyper_rustls::HttpsConnectorBuilder::new()
3044/// #         .with_native_roots()
3045/// #         .unwrap()
3046/// #         .https_or_http()
3047/// #         .enable_http2()
3048/// #         .build()
3049/// # );
3050/// # let mut hub = Firebaseappcheck::new(client, auth);
3051/// // As the method needs a request, you would usually fill it with the desired information
3052/// // into the respective structure. Some of the parts shown here might not be applicable !
3053/// // Values shown here are possibly random and not representative !
3054/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
3055///
3056/// // You can configure optional parameters by calling the respective setters at will, and
3057/// // execute the final call using `doit()`.
3058/// // Values shown here are possibly random and not representative !
3059/// let result = hub.oauth_clients().exchange_app_attest_assertion(req, "app")
3060///              .doit().await;
3061/// # }
3062/// ```
3063pub struct OauthClientExchangeAppAttestAssertionCall<'a, C>
3064where
3065    C: 'a,
3066{
3067    hub: &'a Firebaseappcheck<C>,
3068    _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
3069    _app: String,
3070    _delegate: Option<&'a mut dyn common::Delegate>,
3071    _additional_params: HashMap<String, String>,
3072    _scopes: BTreeSet<String>,
3073}
3074
3075impl<'a, C> common::CallBuilder for OauthClientExchangeAppAttestAssertionCall<'a, C> {}
3076
3077impl<'a, C> OauthClientExchangeAppAttestAssertionCall<'a, C>
3078where
3079    C: common::Connector,
3080{
3081    /// Perform the operation you have build so far.
3082    pub async fn doit(
3083        mut self,
3084    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
3085        use std::borrow::Cow;
3086        use std::io::{Read, Seek};
3087
3088        use common::{url::Params, ToParts};
3089        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3090
3091        let mut dd = common::DefaultDelegate;
3092        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3093        dlg.begin(common::MethodInfo {
3094            id: "firebaseappcheck.oauthClients.exchangeAppAttestAssertion",
3095            http_method: hyper::Method::POST,
3096        });
3097
3098        for &field in ["alt", "app"].iter() {
3099            if self._additional_params.contains_key(field) {
3100                dlg.finished(false);
3101                return Err(common::Error::FieldClash(field));
3102            }
3103        }
3104
3105        let mut params = Params::with_capacity(4 + self._additional_params.len());
3106        params.push("app", self._app);
3107
3108        params.extend(self._additional_params.iter());
3109
3110        params.push("alt", "json");
3111        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAssertion";
3112        if self._scopes.is_empty() {
3113            self._scopes
3114                .insert(Scope::CloudPlatform.as_ref().to_string());
3115        }
3116
3117        #[allow(clippy::single_element_loop)]
3118        for &(find_this, param_name) in [("{+app}", "app")].iter() {
3119            url = params.uri_replacement(url, param_name, find_this, true);
3120        }
3121        {
3122            let to_remove = ["app"];
3123            params.remove_params(&to_remove);
3124        }
3125
3126        let url = params.parse_with_url(&url);
3127
3128        let mut json_mime_type = mime::APPLICATION_JSON;
3129        let mut request_value_reader = {
3130            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3131            common::remove_json_null_values(&mut value);
3132            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3133            serde_json::to_writer(&mut dst, &value).unwrap();
3134            dst
3135        };
3136        let request_size = request_value_reader
3137            .seek(std::io::SeekFrom::End(0))
3138            .unwrap();
3139        request_value_reader
3140            .seek(std::io::SeekFrom::Start(0))
3141            .unwrap();
3142
3143        loop {
3144            let token = match self
3145                .hub
3146                .auth
3147                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3148                .await
3149            {
3150                Ok(token) => token,
3151                Err(e) => match dlg.token(e) {
3152                    Ok(token) => token,
3153                    Err(e) => {
3154                        dlg.finished(false);
3155                        return Err(common::Error::MissingToken(e));
3156                    }
3157                },
3158            };
3159            request_value_reader
3160                .seek(std::io::SeekFrom::Start(0))
3161                .unwrap();
3162            let mut req_result = {
3163                let client = &self.hub.client;
3164                dlg.pre_request();
3165                let mut req_builder = hyper::Request::builder()
3166                    .method(hyper::Method::POST)
3167                    .uri(url.as_str())
3168                    .header(USER_AGENT, self.hub._user_agent.clone());
3169
3170                if let Some(token) = token.as_ref() {
3171                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3172                }
3173
3174                let request = req_builder
3175                    .header(CONTENT_TYPE, json_mime_type.to_string())
3176                    .header(CONTENT_LENGTH, request_size as u64)
3177                    .body(common::to_body(
3178                        request_value_reader.get_ref().clone().into(),
3179                    ));
3180
3181                client.request(request.unwrap()).await
3182            };
3183
3184            match req_result {
3185                Err(err) => {
3186                    if let common::Retry::After(d) = dlg.http_error(&err) {
3187                        sleep(d).await;
3188                        continue;
3189                    }
3190                    dlg.finished(false);
3191                    return Err(common::Error::HttpError(err));
3192                }
3193                Ok(res) => {
3194                    let (mut parts, body) = res.into_parts();
3195                    let mut body = common::Body::new(body);
3196                    if !parts.status.is_success() {
3197                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3198                        let error = serde_json::from_str(&common::to_string(&bytes));
3199                        let response = common::to_response(parts, bytes.into());
3200
3201                        if let common::Retry::After(d) =
3202                            dlg.http_failure(&response, error.as_ref().ok())
3203                        {
3204                            sleep(d).await;
3205                            continue;
3206                        }
3207
3208                        dlg.finished(false);
3209
3210                        return Err(match error {
3211                            Ok(value) => common::Error::BadRequest(value),
3212                            _ => common::Error::Failure(response),
3213                        });
3214                    }
3215                    let response = {
3216                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3217                        let encoded = common::to_string(&bytes);
3218                        match serde_json::from_str(&encoded) {
3219                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3220                            Err(error) => {
3221                                dlg.response_json_decode_error(&encoded, &error);
3222                                return Err(common::Error::JsonDecodeError(
3223                                    encoded.to_string(),
3224                                    error,
3225                                ));
3226                            }
3227                        }
3228                    };
3229
3230                    dlg.finished(true);
3231                    return Ok(response);
3232                }
3233            }
3234        }
3235    }
3236
3237    ///
3238    /// Sets the *request* property to the given value.
3239    ///
3240    /// Even though the property as already been set when instantiating this call,
3241    /// we provide this method for API completeness.
3242    pub fn request(
3243        mut self,
3244        new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
3245    ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3246        self._request = new_value;
3247        self
3248    }
3249    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
3250    ///
3251    /// Sets the *app* path property to the given value.
3252    ///
3253    /// Even though the property as already been set when instantiating this call,
3254    /// we provide this method for API completeness.
3255    pub fn app(mut self, new_value: &str) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3256        self._app = new_value.to_string();
3257        self
3258    }
3259    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3260    /// while executing the actual API request.
3261    ///
3262    /// ````text
3263    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3264    /// ````
3265    ///
3266    /// Sets the *delegate* property to the given value.
3267    pub fn delegate(
3268        mut self,
3269        new_value: &'a mut dyn common::Delegate,
3270    ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3271        self._delegate = Some(new_value);
3272        self
3273    }
3274
3275    /// Set any additional parameter of the query string used in the request.
3276    /// It should be used to set parameters which are not yet available through their own
3277    /// setters.
3278    ///
3279    /// Please note that this method must not be used to set any of the known parameters
3280    /// which have their own setter method. If done anyway, the request will fail.
3281    ///
3282    /// # Additional Parameters
3283    ///
3284    /// * *$.xgafv* (query-string) - V1 error format.
3285    /// * *access_token* (query-string) - OAuth access token.
3286    /// * *alt* (query-string) - Data format for response.
3287    /// * *callback* (query-string) - JSONP
3288    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3289    /// * *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.
3290    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3291    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3292    /// * *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.
3293    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3294    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3295    pub fn param<T>(mut self, name: T, value: T) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3296    where
3297        T: AsRef<str>,
3298    {
3299        self._additional_params
3300            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3301        self
3302    }
3303
3304    /// Identifies the authorization scope for the method you are building.
3305    ///
3306    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3307    /// [`Scope::CloudPlatform`].
3308    ///
3309    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3310    /// tokens for more than one scope.
3311    ///
3312    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3313    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3314    /// sufficient, a read-write scope will do as well.
3315    pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3316    where
3317        St: AsRef<str>,
3318    {
3319        self._scopes.insert(String::from(scope.as_ref()));
3320        self
3321    }
3322    /// Identifies the authorization scope(s) for the method you are building.
3323    ///
3324    /// See [`Self::add_scope()`] for details.
3325    pub fn add_scopes<I, St>(
3326        mut self,
3327        scopes: I,
3328    ) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3329    where
3330        I: IntoIterator<Item = St>,
3331        St: AsRef<str>,
3332    {
3333        self._scopes
3334            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3335        self
3336    }
3337
3338    /// Removes all scopes, and no default scope will be used either.
3339    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3340    /// for details).
3341    pub fn clear_scopes(mut self) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3342        self._scopes.clear();
3343        self
3344    }
3345}
3346
3347/// Accepts an App Attest CBOR attestation and verifies it with Apple using your preconfigured team and bundle IDs. If valid, returns an attestation artifact that can later be exchanged for an AppCheckToken using ExchangeAppAttestAssertion. For convenience and performance, this method's response object will also contain an AppCheckToken (if the verification is successful).
3348///
3349/// A builder for the *exchangeAppAttestAttestation* method supported by a *oauthClient* resource.
3350/// It is not used directly, but through a [`OauthClientMethods`] instance.
3351///
3352/// # Example
3353///
3354/// Instantiate a resource method builder
3355///
3356/// ```test_harness,no_run
3357/// # extern crate hyper;
3358/// # extern crate hyper_rustls;
3359/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3360/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest;
3361/// # async fn dox() {
3362/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3363///
3364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3365/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3366/// #     .with_native_roots()
3367/// #     .unwrap()
3368/// #     .https_only()
3369/// #     .enable_http2()
3370/// #     .build();
3371///
3372/// # let executor = hyper_util::rt::TokioExecutor::new();
3373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3374/// #     secret,
3375/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3376/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3377/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3378/// #     ),
3379/// # ).build().await.unwrap();
3380///
3381/// # let client = hyper_util::client::legacy::Client::builder(
3382/// #     hyper_util::rt::TokioExecutor::new()
3383/// # )
3384/// # .build(
3385/// #     hyper_rustls::HttpsConnectorBuilder::new()
3386/// #         .with_native_roots()
3387/// #         .unwrap()
3388/// #         .https_or_http()
3389/// #         .enable_http2()
3390/// #         .build()
3391/// # );
3392/// # let mut hub = Firebaseappcheck::new(client, auth);
3393/// // As the method needs a request, you would usually fill it with the desired information
3394/// // into the respective structure. Some of the parts shown here might not be applicable !
3395/// // Values shown here are possibly random and not representative !
3396/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest::default();
3397///
3398/// // You can configure optional parameters by calling the respective setters at will, and
3399/// // execute the final call using `doit()`.
3400/// // Values shown here are possibly random and not representative !
3401/// let result = hub.oauth_clients().exchange_app_attest_attestation(req, "app")
3402///              .doit().await;
3403/// # }
3404/// ```
3405pub struct OauthClientExchangeAppAttestAttestationCall<'a, C>
3406where
3407    C: 'a,
3408{
3409    hub: &'a Firebaseappcheck<C>,
3410    _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
3411    _app: String,
3412    _delegate: Option<&'a mut dyn common::Delegate>,
3413    _additional_params: HashMap<String, String>,
3414    _scopes: BTreeSet<String>,
3415}
3416
3417impl<'a, C> common::CallBuilder for OauthClientExchangeAppAttestAttestationCall<'a, C> {}
3418
3419impl<'a, C> OauthClientExchangeAppAttestAttestationCall<'a, C>
3420where
3421    C: common::Connector,
3422{
3423    /// Perform the operation you have build so far.
3424    pub async fn doit(
3425        mut self,
3426    ) -> common::Result<(
3427        common::Response,
3428        GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse,
3429    )> {
3430        use std::borrow::Cow;
3431        use std::io::{Read, Seek};
3432
3433        use common::{url::Params, ToParts};
3434        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3435
3436        let mut dd = common::DefaultDelegate;
3437        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3438        dlg.begin(common::MethodInfo {
3439            id: "firebaseappcheck.oauthClients.exchangeAppAttestAttestation",
3440            http_method: hyper::Method::POST,
3441        });
3442
3443        for &field in ["alt", "app"].iter() {
3444            if self._additional_params.contains_key(field) {
3445                dlg.finished(false);
3446                return Err(common::Error::FieldClash(field));
3447            }
3448        }
3449
3450        let mut params = Params::with_capacity(4 + self._additional_params.len());
3451        params.push("app", self._app);
3452
3453        params.extend(self._additional_params.iter());
3454
3455        params.push("alt", "json");
3456        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAttestation";
3457        if self._scopes.is_empty() {
3458            self._scopes
3459                .insert(Scope::CloudPlatform.as_ref().to_string());
3460        }
3461
3462        #[allow(clippy::single_element_loop)]
3463        for &(find_this, param_name) in [("{+app}", "app")].iter() {
3464            url = params.uri_replacement(url, param_name, find_this, true);
3465        }
3466        {
3467            let to_remove = ["app"];
3468            params.remove_params(&to_remove);
3469        }
3470
3471        let url = params.parse_with_url(&url);
3472
3473        let mut json_mime_type = mime::APPLICATION_JSON;
3474        let mut request_value_reader = {
3475            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3476            common::remove_json_null_values(&mut value);
3477            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3478            serde_json::to_writer(&mut dst, &value).unwrap();
3479            dst
3480        };
3481        let request_size = request_value_reader
3482            .seek(std::io::SeekFrom::End(0))
3483            .unwrap();
3484        request_value_reader
3485            .seek(std::io::SeekFrom::Start(0))
3486            .unwrap();
3487
3488        loop {
3489            let token = match self
3490                .hub
3491                .auth
3492                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3493                .await
3494            {
3495                Ok(token) => token,
3496                Err(e) => match dlg.token(e) {
3497                    Ok(token) => token,
3498                    Err(e) => {
3499                        dlg.finished(false);
3500                        return Err(common::Error::MissingToken(e));
3501                    }
3502                },
3503            };
3504            request_value_reader
3505                .seek(std::io::SeekFrom::Start(0))
3506                .unwrap();
3507            let mut req_result = {
3508                let client = &self.hub.client;
3509                dlg.pre_request();
3510                let mut req_builder = hyper::Request::builder()
3511                    .method(hyper::Method::POST)
3512                    .uri(url.as_str())
3513                    .header(USER_AGENT, self.hub._user_agent.clone());
3514
3515                if let Some(token) = token.as_ref() {
3516                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3517                }
3518
3519                let request = req_builder
3520                    .header(CONTENT_TYPE, json_mime_type.to_string())
3521                    .header(CONTENT_LENGTH, request_size as u64)
3522                    .body(common::to_body(
3523                        request_value_reader.get_ref().clone().into(),
3524                    ));
3525
3526                client.request(request.unwrap()).await
3527            };
3528
3529            match req_result {
3530                Err(err) => {
3531                    if let common::Retry::After(d) = dlg.http_error(&err) {
3532                        sleep(d).await;
3533                        continue;
3534                    }
3535                    dlg.finished(false);
3536                    return Err(common::Error::HttpError(err));
3537                }
3538                Ok(res) => {
3539                    let (mut parts, body) = res.into_parts();
3540                    let mut body = common::Body::new(body);
3541                    if !parts.status.is_success() {
3542                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3543                        let error = serde_json::from_str(&common::to_string(&bytes));
3544                        let response = common::to_response(parts, bytes.into());
3545
3546                        if let common::Retry::After(d) =
3547                            dlg.http_failure(&response, error.as_ref().ok())
3548                        {
3549                            sleep(d).await;
3550                            continue;
3551                        }
3552
3553                        dlg.finished(false);
3554
3555                        return Err(match error {
3556                            Ok(value) => common::Error::BadRequest(value),
3557                            _ => common::Error::Failure(response),
3558                        });
3559                    }
3560                    let response = {
3561                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3562                        let encoded = common::to_string(&bytes);
3563                        match serde_json::from_str(&encoded) {
3564                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3565                            Err(error) => {
3566                                dlg.response_json_decode_error(&encoded, &error);
3567                                return Err(common::Error::JsonDecodeError(
3568                                    encoded.to_string(),
3569                                    error,
3570                                ));
3571                            }
3572                        }
3573                    };
3574
3575                    dlg.finished(true);
3576                    return Ok(response);
3577                }
3578            }
3579        }
3580    }
3581
3582    ///
3583    /// Sets the *request* property to the given value.
3584    ///
3585    /// Even though the property as already been set when instantiating this call,
3586    /// we provide this method for API completeness.
3587    pub fn request(
3588        mut self,
3589        new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
3590    ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3591        self._request = new_value;
3592        self
3593    }
3594    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
3595    ///
3596    /// Sets the *app* path property to the given value.
3597    ///
3598    /// Even though the property as already been set when instantiating this call,
3599    /// we provide this method for API completeness.
3600    pub fn app(mut self, new_value: &str) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3601        self._app = new_value.to_string();
3602        self
3603    }
3604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3605    /// while executing the actual API request.
3606    ///
3607    /// ````text
3608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3609    /// ````
3610    ///
3611    /// Sets the *delegate* property to the given value.
3612    pub fn delegate(
3613        mut self,
3614        new_value: &'a mut dyn common::Delegate,
3615    ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3616        self._delegate = Some(new_value);
3617        self
3618    }
3619
3620    /// Set any additional parameter of the query string used in the request.
3621    /// It should be used to set parameters which are not yet available through their own
3622    /// setters.
3623    ///
3624    /// Please note that this method must not be used to set any of the known parameters
3625    /// which have their own setter method. If done anyway, the request will fail.
3626    ///
3627    /// # Additional Parameters
3628    ///
3629    /// * *$.xgafv* (query-string) - V1 error format.
3630    /// * *access_token* (query-string) - OAuth access token.
3631    /// * *alt* (query-string) - Data format for response.
3632    /// * *callback* (query-string) - JSONP
3633    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3634    /// * *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.
3635    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3636    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3637    /// * *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.
3638    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3639    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3640    pub fn param<T>(
3641        mut self,
3642        name: T,
3643        value: T,
3644    ) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3645    where
3646        T: AsRef<str>,
3647    {
3648        self._additional_params
3649            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3650        self
3651    }
3652
3653    /// Identifies the authorization scope for the method you are building.
3654    ///
3655    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3656    /// [`Scope::CloudPlatform`].
3657    ///
3658    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3659    /// tokens for more than one scope.
3660    ///
3661    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3662    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3663    /// sufficient, a read-write scope will do as well.
3664    pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3665    where
3666        St: AsRef<str>,
3667    {
3668        self._scopes.insert(String::from(scope.as_ref()));
3669        self
3670    }
3671    /// Identifies the authorization scope(s) for the method you are building.
3672    ///
3673    /// See [`Self::add_scope()`] for details.
3674    pub fn add_scopes<I, St>(
3675        mut self,
3676        scopes: I,
3677    ) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3678    where
3679        I: IntoIterator<Item = St>,
3680        St: AsRef<str>,
3681    {
3682        self._scopes
3683            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3684        self
3685    }
3686
3687    /// Removes all scopes, and no default scope will be used either.
3688    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3689    /// for details).
3690    pub fn clear_scopes(mut self) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3691        self._scopes.clear();
3692        self
3693    }
3694}
3695
3696/// Validates a debug token secret that you have previously created using CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive quota is enforced on this method to prevent accidental exposure of the app to abuse.
3697///
3698/// A builder for the *exchangeDebugToken* method supported by a *oauthClient* resource.
3699/// It is not used directly, but through a [`OauthClientMethods`] instance.
3700///
3701/// # Example
3702///
3703/// Instantiate a resource method builder
3704///
3705/// ```test_harness,no_run
3706/// # extern crate hyper;
3707/// # extern crate hyper_rustls;
3708/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3709/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest;
3710/// # async fn dox() {
3711/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3712///
3713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3715/// #     .with_native_roots()
3716/// #     .unwrap()
3717/// #     .https_only()
3718/// #     .enable_http2()
3719/// #     .build();
3720///
3721/// # let executor = hyper_util::rt::TokioExecutor::new();
3722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3723/// #     secret,
3724/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3725/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3726/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3727/// #     ),
3728/// # ).build().await.unwrap();
3729///
3730/// # let client = hyper_util::client::legacy::Client::builder(
3731/// #     hyper_util::rt::TokioExecutor::new()
3732/// # )
3733/// # .build(
3734/// #     hyper_rustls::HttpsConnectorBuilder::new()
3735/// #         .with_native_roots()
3736/// #         .unwrap()
3737/// #         .https_or_http()
3738/// #         .enable_http2()
3739/// #         .build()
3740/// # );
3741/// # let mut hub = Firebaseappcheck::new(client, auth);
3742/// // As the method needs a request, you would usually fill it with the desired information
3743/// // into the respective structure. Some of the parts shown here might not be applicable !
3744/// // Values shown here are possibly random and not representative !
3745/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest::default();
3746///
3747/// // You can configure optional parameters by calling the respective setters at will, and
3748/// // execute the final call using `doit()`.
3749/// // Values shown here are possibly random and not representative !
3750/// let result = hub.oauth_clients().exchange_debug_token(req, "app")
3751///              .doit().await;
3752/// # }
3753/// ```
3754pub struct OauthClientExchangeDebugTokenCall<'a, C>
3755where
3756    C: 'a,
3757{
3758    hub: &'a Firebaseappcheck<C>,
3759    _request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
3760    _app: String,
3761    _delegate: Option<&'a mut dyn common::Delegate>,
3762    _additional_params: HashMap<String, String>,
3763    _scopes: BTreeSet<String>,
3764}
3765
3766impl<'a, C> common::CallBuilder for OauthClientExchangeDebugTokenCall<'a, C> {}
3767
3768impl<'a, C> OauthClientExchangeDebugTokenCall<'a, C>
3769where
3770    C: common::Connector,
3771{
3772    /// Perform the operation you have build so far.
3773    pub async fn doit(
3774        mut self,
3775    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
3776        use std::borrow::Cow;
3777        use std::io::{Read, Seek};
3778
3779        use common::{url::Params, ToParts};
3780        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3781
3782        let mut dd = common::DefaultDelegate;
3783        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3784        dlg.begin(common::MethodInfo {
3785            id: "firebaseappcheck.oauthClients.exchangeDebugToken",
3786            http_method: hyper::Method::POST,
3787        });
3788
3789        for &field in ["alt", "app"].iter() {
3790            if self._additional_params.contains_key(field) {
3791                dlg.finished(false);
3792                return Err(common::Error::FieldClash(field));
3793            }
3794        }
3795
3796        let mut params = Params::with_capacity(4 + self._additional_params.len());
3797        params.push("app", self._app);
3798
3799        params.extend(self._additional_params.iter());
3800
3801        params.push("alt", "json");
3802        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDebugToken";
3803        if self._scopes.is_empty() {
3804            self._scopes
3805                .insert(Scope::CloudPlatform.as_ref().to_string());
3806        }
3807
3808        #[allow(clippy::single_element_loop)]
3809        for &(find_this, param_name) in [("{+app}", "app")].iter() {
3810            url = params.uri_replacement(url, param_name, find_this, true);
3811        }
3812        {
3813            let to_remove = ["app"];
3814            params.remove_params(&to_remove);
3815        }
3816
3817        let url = params.parse_with_url(&url);
3818
3819        let mut json_mime_type = mime::APPLICATION_JSON;
3820        let mut request_value_reader = {
3821            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3822            common::remove_json_null_values(&mut value);
3823            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3824            serde_json::to_writer(&mut dst, &value).unwrap();
3825            dst
3826        };
3827        let request_size = request_value_reader
3828            .seek(std::io::SeekFrom::End(0))
3829            .unwrap();
3830        request_value_reader
3831            .seek(std::io::SeekFrom::Start(0))
3832            .unwrap();
3833
3834        loop {
3835            let token = match self
3836                .hub
3837                .auth
3838                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3839                .await
3840            {
3841                Ok(token) => token,
3842                Err(e) => match dlg.token(e) {
3843                    Ok(token) => token,
3844                    Err(e) => {
3845                        dlg.finished(false);
3846                        return Err(common::Error::MissingToken(e));
3847                    }
3848                },
3849            };
3850            request_value_reader
3851                .seek(std::io::SeekFrom::Start(0))
3852                .unwrap();
3853            let mut req_result = {
3854                let client = &self.hub.client;
3855                dlg.pre_request();
3856                let mut req_builder = hyper::Request::builder()
3857                    .method(hyper::Method::POST)
3858                    .uri(url.as_str())
3859                    .header(USER_AGENT, self.hub._user_agent.clone());
3860
3861                if let Some(token) = token.as_ref() {
3862                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3863                }
3864
3865                let request = req_builder
3866                    .header(CONTENT_TYPE, json_mime_type.to_string())
3867                    .header(CONTENT_LENGTH, request_size as u64)
3868                    .body(common::to_body(
3869                        request_value_reader.get_ref().clone().into(),
3870                    ));
3871
3872                client.request(request.unwrap()).await
3873            };
3874
3875            match req_result {
3876                Err(err) => {
3877                    if let common::Retry::After(d) = dlg.http_error(&err) {
3878                        sleep(d).await;
3879                        continue;
3880                    }
3881                    dlg.finished(false);
3882                    return Err(common::Error::HttpError(err));
3883                }
3884                Ok(res) => {
3885                    let (mut parts, body) = res.into_parts();
3886                    let mut body = common::Body::new(body);
3887                    if !parts.status.is_success() {
3888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3889                        let error = serde_json::from_str(&common::to_string(&bytes));
3890                        let response = common::to_response(parts, bytes.into());
3891
3892                        if let common::Retry::After(d) =
3893                            dlg.http_failure(&response, error.as_ref().ok())
3894                        {
3895                            sleep(d).await;
3896                            continue;
3897                        }
3898
3899                        dlg.finished(false);
3900
3901                        return Err(match error {
3902                            Ok(value) => common::Error::BadRequest(value),
3903                            _ => common::Error::Failure(response),
3904                        });
3905                    }
3906                    let response = {
3907                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3908                        let encoded = common::to_string(&bytes);
3909                        match serde_json::from_str(&encoded) {
3910                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3911                            Err(error) => {
3912                                dlg.response_json_decode_error(&encoded, &error);
3913                                return Err(common::Error::JsonDecodeError(
3914                                    encoded.to_string(),
3915                                    error,
3916                                ));
3917                            }
3918                        }
3919                    };
3920
3921                    dlg.finished(true);
3922                    return Ok(response);
3923                }
3924            }
3925        }
3926    }
3927
3928    ///
3929    /// Sets the *request* property to the given value.
3930    ///
3931    /// Even though the property as already been set when instantiating this call,
3932    /// we provide this method for API completeness.
3933    pub fn request(
3934        mut self,
3935        new_value: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
3936    ) -> OauthClientExchangeDebugTokenCall<'a, C> {
3937        self._request = new_value;
3938        self
3939    }
3940    /// Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
3941    ///
3942    /// Sets the *app* path property to the given value.
3943    ///
3944    /// Even though the property as already been set when instantiating this call,
3945    /// we provide this method for API completeness.
3946    pub fn app(mut self, new_value: &str) -> OauthClientExchangeDebugTokenCall<'a, C> {
3947        self._app = new_value.to_string();
3948        self
3949    }
3950    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3951    /// while executing the actual API request.
3952    ///
3953    /// ````text
3954    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3955    /// ````
3956    ///
3957    /// Sets the *delegate* property to the given value.
3958    pub fn delegate(
3959        mut self,
3960        new_value: &'a mut dyn common::Delegate,
3961    ) -> OauthClientExchangeDebugTokenCall<'a, C> {
3962        self._delegate = Some(new_value);
3963        self
3964    }
3965
3966    /// Set any additional parameter of the query string used in the request.
3967    /// It should be used to set parameters which are not yet available through their own
3968    /// setters.
3969    ///
3970    /// Please note that this method must not be used to set any of the known parameters
3971    /// which have their own setter method. If done anyway, the request will fail.
3972    ///
3973    /// # Additional Parameters
3974    ///
3975    /// * *$.xgafv* (query-string) - V1 error format.
3976    /// * *access_token* (query-string) - OAuth access token.
3977    /// * *alt* (query-string) - Data format for response.
3978    /// * *callback* (query-string) - JSONP
3979    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3980    /// * *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.
3981    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3982    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3983    /// * *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.
3984    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3985    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3986    pub fn param<T>(mut self, name: T, value: T) -> OauthClientExchangeDebugTokenCall<'a, C>
3987    where
3988        T: AsRef<str>,
3989    {
3990        self._additional_params
3991            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3992        self
3993    }
3994
3995    /// Identifies the authorization scope for the method you are building.
3996    ///
3997    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3998    /// [`Scope::CloudPlatform`].
3999    ///
4000    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4001    /// tokens for more than one scope.
4002    ///
4003    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4004    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4005    /// sufficient, a read-write scope will do as well.
4006    pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeDebugTokenCall<'a, C>
4007    where
4008        St: AsRef<str>,
4009    {
4010        self._scopes.insert(String::from(scope.as_ref()));
4011        self
4012    }
4013    /// Identifies the authorization scope(s) for the method you are building.
4014    ///
4015    /// See [`Self::add_scope()`] for details.
4016    pub fn add_scopes<I, St>(mut self, scopes: I) -> OauthClientExchangeDebugTokenCall<'a, C>
4017    where
4018        I: IntoIterator<Item = St>,
4019        St: AsRef<str>,
4020    {
4021        self._scopes
4022            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4023        self
4024    }
4025
4026    /// Removes all scopes, and no default scope will be used either.
4027    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4028    /// for details).
4029    pub fn clear_scopes(mut self) -> OauthClientExchangeDebugTokenCall<'a, C> {
4030        self._scopes.clear();
4031        self
4032    }
4033}
4034
4035/// Generates a challenge that protects the integrity of an immediately following call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A challenge should not be reused for multiple calls.
4036///
4037/// A builder for the *generateAppAttestChallenge* method supported by a *oauthClient* resource.
4038/// It is not used directly, but through a [`OauthClientMethods`] instance.
4039///
4040/// # Example
4041///
4042/// Instantiate a resource method builder
4043///
4044/// ```test_harness,no_run
4045/// # extern crate hyper;
4046/// # extern crate hyper_rustls;
4047/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4048/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest;
4049/// # async fn dox() {
4050/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4051///
4052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4054/// #     .with_native_roots()
4055/// #     .unwrap()
4056/// #     .https_only()
4057/// #     .enable_http2()
4058/// #     .build();
4059///
4060/// # let executor = hyper_util::rt::TokioExecutor::new();
4061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4062/// #     secret,
4063/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4064/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4065/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4066/// #     ),
4067/// # ).build().await.unwrap();
4068///
4069/// # let client = hyper_util::client::legacy::Client::builder(
4070/// #     hyper_util::rt::TokioExecutor::new()
4071/// # )
4072/// # .build(
4073/// #     hyper_rustls::HttpsConnectorBuilder::new()
4074/// #         .with_native_roots()
4075/// #         .unwrap()
4076/// #         .https_or_http()
4077/// #         .enable_http2()
4078/// #         .build()
4079/// # );
4080/// # let mut hub = Firebaseappcheck::new(client, auth);
4081/// // As the method needs a request, you would usually fill it with the desired information
4082/// // into the respective structure. Some of the parts shown here might not be applicable !
4083/// // Values shown here are possibly random and not representative !
4084/// let mut req = GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest::default();
4085///
4086/// // You can configure optional parameters by calling the respective setters at will, and
4087/// // execute the final call using `doit()`.
4088/// // Values shown here are possibly random and not representative !
4089/// let result = hub.oauth_clients().generate_app_attest_challenge(req, "app")
4090///              .doit().await;
4091/// # }
4092/// ```
4093pub struct OauthClientGenerateAppAttestChallengeCall<'a, C>
4094where
4095    C: 'a,
4096{
4097    hub: &'a Firebaseappcheck<C>,
4098    _request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
4099    _app: String,
4100    _delegate: Option<&'a mut dyn common::Delegate>,
4101    _additional_params: HashMap<String, String>,
4102    _scopes: BTreeSet<String>,
4103}
4104
4105impl<'a, C> common::CallBuilder for OauthClientGenerateAppAttestChallengeCall<'a, C> {}
4106
4107impl<'a, C> OauthClientGenerateAppAttestChallengeCall<'a, C>
4108where
4109    C: common::Connector,
4110{
4111    /// Perform the operation you have build so far.
4112    pub async fn doit(
4113        mut self,
4114    ) -> common::Result<(
4115        common::Response,
4116        GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse,
4117    )> {
4118        use std::borrow::Cow;
4119        use std::io::{Read, Seek};
4120
4121        use common::{url::Params, ToParts};
4122        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4123
4124        let mut dd = common::DefaultDelegate;
4125        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4126        dlg.begin(common::MethodInfo {
4127            id: "firebaseappcheck.oauthClients.generateAppAttestChallenge",
4128            http_method: hyper::Method::POST,
4129        });
4130
4131        for &field in ["alt", "app"].iter() {
4132            if self._additional_params.contains_key(field) {
4133                dlg.finished(false);
4134                return Err(common::Error::FieldClash(field));
4135            }
4136        }
4137
4138        let mut params = Params::with_capacity(4 + self._additional_params.len());
4139        params.push("app", self._app);
4140
4141        params.extend(self._additional_params.iter());
4142
4143        params.push("alt", "json");
4144        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generateAppAttestChallenge";
4145        if self._scopes.is_empty() {
4146            self._scopes
4147                .insert(Scope::CloudPlatform.as_ref().to_string());
4148        }
4149
4150        #[allow(clippy::single_element_loop)]
4151        for &(find_this, param_name) in [("{+app}", "app")].iter() {
4152            url = params.uri_replacement(url, param_name, find_this, true);
4153        }
4154        {
4155            let to_remove = ["app"];
4156            params.remove_params(&to_remove);
4157        }
4158
4159        let url = params.parse_with_url(&url);
4160
4161        let mut json_mime_type = mime::APPLICATION_JSON;
4162        let mut request_value_reader = {
4163            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4164            common::remove_json_null_values(&mut value);
4165            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4166            serde_json::to_writer(&mut dst, &value).unwrap();
4167            dst
4168        };
4169        let request_size = request_value_reader
4170            .seek(std::io::SeekFrom::End(0))
4171            .unwrap();
4172        request_value_reader
4173            .seek(std::io::SeekFrom::Start(0))
4174            .unwrap();
4175
4176        loop {
4177            let token = match self
4178                .hub
4179                .auth
4180                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4181                .await
4182            {
4183                Ok(token) => token,
4184                Err(e) => match dlg.token(e) {
4185                    Ok(token) => token,
4186                    Err(e) => {
4187                        dlg.finished(false);
4188                        return Err(common::Error::MissingToken(e));
4189                    }
4190                },
4191            };
4192            request_value_reader
4193                .seek(std::io::SeekFrom::Start(0))
4194                .unwrap();
4195            let mut req_result = {
4196                let client = &self.hub.client;
4197                dlg.pre_request();
4198                let mut req_builder = hyper::Request::builder()
4199                    .method(hyper::Method::POST)
4200                    .uri(url.as_str())
4201                    .header(USER_AGENT, self.hub._user_agent.clone());
4202
4203                if let Some(token) = token.as_ref() {
4204                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4205                }
4206
4207                let request = req_builder
4208                    .header(CONTENT_TYPE, json_mime_type.to_string())
4209                    .header(CONTENT_LENGTH, request_size as u64)
4210                    .body(common::to_body(
4211                        request_value_reader.get_ref().clone().into(),
4212                    ));
4213
4214                client.request(request.unwrap()).await
4215            };
4216
4217            match req_result {
4218                Err(err) => {
4219                    if let common::Retry::After(d) = dlg.http_error(&err) {
4220                        sleep(d).await;
4221                        continue;
4222                    }
4223                    dlg.finished(false);
4224                    return Err(common::Error::HttpError(err));
4225                }
4226                Ok(res) => {
4227                    let (mut parts, body) = res.into_parts();
4228                    let mut body = common::Body::new(body);
4229                    if !parts.status.is_success() {
4230                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4231                        let error = serde_json::from_str(&common::to_string(&bytes));
4232                        let response = common::to_response(parts, bytes.into());
4233
4234                        if let common::Retry::After(d) =
4235                            dlg.http_failure(&response, error.as_ref().ok())
4236                        {
4237                            sleep(d).await;
4238                            continue;
4239                        }
4240
4241                        dlg.finished(false);
4242
4243                        return Err(match error {
4244                            Ok(value) => common::Error::BadRequest(value),
4245                            _ => common::Error::Failure(response),
4246                        });
4247                    }
4248                    let response = {
4249                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4250                        let encoded = common::to_string(&bytes);
4251                        match serde_json::from_str(&encoded) {
4252                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4253                            Err(error) => {
4254                                dlg.response_json_decode_error(&encoded, &error);
4255                                return Err(common::Error::JsonDecodeError(
4256                                    encoded.to_string(),
4257                                    error,
4258                                ));
4259                            }
4260                        }
4261                    };
4262
4263                    dlg.finished(true);
4264                    return Ok(response);
4265                }
4266            }
4267        }
4268    }
4269
4270    ///
4271    /// Sets the *request* property to the given value.
4272    ///
4273    /// Even though the property as already been set when instantiating this call,
4274    /// we provide this method for API completeness.
4275    pub fn request(
4276        mut self,
4277        new_value: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
4278    ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4279        self._request = new_value;
4280        self
4281    }
4282    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
4283    ///
4284    /// Sets the *app* path property to the given value.
4285    ///
4286    /// Even though the property as already been set when instantiating this call,
4287    /// we provide this method for API completeness.
4288    pub fn app(mut self, new_value: &str) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4289        self._app = new_value.to_string();
4290        self
4291    }
4292    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4293    /// while executing the actual API request.
4294    ///
4295    /// ````text
4296    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4297    /// ````
4298    ///
4299    /// Sets the *delegate* property to the given value.
4300    pub fn delegate(
4301        mut self,
4302        new_value: &'a mut dyn common::Delegate,
4303    ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4304        self._delegate = Some(new_value);
4305        self
4306    }
4307
4308    /// Set any additional parameter of the query string used in the request.
4309    /// It should be used to set parameters which are not yet available through their own
4310    /// setters.
4311    ///
4312    /// Please note that this method must not be used to set any of the known parameters
4313    /// which have their own setter method. If done anyway, the request will fail.
4314    ///
4315    /// # Additional Parameters
4316    ///
4317    /// * *$.xgafv* (query-string) - V1 error format.
4318    /// * *access_token* (query-string) - OAuth access token.
4319    /// * *alt* (query-string) - Data format for response.
4320    /// * *callback* (query-string) - JSONP
4321    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4322    /// * *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.
4323    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4324    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4325    /// * *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.
4326    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4327    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4328    pub fn param<T>(mut self, name: T, value: T) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4329    where
4330        T: AsRef<str>,
4331    {
4332        self._additional_params
4333            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4334        self
4335    }
4336
4337    /// Identifies the authorization scope for the method you are building.
4338    ///
4339    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4340    /// [`Scope::CloudPlatform`].
4341    ///
4342    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4343    /// tokens for more than one scope.
4344    ///
4345    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4346    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4347    /// sufficient, a read-write scope will do as well.
4348    pub fn add_scope<St>(mut self, scope: St) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4349    where
4350        St: AsRef<str>,
4351    {
4352        self._scopes.insert(String::from(scope.as_ref()));
4353        self
4354    }
4355    /// Identifies the authorization scope(s) for the method you are building.
4356    ///
4357    /// See [`Self::add_scope()`] for details.
4358    pub fn add_scopes<I, St>(
4359        mut self,
4360        scopes: I,
4361    ) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4362    where
4363        I: IntoIterator<Item = St>,
4364        St: AsRef<str>,
4365    {
4366        self._scopes
4367            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4368        self
4369    }
4370
4371    /// Removes all scopes, and no default scope will be used either.
4372    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4373    /// for details).
4374    pub fn clear_scopes(mut self) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4375        self._scopes.clear();
4376        self
4377    }
4378}
4379
4380/// Atomically gets the AppAttestConfigs for the specified list of apps.
4381///
4382/// A builder for the *apps.appAttestConfig.batchGet* method supported by a *project* resource.
4383/// It is not used directly, but through a [`ProjectMethods`] instance.
4384///
4385/// # Example
4386///
4387/// Instantiate a resource method builder
4388///
4389/// ```test_harness,no_run
4390/// # extern crate hyper;
4391/// # extern crate hyper_rustls;
4392/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4393/// # async fn dox() {
4394/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4395///
4396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4397/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4398/// #     .with_native_roots()
4399/// #     .unwrap()
4400/// #     .https_only()
4401/// #     .enable_http2()
4402/// #     .build();
4403///
4404/// # let executor = hyper_util::rt::TokioExecutor::new();
4405/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4406/// #     secret,
4407/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4408/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4409/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4410/// #     ),
4411/// # ).build().await.unwrap();
4412///
4413/// # let client = hyper_util::client::legacy::Client::builder(
4414/// #     hyper_util::rt::TokioExecutor::new()
4415/// # )
4416/// # .build(
4417/// #     hyper_rustls::HttpsConnectorBuilder::new()
4418/// #         .with_native_roots()
4419/// #         .unwrap()
4420/// #         .https_or_http()
4421/// #         .enable_http2()
4422/// #         .build()
4423/// # );
4424/// # let mut hub = Firebaseappcheck::new(client, auth);
4425/// // You can configure optional parameters by calling the respective setters at will, and
4426/// // execute the final call using `doit()`.
4427/// // Values shown here are possibly random and not representative !
4428/// let result = hub.projects().apps_app_attest_config_batch_get("parent")
4429///              .add_names("takimata")
4430///              .doit().await;
4431/// # }
4432/// ```
4433pub struct ProjectAppAppAttestConfigBatchGetCall<'a, C>
4434where
4435    C: 'a,
4436{
4437    hub: &'a Firebaseappcheck<C>,
4438    _parent: String,
4439    _names: Vec<String>,
4440    _delegate: Option<&'a mut dyn common::Delegate>,
4441    _additional_params: HashMap<String, String>,
4442    _scopes: BTreeSet<String>,
4443}
4444
4445impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigBatchGetCall<'a, C> {}
4446
4447impl<'a, C> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4448where
4449    C: common::Connector,
4450{
4451    /// Perform the operation you have build so far.
4452    pub async fn doit(
4453        mut self,
4454    ) -> common::Result<(
4455        common::Response,
4456        GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse,
4457    )> {
4458        use std::borrow::Cow;
4459        use std::io::{Read, Seek};
4460
4461        use common::{url::Params, ToParts};
4462        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4463
4464        let mut dd = common::DefaultDelegate;
4465        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4466        dlg.begin(common::MethodInfo {
4467            id: "firebaseappcheck.projects.apps.appAttestConfig.batchGet",
4468            http_method: hyper::Method::GET,
4469        });
4470
4471        for &field in ["alt", "parent", "names"].iter() {
4472            if self._additional_params.contains_key(field) {
4473                dlg.finished(false);
4474                return Err(common::Error::FieldClash(field));
4475            }
4476        }
4477
4478        let mut params = Params::with_capacity(4 + self._additional_params.len());
4479        params.push("parent", self._parent);
4480        if !self._names.is_empty() {
4481            for f in self._names.iter() {
4482                params.push("names", f);
4483            }
4484        }
4485
4486        params.extend(self._additional_params.iter());
4487
4488        params.push("alt", "json");
4489        let mut url =
4490            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/appAttestConfig:batchGet";
4491        if self._scopes.is_empty() {
4492            self._scopes
4493                .insert(Scope::CloudPlatform.as_ref().to_string());
4494        }
4495
4496        #[allow(clippy::single_element_loop)]
4497        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4498            url = params.uri_replacement(url, param_name, find_this, true);
4499        }
4500        {
4501            let to_remove = ["parent"];
4502            params.remove_params(&to_remove);
4503        }
4504
4505        let url = params.parse_with_url(&url);
4506
4507        loop {
4508            let token = match self
4509                .hub
4510                .auth
4511                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4512                .await
4513            {
4514                Ok(token) => token,
4515                Err(e) => match dlg.token(e) {
4516                    Ok(token) => token,
4517                    Err(e) => {
4518                        dlg.finished(false);
4519                        return Err(common::Error::MissingToken(e));
4520                    }
4521                },
4522            };
4523            let mut req_result = {
4524                let client = &self.hub.client;
4525                dlg.pre_request();
4526                let mut req_builder = hyper::Request::builder()
4527                    .method(hyper::Method::GET)
4528                    .uri(url.as_str())
4529                    .header(USER_AGENT, self.hub._user_agent.clone());
4530
4531                if let Some(token) = token.as_ref() {
4532                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4533                }
4534
4535                let request = req_builder
4536                    .header(CONTENT_LENGTH, 0_u64)
4537                    .body(common::to_body::<String>(None));
4538
4539                client.request(request.unwrap()).await
4540            };
4541
4542            match req_result {
4543                Err(err) => {
4544                    if let common::Retry::After(d) = dlg.http_error(&err) {
4545                        sleep(d).await;
4546                        continue;
4547                    }
4548                    dlg.finished(false);
4549                    return Err(common::Error::HttpError(err));
4550                }
4551                Ok(res) => {
4552                    let (mut parts, body) = res.into_parts();
4553                    let mut body = common::Body::new(body);
4554                    if !parts.status.is_success() {
4555                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4556                        let error = serde_json::from_str(&common::to_string(&bytes));
4557                        let response = common::to_response(parts, bytes.into());
4558
4559                        if let common::Retry::After(d) =
4560                            dlg.http_failure(&response, error.as_ref().ok())
4561                        {
4562                            sleep(d).await;
4563                            continue;
4564                        }
4565
4566                        dlg.finished(false);
4567
4568                        return Err(match error {
4569                            Ok(value) => common::Error::BadRequest(value),
4570                            _ => common::Error::Failure(response),
4571                        });
4572                    }
4573                    let response = {
4574                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4575                        let encoded = common::to_string(&bytes);
4576                        match serde_json::from_str(&encoded) {
4577                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4578                            Err(error) => {
4579                                dlg.response_json_decode_error(&encoded, &error);
4580                                return Err(common::Error::JsonDecodeError(
4581                                    encoded.to_string(),
4582                                    error,
4583                                ));
4584                            }
4585                        }
4586                    };
4587
4588                    dlg.finished(true);
4589                    return Ok(response);
4590                }
4591            }
4592        }
4593    }
4594
4595    /// Required. The parent project name shared by all AppAttestConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
4596    ///
4597    /// Sets the *parent* path property to the given value.
4598    ///
4599    /// Even though the property as already been set when instantiating this call,
4600    /// we provide this method for API completeness.
4601    pub fn parent(mut self, new_value: &str) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4602        self._parent = new_value.to_string();
4603        self
4604    }
4605    /// Required. The relative resource names of the AppAttestConfigs to retrieve, in the format ``` projects/{project_number}/apps/{app_id}/appAttestConfig ``` A maximum of 100 objects can be retrieved in a batch.
4606    ///
4607    /// Append the given value to the *names* query property.
4608    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4609    pub fn add_names(mut self, new_value: &str) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4610        self._names.push(new_value.to_string());
4611        self
4612    }
4613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4614    /// while executing the actual API request.
4615    ///
4616    /// ````text
4617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4618    /// ````
4619    ///
4620    /// Sets the *delegate* property to the given value.
4621    pub fn delegate(
4622        mut self,
4623        new_value: &'a mut dyn common::Delegate,
4624    ) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4625        self._delegate = Some(new_value);
4626        self
4627    }
4628
4629    /// Set any additional parameter of the query string used in the request.
4630    /// It should be used to set parameters which are not yet available through their own
4631    /// setters.
4632    ///
4633    /// Please note that this method must not be used to set any of the known parameters
4634    /// which have their own setter method. If done anyway, the request will fail.
4635    ///
4636    /// # Additional Parameters
4637    ///
4638    /// * *$.xgafv* (query-string) - V1 error format.
4639    /// * *access_token* (query-string) - OAuth access token.
4640    /// * *alt* (query-string) - Data format for response.
4641    /// * *callback* (query-string) - JSONP
4642    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4643    /// * *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.
4644    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4645    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4646    /// * *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.
4647    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4648    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4649    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4650    where
4651        T: AsRef<str>,
4652    {
4653        self._additional_params
4654            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4655        self
4656    }
4657
4658    /// Identifies the authorization scope for the method you are building.
4659    ///
4660    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4661    /// [`Scope::CloudPlatform`].
4662    ///
4663    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4664    /// tokens for more than one scope.
4665    ///
4666    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4667    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4668    /// sufficient, a read-write scope will do as well.
4669    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4670    where
4671        St: AsRef<str>,
4672    {
4673        self._scopes.insert(String::from(scope.as_ref()));
4674        self
4675    }
4676    /// Identifies the authorization scope(s) for the method you are building.
4677    ///
4678    /// See [`Self::add_scope()`] for details.
4679    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4680    where
4681        I: IntoIterator<Item = St>,
4682        St: AsRef<str>,
4683    {
4684        self._scopes
4685            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4686        self
4687    }
4688
4689    /// Removes all scopes, and no default scope will be used either.
4690    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4691    /// for details).
4692    pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4693        self._scopes.clear();
4694        self
4695    }
4696}
4697
4698/// Gets the AppAttestConfig for the specified app.
4699///
4700/// A builder for the *apps.appAttestConfig.get* method supported by a *project* resource.
4701/// It is not used directly, but through a [`ProjectMethods`] instance.
4702///
4703/// # Example
4704///
4705/// Instantiate a resource method builder
4706///
4707/// ```test_harness,no_run
4708/// # extern crate hyper;
4709/// # extern crate hyper_rustls;
4710/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4711/// # async fn dox() {
4712/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4713///
4714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4715/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4716/// #     .with_native_roots()
4717/// #     .unwrap()
4718/// #     .https_only()
4719/// #     .enable_http2()
4720/// #     .build();
4721///
4722/// # let executor = hyper_util::rt::TokioExecutor::new();
4723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4724/// #     secret,
4725/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4726/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4727/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4728/// #     ),
4729/// # ).build().await.unwrap();
4730///
4731/// # let client = hyper_util::client::legacy::Client::builder(
4732/// #     hyper_util::rt::TokioExecutor::new()
4733/// # )
4734/// # .build(
4735/// #     hyper_rustls::HttpsConnectorBuilder::new()
4736/// #         .with_native_roots()
4737/// #         .unwrap()
4738/// #         .https_or_http()
4739/// #         .enable_http2()
4740/// #         .build()
4741/// # );
4742/// # let mut hub = Firebaseappcheck::new(client, auth);
4743/// // You can configure optional parameters by calling the respective setters at will, and
4744/// // execute the final call using `doit()`.
4745/// // Values shown here are possibly random and not representative !
4746/// let result = hub.projects().apps_app_attest_config_get("name")
4747///              .doit().await;
4748/// # }
4749/// ```
4750pub struct ProjectAppAppAttestConfigGetCall<'a, C>
4751where
4752    C: 'a,
4753{
4754    hub: &'a Firebaseappcheck<C>,
4755    _name: String,
4756    _delegate: Option<&'a mut dyn common::Delegate>,
4757    _additional_params: HashMap<String, String>,
4758    _scopes: BTreeSet<String>,
4759}
4760
4761impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigGetCall<'a, C> {}
4762
4763impl<'a, C> ProjectAppAppAttestConfigGetCall<'a, C>
4764where
4765    C: common::Connector,
4766{
4767    /// Perform the operation you have build so far.
4768    pub async fn doit(
4769        mut self,
4770    ) -> common::Result<(
4771        common::Response,
4772        GoogleFirebaseAppcheckV1betaAppAttestConfig,
4773    )> {
4774        use std::borrow::Cow;
4775        use std::io::{Read, Seek};
4776
4777        use common::{url::Params, ToParts};
4778        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4779
4780        let mut dd = common::DefaultDelegate;
4781        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4782        dlg.begin(common::MethodInfo {
4783            id: "firebaseappcheck.projects.apps.appAttestConfig.get",
4784            http_method: hyper::Method::GET,
4785        });
4786
4787        for &field in ["alt", "name"].iter() {
4788            if self._additional_params.contains_key(field) {
4789                dlg.finished(false);
4790                return Err(common::Error::FieldClash(field));
4791            }
4792        }
4793
4794        let mut params = Params::with_capacity(3 + self._additional_params.len());
4795        params.push("name", self._name);
4796
4797        params.extend(self._additional_params.iter());
4798
4799        params.push("alt", "json");
4800        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
4801        if self._scopes.is_empty() {
4802            self._scopes
4803                .insert(Scope::CloudPlatform.as_ref().to_string());
4804        }
4805
4806        #[allow(clippy::single_element_loop)]
4807        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4808            url = params.uri_replacement(url, param_name, find_this, true);
4809        }
4810        {
4811            let to_remove = ["name"];
4812            params.remove_params(&to_remove);
4813        }
4814
4815        let url = params.parse_with_url(&url);
4816
4817        loop {
4818            let token = match self
4819                .hub
4820                .auth
4821                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4822                .await
4823            {
4824                Ok(token) => token,
4825                Err(e) => match dlg.token(e) {
4826                    Ok(token) => token,
4827                    Err(e) => {
4828                        dlg.finished(false);
4829                        return Err(common::Error::MissingToken(e));
4830                    }
4831                },
4832            };
4833            let mut req_result = {
4834                let client = &self.hub.client;
4835                dlg.pre_request();
4836                let mut req_builder = hyper::Request::builder()
4837                    .method(hyper::Method::GET)
4838                    .uri(url.as_str())
4839                    .header(USER_AGENT, self.hub._user_agent.clone());
4840
4841                if let Some(token) = token.as_ref() {
4842                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4843                }
4844
4845                let request = req_builder
4846                    .header(CONTENT_LENGTH, 0_u64)
4847                    .body(common::to_body::<String>(None));
4848
4849                client.request(request.unwrap()).await
4850            };
4851
4852            match req_result {
4853                Err(err) => {
4854                    if let common::Retry::After(d) = dlg.http_error(&err) {
4855                        sleep(d).await;
4856                        continue;
4857                    }
4858                    dlg.finished(false);
4859                    return Err(common::Error::HttpError(err));
4860                }
4861                Ok(res) => {
4862                    let (mut parts, body) = res.into_parts();
4863                    let mut body = common::Body::new(body);
4864                    if !parts.status.is_success() {
4865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4866                        let error = serde_json::from_str(&common::to_string(&bytes));
4867                        let response = common::to_response(parts, bytes.into());
4868
4869                        if let common::Retry::After(d) =
4870                            dlg.http_failure(&response, error.as_ref().ok())
4871                        {
4872                            sleep(d).await;
4873                            continue;
4874                        }
4875
4876                        dlg.finished(false);
4877
4878                        return Err(match error {
4879                            Ok(value) => common::Error::BadRequest(value),
4880                            _ => common::Error::Failure(response),
4881                        });
4882                    }
4883                    let response = {
4884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4885                        let encoded = common::to_string(&bytes);
4886                        match serde_json::from_str(&encoded) {
4887                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4888                            Err(error) => {
4889                                dlg.response_json_decode_error(&encoded, &error);
4890                                return Err(common::Error::JsonDecodeError(
4891                                    encoded.to_string(),
4892                                    error,
4893                                ));
4894                            }
4895                        }
4896                    };
4897
4898                    dlg.finished(true);
4899                    return Ok(response);
4900                }
4901            }
4902        }
4903    }
4904
4905    /// Required. The relative resource name of the AppAttestConfig, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
4906    ///
4907    /// Sets the *name* path property to the given value.
4908    ///
4909    /// Even though the property as already been set when instantiating this call,
4910    /// we provide this method for API completeness.
4911    pub fn name(mut self, new_value: &str) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4912        self._name = new_value.to_string();
4913        self
4914    }
4915    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4916    /// while executing the actual API request.
4917    ///
4918    /// ````text
4919    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4920    /// ````
4921    ///
4922    /// Sets the *delegate* property to the given value.
4923    pub fn delegate(
4924        mut self,
4925        new_value: &'a mut dyn common::Delegate,
4926    ) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4927        self._delegate = Some(new_value);
4928        self
4929    }
4930
4931    /// Set any additional parameter of the query string used in the request.
4932    /// It should be used to set parameters which are not yet available through their own
4933    /// setters.
4934    ///
4935    /// Please note that this method must not be used to set any of the known parameters
4936    /// which have their own setter method. If done anyway, the request will fail.
4937    ///
4938    /// # Additional Parameters
4939    ///
4940    /// * *$.xgafv* (query-string) - V1 error format.
4941    /// * *access_token* (query-string) - OAuth access token.
4942    /// * *alt* (query-string) - Data format for response.
4943    /// * *callback* (query-string) - JSONP
4944    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4945    /// * *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.
4946    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4947    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4948    /// * *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.
4949    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4950    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4951    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigGetCall<'a, C>
4952    where
4953        T: AsRef<str>,
4954    {
4955        self._additional_params
4956            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4957        self
4958    }
4959
4960    /// Identifies the authorization scope for the method you are building.
4961    ///
4962    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4963    /// [`Scope::CloudPlatform`].
4964    ///
4965    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4966    /// tokens for more than one scope.
4967    ///
4968    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4969    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4970    /// sufficient, a read-write scope will do as well.
4971    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigGetCall<'a, C>
4972    where
4973        St: AsRef<str>,
4974    {
4975        self._scopes.insert(String::from(scope.as_ref()));
4976        self
4977    }
4978    /// Identifies the authorization scope(s) for the method you are building.
4979    ///
4980    /// See [`Self::add_scope()`] for details.
4981    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigGetCall<'a, C>
4982    where
4983        I: IntoIterator<Item = St>,
4984        St: AsRef<str>,
4985    {
4986        self._scopes
4987            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4988        self
4989    }
4990
4991    /// Removes all scopes, and no default scope will be used either.
4992    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4993    /// for details).
4994    pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4995        self._scopes.clear();
4996        self
4997    }
4998}
4999
5000/// Updates the AppAttestConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange AppAttest tokens for App Check tokens.
5001///
5002/// A builder for the *apps.appAttestConfig.patch* method supported by a *project* resource.
5003/// It is not used directly, but through a [`ProjectMethods`] instance.
5004///
5005/// # Example
5006///
5007/// Instantiate a resource method builder
5008///
5009/// ```test_harness,no_run
5010/// # extern crate hyper;
5011/// # extern crate hyper_rustls;
5012/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5013/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaAppAttestConfig;
5014/// # async fn dox() {
5015/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5016///
5017/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5018/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5019/// #     .with_native_roots()
5020/// #     .unwrap()
5021/// #     .https_only()
5022/// #     .enable_http2()
5023/// #     .build();
5024///
5025/// # let executor = hyper_util::rt::TokioExecutor::new();
5026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5027/// #     secret,
5028/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5029/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5030/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5031/// #     ),
5032/// # ).build().await.unwrap();
5033///
5034/// # let client = hyper_util::client::legacy::Client::builder(
5035/// #     hyper_util::rt::TokioExecutor::new()
5036/// # )
5037/// # .build(
5038/// #     hyper_rustls::HttpsConnectorBuilder::new()
5039/// #         .with_native_roots()
5040/// #         .unwrap()
5041/// #         .https_or_http()
5042/// #         .enable_http2()
5043/// #         .build()
5044/// # );
5045/// # let mut hub = Firebaseappcheck::new(client, auth);
5046/// // As the method needs a request, you would usually fill it with the desired information
5047/// // into the respective structure. Some of the parts shown here might not be applicable !
5048/// // Values shown here are possibly random and not representative !
5049/// let mut req = GoogleFirebaseAppcheckV1betaAppAttestConfig::default();
5050///
5051/// // You can configure optional parameters by calling the respective setters at will, and
5052/// // execute the final call using `doit()`.
5053/// // Values shown here are possibly random and not representative !
5054/// let result = hub.projects().apps_app_attest_config_patch(req, "name")
5055///              .update_mask(FieldMask::new::<&str>(&[]))
5056///              .doit().await;
5057/// # }
5058/// ```
5059pub struct ProjectAppAppAttestConfigPatchCall<'a, C>
5060where
5061    C: 'a,
5062{
5063    hub: &'a Firebaseappcheck<C>,
5064    _request: GoogleFirebaseAppcheckV1betaAppAttestConfig,
5065    _name: String,
5066    _update_mask: Option<common::FieldMask>,
5067    _delegate: Option<&'a mut dyn common::Delegate>,
5068    _additional_params: HashMap<String, String>,
5069    _scopes: BTreeSet<String>,
5070}
5071
5072impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigPatchCall<'a, C> {}
5073
5074impl<'a, C> ProjectAppAppAttestConfigPatchCall<'a, C>
5075where
5076    C: common::Connector,
5077{
5078    /// Perform the operation you have build so far.
5079    pub async fn doit(
5080        mut self,
5081    ) -> common::Result<(
5082        common::Response,
5083        GoogleFirebaseAppcheckV1betaAppAttestConfig,
5084    )> {
5085        use std::borrow::Cow;
5086        use std::io::{Read, Seek};
5087
5088        use common::{url::Params, ToParts};
5089        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5090
5091        let mut dd = common::DefaultDelegate;
5092        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5093        dlg.begin(common::MethodInfo {
5094            id: "firebaseappcheck.projects.apps.appAttestConfig.patch",
5095            http_method: hyper::Method::PATCH,
5096        });
5097
5098        for &field in ["alt", "name", "updateMask"].iter() {
5099            if self._additional_params.contains_key(field) {
5100                dlg.finished(false);
5101                return Err(common::Error::FieldClash(field));
5102            }
5103        }
5104
5105        let mut params = Params::with_capacity(5 + self._additional_params.len());
5106        params.push("name", self._name);
5107        if let Some(value) = self._update_mask.as_ref() {
5108            params.push("updateMask", value.to_string());
5109        }
5110
5111        params.extend(self._additional_params.iter());
5112
5113        params.push("alt", "json");
5114        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
5115        if self._scopes.is_empty() {
5116            self._scopes
5117                .insert(Scope::CloudPlatform.as_ref().to_string());
5118        }
5119
5120        #[allow(clippy::single_element_loop)]
5121        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5122            url = params.uri_replacement(url, param_name, find_this, true);
5123        }
5124        {
5125            let to_remove = ["name"];
5126            params.remove_params(&to_remove);
5127        }
5128
5129        let url = params.parse_with_url(&url);
5130
5131        let mut json_mime_type = mime::APPLICATION_JSON;
5132        let mut request_value_reader = {
5133            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5134            common::remove_json_null_values(&mut value);
5135            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5136            serde_json::to_writer(&mut dst, &value).unwrap();
5137            dst
5138        };
5139        let request_size = request_value_reader
5140            .seek(std::io::SeekFrom::End(0))
5141            .unwrap();
5142        request_value_reader
5143            .seek(std::io::SeekFrom::Start(0))
5144            .unwrap();
5145
5146        loop {
5147            let token = match self
5148                .hub
5149                .auth
5150                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5151                .await
5152            {
5153                Ok(token) => token,
5154                Err(e) => match dlg.token(e) {
5155                    Ok(token) => token,
5156                    Err(e) => {
5157                        dlg.finished(false);
5158                        return Err(common::Error::MissingToken(e));
5159                    }
5160                },
5161            };
5162            request_value_reader
5163                .seek(std::io::SeekFrom::Start(0))
5164                .unwrap();
5165            let mut req_result = {
5166                let client = &self.hub.client;
5167                dlg.pre_request();
5168                let mut req_builder = hyper::Request::builder()
5169                    .method(hyper::Method::PATCH)
5170                    .uri(url.as_str())
5171                    .header(USER_AGENT, self.hub._user_agent.clone());
5172
5173                if let Some(token) = token.as_ref() {
5174                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5175                }
5176
5177                let request = req_builder
5178                    .header(CONTENT_TYPE, json_mime_type.to_string())
5179                    .header(CONTENT_LENGTH, request_size as u64)
5180                    .body(common::to_body(
5181                        request_value_reader.get_ref().clone().into(),
5182                    ));
5183
5184                client.request(request.unwrap()).await
5185            };
5186
5187            match req_result {
5188                Err(err) => {
5189                    if let common::Retry::After(d) = dlg.http_error(&err) {
5190                        sleep(d).await;
5191                        continue;
5192                    }
5193                    dlg.finished(false);
5194                    return Err(common::Error::HttpError(err));
5195                }
5196                Ok(res) => {
5197                    let (mut parts, body) = res.into_parts();
5198                    let mut body = common::Body::new(body);
5199                    if !parts.status.is_success() {
5200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5201                        let error = serde_json::from_str(&common::to_string(&bytes));
5202                        let response = common::to_response(parts, bytes.into());
5203
5204                        if let common::Retry::After(d) =
5205                            dlg.http_failure(&response, error.as_ref().ok())
5206                        {
5207                            sleep(d).await;
5208                            continue;
5209                        }
5210
5211                        dlg.finished(false);
5212
5213                        return Err(match error {
5214                            Ok(value) => common::Error::BadRequest(value),
5215                            _ => common::Error::Failure(response),
5216                        });
5217                    }
5218                    let response = {
5219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5220                        let encoded = common::to_string(&bytes);
5221                        match serde_json::from_str(&encoded) {
5222                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5223                            Err(error) => {
5224                                dlg.response_json_decode_error(&encoded, &error);
5225                                return Err(common::Error::JsonDecodeError(
5226                                    encoded.to_string(),
5227                                    error,
5228                                ));
5229                            }
5230                        }
5231                    };
5232
5233                    dlg.finished(true);
5234                    return Ok(response);
5235                }
5236            }
5237        }
5238    }
5239
5240    ///
5241    /// Sets the *request* property to the given value.
5242    ///
5243    /// Even though the property as already been set when instantiating this call,
5244    /// we provide this method for API completeness.
5245    pub fn request(
5246        mut self,
5247        new_value: GoogleFirebaseAppcheckV1betaAppAttestConfig,
5248    ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5249        self._request = new_value;
5250        self
5251    }
5252    /// Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
5253    ///
5254    /// Sets the *name* path property to the given value.
5255    ///
5256    /// Even though the property as already been set when instantiating this call,
5257    /// we provide this method for API completeness.
5258    pub fn name(mut self, new_value: &str) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5259        self._name = new_value.to_string();
5260        self
5261    }
5262    /// Required. A comma-separated list of names of fields in the AppAttestConfig to update. Example: `token_ttl`.
5263    ///
5264    /// Sets the *update mask* query property to the given value.
5265    pub fn update_mask(
5266        mut self,
5267        new_value: common::FieldMask,
5268    ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5269        self._update_mask = Some(new_value);
5270        self
5271    }
5272    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5273    /// while executing the actual API request.
5274    ///
5275    /// ````text
5276    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5277    /// ````
5278    ///
5279    /// Sets the *delegate* property to the given value.
5280    pub fn delegate(
5281        mut self,
5282        new_value: &'a mut dyn common::Delegate,
5283    ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5284        self._delegate = Some(new_value);
5285        self
5286    }
5287
5288    /// Set any additional parameter of the query string used in the request.
5289    /// It should be used to set parameters which are not yet available through their own
5290    /// setters.
5291    ///
5292    /// Please note that this method must not be used to set any of the known parameters
5293    /// which have their own setter method. If done anyway, the request will fail.
5294    ///
5295    /// # Additional Parameters
5296    ///
5297    /// * *$.xgafv* (query-string) - V1 error format.
5298    /// * *access_token* (query-string) - OAuth access token.
5299    /// * *alt* (query-string) - Data format for response.
5300    /// * *callback* (query-string) - JSONP
5301    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5302    /// * *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.
5303    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5304    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5305    /// * *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.
5306    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5307    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5308    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5309    where
5310        T: AsRef<str>,
5311    {
5312        self._additional_params
5313            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5314        self
5315    }
5316
5317    /// Identifies the authorization scope for the method you are building.
5318    ///
5319    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5320    /// [`Scope::CloudPlatform`].
5321    ///
5322    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5323    /// tokens for more than one scope.
5324    ///
5325    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5326    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5327    /// sufficient, a read-write scope will do as well.
5328    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5329    where
5330        St: AsRef<str>,
5331    {
5332        self._scopes.insert(String::from(scope.as_ref()));
5333        self
5334    }
5335    /// Identifies the authorization scope(s) for the method you are building.
5336    ///
5337    /// See [`Self::add_scope()`] for details.
5338    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5339    where
5340        I: IntoIterator<Item = St>,
5341        St: AsRef<str>,
5342    {
5343        self._scopes
5344            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5345        self
5346    }
5347
5348    /// Removes all scopes, and no default scope will be used either.
5349    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5350    /// for details).
5351    pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5352        self._scopes.clear();
5353        self
5354    }
5355}
5356
5357/// Creates a new DebugToken for the specified app. For security reasons, after the creation operation completes, the `token` field cannot be updated or retrieved, but you can revoke the debug token using DeleteDebugToken. Each app can have a maximum of 20 debug tokens.
5358///
5359/// A builder for the *apps.debugTokens.create* method supported by a *project* resource.
5360/// It is not used directly, but through a [`ProjectMethods`] instance.
5361///
5362/// # Example
5363///
5364/// Instantiate a resource method builder
5365///
5366/// ```test_harness,no_run
5367/// # extern crate hyper;
5368/// # extern crate hyper_rustls;
5369/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5370/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDebugToken;
5371/// # async fn dox() {
5372/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5373///
5374/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5375/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5376/// #     .with_native_roots()
5377/// #     .unwrap()
5378/// #     .https_only()
5379/// #     .enable_http2()
5380/// #     .build();
5381///
5382/// # let executor = hyper_util::rt::TokioExecutor::new();
5383/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5384/// #     secret,
5385/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5386/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5387/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5388/// #     ),
5389/// # ).build().await.unwrap();
5390///
5391/// # let client = hyper_util::client::legacy::Client::builder(
5392/// #     hyper_util::rt::TokioExecutor::new()
5393/// # )
5394/// # .build(
5395/// #     hyper_rustls::HttpsConnectorBuilder::new()
5396/// #         .with_native_roots()
5397/// #         .unwrap()
5398/// #         .https_or_http()
5399/// #         .enable_http2()
5400/// #         .build()
5401/// # );
5402/// # let mut hub = Firebaseappcheck::new(client, auth);
5403/// // As the method needs a request, you would usually fill it with the desired information
5404/// // into the respective structure. Some of the parts shown here might not be applicable !
5405/// // Values shown here are possibly random and not representative !
5406/// let mut req = GoogleFirebaseAppcheckV1betaDebugToken::default();
5407///
5408/// // You can configure optional parameters by calling the respective setters at will, and
5409/// // execute the final call using `doit()`.
5410/// // Values shown here are possibly random and not representative !
5411/// let result = hub.projects().apps_debug_tokens_create(req, "parent")
5412///              .doit().await;
5413/// # }
5414/// ```
5415pub struct ProjectAppDebugTokenCreateCall<'a, C>
5416where
5417    C: 'a,
5418{
5419    hub: &'a Firebaseappcheck<C>,
5420    _request: GoogleFirebaseAppcheckV1betaDebugToken,
5421    _parent: String,
5422    _delegate: Option<&'a mut dyn common::Delegate>,
5423    _additional_params: HashMap<String, String>,
5424    _scopes: BTreeSet<String>,
5425}
5426
5427impl<'a, C> common::CallBuilder for ProjectAppDebugTokenCreateCall<'a, C> {}
5428
5429impl<'a, C> ProjectAppDebugTokenCreateCall<'a, C>
5430where
5431    C: common::Connector,
5432{
5433    /// Perform the operation you have build so far.
5434    pub async fn doit(
5435        mut self,
5436    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
5437        use std::borrow::Cow;
5438        use std::io::{Read, Seek};
5439
5440        use common::{url::Params, ToParts};
5441        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5442
5443        let mut dd = common::DefaultDelegate;
5444        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5445        dlg.begin(common::MethodInfo {
5446            id: "firebaseappcheck.projects.apps.debugTokens.create",
5447            http_method: hyper::Method::POST,
5448        });
5449
5450        for &field in ["alt", "parent"].iter() {
5451            if self._additional_params.contains_key(field) {
5452                dlg.finished(false);
5453                return Err(common::Error::FieldClash(field));
5454            }
5455        }
5456
5457        let mut params = Params::with_capacity(4 + self._additional_params.len());
5458        params.push("parent", self._parent);
5459
5460        params.extend(self._additional_params.iter());
5461
5462        params.push("alt", "json");
5463        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/debugTokens";
5464        if self._scopes.is_empty() {
5465            self._scopes
5466                .insert(Scope::CloudPlatform.as_ref().to_string());
5467        }
5468
5469        #[allow(clippy::single_element_loop)]
5470        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5471            url = params.uri_replacement(url, param_name, find_this, true);
5472        }
5473        {
5474            let to_remove = ["parent"];
5475            params.remove_params(&to_remove);
5476        }
5477
5478        let url = params.parse_with_url(&url);
5479
5480        let mut json_mime_type = mime::APPLICATION_JSON;
5481        let mut request_value_reader = {
5482            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5483            common::remove_json_null_values(&mut value);
5484            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5485            serde_json::to_writer(&mut dst, &value).unwrap();
5486            dst
5487        };
5488        let request_size = request_value_reader
5489            .seek(std::io::SeekFrom::End(0))
5490            .unwrap();
5491        request_value_reader
5492            .seek(std::io::SeekFrom::Start(0))
5493            .unwrap();
5494
5495        loop {
5496            let token = match self
5497                .hub
5498                .auth
5499                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5500                .await
5501            {
5502                Ok(token) => token,
5503                Err(e) => match dlg.token(e) {
5504                    Ok(token) => token,
5505                    Err(e) => {
5506                        dlg.finished(false);
5507                        return Err(common::Error::MissingToken(e));
5508                    }
5509                },
5510            };
5511            request_value_reader
5512                .seek(std::io::SeekFrom::Start(0))
5513                .unwrap();
5514            let mut req_result = {
5515                let client = &self.hub.client;
5516                dlg.pre_request();
5517                let mut req_builder = hyper::Request::builder()
5518                    .method(hyper::Method::POST)
5519                    .uri(url.as_str())
5520                    .header(USER_AGENT, self.hub._user_agent.clone());
5521
5522                if let Some(token) = token.as_ref() {
5523                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5524                }
5525
5526                let request = req_builder
5527                    .header(CONTENT_TYPE, json_mime_type.to_string())
5528                    .header(CONTENT_LENGTH, request_size as u64)
5529                    .body(common::to_body(
5530                        request_value_reader.get_ref().clone().into(),
5531                    ));
5532
5533                client.request(request.unwrap()).await
5534            };
5535
5536            match req_result {
5537                Err(err) => {
5538                    if let common::Retry::After(d) = dlg.http_error(&err) {
5539                        sleep(d).await;
5540                        continue;
5541                    }
5542                    dlg.finished(false);
5543                    return Err(common::Error::HttpError(err));
5544                }
5545                Ok(res) => {
5546                    let (mut parts, body) = res.into_parts();
5547                    let mut body = common::Body::new(body);
5548                    if !parts.status.is_success() {
5549                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5550                        let error = serde_json::from_str(&common::to_string(&bytes));
5551                        let response = common::to_response(parts, bytes.into());
5552
5553                        if let common::Retry::After(d) =
5554                            dlg.http_failure(&response, error.as_ref().ok())
5555                        {
5556                            sleep(d).await;
5557                            continue;
5558                        }
5559
5560                        dlg.finished(false);
5561
5562                        return Err(match error {
5563                            Ok(value) => common::Error::BadRequest(value),
5564                            _ => common::Error::Failure(response),
5565                        });
5566                    }
5567                    let response = {
5568                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5569                        let encoded = common::to_string(&bytes);
5570                        match serde_json::from_str(&encoded) {
5571                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5572                            Err(error) => {
5573                                dlg.response_json_decode_error(&encoded, &error);
5574                                return Err(common::Error::JsonDecodeError(
5575                                    encoded.to_string(),
5576                                    error,
5577                                ));
5578                            }
5579                        }
5580                    };
5581
5582                    dlg.finished(true);
5583                    return Ok(response);
5584                }
5585            }
5586        }
5587    }
5588
5589    ///
5590    /// Sets the *request* property to the given value.
5591    ///
5592    /// Even though the property as already been set when instantiating this call,
5593    /// we provide this method for API completeness.
5594    pub fn request(
5595        mut self,
5596        new_value: GoogleFirebaseAppcheckV1betaDebugToken,
5597    ) -> ProjectAppDebugTokenCreateCall<'a, C> {
5598        self._request = new_value;
5599        self
5600    }
5601    /// Required. The relative resource name of the parent app in which the specified DebugToken will be created, in the format: ``` projects/{project_number}/apps/{app_id} ```
5602    ///
5603    /// Sets the *parent* path property to the given value.
5604    ///
5605    /// Even though the property as already been set when instantiating this call,
5606    /// we provide this method for API completeness.
5607    pub fn parent(mut self, new_value: &str) -> ProjectAppDebugTokenCreateCall<'a, C> {
5608        self._parent = new_value.to_string();
5609        self
5610    }
5611    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5612    /// while executing the actual API request.
5613    ///
5614    /// ````text
5615    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5616    /// ````
5617    ///
5618    /// Sets the *delegate* property to the given value.
5619    pub fn delegate(
5620        mut self,
5621        new_value: &'a mut dyn common::Delegate,
5622    ) -> ProjectAppDebugTokenCreateCall<'a, C> {
5623        self._delegate = Some(new_value);
5624        self
5625    }
5626
5627    /// Set any additional parameter of the query string used in the request.
5628    /// It should be used to set parameters which are not yet available through their own
5629    /// setters.
5630    ///
5631    /// Please note that this method must not be used to set any of the known parameters
5632    /// which have their own setter method. If done anyway, the request will fail.
5633    ///
5634    /// # Additional Parameters
5635    ///
5636    /// * *$.xgafv* (query-string) - V1 error format.
5637    /// * *access_token* (query-string) - OAuth access token.
5638    /// * *alt* (query-string) - Data format for response.
5639    /// * *callback* (query-string) - JSONP
5640    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5641    /// * *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.
5642    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5643    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5644    /// * *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.
5645    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5646    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5647    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenCreateCall<'a, C>
5648    where
5649        T: AsRef<str>,
5650    {
5651        self._additional_params
5652            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5653        self
5654    }
5655
5656    /// Identifies the authorization scope for the method you are building.
5657    ///
5658    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5659    /// [`Scope::CloudPlatform`].
5660    ///
5661    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5662    /// tokens for more than one scope.
5663    ///
5664    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5665    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5666    /// sufficient, a read-write scope will do as well.
5667    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenCreateCall<'a, C>
5668    where
5669        St: AsRef<str>,
5670    {
5671        self._scopes.insert(String::from(scope.as_ref()));
5672        self
5673    }
5674    /// Identifies the authorization scope(s) for the method you are building.
5675    ///
5676    /// See [`Self::add_scope()`] for details.
5677    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenCreateCall<'a, C>
5678    where
5679        I: IntoIterator<Item = St>,
5680        St: AsRef<str>,
5681    {
5682        self._scopes
5683            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5684        self
5685    }
5686
5687    /// Removes all scopes, and no default scope will be used either.
5688    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5689    /// for details).
5690    pub fn clear_scopes(mut self) -> ProjectAppDebugTokenCreateCall<'a, C> {
5691        self._scopes.clear();
5692        self
5693    }
5694}
5695
5696/// Deletes the specified DebugToken. A deleted debug token cannot be used to exchange for an App Check token. Use this method when you suspect the secret `token` has been compromised or when you no longer need the debug token.
5697///
5698/// A builder for the *apps.debugTokens.delete* method supported by a *project* resource.
5699/// It is not used directly, but through a [`ProjectMethods`] instance.
5700///
5701/// # Example
5702///
5703/// Instantiate a resource method builder
5704///
5705/// ```test_harness,no_run
5706/// # extern crate hyper;
5707/// # extern crate hyper_rustls;
5708/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5709/// # async fn dox() {
5710/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5711///
5712/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5713/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5714/// #     .with_native_roots()
5715/// #     .unwrap()
5716/// #     .https_only()
5717/// #     .enable_http2()
5718/// #     .build();
5719///
5720/// # let executor = hyper_util::rt::TokioExecutor::new();
5721/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5722/// #     secret,
5723/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5724/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5725/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5726/// #     ),
5727/// # ).build().await.unwrap();
5728///
5729/// # let client = hyper_util::client::legacy::Client::builder(
5730/// #     hyper_util::rt::TokioExecutor::new()
5731/// # )
5732/// # .build(
5733/// #     hyper_rustls::HttpsConnectorBuilder::new()
5734/// #         .with_native_roots()
5735/// #         .unwrap()
5736/// #         .https_or_http()
5737/// #         .enable_http2()
5738/// #         .build()
5739/// # );
5740/// # let mut hub = Firebaseappcheck::new(client, auth);
5741/// // You can configure optional parameters by calling the respective setters at will, and
5742/// // execute the final call using `doit()`.
5743/// // Values shown here are possibly random and not representative !
5744/// let result = hub.projects().apps_debug_tokens_delete("name")
5745///              .doit().await;
5746/// # }
5747/// ```
5748pub struct ProjectAppDebugTokenDeleteCall<'a, C>
5749where
5750    C: 'a,
5751{
5752    hub: &'a Firebaseappcheck<C>,
5753    _name: String,
5754    _delegate: Option<&'a mut dyn common::Delegate>,
5755    _additional_params: HashMap<String, String>,
5756    _scopes: BTreeSet<String>,
5757}
5758
5759impl<'a, C> common::CallBuilder for ProjectAppDebugTokenDeleteCall<'a, C> {}
5760
5761impl<'a, C> ProjectAppDebugTokenDeleteCall<'a, C>
5762where
5763    C: common::Connector,
5764{
5765    /// Perform the operation you have build so far.
5766    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
5767        use std::borrow::Cow;
5768        use std::io::{Read, Seek};
5769
5770        use common::{url::Params, ToParts};
5771        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5772
5773        let mut dd = common::DefaultDelegate;
5774        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5775        dlg.begin(common::MethodInfo {
5776            id: "firebaseappcheck.projects.apps.debugTokens.delete",
5777            http_method: hyper::Method::DELETE,
5778        });
5779
5780        for &field in ["alt", "name"].iter() {
5781            if self._additional_params.contains_key(field) {
5782                dlg.finished(false);
5783                return Err(common::Error::FieldClash(field));
5784            }
5785        }
5786
5787        let mut params = Params::with_capacity(3 + self._additional_params.len());
5788        params.push("name", self._name);
5789
5790        params.extend(self._additional_params.iter());
5791
5792        params.push("alt", "json");
5793        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
5794        if self._scopes.is_empty() {
5795            self._scopes
5796                .insert(Scope::CloudPlatform.as_ref().to_string());
5797        }
5798
5799        #[allow(clippy::single_element_loop)]
5800        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5801            url = params.uri_replacement(url, param_name, find_this, true);
5802        }
5803        {
5804            let to_remove = ["name"];
5805            params.remove_params(&to_remove);
5806        }
5807
5808        let url = params.parse_with_url(&url);
5809
5810        loop {
5811            let token = match self
5812                .hub
5813                .auth
5814                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5815                .await
5816            {
5817                Ok(token) => token,
5818                Err(e) => match dlg.token(e) {
5819                    Ok(token) => token,
5820                    Err(e) => {
5821                        dlg.finished(false);
5822                        return Err(common::Error::MissingToken(e));
5823                    }
5824                },
5825            };
5826            let mut req_result = {
5827                let client = &self.hub.client;
5828                dlg.pre_request();
5829                let mut req_builder = hyper::Request::builder()
5830                    .method(hyper::Method::DELETE)
5831                    .uri(url.as_str())
5832                    .header(USER_AGENT, self.hub._user_agent.clone());
5833
5834                if let Some(token) = token.as_ref() {
5835                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5836                }
5837
5838                let request = req_builder
5839                    .header(CONTENT_LENGTH, 0_u64)
5840                    .body(common::to_body::<String>(None));
5841
5842                client.request(request.unwrap()).await
5843            };
5844
5845            match req_result {
5846                Err(err) => {
5847                    if let common::Retry::After(d) = dlg.http_error(&err) {
5848                        sleep(d).await;
5849                        continue;
5850                    }
5851                    dlg.finished(false);
5852                    return Err(common::Error::HttpError(err));
5853                }
5854                Ok(res) => {
5855                    let (mut parts, body) = res.into_parts();
5856                    let mut body = common::Body::new(body);
5857                    if !parts.status.is_success() {
5858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5859                        let error = serde_json::from_str(&common::to_string(&bytes));
5860                        let response = common::to_response(parts, bytes.into());
5861
5862                        if let common::Retry::After(d) =
5863                            dlg.http_failure(&response, error.as_ref().ok())
5864                        {
5865                            sleep(d).await;
5866                            continue;
5867                        }
5868
5869                        dlg.finished(false);
5870
5871                        return Err(match error {
5872                            Ok(value) => common::Error::BadRequest(value),
5873                            _ => common::Error::Failure(response),
5874                        });
5875                    }
5876                    let response = {
5877                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5878                        let encoded = common::to_string(&bytes);
5879                        match serde_json::from_str(&encoded) {
5880                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5881                            Err(error) => {
5882                                dlg.response_json_decode_error(&encoded, &error);
5883                                return Err(common::Error::JsonDecodeError(
5884                                    encoded.to_string(),
5885                                    error,
5886                                ));
5887                            }
5888                        }
5889                    };
5890
5891                    dlg.finished(true);
5892                    return Ok(response);
5893                }
5894            }
5895        }
5896    }
5897
5898    /// Required. The relative resource name of the DebugToken to delete, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
5899    ///
5900    /// Sets the *name* path property to the given value.
5901    ///
5902    /// Even though the property as already been set when instantiating this call,
5903    /// we provide this method for API completeness.
5904    pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5905        self._name = new_value.to_string();
5906        self
5907    }
5908    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5909    /// while executing the actual API request.
5910    ///
5911    /// ````text
5912    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5913    /// ````
5914    ///
5915    /// Sets the *delegate* property to the given value.
5916    pub fn delegate(
5917        mut self,
5918        new_value: &'a mut dyn common::Delegate,
5919    ) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5920        self._delegate = Some(new_value);
5921        self
5922    }
5923
5924    /// Set any additional parameter of the query string used in the request.
5925    /// It should be used to set parameters which are not yet available through their own
5926    /// setters.
5927    ///
5928    /// Please note that this method must not be used to set any of the known parameters
5929    /// which have their own setter method. If done anyway, the request will fail.
5930    ///
5931    /// # Additional Parameters
5932    ///
5933    /// * *$.xgafv* (query-string) - V1 error format.
5934    /// * *access_token* (query-string) - OAuth access token.
5935    /// * *alt* (query-string) - Data format for response.
5936    /// * *callback* (query-string) - JSONP
5937    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5938    /// * *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.
5939    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5940    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5941    /// * *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.
5942    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5943    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5944    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenDeleteCall<'a, C>
5945    where
5946        T: AsRef<str>,
5947    {
5948        self._additional_params
5949            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5950        self
5951    }
5952
5953    /// Identifies the authorization scope for the method you are building.
5954    ///
5955    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5956    /// [`Scope::CloudPlatform`].
5957    ///
5958    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5959    /// tokens for more than one scope.
5960    ///
5961    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5962    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5963    /// sufficient, a read-write scope will do as well.
5964    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenDeleteCall<'a, C>
5965    where
5966        St: AsRef<str>,
5967    {
5968        self._scopes.insert(String::from(scope.as_ref()));
5969        self
5970    }
5971    /// Identifies the authorization scope(s) for the method you are building.
5972    ///
5973    /// See [`Self::add_scope()`] for details.
5974    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenDeleteCall<'a, C>
5975    where
5976        I: IntoIterator<Item = St>,
5977        St: AsRef<str>,
5978    {
5979        self._scopes
5980            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5981        self
5982    }
5983
5984    /// Removes all scopes, and no default scope will be used either.
5985    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5986    /// for details).
5987    pub fn clear_scopes(mut self) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5988        self._scopes.clear();
5989        self
5990    }
5991}
5992
5993/// Gets the specified DebugToken. For security reasons, the `token` field is never populated in the response.
5994///
5995/// A builder for the *apps.debugTokens.get* method supported by a *project* resource.
5996/// It is not used directly, but through a [`ProjectMethods`] instance.
5997///
5998/// # Example
5999///
6000/// Instantiate a resource method builder
6001///
6002/// ```test_harness,no_run
6003/// # extern crate hyper;
6004/// # extern crate hyper_rustls;
6005/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6006/// # async fn dox() {
6007/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6008///
6009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6011/// #     .with_native_roots()
6012/// #     .unwrap()
6013/// #     .https_only()
6014/// #     .enable_http2()
6015/// #     .build();
6016///
6017/// # let executor = hyper_util::rt::TokioExecutor::new();
6018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6019/// #     secret,
6020/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6021/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6022/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6023/// #     ),
6024/// # ).build().await.unwrap();
6025///
6026/// # let client = hyper_util::client::legacy::Client::builder(
6027/// #     hyper_util::rt::TokioExecutor::new()
6028/// # )
6029/// # .build(
6030/// #     hyper_rustls::HttpsConnectorBuilder::new()
6031/// #         .with_native_roots()
6032/// #         .unwrap()
6033/// #         .https_or_http()
6034/// #         .enable_http2()
6035/// #         .build()
6036/// # );
6037/// # let mut hub = Firebaseappcheck::new(client, auth);
6038/// // You can configure optional parameters by calling the respective setters at will, and
6039/// // execute the final call using `doit()`.
6040/// // Values shown here are possibly random and not representative !
6041/// let result = hub.projects().apps_debug_tokens_get("name")
6042///              .doit().await;
6043/// # }
6044/// ```
6045pub struct ProjectAppDebugTokenGetCall<'a, C>
6046where
6047    C: 'a,
6048{
6049    hub: &'a Firebaseappcheck<C>,
6050    _name: String,
6051    _delegate: Option<&'a mut dyn common::Delegate>,
6052    _additional_params: HashMap<String, String>,
6053    _scopes: BTreeSet<String>,
6054}
6055
6056impl<'a, C> common::CallBuilder for ProjectAppDebugTokenGetCall<'a, C> {}
6057
6058impl<'a, C> ProjectAppDebugTokenGetCall<'a, C>
6059where
6060    C: common::Connector,
6061{
6062    /// Perform the operation you have build so far.
6063    pub async fn doit(
6064        mut self,
6065    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
6066        use std::borrow::Cow;
6067        use std::io::{Read, Seek};
6068
6069        use common::{url::Params, ToParts};
6070        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6071
6072        let mut dd = common::DefaultDelegate;
6073        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6074        dlg.begin(common::MethodInfo {
6075            id: "firebaseappcheck.projects.apps.debugTokens.get",
6076            http_method: hyper::Method::GET,
6077        });
6078
6079        for &field in ["alt", "name"].iter() {
6080            if self._additional_params.contains_key(field) {
6081                dlg.finished(false);
6082                return Err(common::Error::FieldClash(field));
6083            }
6084        }
6085
6086        let mut params = Params::with_capacity(3 + self._additional_params.len());
6087        params.push("name", self._name);
6088
6089        params.extend(self._additional_params.iter());
6090
6091        params.push("alt", "json");
6092        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
6093        if self._scopes.is_empty() {
6094            self._scopes
6095                .insert(Scope::CloudPlatform.as_ref().to_string());
6096        }
6097
6098        #[allow(clippy::single_element_loop)]
6099        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6100            url = params.uri_replacement(url, param_name, find_this, true);
6101        }
6102        {
6103            let to_remove = ["name"];
6104            params.remove_params(&to_remove);
6105        }
6106
6107        let url = params.parse_with_url(&url);
6108
6109        loop {
6110            let token = match self
6111                .hub
6112                .auth
6113                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6114                .await
6115            {
6116                Ok(token) => token,
6117                Err(e) => match dlg.token(e) {
6118                    Ok(token) => token,
6119                    Err(e) => {
6120                        dlg.finished(false);
6121                        return Err(common::Error::MissingToken(e));
6122                    }
6123                },
6124            };
6125            let mut req_result = {
6126                let client = &self.hub.client;
6127                dlg.pre_request();
6128                let mut req_builder = hyper::Request::builder()
6129                    .method(hyper::Method::GET)
6130                    .uri(url.as_str())
6131                    .header(USER_AGENT, self.hub._user_agent.clone());
6132
6133                if let Some(token) = token.as_ref() {
6134                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6135                }
6136
6137                let request = req_builder
6138                    .header(CONTENT_LENGTH, 0_u64)
6139                    .body(common::to_body::<String>(None));
6140
6141                client.request(request.unwrap()).await
6142            };
6143
6144            match req_result {
6145                Err(err) => {
6146                    if let common::Retry::After(d) = dlg.http_error(&err) {
6147                        sleep(d).await;
6148                        continue;
6149                    }
6150                    dlg.finished(false);
6151                    return Err(common::Error::HttpError(err));
6152                }
6153                Ok(res) => {
6154                    let (mut parts, body) = res.into_parts();
6155                    let mut body = common::Body::new(body);
6156                    if !parts.status.is_success() {
6157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6158                        let error = serde_json::from_str(&common::to_string(&bytes));
6159                        let response = common::to_response(parts, bytes.into());
6160
6161                        if let common::Retry::After(d) =
6162                            dlg.http_failure(&response, error.as_ref().ok())
6163                        {
6164                            sleep(d).await;
6165                            continue;
6166                        }
6167
6168                        dlg.finished(false);
6169
6170                        return Err(match error {
6171                            Ok(value) => common::Error::BadRequest(value),
6172                            _ => common::Error::Failure(response),
6173                        });
6174                    }
6175                    let response = {
6176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6177                        let encoded = common::to_string(&bytes);
6178                        match serde_json::from_str(&encoded) {
6179                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6180                            Err(error) => {
6181                                dlg.response_json_decode_error(&encoded, &error);
6182                                return Err(common::Error::JsonDecodeError(
6183                                    encoded.to_string(),
6184                                    error,
6185                                ));
6186                            }
6187                        }
6188                    };
6189
6190                    dlg.finished(true);
6191                    return Ok(response);
6192                }
6193            }
6194        }
6195    }
6196
6197    /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
6198    ///
6199    /// Sets the *name* path property to the given value.
6200    ///
6201    /// Even though the property as already been set when instantiating this call,
6202    /// we provide this method for API completeness.
6203    pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenGetCall<'a, C> {
6204        self._name = new_value.to_string();
6205        self
6206    }
6207    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6208    /// while executing the actual API request.
6209    ///
6210    /// ````text
6211    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6212    /// ````
6213    ///
6214    /// Sets the *delegate* property to the given value.
6215    pub fn delegate(
6216        mut self,
6217        new_value: &'a mut dyn common::Delegate,
6218    ) -> ProjectAppDebugTokenGetCall<'a, C> {
6219        self._delegate = Some(new_value);
6220        self
6221    }
6222
6223    /// Set any additional parameter of the query string used in the request.
6224    /// It should be used to set parameters which are not yet available through their own
6225    /// setters.
6226    ///
6227    /// Please note that this method must not be used to set any of the known parameters
6228    /// which have their own setter method. If done anyway, the request will fail.
6229    ///
6230    /// # Additional Parameters
6231    ///
6232    /// * *$.xgafv* (query-string) - V1 error format.
6233    /// * *access_token* (query-string) - OAuth access token.
6234    /// * *alt* (query-string) - Data format for response.
6235    /// * *callback* (query-string) - JSONP
6236    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6237    /// * *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.
6238    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6239    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6240    /// * *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.
6241    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6242    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6243    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenGetCall<'a, C>
6244    where
6245        T: AsRef<str>,
6246    {
6247        self._additional_params
6248            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6249        self
6250    }
6251
6252    /// Identifies the authorization scope for the method you are building.
6253    ///
6254    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6255    /// [`Scope::CloudPlatform`].
6256    ///
6257    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6258    /// tokens for more than one scope.
6259    ///
6260    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6261    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6262    /// sufficient, a read-write scope will do as well.
6263    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenGetCall<'a, C>
6264    where
6265        St: AsRef<str>,
6266    {
6267        self._scopes.insert(String::from(scope.as_ref()));
6268        self
6269    }
6270    /// Identifies the authorization scope(s) for the method you are building.
6271    ///
6272    /// See [`Self::add_scope()`] for details.
6273    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenGetCall<'a, C>
6274    where
6275        I: IntoIterator<Item = St>,
6276        St: AsRef<str>,
6277    {
6278        self._scopes
6279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6280        self
6281    }
6282
6283    /// Removes all scopes, and no default scope will be used either.
6284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6285    /// for details).
6286    pub fn clear_scopes(mut self) -> ProjectAppDebugTokenGetCall<'a, C> {
6287        self._scopes.clear();
6288        self
6289    }
6290}
6291
6292/// Lists all DebugTokens for the specified app. For security reasons, the `token` field is never populated in the response.
6293///
6294/// A builder for the *apps.debugTokens.list* method supported by a *project* resource.
6295/// It is not used directly, but through a [`ProjectMethods`] instance.
6296///
6297/// # Example
6298///
6299/// Instantiate a resource method builder
6300///
6301/// ```test_harness,no_run
6302/// # extern crate hyper;
6303/// # extern crate hyper_rustls;
6304/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6305/// # async fn dox() {
6306/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6307///
6308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6309/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6310/// #     .with_native_roots()
6311/// #     .unwrap()
6312/// #     .https_only()
6313/// #     .enable_http2()
6314/// #     .build();
6315///
6316/// # let executor = hyper_util::rt::TokioExecutor::new();
6317/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6318/// #     secret,
6319/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6320/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6321/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6322/// #     ),
6323/// # ).build().await.unwrap();
6324///
6325/// # let client = hyper_util::client::legacy::Client::builder(
6326/// #     hyper_util::rt::TokioExecutor::new()
6327/// # )
6328/// # .build(
6329/// #     hyper_rustls::HttpsConnectorBuilder::new()
6330/// #         .with_native_roots()
6331/// #         .unwrap()
6332/// #         .https_or_http()
6333/// #         .enable_http2()
6334/// #         .build()
6335/// # );
6336/// # let mut hub = Firebaseappcheck::new(client, auth);
6337/// // You can configure optional parameters by calling the respective setters at will, and
6338/// // execute the final call using `doit()`.
6339/// // Values shown here are possibly random and not representative !
6340/// let result = hub.projects().apps_debug_tokens_list("parent")
6341///              .page_token("eos")
6342///              .page_size(-4)
6343///              .doit().await;
6344/// # }
6345/// ```
6346pub struct ProjectAppDebugTokenListCall<'a, C>
6347where
6348    C: 'a,
6349{
6350    hub: &'a Firebaseappcheck<C>,
6351    _parent: String,
6352    _page_token: Option<String>,
6353    _page_size: Option<i32>,
6354    _delegate: Option<&'a mut dyn common::Delegate>,
6355    _additional_params: HashMap<String, String>,
6356    _scopes: BTreeSet<String>,
6357}
6358
6359impl<'a, C> common::CallBuilder for ProjectAppDebugTokenListCall<'a, C> {}
6360
6361impl<'a, C> ProjectAppDebugTokenListCall<'a, C>
6362where
6363    C: common::Connector,
6364{
6365    /// Perform the operation you have build so far.
6366    pub async fn doit(
6367        mut self,
6368    ) -> common::Result<(
6369        common::Response,
6370        GoogleFirebaseAppcheckV1betaListDebugTokensResponse,
6371    )> {
6372        use std::borrow::Cow;
6373        use std::io::{Read, Seek};
6374
6375        use common::{url::Params, ToParts};
6376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6377
6378        let mut dd = common::DefaultDelegate;
6379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6380        dlg.begin(common::MethodInfo {
6381            id: "firebaseappcheck.projects.apps.debugTokens.list",
6382            http_method: hyper::Method::GET,
6383        });
6384
6385        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6386            if self._additional_params.contains_key(field) {
6387                dlg.finished(false);
6388                return Err(common::Error::FieldClash(field));
6389            }
6390        }
6391
6392        let mut params = Params::with_capacity(5 + self._additional_params.len());
6393        params.push("parent", self._parent);
6394        if let Some(value) = self._page_token.as_ref() {
6395            params.push("pageToken", value);
6396        }
6397        if let Some(value) = self._page_size.as_ref() {
6398            params.push("pageSize", value.to_string());
6399        }
6400
6401        params.extend(self._additional_params.iter());
6402
6403        params.push("alt", "json");
6404        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/debugTokens";
6405        if self._scopes.is_empty() {
6406            self._scopes
6407                .insert(Scope::CloudPlatform.as_ref().to_string());
6408        }
6409
6410        #[allow(clippy::single_element_loop)]
6411        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6412            url = params.uri_replacement(url, param_name, find_this, true);
6413        }
6414        {
6415            let to_remove = ["parent"];
6416            params.remove_params(&to_remove);
6417        }
6418
6419        let url = params.parse_with_url(&url);
6420
6421        loop {
6422            let token = match self
6423                .hub
6424                .auth
6425                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6426                .await
6427            {
6428                Ok(token) => token,
6429                Err(e) => match dlg.token(e) {
6430                    Ok(token) => token,
6431                    Err(e) => {
6432                        dlg.finished(false);
6433                        return Err(common::Error::MissingToken(e));
6434                    }
6435                },
6436            };
6437            let mut req_result = {
6438                let client = &self.hub.client;
6439                dlg.pre_request();
6440                let mut req_builder = hyper::Request::builder()
6441                    .method(hyper::Method::GET)
6442                    .uri(url.as_str())
6443                    .header(USER_AGENT, self.hub._user_agent.clone());
6444
6445                if let Some(token) = token.as_ref() {
6446                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6447                }
6448
6449                let request = req_builder
6450                    .header(CONTENT_LENGTH, 0_u64)
6451                    .body(common::to_body::<String>(None));
6452
6453                client.request(request.unwrap()).await
6454            };
6455
6456            match req_result {
6457                Err(err) => {
6458                    if let common::Retry::After(d) = dlg.http_error(&err) {
6459                        sleep(d).await;
6460                        continue;
6461                    }
6462                    dlg.finished(false);
6463                    return Err(common::Error::HttpError(err));
6464                }
6465                Ok(res) => {
6466                    let (mut parts, body) = res.into_parts();
6467                    let mut body = common::Body::new(body);
6468                    if !parts.status.is_success() {
6469                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6470                        let error = serde_json::from_str(&common::to_string(&bytes));
6471                        let response = common::to_response(parts, bytes.into());
6472
6473                        if let common::Retry::After(d) =
6474                            dlg.http_failure(&response, error.as_ref().ok())
6475                        {
6476                            sleep(d).await;
6477                            continue;
6478                        }
6479
6480                        dlg.finished(false);
6481
6482                        return Err(match error {
6483                            Ok(value) => common::Error::BadRequest(value),
6484                            _ => common::Error::Failure(response),
6485                        });
6486                    }
6487                    let response = {
6488                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6489                        let encoded = common::to_string(&bytes);
6490                        match serde_json::from_str(&encoded) {
6491                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6492                            Err(error) => {
6493                                dlg.response_json_decode_error(&encoded, &error);
6494                                return Err(common::Error::JsonDecodeError(
6495                                    encoded.to_string(),
6496                                    error,
6497                                ));
6498                            }
6499                        }
6500                    };
6501
6502                    dlg.finished(true);
6503                    return Ok(response);
6504                }
6505            }
6506        }
6507    }
6508
6509    /// Required. The relative resource name of the parent app for which to list each associated DebugToken, in the format: ``` projects/{project_number}/apps/{app_id} ```
6510    ///
6511    /// Sets the *parent* path property to the given value.
6512    ///
6513    /// Even though the property as already been set when instantiating this call,
6514    /// we provide this method for API completeness.
6515    pub fn parent(mut self, new_value: &str) -> ProjectAppDebugTokenListCall<'a, C> {
6516        self._parent = new_value.to_string();
6517        self
6518    }
6519    /// Token returned from a previous call to ListDebugTokens indicating where in the set of DebugTokens to resume listing. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListDebugTokens must match the call that provided the page token; if they do not match, the result is undefined.
6520    ///
6521    /// Sets the *page token* query property to the given value.
6522    pub fn page_token(mut self, new_value: &str) -> ProjectAppDebugTokenListCall<'a, C> {
6523        self._page_token = Some(new_value.to_string());
6524        self
6525    }
6526    /// The maximum number of DebugTokens to return in the response. Note that an app can have at most 20 debug tokens. The server may return fewer than this at its own discretion. If no value is specified (or too large a value is specified), the server will impose its own limit.
6527    ///
6528    /// Sets the *page size* query property to the given value.
6529    pub fn page_size(mut self, new_value: i32) -> ProjectAppDebugTokenListCall<'a, C> {
6530        self._page_size = Some(new_value);
6531        self
6532    }
6533    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6534    /// while executing the actual API request.
6535    ///
6536    /// ````text
6537    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6538    /// ````
6539    ///
6540    /// Sets the *delegate* property to the given value.
6541    pub fn delegate(
6542        mut self,
6543        new_value: &'a mut dyn common::Delegate,
6544    ) -> ProjectAppDebugTokenListCall<'a, C> {
6545        self._delegate = Some(new_value);
6546        self
6547    }
6548
6549    /// Set any additional parameter of the query string used in the request.
6550    /// It should be used to set parameters which are not yet available through their own
6551    /// setters.
6552    ///
6553    /// Please note that this method must not be used to set any of the known parameters
6554    /// which have their own setter method. If done anyway, the request will fail.
6555    ///
6556    /// # Additional Parameters
6557    ///
6558    /// * *$.xgafv* (query-string) - V1 error format.
6559    /// * *access_token* (query-string) - OAuth access token.
6560    /// * *alt* (query-string) - Data format for response.
6561    /// * *callback* (query-string) - JSONP
6562    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6563    /// * *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.
6564    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6565    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6566    /// * *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.
6567    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6568    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6569    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenListCall<'a, C>
6570    where
6571        T: AsRef<str>,
6572    {
6573        self._additional_params
6574            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6575        self
6576    }
6577
6578    /// Identifies the authorization scope for the method you are building.
6579    ///
6580    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6581    /// [`Scope::CloudPlatform`].
6582    ///
6583    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6584    /// tokens for more than one scope.
6585    ///
6586    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6587    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6588    /// sufficient, a read-write scope will do as well.
6589    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenListCall<'a, C>
6590    where
6591        St: AsRef<str>,
6592    {
6593        self._scopes.insert(String::from(scope.as_ref()));
6594        self
6595    }
6596    /// Identifies the authorization scope(s) for the method you are building.
6597    ///
6598    /// See [`Self::add_scope()`] for details.
6599    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenListCall<'a, C>
6600    where
6601        I: IntoIterator<Item = St>,
6602        St: AsRef<str>,
6603    {
6604        self._scopes
6605            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6606        self
6607    }
6608
6609    /// Removes all scopes, and no default scope will be used either.
6610    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6611    /// for details).
6612    pub fn clear_scopes(mut self) -> ProjectAppDebugTokenListCall<'a, C> {
6613        self._scopes.clear();
6614        self
6615    }
6616}
6617
6618/// Updates the specified DebugToken. For security reasons, the `token` field cannot be updated, nor will it be populated in the response, but you can revoke the debug token using DeleteDebugToken.
6619///
6620/// A builder for the *apps.debugTokens.patch* method supported by a *project* resource.
6621/// It is not used directly, but through a [`ProjectMethods`] instance.
6622///
6623/// # Example
6624///
6625/// Instantiate a resource method builder
6626///
6627/// ```test_harness,no_run
6628/// # extern crate hyper;
6629/// # extern crate hyper_rustls;
6630/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6631/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDebugToken;
6632/// # async fn dox() {
6633/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6634///
6635/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6636/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6637/// #     .with_native_roots()
6638/// #     .unwrap()
6639/// #     .https_only()
6640/// #     .enable_http2()
6641/// #     .build();
6642///
6643/// # let executor = hyper_util::rt::TokioExecutor::new();
6644/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6645/// #     secret,
6646/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6647/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6648/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6649/// #     ),
6650/// # ).build().await.unwrap();
6651///
6652/// # let client = hyper_util::client::legacy::Client::builder(
6653/// #     hyper_util::rt::TokioExecutor::new()
6654/// # )
6655/// # .build(
6656/// #     hyper_rustls::HttpsConnectorBuilder::new()
6657/// #         .with_native_roots()
6658/// #         .unwrap()
6659/// #         .https_or_http()
6660/// #         .enable_http2()
6661/// #         .build()
6662/// # );
6663/// # let mut hub = Firebaseappcheck::new(client, auth);
6664/// // As the method needs a request, you would usually fill it with the desired information
6665/// // into the respective structure. Some of the parts shown here might not be applicable !
6666/// // Values shown here are possibly random and not representative !
6667/// let mut req = GoogleFirebaseAppcheckV1betaDebugToken::default();
6668///
6669/// // You can configure optional parameters by calling the respective setters at will, and
6670/// // execute the final call using `doit()`.
6671/// // Values shown here are possibly random and not representative !
6672/// let result = hub.projects().apps_debug_tokens_patch(req, "name")
6673///              .update_mask(FieldMask::new::<&str>(&[]))
6674///              .doit().await;
6675/// # }
6676/// ```
6677pub struct ProjectAppDebugTokenPatchCall<'a, C>
6678where
6679    C: 'a,
6680{
6681    hub: &'a Firebaseappcheck<C>,
6682    _request: GoogleFirebaseAppcheckV1betaDebugToken,
6683    _name: String,
6684    _update_mask: Option<common::FieldMask>,
6685    _delegate: Option<&'a mut dyn common::Delegate>,
6686    _additional_params: HashMap<String, String>,
6687    _scopes: BTreeSet<String>,
6688}
6689
6690impl<'a, C> common::CallBuilder for ProjectAppDebugTokenPatchCall<'a, C> {}
6691
6692impl<'a, C> ProjectAppDebugTokenPatchCall<'a, C>
6693where
6694    C: common::Connector,
6695{
6696    /// Perform the operation you have build so far.
6697    pub async fn doit(
6698        mut self,
6699    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
6700        use std::borrow::Cow;
6701        use std::io::{Read, Seek};
6702
6703        use common::{url::Params, ToParts};
6704        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6705
6706        let mut dd = common::DefaultDelegate;
6707        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6708        dlg.begin(common::MethodInfo {
6709            id: "firebaseappcheck.projects.apps.debugTokens.patch",
6710            http_method: hyper::Method::PATCH,
6711        });
6712
6713        for &field in ["alt", "name", "updateMask"].iter() {
6714            if self._additional_params.contains_key(field) {
6715                dlg.finished(false);
6716                return Err(common::Error::FieldClash(field));
6717            }
6718        }
6719
6720        let mut params = Params::with_capacity(5 + self._additional_params.len());
6721        params.push("name", self._name);
6722        if let Some(value) = self._update_mask.as_ref() {
6723            params.push("updateMask", value.to_string());
6724        }
6725
6726        params.extend(self._additional_params.iter());
6727
6728        params.push("alt", "json");
6729        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
6730        if self._scopes.is_empty() {
6731            self._scopes
6732                .insert(Scope::CloudPlatform.as_ref().to_string());
6733        }
6734
6735        #[allow(clippy::single_element_loop)]
6736        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6737            url = params.uri_replacement(url, param_name, find_this, true);
6738        }
6739        {
6740            let to_remove = ["name"];
6741            params.remove_params(&to_remove);
6742        }
6743
6744        let url = params.parse_with_url(&url);
6745
6746        let mut json_mime_type = mime::APPLICATION_JSON;
6747        let mut request_value_reader = {
6748            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6749            common::remove_json_null_values(&mut value);
6750            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6751            serde_json::to_writer(&mut dst, &value).unwrap();
6752            dst
6753        };
6754        let request_size = request_value_reader
6755            .seek(std::io::SeekFrom::End(0))
6756            .unwrap();
6757        request_value_reader
6758            .seek(std::io::SeekFrom::Start(0))
6759            .unwrap();
6760
6761        loop {
6762            let token = match self
6763                .hub
6764                .auth
6765                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6766                .await
6767            {
6768                Ok(token) => token,
6769                Err(e) => match dlg.token(e) {
6770                    Ok(token) => token,
6771                    Err(e) => {
6772                        dlg.finished(false);
6773                        return Err(common::Error::MissingToken(e));
6774                    }
6775                },
6776            };
6777            request_value_reader
6778                .seek(std::io::SeekFrom::Start(0))
6779                .unwrap();
6780            let mut req_result = {
6781                let client = &self.hub.client;
6782                dlg.pre_request();
6783                let mut req_builder = hyper::Request::builder()
6784                    .method(hyper::Method::PATCH)
6785                    .uri(url.as_str())
6786                    .header(USER_AGENT, self.hub._user_agent.clone());
6787
6788                if let Some(token) = token.as_ref() {
6789                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6790                }
6791
6792                let request = req_builder
6793                    .header(CONTENT_TYPE, json_mime_type.to_string())
6794                    .header(CONTENT_LENGTH, request_size as u64)
6795                    .body(common::to_body(
6796                        request_value_reader.get_ref().clone().into(),
6797                    ));
6798
6799                client.request(request.unwrap()).await
6800            };
6801
6802            match req_result {
6803                Err(err) => {
6804                    if let common::Retry::After(d) = dlg.http_error(&err) {
6805                        sleep(d).await;
6806                        continue;
6807                    }
6808                    dlg.finished(false);
6809                    return Err(common::Error::HttpError(err));
6810                }
6811                Ok(res) => {
6812                    let (mut parts, body) = res.into_parts();
6813                    let mut body = common::Body::new(body);
6814                    if !parts.status.is_success() {
6815                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6816                        let error = serde_json::from_str(&common::to_string(&bytes));
6817                        let response = common::to_response(parts, bytes.into());
6818
6819                        if let common::Retry::After(d) =
6820                            dlg.http_failure(&response, error.as_ref().ok())
6821                        {
6822                            sleep(d).await;
6823                            continue;
6824                        }
6825
6826                        dlg.finished(false);
6827
6828                        return Err(match error {
6829                            Ok(value) => common::Error::BadRequest(value),
6830                            _ => common::Error::Failure(response),
6831                        });
6832                    }
6833                    let response = {
6834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6835                        let encoded = common::to_string(&bytes);
6836                        match serde_json::from_str(&encoded) {
6837                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6838                            Err(error) => {
6839                                dlg.response_json_decode_error(&encoded, &error);
6840                                return Err(common::Error::JsonDecodeError(
6841                                    encoded.to_string(),
6842                                    error,
6843                                ));
6844                            }
6845                        }
6846                    };
6847
6848                    dlg.finished(true);
6849                    return Ok(response);
6850                }
6851            }
6852        }
6853    }
6854
6855    ///
6856    /// Sets the *request* property to the given value.
6857    ///
6858    /// Even though the property as already been set when instantiating this call,
6859    /// we provide this method for API completeness.
6860    pub fn request(
6861        mut self,
6862        new_value: GoogleFirebaseAppcheckV1betaDebugToken,
6863    ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6864        self._request = new_value;
6865        self
6866    }
6867    /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
6868    ///
6869    /// Sets the *name* path property to the given value.
6870    ///
6871    /// Even though the property as already been set when instantiating this call,
6872    /// we provide this method for API completeness.
6873    pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenPatchCall<'a, C> {
6874        self._name = new_value.to_string();
6875        self
6876    }
6877    /// Required. A comma-separated list of names of fields in the DebugToken to update. Example: `display_name`.
6878    ///
6879    /// Sets the *update mask* query property to the given value.
6880    pub fn update_mask(
6881        mut self,
6882        new_value: common::FieldMask,
6883    ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6884        self._update_mask = Some(new_value);
6885        self
6886    }
6887    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6888    /// while executing the actual API request.
6889    ///
6890    /// ````text
6891    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6892    /// ````
6893    ///
6894    /// Sets the *delegate* property to the given value.
6895    pub fn delegate(
6896        mut self,
6897        new_value: &'a mut dyn common::Delegate,
6898    ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6899        self._delegate = Some(new_value);
6900        self
6901    }
6902
6903    /// Set any additional parameter of the query string used in the request.
6904    /// It should be used to set parameters which are not yet available through their own
6905    /// setters.
6906    ///
6907    /// Please note that this method must not be used to set any of the known parameters
6908    /// which have their own setter method. If done anyway, the request will fail.
6909    ///
6910    /// # Additional Parameters
6911    ///
6912    /// * *$.xgafv* (query-string) - V1 error format.
6913    /// * *access_token* (query-string) - OAuth access token.
6914    /// * *alt* (query-string) - Data format for response.
6915    /// * *callback* (query-string) - JSONP
6916    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6917    /// * *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.
6918    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6919    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6920    /// * *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.
6921    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6922    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6923    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenPatchCall<'a, C>
6924    where
6925        T: AsRef<str>,
6926    {
6927        self._additional_params
6928            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6929        self
6930    }
6931
6932    /// Identifies the authorization scope for the method you are building.
6933    ///
6934    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6935    /// [`Scope::CloudPlatform`].
6936    ///
6937    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6938    /// tokens for more than one scope.
6939    ///
6940    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6941    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6942    /// sufficient, a read-write scope will do as well.
6943    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenPatchCall<'a, C>
6944    where
6945        St: AsRef<str>,
6946    {
6947        self._scopes.insert(String::from(scope.as_ref()));
6948        self
6949    }
6950    /// Identifies the authorization scope(s) for the method you are building.
6951    ///
6952    /// See [`Self::add_scope()`] for details.
6953    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenPatchCall<'a, C>
6954    where
6955        I: IntoIterator<Item = St>,
6956        St: AsRef<str>,
6957    {
6958        self._scopes
6959            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6960        self
6961    }
6962
6963    /// Removes all scopes, and no default scope will be used either.
6964    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6965    /// for details).
6966    pub fn clear_scopes(mut self) -> ProjectAppDebugTokenPatchCall<'a, C> {
6967        self._scopes.clear();
6968        self
6969    }
6970}
6971
6972/// Atomically gets the DeviceCheckConfigs for the specified list of apps. For security reasons, the `private_key` field is never populated in the response.
6973///
6974/// A builder for the *apps.deviceCheckConfig.batchGet* method supported by a *project* resource.
6975/// It is not used directly, but through a [`ProjectMethods`] instance.
6976///
6977/// # Example
6978///
6979/// Instantiate a resource method builder
6980///
6981/// ```test_harness,no_run
6982/// # extern crate hyper;
6983/// # extern crate hyper_rustls;
6984/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6985/// # async fn dox() {
6986/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6987///
6988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6990/// #     .with_native_roots()
6991/// #     .unwrap()
6992/// #     .https_only()
6993/// #     .enable_http2()
6994/// #     .build();
6995///
6996/// # let executor = hyper_util::rt::TokioExecutor::new();
6997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6998/// #     secret,
6999/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7000/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7001/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7002/// #     ),
7003/// # ).build().await.unwrap();
7004///
7005/// # let client = hyper_util::client::legacy::Client::builder(
7006/// #     hyper_util::rt::TokioExecutor::new()
7007/// # )
7008/// # .build(
7009/// #     hyper_rustls::HttpsConnectorBuilder::new()
7010/// #         .with_native_roots()
7011/// #         .unwrap()
7012/// #         .https_or_http()
7013/// #         .enable_http2()
7014/// #         .build()
7015/// # );
7016/// # let mut hub = Firebaseappcheck::new(client, auth);
7017/// // You can configure optional parameters by calling the respective setters at will, and
7018/// // execute the final call using `doit()`.
7019/// // Values shown here are possibly random and not representative !
7020/// let result = hub.projects().apps_device_check_config_batch_get("parent")
7021///              .add_names("invidunt")
7022///              .doit().await;
7023/// # }
7024/// ```
7025pub struct ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
7026where
7027    C: 'a,
7028{
7029    hub: &'a Firebaseappcheck<C>,
7030    _parent: String,
7031    _names: Vec<String>,
7032    _delegate: Option<&'a mut dyn common::Delegate>,
7033    _additional_params: HashMap<String, String>,
7034    _scopes: BTreeSet<String>,
7035}
7036
7037impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {}
7038
7039impl<'a, C> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
7040where
7041    C: common::Connector,
7042{
7043    /// Perform the operation you have build so far.
7044    pub async fn doit(
7045        mut self,
7046    ) -> common::Result<(
7047        common::Response,
7048        GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse,
7049    )> {
7050        use std::borrow::Cow;
7051        use std::io::{Read, Seek};
7052
7053        use common::{url::Params, ToParts};
7054        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7055
7056        let mut dd = common::DefaultDelegate;
7057        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7058        dlg.begin(common::MethodInfo {
7059            id: "firebaseappcheck.projects.apps.deviceCheckConfig.batchGet",
7060            http_method: hyper::Method::GET,
7061        });
7062
7063        for &field in ["alt", "parent", "names"].iter() {
7064            if self._additional_params.contains_key(field) {
7065                dlg.finished(false);
7066                return Err(common::Error::FieldClash(field));
7067            }
7068        }
7069
7070        let mut params = Params::with_capacity(4 + self._additional_params.len());
7071        params.push("parent", self._parent);
7072        if !self._names.is_empty() {
7073            for f in self._names.iter() {
7074                params.push("names", f);
7075            }
7076        }
7077
7078        params.extend(self._additional_params.iter());
7079
7080        params.push("alt", "json");
7081        let mut url =
7082            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/deviceCheckConfig:batchGet";
7083        if self._scopes.is_empty() {
7084            self._scopes
7085                .insert(Scope::CloudPlatform.as_ref().to_string());
7086        }
7087
7088        #[allow(clippy::single_element_loop)]
7089        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7090            url = params.uri_replacement(url, param_name, find_this, true);
7091        }
7092        {
7093            let to_remove = ["parent"];
7094            params.remove_params(&to_remove);
7095        }
7096
7097        let url = params.parse_with_url(&url);
7098
7099        loop {
7100            let token = match self
7101                .hub
7102                .auth
7103                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7104                .await
7105            {
7106                Ok(token) => token,
7107                Err(e) => match dlg.token(e) {
7108                    Ok(token) => token,
7109                    Err(e) => {
7110                        dlg.finished(false);
7111                        return Err(common::Error::MissingToken(e));
7112                    }
7113                },
7114            };
7115            let mut req_result = {
7116                let client = &self.hub.client;
7117                dlg.pre_request();
7118                let mut req_builder = hyper::Request::builder()
7119                    .method(hyper::Method::GET)
7120                    .uri(url.as_str())
7121                    .header(USER_AGENT, self.hub._user_agent.clone());
7122
7123                if let Some(token) = token.as_ref() {
7124                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7125                }
7126
7127                let request = req_builder
7128                    .header(CONTENT_LENGTH, 0_u64)
7129                    .body(common::to_body::<String>(None));
7130
7131                client.request(request.unwrap()).await
7132            };
7133
7134            match req_result {
7135                Err(err) => {
7136                    if let common::Retry::After(d) = dlg.http_error(&err) {
7137                        sleep(d).await;
7138                        continue;
7139                    }
7140                    dlg.finished(false);
7141                    return Err(common::Error::HttpError(err));
7142                }
7143                Ok(res) => {
7144                    let (mut parts, body) = res.into_parts();
7145                    let mut body = common::Body::new(body);
7146                    if !parts.status.is_success() {
7147                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7148                        let error = serde_json::from_str(&common::to_string(&bytes));
7149                        let response = common::to_response(parts, bytes.into());
7150
7151                        if let common::Retry::After(d) =
7152                            dlg.http_failure(&response, error.as_ref().ok())
7153                        {
7154                            sleep(d).await;
7155                            continue;
7156                        }
7157
7158                        dlg.finished(false);
7159
7160                        return Err(match error {
7161                            Ok(value) => common::Error::BadRequest(value),
7162                            _ => common::Error::Failure(response),
7163                        });
7164                    }
7165                    let response = {
7166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7167                        let encoded = common::to_string(&bytes);
7168                        match serde_json::from_str(&encoded) {
7169                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7170                            Err(error) => {
7171                                dlg.response_json_decode_error(&encoded, &error);
7172                                return Err(common::Error::JsonDecodeError(
7173                                    encoded.to_string(),
7174                                    error,
7175                                ));
7176                            }
7177                        }
7178                    };
7179
7180                    dlg.finished(true);
7181                    return Ok(response);
7182                }
7183            }
7184        }
7185    }
7186
7187    /// Required. The parent project name shared by all DeviceCheckConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
7188    ///
7189    /// Sets the *parent* path property to the given value.
7190    ///
7191    /// Even though the property as already been set when instantiating this call,
7192    /// we provide this method for API completeness.
7193    pub fn parent(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
7194        self._parent = new_value.to_string();
7195        self
7196    }
7197    /// Required. The relative resource names of the DeviceCheckConfigs to retrieve, in the format ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ``` A maximum of 100 objects can be retrieved in a batch.
7198    ///
7199    /// Append the given value to the *names* query property.
7200    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7201    pub fn add_names(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
7202        self._names.push(new_value.to_string());
7203        self
7204    }
7205    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7206    /// while executing the actual API request.
7207    ///
7208    /// ````text
7209    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7210    /// ````
7211    ///
7212    /// Sets the *delegate* property to the given value.
7213    pub fn delegate(
7214        mut self,
7215        new_value: &'a mut dyn common::Delegate,
7216    ) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
7217        self._delegate = Some(new_value);
7218        self
7219    }
7220
7221    /// Set any additional parameter of the query string used in the request.
7222    /// It should be used to set parameters which are not yet available through their own
7223    /// setters.
7224    ///
7225    /// Please note that this method must not be used to set any of the known parameters
7226    /// which have their own setter method. If done anyway, the request will fail.
7227    ///
7228    /// # Additional Parameters
7229    ///
7230    /// * *$.xgafv* (query-string) - V1 error format.
7231    /// * *access_token* (query-string) - OAuth access token.
7232    /// * *alt* (query-string) - Data format for response.
7233    /// * *callback* (query-string) - JSONP
7234    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7235    /// * *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.
7236    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7237    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7238    /// * *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.
7239    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7240    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7241    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
7242    where
7243        T: AsRef<str>,
7244    {
7245        self._additional_params
7246            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7247        self
7248    }
7249
7250    /// Identifies the authorization scope for the method you are building.
7251    ///
7252    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7253    /// [`Scope::CloudPlatform`].
7254    ///
7255    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7256    /// tokens for more than one scope.
7257    ///
7258    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7259    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7260    /// sufficient, a read-write scope will do as well.
7261    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
7262    where
7263        St: AsRef<str>,
7264    {
7265        self._scopes.insert(String::from(scope.as_ref()));
7266        self
7267    }
7268    /// Identifies the authorization scope(s) for the method you are building.
7269    ///
7270    /// See [`Self::add_scope()`] for details.
7271    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
7272    where
7273        I: IntoIterator<Item = St>,
7274        St: AsRef<str>,
7275    {
7276        self._scopes
7277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7278        self
7279    }
7280
7281    /// Removes all scopes, and no default scope will be used either.
7282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7283    /// for details).
7284    pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
7285        self._scopes.clear();
7286        self
7287    }
7288}
7289
7290/// Gets the DeviceCheckConfig for the specified app. For security reasons, the `private_key` field is never populated in the response.
7291///
7292/// A builder for the *apps.deviceCheckConfig.get* method supported by a *project* resource.
7293/// It is not used directly, but through a [`ProjectMethods`] instance.
7294///
7295/// # Example
7296///
7297/// Instantiate a resource method builder
7298///
7299/// ```test_harness,no_run
7300/// # extern crate hyper;
7301/// # extern crate hyper_rustls;
7302/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7303/// # async fn dox() {
7304/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7305///
7306/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7307/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7308/// #     .with_native_roots()
7309/// #     .unwrap()
7310/// #     .https_only()
7311/// #     .enable_http2()
7312/// #     .build();
7313///
7314/// # let executor = hyper_util::rt::TokioExecutor::new();
7315/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7316/// #     secret,
7317/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7318/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7319/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7320/// #     ),
7321/// # ).build().await.unwrap();
7322///
7323/// # let client = hyper_util::client::legacy::Client::builder(
7324/// #     hyper_util::rt::TokioExecutor::new()
7325/// # )
7326/// # .build(
7327/// #     hyper_rustls::HttpsConnectorBuilder::new()
7328/// #         .with_native_roots()
7329/// #         .unwrap()
7330/// #         .https_or_http()
7331/// #         .enable_http2()
7332/// #         .build()
7333/// # );
7334/// # let mut hub = Firebaseappcheck::new(client, auth);
7335/// // You can configure optional parameters by calling the respective setters at will, and
7336/// // execute the final call using `doit()`.
7337/// // Values shown here are possibly random and not representative !
7338/// let result = hub.projects().apps_device_check_config_get("name")
7339///              .doit().await;
7340/// # }
7341/// ```
7342pub struct ProjectAppDeviceCheckConfigGetCall<'a, C>
7343where
7344    C: 'a,
7345{
7346    hub: &'a Firebaseappcheck<C>,
7347    _name: String,
7348    _delegate: Option<&'a mut dyn common::Delegate>,
7349    _additional_params: HashMap<String, String>,
7350    _scopes: BTreeSet<String>,
7351}
7352
7353impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigGetCall<'a, C> {}
7354
7355impl<'a, C> ProjectAppDeviceCheckConfigGetCall<'a, C>
7356where
7357    C: common::Connector,
7358{
7359    /// Perform the operation you have build so far.
7360    pub async fn doit(
7361        mut self,
7362    ) -> common::Result<(
7363        common::Response,
7364        GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7365    )> {
7366        use std::borrow::Cow;
7367        use std::io::{Read, Seek};
7368
7369        use common::{url::Params, ToParts};
7370        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7371
7372        let mut dd = common::DefaultDelegate;
7373        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7374        dlg.begin(common::MethodInfo {
7375            id: "firebaseappcheck.projects.apps.deviceCheckConfig.get",
7376            http_method: hyper::Method::GET,
7377        });
7378
7379        for &field in ["alt", "name"].iter() {
7380            if self._additional_params.contains_key(field) {
7381                dlg.finished(false);
7382                return Err(common::Error::FieldClash(field));
7383            }
7384        }
7385
7386        let mut params = Params::with_capacity(3 + self._additional_params.len());
7387        params.push("name", self._name);
7388
7389        params.extend(self._additional_params.iter());
7390
7391        params.push("alt", "json");
7392        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7393        if self._scopes.is_empty() {
7394            self._scopes
7395                .insert(Scope::CloudPlatform.as_ref().to_string());
7396        }
7397
7398        #[allow(clippy::single_element_loop)]
7399        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7400            url = params.uri_replacement(url, param_name, find_this, true);
7401        }
7402        {
7403            let to_remove = ["name"];
7404            params.remove_params(&to_remove);
7405        }
7406
7407        let url = params.parse_with_url(&url);
7408
7409        loop {
7410            let token = match self
7411                .hub
7412                .auth
7413                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7414                .await
7415            {
7416                Ok(token) => token,
7417                Err(e) => match dlg.token(e) {
7418                    Ok(token) => token,
7419                    Err(e) => {
7420                        dlg.finished(false);
7421                        return Err(common::Error::MissingToken(e));
7422                    }
7423                },
7424            };
7425            let mut req_result = {
7426                let client = &self.hub.client;
7427                dlg.pre_request();
7428                let mut req_builder = hyper::Request::builder()
7429                    .method(hyper::Method::GET)
7430                    .uri(url.as_str())
7431                    .header(USER_AGENT, self.hub._user_agent.clone());
7432
7433                if let Some(token) = token.as_ref() {
7434                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7435                }
7436
7437                let request = req_builder
7438                    .header(CONTENT_LENGTH, 0_u64)
7439                    .body(common::to_body::<String>(None));
7440
7441                client.request(request.unwrap()).await
7442            };
7443
7444            match req_result {
7445                Err(err) => {
7446                    if let common::Retry::After(d) = dlg.http_error(&err) {
7447                        sleep(d).await;
7448                        continue;
7449                    }
7450                    dlg.finished(false);
7451                    return Err(common::Error::HttpError(err));
7452                }
7453                Ok(res) => {
7454                    let (mut parts, body) = res.into_parts();
7455                    let mut body = common::Body::new(body);
7456                    if !parts.status.is_success() {
7457                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7458                        let error = serde_json::from_str(&common::to_string(&bytes));
7459                        let response = common::to_response(parts, bytes.into());
7460
7461                        if let common::Retry::After(d) =
7462                            dlg.http_failure(&response, error.as_ref().ok())
7463                        {
7464                            sleep(d).await;
7465                            continue;
7466                        }
7467
7468                        dlg.finished(false);
7469
7470                        return Err(match error {
7471                            Ok(value) => common::Error::BadRequest(value),
7472                            _ => common::Error::Failure(response),
7473                        });
7474                    }
7475                    let response = {
7476                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7477                        let encoded = common::to_string(&bytes);
7478                        match serde_json::from_str(&encoded) {
7479                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7480                            Err(error) => {
7481                                dlg.response_json_decode_error(&encoded, &error);
7482                                return Err(common::Error::JsonDecodeError(
7483                                    encoded.to_string(),
7484                                    error,
7485                                ));
7486                            }
7487                        }
7488                    };
7489
7490                    dlg.finished(true);
7491                    return Ok(response);
7492                }
7493            }
7494        }
7495    }
7496
7497    /// Required. The relative resource name of the DeviceCheckConfig, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
7498    ///
7499    /// Sets the *name* path property to the given value.
7500    ///
7501    /// Even though the property as already been set when instantiating this call,
7502    /// we provide this method for API completeness.
7503    pub fn name(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7504        self._name = new_value.to_string();
7505        self
7506    }
7507    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7508    /// while executing the actual API request.
7509    ///
7510    /// ````text
7511    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7512    /// ````
7513    ///
7514    /// Sets the *delegate* property to the given value.
7515    pub fn delegate(
7516        mut self,
7517        new_value: &'a mut dyn common::Delegate,
7518    ) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7519        self._delegate = Some(new_value);
7520        self
7521    }
7522
7523    /// Set any additional parameter of the query string used in the request.
7524    /// It should be used to set parameters which are not yet available through their own
7525    /// setters.
7526    ///
7527    /// Please note that this method must not be used to set any of the known parameters
7528    /// which have their own setter method. If done anyway, the request will fail.
7529    ///
7530    /// # Additional Parameters
7531    ///
7532    /// * *$.xgafv* (query-string) - V1 error format.
7533    /// * *access_token* (query-string) - OAuth access token.
7534    /// * *alt* (query-string) - Data format for response.
7535    /// * *callback* (query-string) - JSONP
7536    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7537    /// * *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.
7538    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7539    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7540    /// * *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.
7541    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7542    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7543    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7544    where
7545        T: AsRef<str>,
7546    {
7547        self._additional_params
7548            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7549        self
7550    }
7551
7552    /// Identifies the authorization scope for the method you are building.
7553    ///
7554    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7555    /// [`Scope::CloudPlatform`].
7556    ///
7557    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7558    /// tokens for more than one scope.
7559    ///
7560    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7561    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7562    /// sufficient, a read-write scope will do as well.
7563    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7564    where
7565        St: AsRef<str>,
7566    {
7567        self._scopes.insert(String::from(scope.as_ref()));
7568        self
7569    }
7570    /// Identifies the authorization scope(s) for the method you are building.
7571    ///
7572    /// See [`Self::add_scope()`] for details.
7573    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7574    where
7575        I: IntoIterator<Item = St>,
7576        St: AsRef<str>,
7577    {
7578        self._scopes
7579            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7580        self
7581    }
7582
7583    /// Removes all scopes, and no default scope will be used either.
7584    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7585    /// for details).
7586    pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7587        self._scopes.clear();
7588        self
7589    }
7590}
7591
7592/// Updates the DeviceCheckConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange DeviceCheck tokens for App Check tokens. For security reasons, the `private_key` field is never populated in the response.
7593///
7594/// A builder for the *apps.deviceCheckConfig.patch* method supported by a *project* resource.
7595/// It is not used directly, but through a [`ProjectMethods`] instance.
7596///
7597/// # Example
7598///
7599/// Instantiate a resource method builder
7600///
7601/// ```test_harness,no_run
7602/// # extern crate hyper;
7603/// # extern crate hyper_rustls;
7604/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7605/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDeviceCheckConfig;
7606/// # async fn dox() {
7607/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7608///
7609/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7610/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7611/// #     .with_native_roots()
7612/// #     .unwrap()
7613/// #     .https_only()
7614/// #     .enable_http2()
7615/// #     .build();
7616///
7617/// # let executor = hyper_util::rt::TokioExecutor::new();
7618/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7619/// #     secret,
7620/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7621/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7622/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7623/// #     ),
7624/// # ).build().await.unwrap();
7625///
7626/// # let client = hyper_util::client::legacy::Client::builder(
7627/// #     hyper_util::rt::TokioExecutor::new()
7628/// # )
7629/// # .build(
7630/// #     hyper_rustls::HttpsConnectorBuilder::new()
7631/// #         .with_native_roots()
7632/// #         .unwrap()
7633/// #         .https_or_http()
7634/// #         .enable_http2()
7635/// #         .build()
7636/// # );
7637/// # let mut hub = Firebaseappcheck::new(client, auth);
7638/// // As the method needs a request, you would usually fill it with the desired information
7639/// // into the respective structure. Some of the parts shown here might not be applicable !
7640/// // Values shown here are possibly random and not representative !
7641/// let mut req = GoogleFirebaseAppcheckV1betaDeviceCheckConfig::default();
7642///
7643/// // You can configure optional parameters by calling the respective setters at will, and
7644/// // execute the final call using `doit()`.
7645/// // Values shown here are possibly random and not representative !
7646/// let result = hub.projects().apps_device_check_config_patch(req, "name")
7647///              .update_mask(FieldMask::new::<&str>(&[]))
7648///              .doit().await;
7649/// # }
7650/// ```
7651pub struct ProjectAppDeviceCheckConfigPatchCall<'a, C>
7652where
7653    C: 'a,
7654{
7655    hub: &'a Firebaseappcheck<C>,
7656    _request: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7657    _name: String,
7658    _update_mask: Option<common::FieldMask>,
7659    _delegate: Option<&'a mut dyn common::Delegate>,
7660    _additional_params: HashMap<String, String>,
7661    _scopes: BTreeSet<String>,
7662}
7663
7664impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigPatchCall<'a, C> {}
7665
7666impl<'a, C> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7667where
7668    C: common::Connector,
7669{
7670    /// Perform the operation you have build so far.
7671    pub async fn doit(
7672        mut self,
7673    ) -> common::Result<(
7674        common::Response,
7675        GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7676    )> {
7677        use std::borrow::Cow;
7678        use std::io::{Read, Seek};
7679
7680        use common::{url::Params, ToParts};
7681        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7682
7683        let mut dd = common::DefaultDelegate;
7684        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7685        dlg.begin(common::MethodInfo {
7686            id: "firebaseappcheck.projects.apps.deviceCheckConfig.patch",
7687            http_method: hyper::Method::PATCH,
7688        });
7689
7690        for &field in ["alt", "name", "updateMask"].iter() {
7691            if self._additional_params.contains_key(field) {
7692                dlg.finished(false);
7693                return Err(common::Error::FieldClash(field));
7694            }
7695        }
7696
7697        let mut params = Params::with_capacity(5 + self._additional_params.len());
7698        params.push("name", self._name);
7699        if let Some(value) = self._update_mask.as_ref() {
7700            params.push("updateMask", value.to_string());
7701        }
7702
7703        params.extend(self._additional_params.iter());
7704
7705        params.push("alt", "json");
7706        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7707        if self._scopes.is_empty() {
7708            self._scopes
7709                .insert(Scope::CloudPlatform.as_ref().to_string());
7710        }
7711
7712        #[allow(clippy::single_element_loop)]
7713        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7714            url = params.uri_replacement(url, param_name, find_this, true);
7715        }
7716        {
7717            let to_remove = ["name"];
7718            params.remove_params(&to_remove);
7719        }
7720
7721        let url = params.parse_with_url(&url);
7722
7723        let mut json_mime_type = mime::APPLICATION_JSON;
7724        let mut request_value_reader = {
7725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7726            common::remove_json_null_values(&mut value);
7727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7728            serde_json::to_writer(&mut dst, &value).unwrap();
7729            dst
7730        };
7731        let request_size = request_value_reader
7732            .seek(std::io::SeekFrom::End(0))
7733            .unwrap();
7734        request_value_reader
7735            .seek(std::io::SeekFrom::Start(0))
7736            .unwrap();
7737
7738        loop {
7739            let token = match self
7740                .hub
7741                .auth
7742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7743                .await
7744            {
7745                Ok(token) => token,
7746                Err(e) => match dlg.token(e) {
7747                    Ok(token) => token,
7748                    Err(e) => {
7749                        dlg.finished(false);
7750                        return Err(common::Error::MissingToken(e));
7751                    }
7752                },
7753            };
7754            request_value_reader
7755                .seek(std::io::SeekFrom::Start(0))
7756                .unwrap();
7757            let mut req_result = {
7758                let client = &self.hub.client;
7759                dlg.pre_request();
7760                let mut req_builder = hyper::Request::builder()
7761                    .method(hyper::Method::PATCH)
7762                    .uri(url.as_str())
7763                    .header(USER_AGENT, self.hub._user_agent.clone());
7764
7765                if let Some(token) = token.as_ref() {
7766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7767                }
7768
7769                let request = req_builder
7770                    .header(CONTENT_TYPE, json_mime_type.to_string())
7771                    .header(CONTENT_LENGTH, request_size as u64)
7772                    .body(common::to_body(
7773                        request_value_reader.get_ref().clone().into(),
7774                    ));
7775
7776                client.request(request.unwrap()).await
7777            };
7778
7779            match req_result {
7780                Err(err) => {
7781                    if let common::Retry::After(d) = dlg.http_error(&err) {
7782                        sleep(d).await;
7783                        continue;
7784                    }
7785                    dlg.finished(false);
7786                    return Err(common::Error::HttpError(err));
7787                }
7788                Ok(res) => {
7789                    let (mut parts, body) = res.into_parts();
7790                    let mut body = common::Body::new(body);
7791                    if !parts.status.is_success() {
7792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7793                        let error = serde_json::from_str(&common::to_string(&bytes));
7794                        let response = common::to_response(parts, bytes.into());
7795
7796                        if let common::Retry::After(d) =
7797                            dlg.http_failure(&response, error.as_ref().ok())
7798                        {
7799                            sleep(d).await;
7800                            continue;
7801                        }
7802
7803                        dlg.finished(false);
7804
7805                        return Err(match error {
7806                            Ok(value) => common::Error::BadRequest(value),
7807                            _ => common::Error::Failure(response),
7808                        });
7809                    }
7810                    let response = {
7811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7812                        let encoded = common::to_string(&bytes);
7813                        match serde_json::from_str(&encoded) {
7814                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7815                            Err(error) => {
7816                                dlg.response_json_decode_error(&encoded, &error);
7817                                return Err(common::Error::JsonDecodeError(
7818                                    encoded.to_string(),
7819                                    error,
7820                                ));
7821                            }
7822                        }
7823                    };
7824
7825                    dlg.finished(true);
7826                    return Ok(response);
7827                }
7828            }
7829        }
7830    }
7831
7832    ///
7833    /// Sets the *request* property to the given value.
7834    ///
7835    /// Even though the property as already been set when instantiating this call,
7836    /// we provide this method for API completeness.
7837    pub fn request(
7838        mut self,
7839        new_value: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7840    ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7841        self._request = new_value;
7842        self
7843    }
7844    /// Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
7845    ///
7846    /// Sets the *name* path property to the given value.
7847    ///
7848    /// Even though the property as already been set when instantiating this call,
7849    /// we provide this method for API completeness.
7850    pub fn name(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7851        self._name = new_value.to_string();
7852        self
7853    }
7854    /// Required. A comma-separated list of names of fields in the DeviceCheckConfig to update. Example: `key_id,private_key`.
7855    ///
7856    /// Sets the *update mask* query property to the given value.
7857    pub fn update_mask(
7858        mut self,
7859        new_value: common::FieldMask,
7860    ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7861        self._update_mask = Some(new_value);
7862        self
7863    }
7864    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7865    /// while executing the actual API request.
7866    ///
7867    /// ````text
7868    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7869    /// ````
7870    ///
7871    /// Sets the *delegate* property to the given value.
7872    pub fn delegate(
7873        mut self,
7874        new_value: &'a mut dyn common::Delegate,
7875    ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7876        self._delegate = Some(new_value);
7877        self
7878    }
7879
7880    /// Set any additional parameter of the query string used in the request.
7881    /// It should be used to set parameters which are not yet available through their own
7882    /// setters.
7883    ///
7884    /// Please note that this method must not be used to set any of the known parameters
7885    /// which have their own setter method. If done anyway, the request will fail.
7886    ///
7887    /// # Additional Parameters
7888    ///
7889    /// * *$.xgafv* (query-string) - V1 error format.
7890    /// * *access_token* (query-string) - OAuth access token.
7891    /// * *alt* (query-string) - Data format for response.
7892    /// * *callback* (query-string) - JSONP
7893    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7894    /// * *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.
7895    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7896    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7897    /// * *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.
7898    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7899    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7900    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7901    where
7902        T: AsRef<str>,
7903    {
7904        self._additional_params
7905            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7906        self
7907    }
7908
7909    /// Identifies the authorization scope for the method you are building.
7910    ///
7911    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7912    /// [`Scope::CloudPlatform`].
7913    ///
7914    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7915    /// tokens for more than one scope.
7916    ///
7917    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7918    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7919    /// sufficient, a read-write scope will do as well.
7920    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7921    where
7922        St: AsRef<str>,
7923    {
7924        self._scopes.insert(String::from(scope.as_ref()));
7925        self
7926    }
7927    /// Identifies the authorization scope(s) for the method you are building.
7928    ///
7929    /// See [`Self::add_scope()`] for details.
7930    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7931    where
7932        I: IntoIterator<Item = St>,
7933        St: AsRef<str>,
7934    {
7935        self._scopes
7936            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7937        self
7938    }
7939
7940    /// Removes all scopes, and no default scope will be used either.
7941    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7942    /// for details).
7943    pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7944        self._scopes.clear();
7945        self
7946    }
7947}
7948
7949/// Atomically gets the PlayIntegrityConfigs for the specified list of apps.
7950///
7951/// A builder for the *apps.playIntegrityConfig.batchGet* method supported by a *project* resource.
7952/// It is not used directly, but through a [`ProjectMethods`] instance.
7953///
7954/// # Example
7955///
7956/// Instantiate a resource method builder
7957///
7958/// ```test_harness,no_run
7959/// # extern crate hyper;
7960/// # extern crate hyper_rustls;
7961/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7962/// # async fn dox() {
7963/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7964///
7965/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7966/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7967/// #     .with_native_roots()
7968/// #     .unwrap()
7969/// #     .https_only()
7970/// #     .enable_http2()
7971/// #     .build();
7972///
7973/// # let executor = hyper_util::rt::TokioExecutor::new();
7974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7975/// #     secret,
7976/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7977/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7978/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7979/// #     ),
7980/// # ).build().await.unwrap();
7981///
7982/// # let client = hyper_util::client::legacy::Client::builder(
7983/// #     hyper_util::rt::TokioExecutor::new()
7984/// # )
7985/// # .build(
7986/// #     hyper_rustls::HttpsConnectorBuilder::new()
7987/// #         .with_native_roots()
7988/// #         .unwrap()
7989/// #         .https_or_http()
7990/// #         .enable_http2()
7991/// #         .build()
7992/// # );
7993/// # let mut hub = Firebaseappcheck::new(client, auth);
7994/// // You can configure optional parameters by calling the respective setters at will, and
7995/// // execute the final call using `doit()`.
7996/// // Values shown here are possibly random and not representative !
7997/// let result = hub.projects().apps_play_integrity_config_batch_get("parent")
7998///              .add_names("sed")
7999///              .doit().await;
8000/// # }
8001/// ```
8002pub struct ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
8003where
8004    C: 'a,
8005{
8006    hub: &'a Firebaseappcheck<C>,
8007    _parent: String,
8008    _names: Vec<String>,
8009    _delegate: Option<&'a mut dyn common::Delegate>,
8010    _additional_params: HashMap<String, String>,
8011    _scopes: BTreeSet<String>,
8012}
8013
8014impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {}
8015
8016impl<'a, C> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
8017where
8018    C: common::Connector,
8019{
8020    /// Perform the operation you have build so far.
8021    pub async fn doit(
8022        mut self,
8023    ) -> common::Result<(
8024        common::Response,
8025        GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse,
8026    )> {
8027        use std::borrow::Cow;
8028        use std::io::{Read, Seek};
8029
8030        use common::{url::Params, ToParts};
8031        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8032
8033        let mut dd = common::DefaultDelegate;
8034        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8035        dlg.begin(common::MethodInfo {
8036            id: "firebaseappcheck.projects.apps.playIntegrityConfig.batchGet",
8037            http_method: hyper::Method::GET,
8038        });
8039
8040        for &field in ["alt", "parent", "names"].iter() {
8041            if self._additional_params.contains_key(field) {
8042                dlg.finished(false);
8043                return Err(common::Error::FieldClash(field));
8044            }
8045        }
8046
8047        let mut params = Params::with_capacity(4 + self._additional_params.len());
8048        params.push("parent", self._parent);
8049        if !self._names.is_empty() {
8050            for f in self._names.iter() {
8051                params.push("names", f);
8052            }
8053        }
8054
8055        params.extend(self._additional_params.iter());
8056
8057        params.push("alt", "json");
8058        let mut url =
8059            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/playIntegrityConfig:batchGet";
8060        if self._scopes.is_empty() {
8061            self._scopes
8062                .insert(Scope::CloudPlatform.as_ref().to_string());
8063        }
8064
8065        #[allow(clippy::single_element_loop)]
8066        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8067            url = params.uri_replacement(url, param_name, find_this, true);
8068        }
8069        {
8070            let to_remove = ["parent"];
8071            params.remove_params(&to_remove);
8072        }
8073
8074        let url = params.parse_with_url(&url);
8075
8076        loop {
8077            let token = match self
8078                .hub
8079                .auth
8080                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8081                .await
8082            {
8083                Ok(token) => token,
8084                Err(e) => match dlg.token(e) {
8085                    Ok(token) => token,
8086                    Err(e) => {
8087                        dlg.finished(false);
8088                        return Err(common::Error::MissingToken(e));
8089                    }
8090                },
8091            };
8092            let mut req_result = {
8093                let client = &self.hub.client;
8094                dlg.pre_request();
8095                let mut req_builder = hyper::Request::builder()
8096                    .method(hyper::Method::GET)
8097                    .uri(url.as_str())
8098                    .header(USER_AGENT, self.hub._user_agent.clone());
8099
8100                if let Some(token) = token.as_ref() {
8101                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8102                }
8103
8104                let request = req_builder
8105                    .header(CONTENT_LENGTH, 0_u64)
8106                    .body(common::to_body::<String>(None));
8107
8108                client.request(request.unwrap()).await
8109            };
8110
8111            match req_result {
8112                Err(err) => {
8113                    if let common::Retry::After(d) = dlg.http_error(&err) {
8114                        sleep(d).await;
8115                        continue;
8116                    }
8117                    dlg.finished(false);
8118                    return Err(common::Error::HttpError(err));
8119                }
8120                Ok(res) => {
8121                    let (mut parts, body) = res.into_parts();
8122                    let mut body = common::Body::new(body);
8123                    if !parts.status.is_success() {
8124                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8125                        let error = serde_json::from_str(&common::to_string(&bytes));
8126                        let response = common::to_response(parts, bytes.into());
8127
8128                        if let common::Retry::After(d) =
8129                            dlg.http_failure(&response, error.as_ref().ok())
8130                        {
8131                            sleep(d).await;
8132                            continue;
8133                        }
8134
8135                        dlg.finished(false);
8136
8137                        return Err(match error {
8138                            Ok(value) => common::Error::BadRequest(value),
8139                            _ => common::Error::Failure(response),
8140                        });
8141                    }
8142                    let response = {
8143                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8144                        let encoded = common::to_string(&bytes);
8145                        match serde_json::from_str(&encoded) {
8146                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8147                            Err(error) => {
8148                                dlg.response_json_decode_error(&encoded, &error);
8149                                return Err(common::Error::JsonDecodeError(
8150                                    encoded.to_string(),
8151                                    error,
8152                                ));
8153                            }
8154                        }
8155                    };
8156
8157                    dlg.finished(true);
8158                    return Ok(response);
8159                }
8160            }
8161        }
8162    }
8163
8164    /// Required. The parent project name shared by all PlayIntegrityConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
8165    ///
8166    /// Sets the *parent* path property to the given value.
8167    ///
8168    /// Even though the property as already been set when instantiating this call,
8169    /// we provide this method for API completeness.
8170    pub fn parent(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
8171        self._parent = new_value.to_string();
8172        self
8173    }
8174    /// Required. The relative resource names of the PlayIntegrityConfigs to retrieve, in the format ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ``` A maximum of 100 objects can be retrieved in a batch.
8175    ///
8176    /// Append the given value to the *names* query property.
8177    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8178    pub fn add_names(
8179        mut self,
8180        new_value: &str,
8181    ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
8182        self._names.push(new_value.to_string());
8183        self
8184    }
8185    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8186    /// while executing the actual API request.
8187    ///
8188    /// ````text
8189    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8190    /// ````
8191    ///
8192    /// Sets the *delegate* property to the given value.
8193    pub fn delegate(
8194        mut self,
8195        new_value: &'a mut dyn common::Delegate,
8196    ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
8197        self._delegate = Some(new_value);
8198        self
8199    }
8200
8201    /// Set any additional parameter of the query string used in the request.
8202    /// It should be used to set parameters which are not yet available through their own
8203    /// setters.
8204    ///
8205    /// Please note that this method must not be used to set any of the known parameters
8206    /// which have their own setter method. If done anyway, the request will fail.
8207    ///
8208    /// # Additional Parameters
8209    ///
8210    /// * *$.xgafv* (query-string) - V1 error format.
8211    /// * *access_token* (query-string) - OAuth access token.
8212    /// * *alt* (query-string) - Data format for response.
8213    /// * *callback* (query-string) - JSONP
8214    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8215    /// * *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.
8216    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8217    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8218    /// * *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.
8219    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8220    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8221    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
8222    where
8223        T: AsRef<str>,
8224    {
8225        self._additional_params
8226            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8227        self
8228    }
8229
8230    /// Identifies the authorization scope for the method you are building.
8231    ///
8232    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8233    /// [`Scope::CloudPlatform`].
8234    ///
8235    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8236    /// tokens for more than one scope.
8237    ///
8238    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8239    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8240    /// sufficient, a read-write scope will do as well.
8241    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
8242    where
8243        St: AsRef<str>,
8244    {
8245        self._scopes.insert(String::from(scope.as_ref()));
8246        self
8247    }
8248    /// Identifies the authorization scope(s) for the method you are building.
8249    ///
8250    /// See [`Self::add_scope()`] for details.
8251    pub fn add_scopes<I, St>(
8252        mut self,
8253        scopes: I,
8254    ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
8255    where
8256        I: IntoIterator<Item = St>,
8257        St: AsRef<str>,
8258    {
8259        self._scopes
8260            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8261        self
8262    }
8263
8264    /// Removes all scopes, and no default scope will be used either.
8265    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8266    /// for details).
8267    pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
8268        self._scopes.clear();
8269        self
8270    }
8271}
8272
8273/// Gets the PlayIntegrityConfig for the specified app.
8274///
8275/// A builder for the *apps.playIntegrityConfig.get* method supported by a *project* resource.
8276/// It is not used directly, but through a [`ProjectMethods`] instance.
8277///
8278/// # Example
8279///
8280/// Instantiate a resource method builder
8281///
8282/// ```test_harness,no_run
8283/// # extern crate hyper;
8284/// # extern crate hyper_rustls;
8285/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8286/// # async fn dox() {
8287/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8288///
8289/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8290/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8291/// #     .with_native_roots()
8292/// #     .unwrap()
8293/// #     .https_only()
8294/// #     .enable_http2()
8295/// #     .build();
8296///
8297/// # let executor = hyper_util::rt::TokioExecutor::new();
8298/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8299/// #     secret,
8300/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8301/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8302/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8303/// #     ),
8304/// # ).build().await.unwrap();
8305///
8306/// # let client = hyper_util::client::legacy::Client::builder(
8307/// #     hyper_util::rt::TokioExecutor::new()
8308/// # )
8309/// # .build(
8310/// #     hyper_rustls::HttpsConnectorBuilder::new()
8311/// #         .with_native_roots()
8312/// #         .unwrap()
8313/// #         .https_or_http()
8314/// #         .enable_http2()
8315/// #         .build()
8316/// # );
8317/// # let mut hub = Firebaseappcheck::new(client, auth);
8318/// // You can configure optional parameters by calling the respective setters at will, and
8319/// // execute the final call using `doit()`.
8320/// // Values shown here are possibly random and not representative !
8321/// let result = hub.projects().apps_play_integrity_config_get("name")
8322///              .doit().await;
8323/// # }
8324/// ```
8325pub struct ProjectAppPlayIntegrityConfigGetCall<'a, C>
8326where
8327    C: 'a,
8328{
8329    hub: &'a Firebaseappcheck<C>,
8330    _name: String,
8331    _delegate: Option<&'a mut dyn common::Delegate>,
8332    _additional_params: HashMap<String, String>,
8333    _scopes: BTreeSet<String>,
8334}
8335
8336impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigGetCall<'a, C> {}
8337
8338impl<'a, C> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8339where
8340    C: common::Connector,
8341{
8342    /// Perform the operation you have build so far.
8343    pub async fn doit(
8344        mut self,
8345    ) -> common::Result<(
8346        common::Response,
8347        GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8348    )> {
8349        use std::borrow::Cow;
8350        use std::io::{Read, Seek};
8351
8352        use common::{url::Params, ToParts};
8353        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8354
8355        let mut dd = common::DefaultDelegate;
8356        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8357        dlg.begin(common::MethodInfo {
8358            id: "firebaseappcheck.projects.apps.playIntegrityConfig.get",
8359            http_method: hyper::Method::GET,
8360        });
8361
8362        for &field in ["alt", "name"].iter() {
8363            if self._additional_params.contains_key(field) {
8364                dlg.finished(false);
8365                return Err(common::Error::FieldClash(field));
8366            }
8367        }
8368
8369        let mut params = Params::with_capacity(3 + self._additional_params.len());
8370        params.push("name", self._name);
8371
8372        params.extend(self._additional_params.iter());
8373
8374        params.push("alt", "json");
8375        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
8376        if self._scopes.is_empty() {
8377            self._scopes
8378                .insert(Scope::CloudPlatform.as_ref().to_string());
8379        }
8380
8381        #[allow(clippy::single_element_loop)]
8382        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8383            url = params.uri_replacement(url, param_name, find_this, true);
8384        }
8385        {
8386            let to_remove = ["name"];
8387            params.remove_params(&to_remove);
8388        }
8389
8390        let url = params.parse_with_url(&url);
8391
8392        loop {
8393            let token = match self
8394                .hub
8395                .auth
8396                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8397                .await
8398            {
8399                Ok(token) => token,
8400                Err(e) => match dlg.token(e) {
8401                    Ok(token) => token,
8402                    Err(e) => {
8403                        dlg.finished(false);
8404                        return Err(common::Error::MissingToken(e));
8405                    }
8406                },
8407            };
8408            let mut req_result = {
8409                let client = &self.hub.client;
8410                dlg.pre_request();
8411                let mut req_builder = hyper::Request::builder()
8412                    .method(hyper::Method::GET)
8413                    .uri(url.as_str())
8414                    .header(USER_AGENT, self.hub._user_agent.clone());
8415
8416                if let Some(token) = token.as_ref() {
8417                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8418                }
8419
8420                let request = req_builder
8421                    .header(CONTENT_LENGTH, 0_u64)
8422                    .body(common::to_body::<String>(None));
8423
8424                client.request(request.unwrap()).await
8425            };
8426
8427            match req_result {
8428                Err(err) => {
8429                    if let common::Retry::After(d) = dlg.http_error(&err) {
8430                        sleep(d).await;
8431                        continue;
8432                    }
8433                    dlg.finished(false);
8434                    return Err(common::Error::HttpError(err));
8435                }
8436                Ok(res) => {
8437                    let (mut parts, body) = res.into_parts();
8438                    let mut body = common::Body::new(body);
8439                    if !parts.status.is_success() {
8440                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8441                        let error = serde_json::from_str(&common::to_string(&bytes));
8442                        let response = common::to_response(parts, bytes.into());
8443
8444                        if let common::Retry::After(d) =
8445                            dlg.http_failure(&response, error.as_ref().ok())
8446                        {
8447                            sleep(d).await;
8448                            continue;
8449                        }
8450
8451                        dlg.finished(false);
8452
8453                        return Err(match error {
8454                            Ok(value) => common::Error::BadRequest(value),
8455                            _ => common::Error::Failure(response),
8456                        });
8457                    }
8458                    let response = {
8459                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8460                        let encoded = common::to_string(&bytes);
8461                        match serde_json::from_str(&encoded) {
8462                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8463                            Err(error) => {
8464                                dlg.response_json_decode_error(&encoded, &error);
8465                                return Err(common::Error::JsonDecodeError(
8466                                    encoded.to_string(),
8467                                    error,
8468                                ));
8469                            }
8470                        }
8471                    };
8472
8473                    dlg.finished(true);
8474                    return Ok(response);
8475                }
8476            }
8477        }
8478    }
8479
8480    /// Required. The relative resource name of the PlayIntegrityConfig, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
8481    ///
8482    /// Sets the *name* path property to the given value.
8483    ///
8484    /// Even though the property as already been set when instantiating this call,
8485    /// we provide this method for API completeness.
8486    pub fn name(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8487        self._name = new_value.to_string();
8488        self
8489    }
8490    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8491    /// while executing the actual API request.
8492    ///
8493    /// ````text
8494    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8495    /// ````
8496    ///
8497    /// Sets the *delegate* property to the given value.
8498    pub fn delegate(
8499        mut self,
8500        new_value: &'a mut dyn common::Delegate,
8501    ) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8502        self._delegate = Some(new_value);
8503        self
8504    }
8505
8506    /// Set any additional parameter of the query string used in the request.
8507    /// It should be used to set parameters which are not yet available through their own
8508    /// setters.
8509    ///
8510    /// Please note that this method must not be used to set any of the known parameters
8511    /// which have their own setter method. If done anyway, the request will fail.
8512    ///
8513    /// # Additional Parameters
8514    ///
8515    /// * *$.xgafv* (query-string) - V1 error format.
8516    /// * *access_token* (query-string) - OAuth access token.
8517    /// * *alt* (query-string) - Data format for response.
8518    /// * *callback* (query-string) - JSONP
8519    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8520    /// * *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.
8521    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8522    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8523    /// * *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.
8524    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8525    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8526    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8527    where
8528        T: AsRef<str>,
8529    {
8530        self._additional_params
8531            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8532        self
8533    }
8534
8535    /// Identifies the authorization scope for the method you are building.
8536    ///
8537    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8538    /// [`Scope::CloudPlatform`].
8539    ///
8540    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8541    /// tokens for more than one scope.
8542    ///
8543    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8544    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8545    /// sufficient, a read-write scope will do as well.
8546    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8547    where
8548        St: AsRef<str>,
8549    {
8550        self._scopes.insert(String::from(scope.as_ref()));
8551        self
8552    }
8553    /// Identifies the authorization scope(s) for the method you are building.
8554    ///
8555    /// See [`Self::add_scope()`] for details.
8556    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8557    where
8558        I: IntoIterator<Item = St>,
8559        St: AsRef<str>,
8560    {
8561        self._scopes
8562            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8563        self
8564    }
8565
8566    /// Removes all scopes, and no default scope will be used either.
8567    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8568    /// for details).
8569    pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8570        self._scopes.clear();
8571        self
8572    }
8573}
8574
8575/// Updates the PlayIntegrityConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange Play Integrity tokens for App Check tokens.
8576///
8577/// A builder for the *apps.playIntegrityConfig.patch* method supported by a *project* resource.
8578/// It is not used directly, but through a [`ProjectMethods`] instance.
8579///
8580/// # Example
8581///
8582/// Instantiate a resource method builder
8583///
8584/// ```test_harness,no_run
8585/// # extern crate hyper;
8586/// # extern crate hyper_rustls;
8587/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8588/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaPlayIntegrityConfig;
8589/// # async fn dox() {
8590/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8591///
8592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8593/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8594/// #     .with_native_roots()
8595/// #     .unwrap()
8596/// #     .https_only()
8597/// #     .enable_http2()
8598/// #     .build();
8599///
8600/// # let executor = hyper_util::rt::TokioExecutor::new();
8601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8602/// #     secret,
8603/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8604/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8605/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8606/// #     ),
8607/// # ).build().await.unwrap();
8608///
8609/// # let client = hyper_util::client::legacy::Client::builder(
8610/// #     hyper_util::rt::TokioExecutor::new()
8611/// # )
8612/// # .build(
8613/// #     hyper_rustls::HttpsConnectorBuilder::new()
8614/// #         .with_native_roots()
8615/// #         .unwrap()
8616/// #         .https_or_http()
8617/// #         .enable_http2()
8618/// #         .build()
8619/// # );
8620/// # let mut hub = Firebaseappcheck::new(client, auth);
8621/// // As the method needs a request, you would usually fill it with the desired information
8622/// // into the respective structure. Some of the parts shown here might not be applicable !
8623/// // Values shown here are possibly random and not representative !
8624/// let mut req = GoogleFirebaseAppcheckV1betaPlayIntegrityConfig::default();
8625///
8626/// // You can configure optional parameters by calling the respective setters at will, and
8627/// // execute the final call using `doit()`.
8628/// // Values shown here are possibly random and not representative !
8629/// let result = hub.projects().apps_play_integrity_config_patch(req, "name")
8630///              .update_mask(FieldMask::new::<&str>(&[]))
8631///              .doit().await;
8632/// # }
8633/// ```
8634pub struct ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8635where
8636    C: 'a,
8637{
8638    hub: &'a Firebaseappcheck<C>,
8639    _request: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8640    _name: String,
8641    _update_mask: Option<common::FieldMask>,
8642    _delegate: Option<&'a mut dyn common::Delegate>,
8643    _additional_params: HashMap<String, String>,
8644    _scopes: BTreeSet<String>,
8645}
8646
8647impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigPatchCall<'a, C> {}
8648
8649impl<'a, C> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8650where
8651    C: common::Connector,
8652{
8653    /// Perform the operation you have build so far.
8654    pub async fn doit(
8655        mut self,
8656    ) -> common::Result<(
8657        common::Response,
8658        GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8659    )> {
8660        use std::borrow::Cow;
8661        use std::io::{Read, Seek};
8662
8663        use common::{url::Params, ToParts};
8664        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8665
8666        let mut dd = common::DefaultDelegate;
8667        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8668        dlg.begin(common::MethodInfo {
8669            id: "firebaseappcheck.projects.apps.playIntegrityConfig.patch",
8670            http_method: hyper::Method::PATCH,
8671        });
8672
8673        for &field in ["alt", "name", "updateMask"].iter() {
8674            if self._additional_params.contains_key(field) {
8675                dlg.finished(false);
8676                return Err(common::Error::FieldClash(field));
8677            }
8678        }
8679
8680        let mut params = Params::with_capacity(5 + self._additional_params.len());
8681        params.push("name", self._name);
8682        if let Some(value) = self._update_mask.as_ref() {
8683            params.push("updateMask", value.to_string());
8684        }
8685
8686        params.extend(self._additional_params.iter());
8687
8688        params.push("alt", "json");
8689        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
8690        if self._scopes.is_empty() {
8691            self._scopes
8692                .insert(Scope::CloudPlatform.as_ref().to_string());
8693        }
8694
8695        #[allow(clippy::single_element_loop)]
8696        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8697            url = params.uri_replacement(url, param_name, find_this, true);
8698        }
8699        {
8700            let to_remove = ["name"];
8701            params.remove_params(&to_remove);
8702        }
8703
8704        let url = params.parse_with_url(&url);
8705
8706        let mut json_mime_type = mime::APPLICATION_JSON;
8707        let mut request_value_reader = {
8708            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8709            common::remove_json_null_values(&mut value);
8710            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8711            serde_json::to_writer(&mut dst, &value).unwrap();
8712            dst
8713        };
8714        let request_size = request_value_reader
8715            .seek(std::io::SeekFrom::End(0))
8716            .unwrap();
8717        request_value_reader
8718            .seek(std::io::SeekFrom::Start(0))
8719            .unwrap();
8720
8721        loop {
8722            let token = match self
8723                .hub
8724                .auth
8725                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8726                .await
8727            {
8728                Ok(token) => token,
8729                Err(e) => match dlg.token(e) {
8730                    Ok(token) => token,
8731                    Err(e) => {
8732                        dlg.finished(false);
8733                        return Err(common::Error::MissingToken(e));
8734                    }
8735                },
8736            };
8737            request_value_reader
8738                .seek(std::io::SeekFrom::Start(0))
8739                .unwrap();
8740            let mut req_result = {
8741                let client = &self.hub.client;
8742                dlg.pre_request();
8743                let mut req_builder = hyper::Request::builder()
8744                    .method(hyper::Method::PATCH)
8745                    .uri(url.as_str())
8746                    .header(USER_AGENT, self.hub._user_agent.clone());
8747
8748                if let Some(token) = token.as_ref() {
8749                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8750                }
8751
8752                let request = req_builder
8753                    .header(CONTENT_TYPE, json_mime_type.to_string())
8754                    .header(CONTENT_LENGTH, request_size as u64)
8755                    .body(common::to_body(
8756                        request_value_reader.get_ref().clone().into(),
8757                    ));
8758
8759                client.request(request.unwrap()).await
8760            };
8761
8762            match req_result {
8763                Err(err) => {
8764                    if let common::Retry::After(d) = dlg.http_error(&err) {
8765                        sleep(d).await;
8766                        continue;
8767                    }
8768                    dlg.finished(false);
8769                    return Err(common::Error::HttpError(err));
8770                }
8771                Ok(res) => {
8772                    let (mut parts, body) = res.into_parts();
8773                    let mut body = common::Body::new(body);
8774                    if !parts.status.is_success() {
8775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8776                        let error = serde_json::from_str(&common::to_string(&bytes));
8777                        let response = common::to_response(parts, bytes.into());
8778
8779                        if let common::Retry::After(d) =
8780                            dlg.http_failure(&response, error.as_ref().ok())
8781                        {
8782                            sleep(d).await;
8783                            continue;
8784                        }
8785
8786                        dlg.finished(false);
8787
8788                        return Err(match error {
8789                            Ok(value) => common::Error::BadRequest(value),
8790                            _ => common::Error::Failure(response),
8791                        });
8792                    }
8793                    let response = {
8794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8795                        let encoded = common::to_string(&bytes);
8796                        match serde_json::from_str(&encoded) {
8797                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8798                            Err(error) => {
8799                                dlg.response_json_decode_error(&encoded, &error);
8800                                return Err(common::Error::JsonDecodeError(
8801                                    encoded.to_string(),
8802                                    error,
8803                                ));
8804                            }
8805                        }
8806                    };
8807
8808                    dlg.finished(true);
8809                    return Ok(response);
8810                }
8811            }
8812        }
8813    }
8814
8815    ///
8816    /// Sets the *request* property to the given value.
8817    ///
8818    /// Even though the property as already been set when instantiating this call,
8819    /// we provide this method for API completeness.
8820    pub fn request(
8821        mut self,
8822        new_value: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8823    ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8824        self._request = new_value;
8825        self
8826    }
8827    /// Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
8828    ///
8829    /// Sets the *name* path property to the given value.
8830    ///
8831    /// Even though the property as already been set when instantiating this call,
8832    /// we provide this method for API completeness.
8833    pub fn name(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8834        self._name = new_value.to_string();
8835        self
8836    }
8837    /// Required. A comma-separated list of names of fields in the PlayIntegrityConfig to update. Example: `token_ttl`.
8838    ///
8839    /// Sets the *update mask* query property to the given value.
8840    pub fn update_mask(
8841        mut self,
8842        new_value: common::FieldMask,
8843    ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8844        self._update_mask = Some(new_value);
8845        self
8846    }
8847    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8848    /// while executing the actual API request.
8849    ///
8850    /// ````text
8851    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8852    /// ````
8853    ///
8854    /// Sets the *delegate* property to the given value.
8855    pub fn delegate(
8856        mut self,
8857        new_value: &'a mut dyn common::Delegate,
8858    ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8859        self._delegate = Some(new_value);
8860        self
8861    }
8862
8863    /// Set any additional parameter of the query string used in the request.
8864    /// It should be used to set parameters which are not yet available through their own
8865    /// setters.
8866    ///
8867    /// Please note that this method must not be used to set any of the known parameters
8868    /// which have their own setter method. If done anyway, the request will fail.
8869    ///
8870    /// # Additional Parameters
8871    ///
8872    /// * *$.xgafv* (query-string) - V1 error format.
8873    /// * *access_token* (query-string) - OAuth access token.
8874    /// * *alt* (query-string) - Data format for response.
8875    /// * *callback* (query-string) - JSONP
8876    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8877    /// * *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.
8878    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8879    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8880    /// * *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.
8881    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8882    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8883    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8884    where
8885        T: AsRef<str>,
8886    {
8887        self._additional_params
8888            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8889        self
8890    }
8891
8892    /// Identifies the authorization scope for the method you are building.
8893    ///
8894    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8895    /// [`Scope::CloudPlatform`].
8896    ///
8897    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8898    /// tokens for more than one scope.
8899    ///
8900    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8901    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8902    /// sufficient, a read-write scope will do as well.
8903    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8904    where
8905        St: AsRef<str>,
8906    {
8907        self._scopes.insert(String::from(scope.as_ref()));
8908        self
8909    }
8910    /// Identifies the authorization scope(s) for the method you are building.
8911    ///
8912    /// See [`Self::add_scope()`] for details.
8913    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8914    where
8915        I: IntoIterator<Item = St>,
8916        St: AsRef<str>,
8917    {
8918        self._scopes
8919            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8920        self
8921    }
8922
8923    /// Removes all scopes, and no default scope will be used either.
8924    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8925    /// for details).
8926    pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8927        self._scopes.clear();
8928        self
8929    }
8930}
8931
8932/// Atomically gets the RecaptchaConfigs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
8933///
8934/// A builder for the *apps.recaptchaConfig.batchGet* method supported by a *project* resource.
8935/// It is not used directly, but through a [`ProjectMethods`] instance.
8936///
8937/// # Example
8938///
8939/// Instantiate a resource method builder
8940///
8941/// ```test_harness,no_run
8942/// # extern crate hyper;
8943/// # extern crate hyper_rustls;
8944/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8945/// # async fn dox() {
8946/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8947///
8948/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8949/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8950/// #     .with_native_roots()
8951/// #     .unwrap()
8952/// #     .https_only()
8953/// #     .enable_http2()
8954/// #     .build();
8955///
8956/// # let executor = hyper_util::rt::TokioExecutor::new();
8957/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8958/// #     secret,
8959/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8960/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8961/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8962/// #     ),
8963/// # ).build().await.unwrap();
8964///
8965/// # let client = hyper_util::client::legacy::Client::builder(
8966/// #     hyper_util::rt::TokioExecutor::new()
8967/// # )
8968/// # .build(
8969/// #     hyper_rustls::HttpsConnectorBuilder::new()
8970/// #         .with_native_roots()
8971/// #         .unwrap()
8972/// #         .https_or_http()
8973/// #         .enable_http2()
8974/// #         .build()
8975/// # );
8976/// # let mut hub = Firebaseappcheck::new(client, auth);
8977/// // You can configure optional parameters by calling the respective setters at will, and
8978/// // execute the final call using `doit()`.
8979/// // Values shown here are possibly random and not representative !
8980/// let result = hub.projects().apps_recaptcha_config_batch_get("parent")
8981///              .add_names("est")
8982///              .doit().await;
8983/// # }
8984/// ```
8985pub struct ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8986where
8987    C: 'a,
8988{
8989    hub: &'a Firebaseappcheck<C>,
8990    _parent: String,
8991    _names: Vec<String>,
8992    _delegate: Option<&'a mut dyn common::Delegate>,
8993    _additional_params: HashMap<String, String>,
8994    _scopes: BTreeSet<String>,
8995}
8996
8997impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigBatchGetCall<'a, C> {}
8998
8999impl<'a, C> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
9000where
9001    C: common::Connector,
9002{
9003    /// Perform the operation you have build so far.
9004    pub async fn doit(
9005        mut self,
9006    ) -> common::Result<(
9007        common::Response,
9008        GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse,
9009    )> {
9010        use std::borrow::Cow;
9011        use std::io::{Read, Seek};
9012
9013        use common::{url::Params, ToParts};
9014        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9015
9016        let mut dd = common::DefaultDelegate;
9017        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9018        dlg.begin(common::MethodInfo {
9019            id: "firebaseappcheck.projects.apps.recaptchaConfig.batchGet",
9020            http_method: hyper::Method::GET,
9021        });
9022
9023        for &field in ["alt", "parent", "names"].iter() {
9024            if self._additional_params.contains_key(field) {
9025                dlg.finished(false);
9026                return Err(common::Error::FieldClash(field));
9027            }
9028        }
9029
9030        let mut params = Params::with_capacity(4 + self._additional_params.len());
9031        params.push("parent", self._parent);
9032        if !self._names.is_empty() {
9033            for f in self._names.iter() {
9034                params.push("names", f);
9035            }
9036        }
9037
9038        params.extend(self._additional_params.iter());
9039
9040        params.push("alt", "json");
9041        let mut url =
9042            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/recaptchaConfig:batchGet";
9043        if self._scopes.is_empty() {
9044            self._scopes
9045                .insert(Scope::CloudPlatform.as_ref().to_string());
9046        }
9047
9048        #[allow(clippy::single_element_loop)]
9049        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9050            url = params.uri_replacement(url, param_name, find_this, true);
9051        }
9052        {
9053            let to_remove = ["parent"];
9054            params.remove_params(&to_remove);
9055        }
9056
9057        let url = params.parse_with_url(&url);
9058
9059        loop {
9060            let token = match self
9061                .hub
9062                .auth
9063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9064                .await
9065            {
9066                Ok(token) => token,
9067                Err(e) => match dlg.token(e) {
9068                    Ok(token) => token,
9069                    Err(e) => {
9070                        dlg.finished(false);
9071                        return Err(common::Error::MissingToken(e));
9072                    }
9073                },
9074            };
9075            let mut req_result = {
9076                let client = &self.hub.client;
9077                dlg.pre_request();
9078                let mut req_builder = hyper::Request::builder()
9079                    .method(hyper::Method::GET)
9080                    .uri(url.as_str())
9081                    .header(USER_AGENT, self.hub._user_agent.clone());
9082
9083                if let Some(token) = token.as_ref() {
9084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9085                }
9086
9087                let request = req_builder
9088                    .header(CONTENT_LENGTH, 0_u64)
9089                    .body(common::to_body::<String>(None));
9090
9091                client.request(request.unwrap()).await
9092            };
9093
9094            match req_result {
9095                Err(err) => {
9096                    if let common::Retry::After(d) = dlg.http_error(&err) {
9097                        sleep(d).await;
9098                        continue;
9099                    }
9100                    dlg.finished(false);
9101                    return Err(common::Error::HttpError(err));
9102                }
9103                Ok(res) => {
9104                    let (mut parts, body) = res.into_parts();
9105                    let mut body = common::Body::new(body);
9106                    if !parts.status.is_success() {
9107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9108                        let error = serde_json::from_str(&common::to_string(&bytes));
9109                        let response = common::to_response(parts, bytes.into());
9110
9111                        if let common::Retry::After(d) =
9112                            dlg.http_failure(&response, error.as_ref().ok())
9113                        {
9114                            sleep(d).await;
9115                            continue;
9116                        }
9117
9118                        dlg.finished(false);
9119
9120                        return Err(match error {
9121                            Ok(value) => common::Error::BadRequest(value),
9122                            _ => common::Error::Failure(response),
9123                        });
9124                    }
9125                    let response = {
9126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9127                        let encoded = common::to_string(&bytes);
9128                        match serde_json::from_str(&encoded) {
9129                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9130                            Err(error) => {
9131                                dlg.response_json_decode_error(&encoded, &error);
9132                                return Err(common::Error::JsonDecodeError(
9133                                    encoded.to_string(),
9134                                    error,
9135                                ));
9136                            }
9137                        }
9138                    };
9139
9140                    dlg.finished(true);
9141                    return Ok(response);
9142                }
9143            }
9144        }
9145    }
9146
9147    /// Required. The parent project name shared by all RecaptchaConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
9148    ///
9149    /// Sets the *parent* path property to the given value.
9150    ///
9151    /// Even though the property as already been set when instantiating this call,
9152    /// we provide this method for API completeness.
9153    pub fn parent(mut self, new_value: &str) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
9154        self._parent = new_value.to_string();
9155        self
9156    }
9157    /// Required. The relative resource names of the RecaptchaConfigs to retrieve, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ``` A maximum of 100 objects can be retrieved in a batch.
9158    ///
9159    /// Append the given value to the *names* query property.
9160    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9161    pub fn add_names(mut self, new_value: &str) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
9162        self._names.push(new_value.to_string());
9163        self
9164    }
9165    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9166    /// while executing the actual API request.
9167    ///
9168    /// ````text
9169    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9170    /// ````
9171    ///
9172    /// Sets the *delegate* property to the given value.
9173    pub fn delegate(
9174        mut self,
9175        new_value: &'a mut dyn common::Delegate,
9176    ) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
9177        self._delegate = Some(new_value);
9178        self
9179    }
9180
9181    /// Set any additional parameter of the query string used in the request.
9182    /// It should be used to set parameters which are not yet available through their own
9183    /// setters.
9184    ///
9185    /// Please note that this method must not be used to set any of the known parameters
9186    /// which have their own setter method. If done anyway, the request will fail.
9187    ///
9188    /// # Additional Parameters
9189    ///
9190    /// * *$.xgafv* (query-string) - V1 error format.
9191    /// * *access_token* (query-string) - OAuth access token.
9192    /// * *alt* (query-string) - Data format for response.
9193    /// * *callback* (query-string) - JSONP
9194    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9195    /// * *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.
9196    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9197    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9198    /// * *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.
9199    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9200    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9201    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
9202    where
9203        T: AsRef<str>,
9204    {
9205        self._additional_params
9206            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9207        self
9208    }
9209
9210    /// Identifies the authorization scope for the method you are building.
9211    ///
9212    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9213    /// [`Scope::CloudPlatform`].
9214    ///
9215    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9216    /// tokens for more than one scope.
9217    ///
9218    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9219    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9220    /// sufficient, a read-write scope will do as well.
9221    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
9222    where
9223        St: AsRef<str>,
9224    {
9225        self._scopes.insert(String::from(scope.as_ref()));
9226        self
9227    }
9228    /// Identifies the authorization scope(s) for the method you are building.
9229    ///
9230    /// See [`Self::add_scope()`] for details.
9231    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
9232    where
9233        I: IntoIterator<Item = St>,
9234        St: AsRef<str>,
9235    {
9236        self._scopes
9237            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9238        self
9239    }
9240
9241    /// Removes all scopes, and no default scope will be used either.
9242    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9243    /// for details).
9244    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
9245        self._scopes.clear();
9246        self
9247    }
9248}
9249
9250/// Gets the RecaptchaConfig for the specified app. For security reasons, the `site_secret` field is never populated in the response.
9251///
9252/// A builder for the *apps.recaptchaConfig.get* method supported by a *project* resource.
9253/// It is not used directly, but through a [`ProjectMethods`] instance.
9254///
9255/// # Example
9256///
9257/// Instantiate a resource method builder
9258///
9259/// ```test_harness,no_run
9260/// # extern crate hyper;
9261/// # extern crate hyper_rustls;
9262/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9263/// # async fn dox() {
9264/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9265///
9266/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9267/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9268/// #     .with_native_roots()
9269/// #     .unwrap()
9270/// #     .https_only()
9271/// #     .enable_http2()
9272/// #     .build();
9273///
9274/// # let executor = hyper_util::rt::TokioExecutor::new();
9275/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9276/// #     secret,
9277/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9278/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9279/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9280/// #     ),
9281/// # ).build().await.unwrap();
9282///
9283/// # let client = hyper_util::client::legacy::Client::builder(
9284/// #     hyper_util::rt::TokioExecutor::new()
9285/// # )
9286/// # .build(
9287/// #     hyper_rustls::HttpsConnectorBuilder::new()
9288/// #         .with_native_roots()
9289/// #         .unwrap()
9290/// #         .https_or_http()
9291/// #         .enable_http2()
9292/// #         .build()
9293/// # );
9294/// # let mut hub = Firebaseappcheck::new(client, auth);
9295/// // You can configure optional parameters by calling the respective setters at will, and
9296/// // execute the final call using `doit()`.
9297/// // Values shown here are possibly random and not representative !
9298/// let result = hub.projects().apps_recaptcha_config_get("name")
9299///              .doit().await;
9300/// # }
9301/// ```
9302pub struct ProjectAppRecaptchaConfigGetCall<'a, C>
9303where
9304    C: 'a,
9305{
9306    hub: &'a Firebaseappcheck<C>,
9307    _name: String,
9308    _delegate: Option<&'a mut dyn common::Delegate>,
9309    _additional_params: HashMap<String, String>,
9310    _scopes: BTreeSet<String>,
9311}
9312
9313impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigGetCall<'a, C> {}
9314
9315impl<'a, C> ProjectAppRecaptchaConfigGetCall<'a, C>
9316where
9317    C: common::Connector,
9318{
9319    /// Perform the operation you have build so far.
9320    pub async fn doit(
9321        mut self,
9322    ) -> common::Result<(
9323        common::Response,
9324        GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9325    )> {
9326        use std::borrow::Cow;
9327        use std::io::{Read, Seek};
9328
9329        use common::{url::Params, ToParts};
9330        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9331
9332        let mut dd = common::DefaultDelegate;
9333        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9334        dlg.begin(common::MethodInfo {
9335            id: "firebaseappcheck.projects.apps.recaptchaConfig.get",
9336            http_method: hyper::Method::GET,
9337        });
9338
9339        for &field in ["alt", "name"].iter() {
9340            if self._additional_params.contains_key(field) {
9341                dlg.finished(false);
9342                return Err(common::Error::FieldClash(field));
9343            }
9344        }
9345
9346        let mut params = Params::with_capacity(3 + self._additional_params.len());
9347        params.push("name", self._name);
9348
9349        params.extend(self._additional_params.iter());
9350
9351        params.push("alt", "json");
9352        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
9353        if self._scopes.is_empty() {
9354            self._scopes
9355                .insert(Scope::CloudPlatform.as_ref().to_string());
9356        }
9357
9358        #[allow(clippy::single_element_loop)]
9359        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9360            url = params.uri_replacement(url, param_name, find_this, true);
9361        }
9362        {
9363            let to_remove = ["name"];
9364            params.remove_params(&to_remove);
9365        }
9366
9367        let url = params.parse_with_url(&url);
9368
9369        loop {
9370            let token = match self
9371                .hub
9372                .auth
9373                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9374                .await
9375            {
9376                Ok(token) => token,
9377                Err(e) => match dlg.token(e) {
9378                    Ok(token) => token,
9379                    Err(e) => {
9380                        dlg.finished(false);
9381                        return Err(common::Error::MissingToken(e));
9382                    }
9383                },
9384            };
9385            let mut req_result = {
9386                let client = &self.hub.client;
9387                dlg.pre_request();
9388                let mut req_builder = hyper::Request::builder()
9389                    .method(hyper::Method::GET)
9390                    .uri(url.as_str())
9391                    .header(USER_AGENT, self.hub._user_agent.clone());
9392
9393                if let Some(token) = token.as_ref() {
9394                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9395                }
9396
9397                let request = req_builder
9398                    .header(CONTENT_LENGTH, 0_u64)
9399                    .body(common::to_body::<String>(None));
9400
9401                client.request(request.unwrap()).await
9402            };
9403
9404            match req_result {
9405                Err(err) => {
9406                    if let common::Retry::After(d) = dlg.http_error(&err) {
9407                        sleep(d).await;
9408                        continue;
9409                    }
9410                    dlg.finished(false);
9411                    return Err(common::Error::HttpError(err));
9412                }
9413                Ok(res) => {
9414                    let (mut parts, body) = res.into_parts();
9415                    let mut body = common::Body::new(body);
9416                    if !parts.status.is_success() {
9417                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9418                        let error = serde_json::from_str(&common::to_string(&bytes));
9419                        let response = common::to_response(parts, bytes.into());
9420
9421                        if let common::Retry::After(d) =
9422                            dlg.http_failure(&response, error.as_ref().ok())
9423                        {
9424                            sleep(d).await;
9425                            continue;
9426                        }
9427
9428                        dlg.finished(false);
9429
9430                        return Err(match error {
9431                            Ok(value) => common::Error::BadRequest(value),
9432                            _ => common::Error::Failure(response),
9433                        });
9434                    }
9435                    let response = {
9436                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9437                        let encoded = common::to_string(&bytes);
9438                        match serde_json::from_str(&encoded) {
9439                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9440                            Err(error) => {
9441                                dlg.response_json_decode_error(&encoded, &error);
9442                                return Err(common::Error::JsonDecodeError(
9443                                    encoded.to_string(),
9444                                    error,
9445                                ));
9446                            }
9447                        }
9448                    };
9449
9450                    dlg.finished(true);
9451                    return Ok(response);
9452                }
9453            }
9454        }
9455    }
9456
9457    /// Required. The relative resource name of the RecaptchaConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
9458    ///
9459    /// Sets the *name* path property to the given value.
9460    ///
9461    /// Even though the property as already been set when instantiating this call,
9462    /// we provide this method for API completeness.
9463    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9464        self._name = new_value.to_string();
9465        self
9466    }
9467    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9468    /// while executing the actual API request.
9469    ///
9470    /// ````text
9471    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9472    /// ````
9473    ///
9474    /// Sets the *delegate* property to the given value.
9475    pub fn delegate(
9476        mut self,
9477        new_value: &'a mut dyn common::Delegate,
9478    ) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9479        self._delegate = Some(new_value);
9480        self
9481    }
9482
9483    /// Set any additional parameter of the query string used in the request.
9484    /// It should be used to set parameters which are not yet available through their own
9485    /// setters.
9486    ///
9487    /// Please note that this method must not be used to set any of the known parameters
9488    /// which have their own setter method. If done anyway, the request will fail.
9489    ///
9490    /// # Additional Parameters
9491    ///
9492    /// * *$.xgafv* (query-string) - V1 error format.
9493    /// * *access_token* (query-string) - OAuth access token.
9494    /// * *alt* (query-string) - Data format for response.
9495    /// * *callback* (query-string) - JSONP
9496    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9497    /// * *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.
9498    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9499    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9500    /// * *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.
9501    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9502    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9503    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9504    where
9505        T: AsRef<str>,
9506    {
9507        self._additional_params
9508            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9509        self
9510    }
9511
9512    /// Identifies the authorization scope for the method you are building.
9513    ///
9514    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9515    /// [`Scope::CloudPlatform`].
9516    ///
9517    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9518    /// tokens for more than one scope.
9519    ///
9520    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9521    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9522    /// sufficient, a read-write scope will do as well.
9523    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9524    where
9525        St: AsRef<str>,
9526    {
9527        self._scopes.insert(String::from(scope.as_ref()));
9528        self
9529    }
9530    /// Identifies the authorization scope(s) for the method you are building.
9531    ///
9532    /// See [`Self::add_scope()`] for details.
9533    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9534    where
9535        I: IntoIterator<Item = St>,
9536        St: AsRef<str>,
9537    {
9538        self._scopes
9539            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9540        self
9541    }
9542
9543    /// Removes all scopes, and no default scope will be used either.
9544    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9545    /// for details).
9546    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9547        self._scopes.clear();
9548        self
9549    }
9550}
9551
9552/// Updates the RecaptchaConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA tokens for App Check tokens. For security reasons, the `site_secret` field is never populated in the response.
9553///
9554/// A builder for the *apps.recaptchaConfig.patch* method supported by a *project* resource.
9555/// It is not used directly, but through a [`ProjectMethods`] instance.
9556///
9557/// # Example
9558///
9559/// Instantiate a resource method builder
9560///
9561/// ```test_harness,no_run
9562/// # extern crate hyper;
9563/// # extern crate hyper_rustls;
9564/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9565/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaConfig;
9566/// # async fn dox() {
9567/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9568///
9569/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9570/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9571/// #     .with_native_roots()
9572/// #     .unwrap()
9573/// #     .https_only()
9574/// #     .enable_http2()
9575/// #     .build();
9576///
9577/// # let executor = hyper_util::rt::TokioExecutor::new();
9578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9579/// #     secret,
9580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9581/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9582/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9583/// #     ),
9584/// # ).build().await.unwrap();
9585///
9586/// # let client = hyper_util::client::legacy::Client::builder(
9587/// #     hyper_util::rt::TokioExecutor::new()
9588/// # )
9589/// # .build(
9590/// #     hyper_rustls::HttpsConnectorBuilder::new()
9591/// #         .with_native_roots()
9592/// #         .unwrap()
9593/// #         .https_or_http()
9594/// #         .enable_http2()
9595/// #         .build()
9596/// # );
9597/// # let mut hub = Firebaseappcheck::new(client, auth);
9598/// // As the method needs a request, you would usually fill it with the desired information
9599/// // into the respective structure. Some of the parts shown here might not be applicable !
9600/// // Values shown here are possibly random and not representative !
9601/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaConfig::default();
9602///
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.projects().apps_recaptcha_config_patch(req, "name")
9607///              .update_mask(FieldMask::new::<&str>(&[]))
9608///              .doit().await;
9609/// # }
9610/// ```
9611pub struct ProjectAppRecaptchaConfigPatchCall<'a, C>
9612where
9613    C: 'a,
9614{
9615    hub: &'a Firebaseappcheck<C>,
9616    _request: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9617    _name: String,
9618    _update_mask: Option<common::FieldMask>,
9619    _delegate: Option<&'a mut dyn common::Delegate>,
9620    _additional_params: HashMap<String, String>,
9621    _scopes: BTreeSet<String>,
9622}
9623
9624impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigPatchCall<'a, C> {}
9625
9626impl<'a, C> ProjectAppRecaptchaConfigPatchCall<'a, C>
9627where
9628    C: common::Connector,
9629{
9630    /// Perform the operation you have build so far.
9631    pub async fn doit(
9632        mut self,
9633    ) -> common::Result<(
9634        common::Response,
9635        GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9636    )> {
9637        use std::borrow::Cow;
9638        use std::io::{Read, Seek};
9639
9640        use common::{url::Params, ToParts};
9641        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9642
9643        let mut dd = common::DefaultDelegate;
9644        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9645        dlg.begin(common::MethodInfo {
9646            id: "firebaseappcheck.projects.apps.recaptchaConfig.patch",
9647            http_method: hyper::Method::PATCH,
9648        });
9649
9650        for &field in ["alt", "name", "updateMask"].iter() {
9651            if self._additional_params.contains_key(field) {
9652                dlg.finished(false);
9653                return Err(common::Error::FieldClash(field));
9654            }
9655        }
9656
9657        let mut params = Params::with_capacity(5 + self._additional_params.len());
9658        params.push("name", self._name);
9659        if let Some(value) = self._update_mask.as_ref() {
9660            params.push("updateMask", value.to_string());
9661        }
9662
9663        params.extend(self._additional_params.iter());
9664
9665        params.push("alt", "json");
9666        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
9667        if self._scopes.is_empty() {
9668            self._scopes
9669                .insert(Scope::CloudPlatform.as_ref().to_string());
9670        }
9671
9672        #[allow(clippy::single_element_loop)]
9673        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9674            url = params.uri_replacement(url, param_name, find_this, true);
9675        }
9676        {
9677            let to_remove = ["name"];
9678            params.remove_params(&to_remove);
9679        }
9680
9681        let url = params.parse_with_url(&url);
9682
9683        let mut json_mime_type = mime::APPLICATION_JSON;
9684        let mut request_value_reader = {
9685            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9686            common::remove_json_null_values(&mut value);
9687            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9688            serde_json::to_writer(&mut dst, &value).unwrap();
9689            dst
9690        };
9691        let request_size = request_value_reader
9692            .seek(std::io::SeekFrom::End(0))
9693            .unwrap();
9694        request_value_reader
9695            .seek(std::io::SeekFrom::Start(0))
9696            .unwrap();
9697
9698        loop {
9699            let token = match self
9700                .hub
9701                .auth
9702                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9703                .await
9704            {
9705                Ok(token) => token,
9706                Err(e) => match dlg.token(e) {
9707                    Ok(token) => token,
9708                    Err(e) => {
9709                        dlg.finished(false);
9710                        return Err(common::Error::MissingToken(e));
9711                    }
9712                },
9713            };
9714            request_value_reader
9715                .seek(std::io::SeekFrom::Start(0))
9716                .unwrap();
9717            let mut req_result = {
9718                let client = &self.hub.client;
9719                dlg.pre_request();
9720                let mut req_builder = hyper::Request::builder()
9721                    .method(hyper::Method::PATCH)
9722                    .uri(url.as_str())
9723                    .header(USER_AGENT, self.hub._user_agent.clone());
9724
9725                if let Some(token) = token.as_ref() {
9726                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9727                }
9728
9729                let request = req_builder
9730                    .header(CONTENT_TYPE, json_mime_type.to_string())
9731                    .header(CONTENT_LENGTH, request_size as u64)
9732                    .body(common::to_body(
9733                        request_value_reader.get_ref().clone().into(),
9734                    ));
9735
9736                client.request(request.unwrap()).await
9737            };
9738
9739            match req_result {
9740                Err(err) => {
9741                    if let common::Retry::After(d) = dlg.http_error(&err) {
9742                        sleep(d).await;
9743                        continue;
9744                    }
9745                    dlg.finished(false);
9746                    return Err(common::Error::HttpError(err));
9747                }
9748                Ok(res) => {
9749                    let (mut parts, body) = res.into_parts();
9750                    let mut body = common::Body::new(body);
9751                    if !parts.status.is_success() {
9752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9753                        let error = serde_json::from_str(&common::to_string(&bytes));
9754                        let response = common::to_response(parts, bytes.into());
9755
9756                        if let common::Retry::After(d) =
9757                            dlg.http_failure(&response, error.as_ref().ok())
9758                        {
9759                            sleep(d).await;
9760                            continue;
9761                        }
9762
9763                        dlg.finished(false);
9764
9765                        return Err(match error {
9766                            Ok(value) => common::Error::BadRequest(value),
9767                            _ => common::Error::Failure(response),
9768                        });
9769                    }
9770                    let response = {
9771                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9772                        let encoded = common::to_string(&bytes);
9773                        match serde_json::from_str(&encoded) {
9774                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9775                            Err(error) => {
9776                                dlg.response_json_decode_error(&encoded, &error);
9777                                return Err(common::Error::JsonDecodeError(
9778                                    encoded.to_string(),
9779                                    error,
9780                                ));
9781                            }
9782                        }
9783                    };
9784
9785                    dlg.finished(true);
9786                    return Ok(response);
9787                }
9788            }
9789        }
9790    }
9791
9792    ///
9793    /// Sets the *request* property to the given value.
9794    ///
9795    /// Even though the property as already been set when instantiating this call,
9796    /// we provide this method for API completeness.
9797    pub fn request(
9798        mut self,
9799        new_value: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9800    ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9801        self._request = new_value;
9802        self
9803    }
9804    /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
9805    ///
9806    /// Sets the *name* path property to the given value.
9807    ///
9808    /// Even though the property as already been set when instantiating this call,
9809    /// we provide this method for API completeness.
9810    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9811        self._name = new_value.to_string();
9812        self
9813    }
9814    /// Required. A comma-separated list of names of fields in the RecaptchaConfig to update. Example: `site_secret`.
9815    ///
9816    /// Sets the *update mask* query property to the given value.
9817    pub fn update_mask(
9818        mut self,
9819        new_value: common::FieldMask,
9820    ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9821        self._update_mask = Some(new_value);
9822        self
9823    }
9824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9825    /// while executing the actual API request.
9826    ///
9827    /// ````text
9828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9829    /// ````
9830    ///
9831    /// Sets the *delegate* property to the given value.
9832    pub fn delegate(
9833        mut self,
9834        new_value: &'a mut dyn common::Delegate,
9835    ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9836        self._delegate = Some(new_value);
9837        self
9838    }
9839
9840    /// Set any additional parameter of the query string used in the request.
9841    /// It should be used to set parameters which are not yet available through their own
9842    /// setters.
9843    ///
9844    /// Please note that this method must not be used to set any of the known parameters
9845    /// which have their own setter method. If done anyway, the request will fail.
9846    ///
9847    /// # Additional Parameters
9848    ///
9849    /// * *$.xgafv* (query-string) - V1 error format.
9850    /// * *access_token* (query-string) - OAuth access token.
9851    /// * *alt* (query-string) - Data format for response.
9852    /// * *callback* (query-string) - JSONP
9853    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9854    /// * *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.
9855    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9856    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9857    /// * *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.
9858    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9859    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9860    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9861    where
9862        T: AsRef<str>,
9863    {
9864        self._additional_params
9865            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9866        self
9867    }
9868
9869    /// Identifies the authorization scope for the method you are building.
9870    ///
9871    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9872    /// [`Scope::CloudPlatform`].
9873    ///
9874    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9875    /// tokens for more than one scope.
9876    ///
9877    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9878    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9879    /// sufficient, a read-write scope will do as well.
9880    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9881    where
9882        St: AsRef<str>,
9883    {
9884        self._scopes.insert(String::from(scope.as_ref()));
9885        self
9886    }
9887    /// Identifies the authorization scope(s) for the method you are building.
9888    ///
9889    /// See [`Self::add_scope()`] for details.
9890    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9891    where
9892        I: IntoIterator<Item = St>,
9893        St: AsRef<str>,
9894    {
9895        self._scopes
9896            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9897        self
9898    }
9899
9900    /// Removes all scopes, and no default scope will be used either.
9901    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9902    /// for details).
9903    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9904        self._scopes.clear();
9905        self
9906    }
9907}
9908
9909/// Atomically gets the RecaptchaEnterpriseConfigs for the specified list of apps.
9910///
9911/// A builder for the *apps.recaptchaEnterpriseConfig.batchGet* method supported by a *project* resource.
9912/// It is not used directly, but through a [`ProjectMethods`] instance.
9913///
9914/// # Example
9915///
9916/// Instantiate a resource method builder
9917///
9918/// ```test_harness,no_run
9919/// # extern crate hyper;
9920/// # extern crate hyper_rustls;
9921/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9922/// # async fn dox() {
9923/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9924///
9925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9926/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9927/// #     .with_native_roots()
9928/// #     .unwrap()
9929/// #     .https_only()
9930/// #     .enable_http2()
9931/// #     .build();
9932///
9933/// # let executor = hyper_util::rt::TokioExecutor::new();
9934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9935/// #     secret,
9936/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9937/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9938/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9939/// #     ),
9940/// # ).build().await.unwrap();
9941///
9942/// # let client = hyper_util::client::legacy::Client::builder(
9943/// #     hyper_util::rt::TokioExecutor::new()
9944/// # )
9945/// # .build(
9946/// #     hyper_rustls::HttpsConnectorBuilder::new()
9947/// #         .with_native_roots()
9948/// #         .unwrap()
9949/// #         .https_or_http()
9950/// #         .enable_http2()
9951/// #         .build()
9952/// # );
9953/// # let mut hub = Firebaseappcheck::new(client, auth);
9954/// // You can configure optional parameters by calling the respective setters at will, and
9955/// // execute the final call using `doit()`.
9956/// // Values shown here are possibly random and not representative !
9957/// let result = hub.projects().apps_recaptcha_enterprise_config_batch_get("parent")
9958///              .add_names("gubergren")
9959///              .doit().await;
9960/// # }
9961/// ```
9962pub struct ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9963where
9964    C: 'a,
9965{
9966    hub: &'a Firebaseappcheck<C>,
9967    _parent: String,
9968    _names: Vec<String>,
9969    _delegate: Option<&'a mut dyn common::Delegate>,
9970    _additional_params: HashMap<String, String>,
9971    _scopes: BTreeSet<String>,
9972}
9973
9974impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {}
9975
9976impl<'a, C> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9977where
9978    C: common::Connector,
9979{
9980    /// Perform the operation you have build so far.
9981    pub async fn doit(
9982        mut self,
9983    ) -> common::Result<(
9984        common::Response,
9985        GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse,
9986    )> {
9987        use std::borrow::Cow;
9988        use std::io::{Read, Seek};
9989
9990        use common::{url::Params, ToParts};
9991        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9992
9993        let mut dd = common::DefaultDelegate;
9994        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9995        dlg.begin(common::MethodInfo {
9996            id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.batchGet",
9997            http_method: hyper::Method::GET,
9998        });
9999
10000        for &field in ["alt", "parent", "names"].iter() {
10001            if self._additional_params.contains_key(field) {
10002                dlg.finished(false);
10003                return Err(common::Error::FieldClash(field));
10004            }
10005        }
10006
10007        let mut params = Params::with_capacity(4 + self._additional_params.len());
10008        params.push("parent", self._parent);
10009        if !self._names.is_empty() {
10010            for f in self._names.iter() {
10011                params.push("names", f);
10012            }
10013        }
10014
10015        params.extend(self._additional_params.iter());
10016
10017        params.push("alt", "json");
10018        let mut url = self.hub._base_url.clone()
10019            + "v1beta/{+parent}/apps/-/recaptchaEnterpriseConfig:batchGet";
10020        if self._scopes.is_empty() {
10021            self._scopes
10022                .insert(Scope::CloudPlatform.as_ref().to_string());
10023        }
10024
10025        #[allow(clippy::single_element_loop)]
10026        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10027            url = params.uri_replacement(url, param_name, find_this, true);
10028        }
10029        {
10030            let to_remove = ["parent"];
10031            params.remove_params(&to_remove);
10032        }
10033
10034        let url = params.parse_with_url(&url);
10035
10036        loop {
10037            let token = match self
10038                .hub
10039                .auth
10040                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10041                .await
10042            {
10043                Ok(token) => token,
10044                Err(e) => match dlg.token(e) {
10045                    Ok(token) => token,
10046                    Err(e) => {
10047                        dlg.finished(false);
10048                        return Err(common::Error::MissingToken(e));
10049                    }
10050                },
10051            };
10052            let mut req_result = {
10053                let client = &self.hub.client;
10054                dlg.pre_request();
10055                let mut req_builder = hyper::Request::builder()
10056                    .method(hyper::Method::GET)
10057                    .uri(url.as_str())
10058                    .header(USER_AGENT, self.hub._user_agent.clone());
10059
10060                if let Some(token) = token.as_ref() {
10061                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10062                }
10063
10064                let request = req_builder
10065                    .header(CONTENT_LENGTH, 0_u64)
10066                    .body(common::to_body::<String>(None));
10067
10068                client.request(request.unwrap()).await
10069            };
10070
10071            match req_result {
10072                Err(err) => {
10073                    if let common::Retry::After(d) = dlg.http_error(&err) {
10074                        sleep(d).await;
10075                        continue;
10076                    }
10077                    dlg.finished(false);
10078                    return Err(common::Error::HttpError(err));
10079                }
10080                Ok(res) => {
10081                    let (mut parts, body) = res.into_parts();
10082                    let mut body = common::Body::new(body);
10083                    if !parts.status.is_success() {
10084                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10085                        let error = serde_json::from_str(&common::to_string(&bytes));
10086                        let response = common::to_response(parts, bytes.into());
10087
10088                        if let common::Retry::After(d) =
10089                            dlg.http_failure(&response, error.as_ref().ok())
10090                        {
10091                            sleep(d).await;
10092                            continue;
10093                        }
10094
10095                        dlg.finished(false);
10096
10097                        return Err(match error {
10098                            Ok(value) => common::Error::BadRequest(value),
10099                            _ => common::Error::Failure(response),
10100                        });
10101                    }
10102                    let response = {
10103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10104                        let encoded = common::to_string(&bytes);
10105                        match serde_json::from_str(&encoded) {
10106                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10107                            Err(error) => {
10108                                dlg.response_json_decode_error(&encoded, &error);
10109                                return Err(common::Error::JsonDecodeError(
10110                                    encoded.to_string(),
10111                                    error,
10112                                ));
10113                            }
10114                        }
10115                    };
10116
10117                    dlg.finished(true);
10118                    return Ok(response);
10119                }
10120            }
10121        }
10122    }
10123
10124    /// Required. The parent project name shared by all RecaptchaEnterpriseConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
10125    ///
10126    /// Sets the *parent* path property to the given value.
10127    ///
10128    /// Even though the property as already been set when instantiating this call,
10129    /// we provide this method for API completeness.
10130    pub fn parent(
10131        mut self,
10132        new_value: &str,
10133    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
10134        self._parent = new_value.to_string();
10135        self
10136    }
10137    /// Required. The relative resource names of the RecaptchaEnterpriseConfigs to retrieve, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ``` A maximum of 100 objects can be retrieved in a batch.
10138    ///
10139    /// Append the given value to the *names* query property.
10140    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10141    pub fn add_names(
10142        mut self,
10143        new_value: &str,
10144    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
10145        self._names.push(new_value.to_string());
10146        self
10147    }
10148    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10149    /// while executing the actual API request.
10150    ///
10151    /// ````text
10152    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10153    /// ````
10154    ///
10155    /// Sets the *delegate* property to the given value.
10156    pub fn delegate(
10157        mut self,
10158        new_value: &'a mut dyn common::Delegate,
10159    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
10160        self._delegate = Some(new_value);
10161        self
10162    }
10163
10164    /// Set any additional parameter of the query string used in the request.
10165    /// It should be used to set parameters which are not yet available through their own
10166    /// setters.
10167    ///
10168    /// Please note that this method must not be used to set any of the known parameters
10169    /// which have their own setter method. If done anyway, the request will fail.
10170    ///
10171    /// # Additional Parameters
10172    ///
10173    /// * *$.xgafv* (query-string) - V1 error format.
10174    /// * *access_token* (query-string) - OAuth access token.
10175    /// * *alt* (query-string) - Data format for response.
10176    /// * *callback* (query-string) - JSONP
10177    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10178    /// * *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.
10179    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10180    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10181    /// * *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.
10182    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10183    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10184    pub fn param<T>(
10185        mut self,
10186        name: T,
10187        value: T,
10188    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
10189    where
10190        T: AsRef<str>,
10191    {
10192        self._additional_params
10193            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10194        self
10195    }
10196
10197    /// Identifies the authorization scope for the method you are building.
10198    ///
10199    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10200    /// [`Scope::CloudPlatform`].
10201    ///
10202    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10203    /// tokens for more than one scope.
10204    ///
10205    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10206    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10207    /// sufficient, a read-write scope will do as well.
10208    pub fn add_scope<St>(
10209        mut self,
10210        scope: St,
10211    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
10212    where
10213        St: AsRef<str>,
10214    {
10215        self._scopes.insert(String::from(scope.as_ref()));
10216        self
10217    }
10218    /// Identifies the authorization scope(s) for the method you are building.
10219    ///
10220    /// See [`Self::add_scope()`] for details.
10221    pub fn add_scopes<I, St>(
10222        mut self,
10223        scopes: I,
10224    ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
10225    where
10226        I: IntoIterator<Item = St>,
10227        St: AsRef<str>,
10228    {
10229        self._scopes
10230            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10231        self
10232    }
10233
10234    /// Removes all scopes, and no default scope will be used either.
10235    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10236    /// for details).
10237    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
10238        self._scopes.clear();
10239        self
10240    }
10241}
10242
10243/// Gets the RecaptchaEnterpriseConfig for the specified app.
10244///
10245/// A builder for the *apps.recaptchaEnterpriseConfig.get* method supported by a *project* resource.
10246/// It is not used directly, but through a [`ProjectMethods`] instance.
10247///
10248/// # Example
10249///
10250/// Instantiate a resource method builder
10251///
10252/// ```test_harness,no_run
10253/// # extern crate hyper;
10254/// # extern crate hyper_rustls;
10255/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10256/// # async fn dox() {
10257/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10258///
10259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10260/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10261/// #     .with_native_roots()
10262/// #     .unwrap()
10263/// #     .https_only()
10264/// #     .enable_http2()
10265/// #     .build();
10266///
10267/// # let executor = hyper_util::rt::TokioExecutor::new();
10268/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10269/// #     secret,
10270/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10271/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10272/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10273/// #     ),
10274/// # ).build().await.unwrap();
10275///
10276/// # let client = hyper_util::client::legacy::Client::builder(
10277/// #     hyper_util::rt::TokioExecutor::new()
10278/// # )
10279/// # .build(
10280/// #     hyper_rustls::HttpsConnectorBuilder::new()
10281/// #         .with_native_roots()
10282/// #         .unwrap()
10283/// #         .https_or_http()
10284/// #         .enable_http2()
10285/// #         .build()
10286/// # );
10287/// # let mut hub = Firebaseappcheck::new(client, auth);
10288/// // You can configure optional parameters by calling the respective setters at will, and
10289/// // execute the final call using `doit()`.
10290/// // Values shown here are possibly random and not representative !
10291/// let result = hub.projects().apps_recaptcha_enterprise_config_get("name")
10292///              .doit().await;
10293/// # }
10294/// ```
10295pub struct ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10296where
10297    C: 'a,
10298{
10299    hub: &'a Firebaseappcheck<C>,
10300    _name: String,
10301    _delegate: Option<&'a mut dyn common::Delegate>,
10302    _additional_params: HashMap<String, String>,
10303    _scopes: BTreeSet<String>,
10304}
10305
10306impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {}
10307
10308impl<'a, C> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10309where
10310    C: common::Connector,
10311{
10312    /// Perform the operation you have build so far.
10313    pub async fn doit(
10314        mut self,
10315    ) -> common::Result<(
10316        common::Response,
10317        GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10318    )> {
10319        use std::borrow::Cow;
10320        use std::io::{Read, Seek};
10321
10322        use common::{url::Params, ToParts};
10323        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10324
10325        let mut dd = common::DefaultDelegate;
10326        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10327        dlg.begin(common::MethodInfo {
10328            id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.get",
10329            http_method: hyper::Method::GET,
10330        });
10331
10332        for &field in ["alt", "name"].iter() {
10333            if self._additional_params.contains_key(field) {
10334                dlg.finished(false);
10335                return Err(common::Error::FieldClash(field));
10336            }
10337        }
10338
10339        let mut params = Params::with_capacity(3 + self._additional_params.len());
10340        params.push("name", self._name);
10341
10342        params.extend(self._additional_params.iter());
10343
10344        params.push("alt", "json");
10345        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
10346        if self._scopes.is_empty() {
10347            self._scopes
10348                .insert(Scope::CloudPlatform.as_ref().to_string());
10349        }
10350
10351        #[allow(clippy::single_element_loop)]
10352        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10353            url = params.uri_replacement(url, param_name, find_this, true);
10354        }
10355        {
10356            let to_remove = ["name"];
10357            params.remove_params(&to_remove);
10358        }
10359
10360        let url = params.parse_with_url(&url);
10361
10362        loop {
10363            let token = match self
10364                .hub
10365                .auth
10366                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10367                .await
10368            {
10369                Ok(token) => token,
10370                Err(e) => match dlg.token(e) {
10371                    Ok(token) => token,
10372                    Err(e) => {
10373                        dlg.finished(false);
10374                        return Err(common::Error::MissingToken(e));
10375                    }
10376                },
10377            };
10378            let mut req_result = {
10379                let client = &self.hub.client;
10380                dlg.pre_request();
10381                let mut req_builder = hyper::Request::builder()
10382                    .method(hyper::Method::GET)
10383                    .uri(url.as_str())
10384                    .header(USER_AGENT, self.hub._user_agent.clone());
10385
10386                if let Some(token) = token.as_ref() {
10387                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10388                }
10389
10390                let request = req_builder
10391                    .header(CONTENT_LENGTH, 0_u64)
10392                    .body(common::to_body::<String>(None));
10393
10394                client.request(request.unwrap()).await
10395            };
10396
10397            match req_result {
10398                Err(err) => {
10399                    if let common::Retry::After(d) = dlg.http_error(&err) {
10400                        sleep(d).await;
10401                        continue;
10402                    }
10403                    dlg.finished(false);
10404                    return Err(common::Error::HttpError(err));
10405                }
10406                Ok(res) => {
10407                    let (mut parts, body) = res.into_parts();
10408                    let mut body = common::Body::new(body);
10409                    if !parts.status.is_success() {
10410                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10411                        let error = serde_json::from_str(&common::to_string(&bytes));
10412                        let response = common::to_response(parts, bytes.into());
10413
10414                        if let common::Retry::After(d) =
10415                            dlg.http_failure(&response, error.as_ref().ok())
10416                        {
10417                            sleep(d).await;
10418                            continue;
10419                        }
10420
10421                        dlg.finished(false);
10422
10423                        return Err(match error {
10424                            Ok(value) => common::Error::BadRequest(value),
10425                            _ => common::Error::Failure(response),
10426                        });
10427                    }
10428                    let response = {
10429                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10430                        let encoded = common::to_string(&bytes);
10431                        match serde_json::from_str(&encoded) {
10432                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10433                            Err(error) => {
10434                                dlg.response_json_decode_error(&encoded, &error);
10435                                return Err(common::Error::JsonDecodeError(
10436                                    encoded.to_string(),
10437                                    error,
10438                                ));
10439                            }
10440                        }
10441                    };
10442
10443                    dlg.finished(true);
10444                    return Ok(response);
10445                }
10446            }
10447        }
10448    }
10449
10450    /// Required. The relative resource name of the RecaptchaEnterpriseConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
10451    ///
10452    /// Sets the *name* path property to the given value.
10453    ///
10454    /// Even though the property as already been set when instantiating this call,
10455    /// we provide this method for API completeness.
10456    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10457        self._name = new_value.to_string();
10458        self
10459    }
10460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10461    /// while executing the actual API request.
10462    ///
10463    /// ````text
10464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10465    /// ````
10466    ///
10467    /// Sets the *delegate* property to the given value.
10468    pub fn delegate(
10469        mut self,
10470        new_value: &'a mut dyn common::Delegate,
10471    ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10472        self._delegate = Some(new_value);
10473        self
10474    }
10475
10476    /// Set any additional parameter of the query string used in the request.
10477    /// It should be used to set parameters which are not yet available through their own
10478    /// setters.
10479    ///
10480    /// Please note that this method must not be used to set any of the known parameters
10481    /// which have their own setter method. If done anyway, the request will fail.
10482    ///
10483    /// # Additional Parameters
10484    ///
10485    /// * *$.xgafv* (query-string) - V1 error format.
10486    /// * *access_token* (query-string) - OAuth access token.
10487    /// * *alt* (query-string) - Data format for response.
10488    /// * *callback* (query-string) - JSONP
10489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10490    /// * *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.
10491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10493    /// * *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.
10494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10496    pub fn param<T>(
10497        mut self,
10498        name: T,
10499        value: T,
10500    ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10501    where
10502        T: AsRef<str>,
10503    {
10504        self._additional_params
10505            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10506        self
10507    }
10508
10509    /// Identifies the authorization scope for the method you are building.
10510    ///
10511    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10512    /// [`Scope::CloudPlatform`].
10513    ///
10514    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10515    /// tokens for more than one scope.
10516    ///
10517    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10518    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10519    /// sufficient, a read-write scope will do as well.
10520    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10521    where
10522        St: AsRef<str>,
10523    {
10524        self._scopes.insert(String::from(scope.as_ref()));
10525        self
10526    }
10527    /// Identifies the authorization scope(s) for the method you are building.
10528    ///
10529    /// See [`Self::add_scope()`] for details.
10530    pub fn add_scopes<I, St>(
10531        mut self,
10532        scopes: I,
10533    ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10534    where
10535        I: IntoIterator<Item = St>,
10536        St: AsRef<str>,
10537    {
10538        self._scopes
10539            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10540        self
10541    }
10542
10543    /// Removes all scopes, and no default scope will be used either.
10544    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10545    /// for details).
10546    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10547        self._scopes.clear();
10548        self
10549    }
10550}
10551
10552/// Updates the RecaptchaEnterpriseConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA Enterprise tokens for App Check tokens.
10553///
10554/// A builder for the *apps.recaptchaEnterpriseConfig.patch* method supported by a *project* resource.
10555/// It is not used directly, but through a [`ProjectMethods`] instance.
10556///
10557/// # Example
10558///
10559/// Instantiate a resource method builder
10560///
10561/// ```test_harness,no_run
10562/// # extern crate hyper;
10563/// # extern crate hyper_rustls;
10564/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10565/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig;
10566/// # async fn dox() {
10567/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10568///
10569/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10570/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10571/// #     .with_native_roots()
10572/// #     .unwrap()
10573/// #     .https_only()
10574/// #     .enable_http2()
10575/// #     .build();
10576///
10577/// # let executor = hyper_util::rt::TokioExecutor::new();
10578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10579/// #     secret,
10580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10581/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10582/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10583/// #     ),
10584/// # ).build().await.unwrap();
10585///
10586/// # let client = hyper_util::client::legacy::Client::builder(
10587/// #     hyper_util::rt::TokioExecutor::new()
10588/// # )
10589/// # .build(
10590/// #     hyper_rustls::HttpsConnectorBuilder::new()
10591/// #         .with_native_roots()
10592/// #         .unwrap()
10593/// #         .https_or_http()
10594/// #         .enable_http2()
10595/// #         .build()
10596/// # );
10597/// # let mut hub = Firebaseappcheck::new(client, auth);
10598/// // As the method needs a request, you would usually fill it with the desired information
10599/// // into the respective structure. Some of the parts shown here might not be applicable !
10600/// // Values shown here are possibly random and not representative !
10601/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig::default();
10602///
10603/// // You can configure optional parameters by calling the respective setters at will, and
10604/// // execute the final call using `doit()`.
10605/// // Values shown here are possibly random and not representative !
10606/// let result = hub.projects().apps_recaptcha_enterprise_config_patch(req, "name")
10607///              .update_mask(FieldMask::new::<&str>(&[]))
10608///              .doit().await;
10609/// # }
10610/// ```
10611pub struct ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10612where
10613    C: 'a,
10614{
10615    hub: &'a Firebaseappcheck<C>,
10616    _request: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10617    _name: String,
10618    _update_mask: Option<common::FieldMask>,
10619    _delegate: Option<&'a mut dyn common::Delegate>,
10620    _additional_params: HashMap<String, String>,
10621    _scopes: BTreeSet<String>,
10622}
10623
10624impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {}
10625
10626impl<'a, C> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10627where
10628    C: common::Connector,
10629{
10630    /// Perform the operation you have build so far.
10631    pub async fn doit(
10632        mut self,
10633    ) -> common::Result<(
10634        common::Response,
10635        GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10636    )> {
10637        use std::borrow::Cow;
10638        use std::io::{Read, Seek};
10639
10640        use common::{url::Params, ToParts};
10641        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10642
10643        let mut dd = common::DefaultDelegate;
10644        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10645        dlg.begin(common::MethodInfo {
10646            id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.patch",
10647            http_method: hyper::Method::PATCH,
10648        });
10649
10650        for &field in ["alt", "name", "updateMask"].iter() {
10651            if self._additional_params.contains_key(field) {
10652                dlg.finished(false);
10653                return Err(common::Error::FieldClash(field));
10654            }
10655        }
10656
10657        let mut params = Params::with_capacity(5 + self._additional_params.len());
10658        params.push("name", self._name);
10659        if let Some(value) = self._update_mask.as_ref() {
10660            params.push("updateMask", value.to_string());
10661        }
10662
10663        params.extend(self._additional_params.iter());
10664
10665        params.push("alt", "json");
10666        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
10667        if self._scopes.is_empty() {
10668            self._scopes
10669                .insert(Scope::CloudPlatform.as_ref().to_string());
10670        }
10671
10672        #[allow(clippy::single_element_loop)]
10673        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10674            url = params.uri_replacement(url, param_name, find_this, true);
10675        }
10676        {
10677            let to_remove = ["name"];
10678            params.remove_params(&to_remove);
10679        }
10680
10681        let url = params.parse_with_url(&url);
10682
10683        let mut json_mime_type = mime::APPLICATION_JSON;
10684        let mut request_value_reader = {
10685            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10686            common::remove_json_null_values(&mut value);
10687            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10688            serde_json::to_writer(&mut dst, &value).unwrap();
10689            dst
10690        };
10691        let request_size = request_value_reader
10692            .seek(std::io::SeekFrom::End(0))
10693            .unwrap();
10694        request_value_reader
10695            .seek(std::io::SeekFrom::Start(0))
10696            .unwrap();
10697
10698        loop {
10699            let token = match self
10700                .hub
10701                .auth
10702                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10703                .await
10704            {
10705                Ok(token) => token,
10706                Err(e) => match dlg.token(e) {
10707                    Ok(token) => token,
10708                    Err(e) => {
10709                        dlg.finished(false);
10710                        return Err(common::Error::MissingToken(e));
10711                    }
10712                },
10713            };
10714            request_value_reader
10715                .seek(std::io::SeekFrom::Start(0))
10716                .unwrap();
10717            let mut req_result = {
10718                let client = &self.hub.client;
10719                dlg.pre_request();
10720                let mut req_builder = hyper::Request::builder()
10721                    .method(hyper::Method::PATCH)
10722                    .uri(url.as_str())
10723                    .header(USER_AGENT, self.hub._user_agent.clone());
10724
10725                if let Some(token) = token.as_ref() {
10726                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10727                }
10728
10729                let request = req_builder
10730                    .header(CONTENT_TYPE, json_mime_type.to_string())
10731                    .header(CONTENT_LENGTH, request_size as u64)
10732                    .body(common::to_body(
10733                        request_value_reader.get_ref().clone().into(),
10734                    ));
10735
10736                client.request(request.unwrap()).await
10737            };
10738
10739            match req_result {
10740                Err(err) => {
10741                    if let common::Retry::After(d) = dlg.http_error(&err) {
10742                        sleep(d).await;
10743                        continue;
10744                    }
10745                    dlg.finished(false);
10746                    return Err(common::Error::HttpError(err));
10747                }
10748                Ok(res) => {
10749                    let (mut parts, body) = res.into_parts();
10750                    let mut body = common::Body::new(body);
10751                    if !parts.status.is_success() {
10752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10753                        let error = serde_json::from_str(&common::to_string(&bytes));
10754                        let response = common::to_response(parts, bytes.into());
10755
10756                        if let common::Retry::After(d) =
10757                            dlg.http_failure(&response, error.as_ref().ok())
10758                        {
10759                            sleep(d).await;
10760                            continue;
10761                        }
10762
10763                        dlg.finished(false);
10764
10765                        return Err(match error {
10766                            Ok(value) => common::Error::BadRequest(value),
10767                            _ => common::Error::Failure(response),
10768                        });
10769                    }
10770                    let response = {
10771                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10772                        let encoded = common::to_string(&bytes);
10773                        match serde_json::from_str(&encoded) {
10774                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10775                            Err(error) => {
10776                                dlg.response_json_decode_error(&encoded, &error);
10777                                return Err(common::Error::JsonDecodeError(
10778                                    encoded.to_string(),
10779                                    error,
10780                                ));
10781                            }
10782                        }
10783                    };
10784
10785                    dlg.finished(true);
10786                    return Ok(response);
10787                }
10788            }
10789        }
10790    }
10791
10792    ///
10793    /// Sets the *request* property to the given value.
10794    ///
10795    /// Even though the property as already been set when instantiating this call,
10796    /// we provide this method for API completeness.
10797    pub fn request(
10798        mut self,
10799        new_value: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10800    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10801        self._request = new_value;
10802        self
10803    }
10804    /// Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
10805    ///
10806    /// Sets the *name* path property to the given value.
10807    ///
10808    /// Even though the property as already been set when instantiating this call,
10809    /// we provide this method for API completeness.
10810    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10811        self._name = new_value.to_string();
10812        self
10813    }
10814    /// Required. A comma-separated list of names of fields in the RecaptchaEnterpriseConfig to update. Example: `site_key`.
10815    ///
10816    /// Sets the *update mask* query property to the given value.
10817    pub fn update_mask(
10818        mut self,
10819        new_value: common::FieldMask,
10820    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10821        self._update_mask = Some(new_value);
10822        self
10823    }
10824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10825    /// while executing the actual API request.
10826    ///
10827    /// ````text
10828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10829    /// ````
10830    ///
10831    /// Sets the *delegate* property to the given value.
10832    pub fn delegate(
10833        mut self,
10834        new_value: &'a mut dyn common::Delegate,
10835    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10836        self._delegate = Some(new_value);
10837        self
10838    }
10839
10840    /// Set any additional parameter of the query string used in the request.
10841    /// It should be used to set parameters which are not yet available through their own
10842    /// setters.
10843    ///
10844    /// Please note that this method must not be used to set any of the known parameters
10845    /// which have their own setter method. If done anyway, the request will fail.
10846    ///
10847    /// # Additional Parameters
10848    ///
10849    /// * *$.xgafv* (query-string) - V1 error format.
10850    /// * *access_token* (query-string) - OAuth access token.
10851    /// * *alt* (query-string) - Data format for response.
10852    /// * *callback* (query-string) - JSONP
10853    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10854    /// * *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.
10855    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10856    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10857    /// * *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.
10858    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10859    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10860    pub fn param<T>(
10861        mut self,
10862        name: T,
10863        value: T,
10864    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10865    where
10866        T: AsRef<str>,
10867    {
10868        self._additional_params
10869            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10870        self
10871    }
10872
10873    /// Identifies the authorization scope for the method you are building.
10874    ///
10875    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10876    /// [`Scope::CloudPlatform`].
10877    ///
10878    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10879    /// tokens for more than one scope.
10880    ///
10881    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10882    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10883    /// sufficient, a read-write scope will do as well.
10884    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10885    where
10886        St: AsRef<str>,
10887    {
10888        self._scopes.insert(String::from(scope.as_ref()));
10889        self
10890    }
10891    /// Identifies the authorization scope(s) for the method you are building.
10892    ///
10893    /// See [`Self::add_scope()`] for details.
10894    pub fn add_scopes<I, St>(
10895        mut self,
10896        scopes: I,
10897    ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10898    where
10899        I: IntoIterator<Item = St>,
10900        St: AsRef<str>,
10901    {
10902        self._scopes
10903            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10904        self
10905    }
10906
10907    /// Removes all scopes, and no default scope will be used either.
10908    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10909    /// for details).
10910    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10911        self._scopes.clear();
10912        self
10913    }
10914}
10915
10916/// Atomically gets the RecaptchaV3Configs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
10917///
10918/// A builder for the *apps.recaptchaV3Config.batchGet* method supported by a *project* resource.
10919/// It is not used directly, but through a [`ProjectMethods`] instance.
10920///
10921/// # Example
10922///
10923/// Instantiate a resource method builder
10924///
10925/// ```test_harness,no_run
10926/// # extern crate hyper;
10927/// # extern crate hyper_rustls;
10928/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10929/// # async fn dox() {
10930/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10931///
10932/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10933/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10934/// #     .with_native_roots()
10935/// #     .unwrap()
10936/// #     .https_only()
10937/// #     .enable_http2()
10938/// #     .build();
10939///
10940/// # let executor = hyper_util::rt::TokioExecutor::new();
10941/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10942/// #     secret,
10943/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10944/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10945/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10946/// #     ),
10947/// # ).build().await.unwrap();
10948///
10949/// # let client = hyper_util::client::legacy::Client::builder(
10950/// #     hyper_util::rt::TokioExecutor::new()
10951/// # )
10952/// # .build(
10953/// #     hyper_rustls::HttpsConnectorBuilder::new()
10954/// #         .with_native_roots()
10955/// #         .unwrap()
10956/// #         .https_or_http()
10957/// #         .enable_http2()
10958/// #         .build()
10959/// # );
10960/// # let mut hub = Firebaseappcheck::new(client, auth);
10961/// // You can configure optional parameters by calling the respective setters at will, and
10962/// // execute the final call using `doit()`.
10963/// // Values shown here are possibly random and not representative !
10964/// let result = hub.projects().apps_recaptcha_v3_config_batch_get("parent")
10965///              .add_names("eos")
10966///              .doit().await;
10967/// # }
10968/// ```
10969pub struct ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10970where
10971    C: 'a,
10972{
10973    hub: &'a Firebaseappcheck<C>,
10974    _parent: String,
10975    _names: Vec<String>,
10976    _delegate: Option<&'a mut dyn common::Delegate>,
10977    _additional_params: HashMap<String, String>,
10978    _scopes: BTreeSet<String>,
10979}
10980
10981impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {}
10982
10983impl<'a, C> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10984where
10985    C: common::Connector,
10986{
10987    /// Perform the operation you have build so far.
10988    pub async fn doit(
10989        mut self,
10990    ) -> common::Result<(
10991        common::Response,
10992        GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse,
10993    )> {
10994        use std::borrow::Cow;
10995        use std::io::{Read, Seek};
10996
10997        use common::{url::Params, ToParts};
10998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10999
11000        let mut dd = common::DefaultDelegate;
11001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11002        dlg.begin(common::MethodInfo {
11003            id: "firebaseappcheck.projects.apps.recaptchaV3Config.batchGet",
11004            http_method: hyper::Method::GET,
11005        });
11006
11007        for &field in ["alt", "parent", "names"].iter() {
11008            if self._additional_params.contains_key(field) {
11009                dlg.finished(false);
11010                return Err(common::Error::FieldClash(field));
11011            }
11012        }
11013
11014        let mut params = Params::with_capacity(4 + self._additional_params.len());
11015        params.push("parent", self._parent);
11016        if !self._names.is_empty() {
11017            for f in self._names.iter() {
11018                params.push("names", f);
11019            }
11020        }
11021
11022        params.extend(self._additional_params.iter());
11023
11024        params.push("alt", "json");
11025        let mut url =
11026            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/recaptchaV3Config:batchGet";
11027        if self._scopes.is_empty() {
11028            self._scopes
11029                .insert(Scope::CloudPlatform.as_ref().to_string());
11030        }
11031
11032        #[allow(clippy::single_element_loop)]
11033        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11034            url = params.uri_replacement(url, param_name, find_this, true);
11035        }
11036        {
11037            let to_remove = ["parent"];
11038            params.remove_params(&to_remove);
11039        }
11040
11041        let url = params.parse_with_url(&url);
11042
11043        loop {
11044            let token = match self
11045                .hub
11046                .auth
11047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11048                .await
11049            {
11050                Ok(token) => token,
11051                Err(e) => match dlg.token(e) {
11052                    Ok(token) => token,
11053                    Err(e) => {
11054                        dlg.finished(false);
11055                        return Err(common::Error::MissingToken(e));
11056                    }
11057                },
11058            };
11059            let mut req_result = {
11060                let client = &self.hub.client;
11061                dlg.pre_request();
11062                let mut req_builder = hyper::Request::builder()
11063                    .method(hyper::Method::GET)
11064                    .uri(url.as_str())
11065                    .header(USER_AGENT, self.hub._user_agent.clone());
11066
11067                if let Some(token) = token.as_ref() {
11068                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11069                }
11070
11071                let request = req_builder
11072                    .header(CONTENT_LENGTH, 0_u64)
11073                    .body(common::to_body::<String>(None));
11074
11075                client.request(request.unwrap()).await
11076            };
11077
11078            match req_result {
11079                Err(err) => {
11080                    if let common::Retry::After(d) = dlg.http_error(&err) {
11081                        sleep(d).await;
11082                        continue;
11083                    }
11084                    dlg.finished(false);
11085                    return Err(common::Error::HttpError(err));
11086                }
11087                Ok(res) => {
11088                    let (mut parts, body) = res.into_parts();
11089                    let mut body = common::Body::new(body);
11090                    if !parts.status.is_success() {
11091                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11092                        let error = serde_json::from_str(&common::to_string(&bytes));
11093                        let response = common::to_response(parts, bytes.into());
11094
11095                        if let common::Retry::After(d) =
11096                            dlg.http_failure(&response, error.as_ref().ok())
11097                        {
11098                            sleep(d).await;
11099                            continue;
11100                        }
11101
11102                        dlg.finished(false);
11103
11104                        return Err(match error {
11105                            Ok(value) => common::Error::BadRequest(value),
11106                            _ => common::Error::Failure(response),
11107                        });
11108                    }
11109                    let response = {
11110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11111                        let encoded = common::to_string(&bytes);
11112                        match serde_json::from_str(&encoded) {
11113                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11114                            Err(error) => {
11115                                dlg.response_json_decode_error(&encoded, &error);
11116                                return Err(common::Error::JsonDecodeError(
11117                                    encoded.to_string(),
11118                                    error,
11119                                ));
11120                            }
11121                        }
11122                    };
11123
11124                    dlg.finished(true);
11125                    return Ok(response);
11126                }
11127            }
11128        }
11129    }
11130
11131    /// Required. The parent project name shared by all RecaptchaV3Configs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
11132    ///
11133    /// Sets the *parent* path property to the given value.
11134    ///
11135    /// Even though the property as already been set when instantiating this call,
11136    /// we provide this method for API completeness.
11137    pub fn parent(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
11138        self._parent = new_value.to_string();
11139        self
11140    }
11141    /// Required. The relative resource names of the RecaptchaV3Configs to retrieve, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ``` A maximum of 100 objects can be retrieved in a batch.
11142    ///
11143    /// Append the given value to the *names* query property.
11144    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11145    pub fn add_names(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
11146        self._names.push(new_value.to_string());
11147        self
11148    }
11149    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11150    /// while executing the actual API request.
11151    ///
11152    /// ````text
11153    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11154    /// ````
11155    ///
11156    /// Sets the *delegate* property to the given value.
11157    pub fn delegate(
11158        mut self,
11159        new_value: &'a mut dyn common::Delegate,
11160    ) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
11161        self._delegate = Some(new_value);
11162        self
11163    }
11164
11165    /// Set any additional parameter of the query string used in the request.
11166    /// It should be used to set parameters which are not yet available through their own
11167    /// setters.
11168    ///
11169    /// Please note that this method must not be used to set any of the known parameters
11170    /// which have their own setter method. If done anyway, the request will fail.
11171    ///
11172    /// # Additional Parameters
11173    ///
11174    /// * *$.xgafv* (query-string) - V1 error format.
11175    /// * *access_token* (query-string) - OAuth access token.
11176    /// * *alt* (query-string) - Data format for response.
11177    /// * *callback* (query-string) - JSONP
11178    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11179    /// * *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.
11180    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11181    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11182    /// * *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.
11183    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11184    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11185    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
11186    where
11187        T: AsRef<str>,
11188    {
11189        self._additional_params
11190            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11191        self
11192    }
11193
11194    /// Identifies the authorization scope for the method you are building.
11195    ///
11196    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11197    /// [`Scope::CloudPlatform`].
11198    ///
11199    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11200    /// tokens for more than one scope.
11201    ///
11202    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11203    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11204    /// sufficient, a read-write scope will do as well.
11205    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
11206    where
11207        St: AsRef<str>,
11208    {
11209        self._scopes.insert(String::from(scope.as_ref()));
11210        self
11211    }
11212    /// Identifies the authorization scope(s) for the method you are building.
11213    ///
11214    /// See [`Self::add_scope()`] for details.
11215    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
11216    where
11217        I: IntoIterator<Item = St>,
11218        St: AsRef<str>,
11219    {
11220        self._scopes
11221            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11222        self
11223    }
11224
11225    /// Removes all scopes, and no default scope will be used either.
11226    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11227    /// for details).
11228    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
11229        self._scopes.clear();
11230        self
11231    }
11232}
11233
11234/// Gets the RecaptchaV3Config for the specified app. For security reasons, the `site_secret` field is never populated in the response.
11235///
11236/// A builder for the *apps.recaptchaV3Config.get* method supported by a *project* resource.
11237/// It is not used directly, but through a [`ProjectMethods`] instance.
11238///
11239/// # Example
11240///
11241/// Instantiate a resource method builder
11242///
11243/// ```test_harness,no_run
11244/// # extern crate hyper;
11245/// # extern crate hyper_rustls;
11246/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11247/// # async fn dox() {
11248/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11249///
11250/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11251/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11252/// #     .with_native_roots()
11253/// #     .unwrap()
11254/// #     .https_only()
11255/// #     .enable_http2()
11256/// #     .build();
11257///
11258/// # let executor = hyper_util::rt::TokioExecutor::new();
11259/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11260/// #     secret,
11261/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11262/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11263/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11264/// #     ),
11265/// # ).build().await.unwrap();
11266///
11267/// # let client = hyper_util::client::legacy::Client::builder(
11268/// #     hyper_util::rt::TokioExecutor::new()
11269/// # )
11270/// # .build(
11271/// #     hyper_rustls::HttpsConnectorBuilder::new()
11272/// #         .with_native_roots()
11273/// #         .unwrap()
11274/// #         .https_or_http()
11275/// #         .enable_http2()
11276/// #         .build()
11277/// # );
11278/// # let mut hub = Firebaseappcheck::new(client, auth);
11279/// // You can configure optional parameters by calling the respective setters at will, and
11280/// // execute the final call using `doit()`.
11281/// // Values shown here are possibly random and not representative !
11282/// let result = hub.projects().apps_recaptcha_v3_config_get("name")
11283///              .doit().await;
11284/// # }
11285/// ```
11286pub struct ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11287where
11288    C: 'a,
11289{
11290    hub: &'a Firebaseappcheck<C>,
11291    _name: String,
11292    _delegate: Option<&'a mut dyn common::Delegate>,
11293    _additional_params: HashMap<String, String>,
11294    _scopes: BTreeSet<String>,
11295}
11296
11297impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigGetCall<'a, C> {}
11298
11299impl<'a, C> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11300where
11301    C: common::Connector,
11302{
11303    /// Perform the operation you have build so far.
11304    pub async fn doit(
11305        mut self,
11306    ) -> common::Result<(
11307        common::Response,
11308        GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11309    )> {
11310        use std::borrow::Cow;
11311        use std::io::{Read, Seek};
11312
11313        use common::{url::Params, ToParts};
11314        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11315
11316        let mut dd = common::DefaultDelegate;
11317        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11318        dlg.begin(common::MethodInfo {
11319            id: "firebaseappcheck.projects.apps.recaptchaV3Config.get",
11320            http_method: hyper::Method::GET,
11321        });
11322
11323        for &field in ["alt", "name"].iter() {
11324            if self._additional_params.contains_key(field) {
11325                dlg.finished(false);
11326                return Err(common::Error::FieldClash(field));
11327            }
11328        }
11329
11330        let mut params = Params::with_capacity(3 + self._additional_params.len());
11331        params.push("name", self._name);
11332
11333        params.extend(self._additional_params.iter());
11334
11335        params.push("alt", "json");
11336        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
11337        if self._scopes.is_empty() {
11338            self._scopes
11339                .insert(Scope::CloudPlatform.as_ref().to_string());
11340        }
11341
11342        #[allow(clippy::single_element_loop)]
11343        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11344            url = params.uri_replacement(url, param_name, find_this, true);
11345        }
11346        {
11347            let to_remove = ["name"];
11348            params.remove_params(&to_remove);
11349        }
11350
11351        let url = params.parse_with_url(&url);
11352
11353        loop {
11354            let token = match self
11355                .hub
11356                .auth
11357                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11358                .await
11359            {
11360                Ok(token) => token,
11361                Err(e) => match dlg.token(e) {
11362                    Ok(token) => token,
11363                    Err(e) => {
11364                        dlg.finished(false);
11365                        return Err(common::Error::MissingToken(e));
11366                    }
11367                },
11368            };
11369            let mut req_result = {
11370                let client = &self.hub.client;
11371                dlg.pre_request();
11372                let mut req_builder = hyper::Request::builder()
11373                    .method(hyper::Method::GET)
11374                    .uri(url.as_str())
11375                    .header(USER_AGENT, self.hub._user_agent.clone());
11376
11377                if let Some(token) = token.as_ref() {
11378                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11379                }
11380
11381                let request = req_builder
11382                    .header(CONTENT_LENGTH, 0_u64)
11383                    .body(common::to_body::<String>(None));
11384
11385                client.request(request.unwrap()).await
11386            };
11387
11388            match req_result {
11389                Err(err) => {
11390                    if let common::Retry::After(d) = dlg.http_error(&err) {
11391                        sleep(d).await;
11392                        continue;
11393                    }
11394                    dlg.finished(false);
11395                    return Err(common::Error::HttpError(err));
11396                }
11397                Ok(res) => {
11398                    let (mut parts, body) = res.into_parts();
11399                    let mut body = common::Body::new(body);
11400                    if !parts.status.is_success() {
11401                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11402                        let error = serde_json::from_str(&common::to_string(&bytes));
11403                        let response = common::to_response(parts, bytes.into());
11404
11405                        if let common::Retry::After(d) =
11406                            dlg.http_failure(&response, error.as_ref().ok())
11407                        {
11408                            sleep(d).await;
11409                            continue;
11410                        }
11411
11412                        dlg.finished(false);
11413
11414                        return Err(match error {
11415                            Ok(value) => common::Error::BadRequest(value),
11416                            _ => common::Error::Failure(response),
11417                        });
11418                    }
11419                    let response = {
11420                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11421                        let encoded = common::to_string(&bytes);
11422                        match serde_json::from_str(&encoded) {
11423                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11424                            Err(error) => {
11425                                dlg.response_json_decode_error(&encoded, &error);
11426                                return Err(common::Error::JsonDecodeError(
11427                                    encoded.to_string(),
11428                                    error,
11429                                ));
11430                            }
11431                        }
11432                    };
11433
11434                    dlg.finished(true);
11435                    return Ok(response);
11436                }
11437            }
11438        }
11439    }
11440
11441    /// Required. The relative resource name of the RecaptchaV3Config, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
11442    ///
11443    /// Sets the *name* path property to the given value.
11444    ///
11445    /// Even though the property as already been set when instantiating this call,
11446    /// we provide this method for API completeness.
11447    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11448        self._name = new_value.to_string();
11449        self
11450    }
11451    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11452    /// while executing the actual API request.
11453    ///
11454    /// ````text
11455    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11456    /// ````
11457    ///
11458    /// Sets the *delegate* property to the given value.
11459    pub fn delegate(
11460        mut self,
11461        new_value: &'a mut dyn common::Delegate,
11462    ) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11463        self._delegate = Some(new_value);
11464        self
11465    }
11466
11467    /// Set any additional parameter of the query string used in the request.
11468    /// It should be used to set parameters which are not yet available through their own
11469    /// setters.
11470    ///
11471    /// Please note that this method must not be used to set any of the known parameters
11472    /// which have their own setter method. If done anyway, the request will fail.
11473    ///
11474    /// # Additional Parameters
11475    ///
11476    /// * *$.xgafv* (query-string) - V1 error format.
11477    /// * *access_token* (query-string) - OAuth access token.
11478    /// * *alt* (query-string) - Data format for response.
11479    /// * *callback* (query-string) - JSONP
11480    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11481    /// * *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.
11482    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11483    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11484    /// * *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.
11485    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11486    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11487    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11488    where
11489        T: AsRef<str>,
11490    {
11491        self._additional_params
11492            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11493        self
11494    }
11495
11496    /// Identifies the authorization scope for the method you are building.
11497    ///
11498    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11499    /// [`Scope::CloudPlatform`].
11500    ///
11501    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11502    /// tokens for more than one scope.
11503    ///
11504    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11505    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11506    /// sufficient, a read-write scope will do as well.
11507    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11508    where
11509        St: AsRef<str>,
11510    {
11511        self._scopes.insert(String::from(scope.as_ref()));
11512        self
11513    }
11514    /// Identifies the authorization scope(s) for the method you are building.
11515    ///
11516    /// See [`Self::add_scope()`] for details.
11517    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11518    where
11519        I: IntoIterator<Item = St>,
11520        St: AsRef<str>,
11521    {
11522        self._scopes
11523            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11524        self
11525    }
11526
11527    /// Removes all scopes, and no default scope will be used either.
11528    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11529    /// for details).
11530    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11531        self._scopes.clear();
11532        self
11533    }
11534}
11535
11536/// Updates the RecaptchaV3Config for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange reCAPTCHA V3 tokens for App Check tokens. For security reasons, the `site_secret` field is never populated in the response.
11537///
11538/// A builder for the *apps.recaptchaV3Config.patch* method supported by a *project* resource.
11539/// It is not used directly, but through a [`ProjectMethods`] instance.
11540///
11541/// # Example
11542///
11543/// Instantiate a resource method builder
11544///
11545/// ```test_harness,no_run
11546/// # extern crate hyper;
11547/// # extern crate hyper_rustls;
11548/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11549/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaV3Config;
11550/// # async fn dox() {
11551/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11552///
11553/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11554/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11555/// #     .with_native_roots()
11556/// #     .unwrap()
11557/// #     .https_only()
11558/// #     .enable_http2()
11559/// #     .build();
11560///
11561/// # let executor = hyper_util::rt::TokioExecutor::new();
11562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11563/// #     secret,
11564/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11565/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11566/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11567/// #     ),
11568/// # ).build().await.unwrap();
11569///
11570/// # let client = hyper_util::client::legacy::Client::builder(
11571/// #     hyper_util::rt::TokioExecutor::new()
11572/// # )
11573/// # .build(
11574/// #     hyper_rustls::HttpsConnectorBuilder::new()
11575/// #         .with_native_roots()
11576/// #         .unwrap()
11577/// #         .https_or_http()
11578/// #         .enable_http2()
11579/// #         .build()
11580/// # );
11581/// # let mut hub = Firebaseappcheck::new(client, auth);
11582/// // As the method needs a request, you would usually fill it with the desired information
11583/// // into the respective structure. Some of the parts shown here might not be applicable !
11584/// // Values shown here are possibly random and not representative !
11585/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaV3Config::default();
11586///
11587/// // You can configure optional parameters by calling the respective setters at will, and
11588/// // execute the final call using `doit()`.
11589/// // Values shown here are possibly random and not representative !
11590/// let result = hub.projects().apps_recaptcha_v3_config_patch(req, "name")
11591///              .update_mask(FieldMask::new::<&str>(&[]))
11592///              .doit().await;
11593/// # }
11594/// ```
11595pub struct ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11596where
11597    C: 'a,
11598{
11599    hub: &'a Firebaseappcheck<C>,
11600    _request: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11601    _name: String,
11602    _update_mask: Option<common::FieldMask>,
11603    _delegate: Option<&'a mut dyn common::Delegate>,
11604    _additional_params: HashMap<String, String>,
11605    _scopes: BTreeSet<String>,
11606}
11607
11608impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {}
11609
11610impl<'a, C> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11611where
11612    C: common::Connector,
11613{
11614    /// Perform the operation you have build so far.
11615    pub async fn doit(
11616        mut self,
11617    ) -> common::Result<(
11618        common::Response,
11619        GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11620    )> {
11621        use std::borrow::Cow;
11622        use std::io::{Read, Seek};
11623
11624        use common::{url::Params, ToParts};
11625        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11626
11627        let mut dd = common::DefaultDelegate;
11628        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11629        dlg.begin(common::MethodInfo {
11630            id: "firebaseappcheck.projects.apps.recaptchaV3Config.patch",
11631            http_method: hyper::Method::PATCH,
11632        });
11633
11634        for &field in ["alt", "name", "updateMask"].iter() {
11635            if self._additional_params.contains_key(field) {
11636                dlg.finished(false);
11637                return Err(common::Error::FieldClash(field));
11638            }
11639        }
11640
11641        let mut params = Params::with_capacity(5 + self._additional_params.len());
11642        params.push("name", self._name);
11643        if let Some(value) = self._update_mask.as_ref() {
11644            params.push("updateMask", value.to_string());
11645        }
11646
11647        params.extend(self._additional_params.iter());
11648
11649        params.push("alt", "json");
11650        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
11651        if self._scopes.is_empty() {
11652            self._scopes
11653                .insert(Scope::CloudPlatform.as_ref().to_string());
11654        }
11655
11656        #[allow(clippy::single_element_loop)]
11657        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11658            url = params.uri_replacement(url, param_name, find_this, true);
11659        }
11660        {
11661            let to_remove = ["name"];
11662            params.remove_params(&to_remove);
11663        }
11664
11665        let url = params.parse_with_url(&url);
11666
11667        let mut json_mime_type = mime::APPLICATION_JSON;
11668        let mut request_value_reader = {
11669            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11670            common::remove_json_null_values(&mut value);
11671            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11672            serde_json::to_writer(&mut dst, &value).unwrap();
11673            dst
11674        };
11675        let request_size = request_value_reader
11676            .seek(std::io::SeekFrom::End(0))
11677            .unwrap();
11678        request_value_reader
11679            .seek(std::io::SeekFrom::Start(0))
11680            .unwrap();
11681
11682        loop {
11683            let token = match self
11684                .hub
11685                .auth
11686                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11687                .await
11688            {
11689                Ok(token) => token,
11690                Err(e) => match dlg.token(e) {
11691                    Ok(token) => token,
11692                    Err(e) => {
11693                        dlg.finished(false);
11694                        return Err(common::Error::MissingToken(e));
11695                    }
11696                },
11697            };
11698            request_value_reader
11699                .seek(std::io::SeekFrom::Start(0))
11700                .unwrap();
11701            let mut req_result = {
11702                let client = &self.hub.client;
11703                dlg.pre_request();
11704                let mut req_builder = hyper::Request::builder()
11705                    .method(hyper::Method::PATCH)
11706                    .uri(url.as_str())
11707                    .header(USER_AGENT, self.hub._user_agent.clone());
11708
11709                if let Some(token) = token.as_ref() {
11710                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11711                }
11712
11713                let request = req_builder
11714                    .header(CONTENT_TYPE, json_mime_type.to_string())
11715                    .header(CONTENT_LENGTH, request_size as u64)
11716                    .body(common::to_body(
11717                        request_value_reader.get_ref().clone().into(),
11718                    ));
11719
11720                client.request(request.unwrap()).await
11721            };
11722
11723            match req_result {
11724                Err(err) => {
11725                    if let common::Retry::After(d) = dlg.http_error(&err) {
11726                        sleep(d).await;
11727                        continue;
11728                    }
11729                    dlg.finished(false);
11730                    return Err(common::Error::HttpError(err));
11731                }
11732                Ok(res) => {
11733                    let (mut parts, body) = res.into_parts();
11734                    let mut body = common::Body::new(body);
11735                    if !parts.status.is_success() {
11736                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11737                        let error = serde_json::from_str(&common::to_string(&bytes));
11738                        let response = common::to_response(parts, bytes.into());
11739
11740                        if let common::Retry::After(d) =
11741                            dlg.http_failure(&response, error.as_ref().ok())
11742                        {
11743                            sleep(d).await;
11744                            continue;
11745                        }
11746
11747                        dlg.finished(false);
11748
11749                        return Err(match error {
11750                            Ok(value) => common::Error::BadRequest(value),
11751                            _ => common::Error::Failure(response),
11752                        });
11753                    }
11754                    let response = {
11755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11756                        let encoded = common::to_string(&bytes);
11757                        match serde_json::from_str(&encoded) {
11758                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11759                            Err(error) => {
11760                                dlg.response_json_decode_error(&encoded, &error);
11761                                return Err(common::Error::JsonDecodeError(
11762                                    encoded.to_string(),
11763                                    error,
11764                                ));
11765                            }
11766                        }
11767                    };
11768
11769                    dlg.finished(true);
11770                    return Ok(response);
11771                }
11772            }
11773        }
11774    }
11775
11776    ///
11777    /// Sets the *request* property to the given value.
11778    ///
11779    /// Even though the property as already been set when instantiating this call,
11780    /// we provide this method for API completeness.
11781    pub fn request(
11782        mut self,
11783        new_value: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11784    ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11785        self._request = new_value;
11786        self
11787    }
11788    /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
11789    ///
11790    /// Sets the *name* path property to the given value.
11791    ///
11792    /// Even though the property as already been set when instantiating this call,
11793    /// we provide this method for API completeness.
11794    pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11795        self._name = new_value.to_string();
11796        self
11797    }
11798    /// Required. A comma-separated list of names of fields in the RecaptchaV3Config to update. Example: `site_secret`.
11799    ///
11800    /// Sets the *update mask* query property to the given value.
11801    pub fn update_mask(
11802        mut self,
11803        new_value: common::FieldMask,
11804    ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11805        self._update_mask = Some(new_value);
11806        self
11807    }
11808    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11809    /// while executing the actual API request.
11810    ///
11811    /// ````text
11812    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11813    /// ````
11814    ///
11815    /// Sets the *delegate* property to the given value.
11816    pub fn delegate(
11817        mut self,
11818        new_value: &'a mut dyn common::Delegate,
11819    ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11820        self._delegate = Some(new_value);
11821        self
11822    }
11823
11824    /// Set any additional parameter of the query string used in the request.
11825    /// It should be used to set parameters which are not yet available through their own
11826    /// setters.
11827    ///
11828    /// Please note that this method must not be used to set any of the known parameters
11829    /// which have their own setter method. If done anyway, the request will fail.
11830    ///
11831    /// # Additional Parameters
11832    ///
11833    /// * *$.xgafv* (query-string) - V1 error format.
11834    /// * *access_token* (query-string) - OAuth access token.
11835    /// * *alt* (query-string) - Data format for response.
11836    /// * *callback* (query-string) - JSONP
11837    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11838    /// * *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.
11839    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11840    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11841    /// * *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.
11842    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11843    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11844    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11845    where
11846        T: AsRef<str>,
11847    {
11848        self._additional_params
11849            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11850        self
11851    }
11852
11853    /// Identifies the authorization scope for the method you are building.
11854    ///
11855    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11856    /// [`Scope::CloudPlatform`].
11857    ///
11858    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11859    /// tokens for more than one scope.
11860    ///
11861    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11862    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11863    /// sufficient, a read-write scope will do as well.
11864    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11865    where
11866        St: AsRef<str>,
11867    {
11868        self._scopes.insert(String::from(scope.as_ref()));
11869        self
11870    }
11871    /// Identifies the authorization scope(s) for the method you are building.
11872    ///
11873    /// See [`Self::add_scope()`] for details.
11874    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11875    where
11876        I: IntoIterator<Item = St>,
11877        St: AsRef<str>,
11878    {
11879        self._scopes
11880            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11881        self
11882    }
11883
11884    /// Removes all scopes, and no default scope will be used either.
11885    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11886    /// for details).
11887    pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11888        self._scopes.clear();
11889        self
11890    }
11891}
11892
11893/// Atomically gets the SafetyNetConfigs for the specified list of apps.
11894///
11895/// A builder for the *apps.safetyNetConfig.batchGet* method supported by a *project* resource.
11896/// It is not used directly, but through a [`ProjectMethods`] instance.
11897///
11898/// # Example
11899///
11900/// Instantiate a resource method builder
11901///
11902/// ```test_harness,no_run
11903/// # extern crate hyper;
11904/// # extern crate hyper_rustls;
11905/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11906/// # async fn dox() {
11907/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11908///
11909/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11910/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11911/// #     .with_native_roots()
11912/// #     .unwrap()
11913/// #     .https_only()
11914/// #     .enable_http2()
11915/// #     .build();
11916///
11917/// # let executor = hyper_util::rt::TokioExecutor::new();
11918/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11919/// #     secret,
11920/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11921/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11922/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11923/// #     ),
11924/// # ).build().await.unwrap();
11925///
11926/// # let client = hyper_util::client::legacy::Client::builder(
11927/// #     hyper_util::rt::TokioExecutor::new()
11928/// # )
11929/// # .build(
11930/// #     hyper_rustls::HttpsConnectorBuilder::new()
11931/// #         .with_native_roots()
11932/// #         .unwrap()
11933/// #         .https_or_http()
11934/// #         .enable_http2()
11935/// #         .build()
11936/// # );
11937/// # let mut hub = Firebaseappcheck::new(client, auth);
11938/// // You can configure optional parameters by calling the respective setters at will, and
11939/// // execute the final call using `doit()`.
11940/// // Values shown here are possibly random and not representative !
11941/// let result = hub.projects().apps_safety_net_config_batch_get("parent")
11942///              .add_names("sed")
11943///              .doit().await;
11944/// # }
11945/// ```
11946pub struct ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11947where
11948    C: 'a,
11949{
11950    hub: &'a Firebaseappcheck<C>,
11951    _parent: String,
11952    _names: Vec<String>,
11953    _delegate: Option<&'a mut dyn common::Delegate>,
11954    _additional_params: HashMap<String, String>,
11955    _scopes: BTreeSet<String>,
11956}
11957
11958impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigBatchGetCall<'a, C> {}
11959
11960impl<'a, C> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11961where
11962    C: common::Connector,
11963{
11964    /// Perform the operation you have build so far.
11965    pub async fn doit(
11966        mut self,
11967    ) -> common::Result<(
11968        common::Response,
11969        GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse,
11970    )> {
11971        use std::borrow::Cow;
11972        use std::io::{Read, Seek};
11973
11974        use common::{url::Params, ToParts};
11975        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11976
11977        let mut dd = common::DefaultDelegate;
11978        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11979        dlg.begin(common::MethodInfo {
11980            id: "firebaseappcheck.projects.apps.safetyNetConfig.batchGet",
11981            http_method: hyper::Method::GET,
11982        });
11983
11984        for &field in ["alt", "parent", "names"].iter() {
11985            if self._additional_params.contains_key(field) {
11986                dlg.finished(false);
11987                return Err(common::Error::FieldClash(field));
11988            }
11989        }
11990
11991        let mut params = Params::with_capacity(4 + self._additional_params.len());
11992        params.push("parent", self._parent);
11993        if !self._names.is_empty() {
11994            for f in self._names.iter() {
11995                params.push("names", f);
11996            }
11997        }
11998
11999        params.extend(self._additional_params.iter());
12000
12001        params.push("alt", "json");
12002        let mut url =
12003            self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/safetyNetConfig:batchGet";
12004        if self._scopes.is_empty() {
12005            self._scopes
12006                .insert(Scope::CloudPlatform.as_ref().to_string());
12007        }
12008
12009        #[allow(clippy::single_element_loop)]
12010        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12011            url = params.uri_replacement(url, param_name, find_this, true);
12012        }
12013        {
12014            let to_remove = ["parent"];
12015            params.remove_params(&to_remove);
12016        }
12017
12018        let url = params.parse_with_url(&url);
12019
12020        loop {
12021            let token = match self
12022                .hub
12023                .auth
12024                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12025                .await
12026            {
12027                Ok(token) => token,
12028                Err(e) => match dlg.token(e) {
12029                    Ok(token) => token,
12030                    Err(e) => {
12031                        dlg.finished(false);
12032                        return Err(common::Error::MissingToken(e));
12033                    }
12034                },
12035            };
12036            let mut req_result = {
12037                let client = &self.hub.client;
12038                dlg.pre_request();
12039                let mut req_builder = hyper::Request::builder()
12040                    .method(hyper::Method::GET)
12041                    .uri(url.as_str())
12042                    .header(USER_AGENT, self.hub._user_agent.clone());
12043
12044                if let Some(token) = token.as_ref() {
12045                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12046                }
12047
12048                let request = req_builder
12049                    .header(CONTENT_LENGTH, 0_u64)
12050                    .body(common::to_body::<String>(None));
12051
12052                client.request(request.unwrap()).await
12053            };
12054
12055            match req_result {
12056                Err(err) => {
12057                    if let common::Retry::After(d) = dlg.http_error(&err) {
12058                        sleep(d).await;
12059                        continue;
12060                    }
12061                    dlg.finished(false);
12062                    return Err(common::Error::HttpError(err));
12063                }
12064                Ok(res) => {
12065                    let (mut parts, body) = res.into_parts();
12066                    let mut body = common::Body::new(body);
12067                    if !parts.status.is_success() {
12068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12069                        let error = serde_json::from_str(&common::to_string(&bytes));
12070                        let response = common::to_response(parts, bytes.into());
12071
12072                        if let common::Retry::After(d) =
12073                            dlg.http_failure(&response, error.as_ref().ok())
12074                        {
12075                            sleep(d).await;
12076                            continue;
12077                        }
12078
12079                        dlg.finished(false);
12080
12081                        return Err(match error {
12082                            Ok(value) => common::Error::BadRequest(value),
12083                            _ => common::Error::Failure(response),
12084                        });
12085                    }
12086                    let response = {
12087                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12088                        let encoded = common::to_string(&bytes);
12089                        match serde_json::from_str(&encoded) {
12090                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12091                            Err(error) => {
12092                                dlg.response_json_decode_error(&encoded, &error);
12093                                return Err(common::Error::JsonDecodeError(
12094                                    encoded.to_string(),
12095                                    error,
12096                                ));
12097                            }
12098                        }
12099                    };
12100
12101                    dlg.finished(true);
12102                    return Ok(response);
12103                }
12104            }
12105        }
12106    }
12107
12108    /// Required. The parent project name shared by all SafetyNetConfigs being retrieved, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being retrieved must match this field, or the entire batch fails.
12109    ///
12110    /// Sets the *parent* path property to the given value.
12111    ///
12112    /// Even though the property as already been set when instantiating this call,
12113    /// we provide this method for API completeness.
12114    pub fn parent(mut self, new_value: &str) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
12115        self._parent = new_value.to_string();
12116        self
12117    }
12118    /// Required. The relative resource names of the SafetyNetConfigs to retrieve, in the format ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ``` A maximum of 100 objects can be retrieved in a batch.
12119    ///
12120    /// Append the given value to the *names* query property.
12121    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
12122    pub fn add_names(mut self, new_value: &str) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
12123        self._names.push(new_value.to_string());
12124        self
12125    }
12126    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12127    /// while executing the actual API request.
12128    ///
12129    /// ````text
12130    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12131    /// ````
12132    ///
12133    /// Sets the *delegate* property to the given value.
12134    pub fn delegate(
12135        mut self,
12136        new_value: &'a mut dyn common::Delegate,
12137    ) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
12138        self._delegate = Some(new_value);
12139        self
12140    }
12141
12142    /// Set any additional parameter of the query string used in the request.
12143    /// It should be used to set parameters which are not yet available through their own
12144    /// setters.
12145    ///
12146    /// Please note that this method must not be used to set any of the known parameters
12147    /// which have their own setter method. If done anyway, the request will fail.
12148    ///
12149    /// # Additional Parameters
12150    ///
12151    /// * *$.xgafv* (query-string) - V1 error format.
12152    /// * *access_token* (query-string) - OAuth access token.
12153    /// * *alt* (query-string) - Data format for response.
12154    /// * *callback* (query-string) - JSONP
12155    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12156    /// * *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.
12157    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12158    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12159    /// * *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.
12160    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12161    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12162    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
12163    where
12164        T: AsRef<str>,
12165    {
12166        self._additional_params
12167            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12168        self
12169    }
12170
12171    /// Identifies the authorization scope for the method you are building.
12172    ///
12173    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12174    /// [`Scope::CloudPlatform`].
12175    ///
12176    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12177    /// tokens for more than one scope.
12178    ///
12179    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12180    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12181    /// sufficient, a read-write scope will do as well.
12182    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
12183    where
12184        St: AsRef<str>,
12185    {
12186        self._scopes.insert(String::from(scope.as_ref()));
12187        self
12188    }
12189    /// Identifies the authorization scope(s) for the method you are building.
12190    ///
12191    /// See [`Self::add_scope()`] for details.
12192    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
12193    where
12194        I: IntoIterator<Item = St>,
12195        St: AsRef<str>,
12196    {
12197        self._scopes
12198            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12199        self
12200    }
12201
12202    /// Removes all scopes, and no default scope will be used either.
12203    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12204    /// for details).
12205    pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
12206        self._scopes.clear();
12207        self
12208    }
12209}
12210
12211/// Gets the SafetyNetConfig for the specified app.
12212///
12213/// A builder for the *apps.safetyNetConfig.get* method supported by a *project* resource.
12214/// It is not used directly, but through a [`ProjectMethods`] instance.
12215///
12216/// # Example
12217///
12218/// Instantiate a resource method builder
12219///
12220/// ```test_harness,no_run
12221/// # extern crate hyper;
12222/// # extern crate hyper_rustls;
12223/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12224/// # async fn dox() {
12225/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12226///
12227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12228/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12229/// #     .with_native_roots()
12230/// #     .unwrap()
12231/// #     .https_only()
12232/// #     .enable_http2()
12233/// #     .build();
12234///
12235/// # let executor = hyper_util::rt::TokioExecutor::new();
12236/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12237/// #     secret,
12238/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12239/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12240/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12241/// #     ),
12242/// # ).build().await.unwrap();
12243///
12244/// # let client = hyper_util::client::legacy::Client::builder(
12245/// #     hyper_util::rt::TokioExecutor::new()
12246/// # )
12247/// # .build(
12248/// #     hyper_rustls::HttpsConnectorBuilder::new()
12249/// #         .with_native_roots()
12250/// #         .unwrap()
12251/// #         .https_or_http()
12252/// #         .enable_http2()
12253/// #         .build()
12254/// # );
12255/// # let mut hub = Firebaseappcheck::new(client, auth);
12256/// // You can configure optional parameters by calling the respective setters at will, and
12257/// // execute the final call using `doit()`.
12258/// // Values shown here are possibly random and not representative !
12259/// let result = hub.projects().apps_safety_net_config_get("name")
12260///              .doit().await;
12261/// # }
12262/// ```
12263pub struct ProjectAppSafetyNetConfigGetCall<'a, C>
12264where
12265    C: 'a,
12266{
12267    hub: &'a Firebaseappcheck<C>,
12268    _name: String,
12269    _delegate: Option<&'a mut dyn common::Delegate>,
12270    _additional_params: HashMap<String, String>,
12271    _scopes: BTreeSet<String>,
12272}
12273
12274impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigGetCall<'a, C> {}
12275
12276impl<'a, C> ProjectAppSafetyNetConfigGetCall<'a, C>
12277where
12278    C: common::Connector,
12279{
12280    /// Perform the operation you have build so far.
12281    pub async fn doit(
12282        mut self,
12283    ) -> common::Result<(
12284        common::Response,
12285        GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12286    )> {
12287        use std::borrow::Cow;
12288        use std::io::{Read, Seek};
12289
12290        use common::{url::Params, ToParts};
12291        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12292
12293        let mut dd = common::DefaultDelegate;
12294        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12295        dlg.begin(common::MethodInfo {
12296            id: "firebaseappcheck.projects.apps.safetyNetConfig.get",
12297            http_method: hyper::Method::GET,
12298        });
12299
12300        for &field in ["alt", "name"].iter() {
12301            if self._additional_params.contains_key(field) {
12302                dlg.finished(false);
12303                return Err(common::Error::FieldClash(field));
12304            }
12305        }
12306
12307        let mut params = Params::with_capacity(3 + self._additional_params.len());
12308        params.push("name", self._name);
12309
12310        params.extend(self._additional_params.iter());
12311
12312        params.push("alt", "json");
12313        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
12314        if self._scopes.is_empty() {
12315            self._scopes
12316                .insert(Scope::CloudPlatform.as_ref().to_string());
12317        }
12318
12319        #[allow(clippy::single_element_loop)]
12320        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12321            url = params.uri_replacement(url, param_name, find_this, true);
12322        }
12323        {
12324            let to_remove = ["name"];
12325            params.remove_params(&to_remove);
12326        }
12327
12328        let url = params.parse_with_url(&url);
12329
12330        loop {
12331            let token = match self
12332                .hub
12333                .auth
12334                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12335                .await
12336            {
12337                Ok(token) => token,
12338                Err(e) => match dlg.token(e) {
12339                    Ok(token) => token,
12340                    Err(e) => {
12341                        dlg.finished(false);
12342                        return Err(common::Error::MissingToken(e));
12343                    }
12344                },
12345            };
12346            let mut req_result = {
12347                let client = &self.hub.client;
12348                dlg.pre_request();
12349                let mut req_builder = hyper::Request::builder()
12350                    .method(hyper::Method::GET)
12351                    .uri(url.as_str())
12352                    .header(USER_AGENT, self.hub._user_agent.clone());
12353
12354                if let Some(token) = token.as_ref() {
12355                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12356                }
12357
12358                let request = req_builder
12359                    .header(CONTENT_LENGTH, 0_u64)
12360                    .body(common::to_body::<String>(None));
12361
12362                client.request(request.unwrap()).await
12363            };
12364
12365            match req_result {
12366                Err(err) => {
12367                    if let common::Retry::After(d) = dlg.http_error(&err) {
12368                        sleep(d).await;
12369                        continue;
12370                    }
12371                    dlg.finished(false);
12372                    return Err(common::Error::HttpError(err));
12373                }
12374                Ok(res) => {
12375                    let (mut parts, body) = res.into_parts();
12376                    let mut body = common::Body::new(body);
12377                    if !parts.status.is_success() {
12378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12379                        let error = serde_json::from_str(&common::to_string(&bytes));
12380                        let response = common::to_response(parts, bytes.into());
12381
12382                        if let common::Retry::After(d) =
12383                            dlg.http_failure(&response, error.as_ref().ok())
12384                        {
12385                            sleep(d).await;
12386                            continue;
12387                        }
12388
12389                        dlg.finished(false);
12390
12391                        return Err(match error {
12392                            Ok(value) => common::Error::BadRequest(value),
12393                            _ => common::Error::Failure(response),
12394                        });
12395                    }
12396                    let response = {
12397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12398                        let encoded = common::to_string(&bytes);
12399                        match serde_json::from_str(&encoded) {
12400                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12401                            Err(error) => {
12402                                dlg.response_json_decode_error(&encoded, &error);
12403                                return Err(common::Error::JsonDecodeError(
12404                                    encoded.to_string(),
12405                                    error,
12406                                ));
12407                            }
12408                        }
12409                    };
12410
12411                    dlg.finished(true);
12412                    return Ok(response);
12413                }
12414            }
12415        }
12416    }
12417
12418    /// Required. The relative resource name of the SafetyNetConfig, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
12419    ///
12420    /// Sets the *name* path property to the given value.
12421    ///
12422    /// Even though the property as already been set when instantiating this call,
12423    /// we provide this method for API completeness.
12424    pub fn name(mut self, new_value: &str) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
12425        self._name = new_value.to_string();
12426        self
12427    }
12428    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12429    /// while executing the actual API request.
12430    ///
12431    /// ````text
12432    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12433    /// ````
12434    ///
12435    /// Sets the *delegate* property to the given value.
12436    pub fn delegate(
12437        mut self,
12438        new_value: &'a mut dyn common::Delegate,
12439    ) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
12440        self._delegate = Some(new_value);
12441        self
12442    }
12443
12444    /// Set any additional parameter of the query string used in the request.
12445    /// It should be used to set parameters which are not yet available through their own
12446    /// setters.
12447    ///
12448    /// Please note that this method must not be used to set any of the known parameters
12449    /// which have their own setter method. If done anyway, the request will fail.
12450    ///
12451    /// # Additional Parameters
12452    ///
12453    /// * *$.xgafv* (query-string) - V1 error format.
12454    /// * *access_token* (query-string) - OAuth access token.
12455    /// * *alt* (query-string) - Data format for response.
12456    /// * *callback* (query-string) - JSONP
12457    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12458    /// * *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.
12459    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12460    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12461    /// * *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.
12462    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12463    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12464    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12465    where
12466        T: AsRef<str>,
12467    {
12468        self._additional_params
12469            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12470        self
12471    }
12472
12473    /// Identifies the authorization scope for the method you are building.
12474    ///
12475    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12476    /// [`Scope::CloudPlatform`].
12477    ///
12478    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12479    /// tokens for more than one scope.
12480    ///
12481    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12482    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12483    /// sufficient, a read-write scope will do as well.
12484    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12485    where
12486        St: AsRef<str>,
12487    {
12488        self._scopes.insert(String::from(scope.as_ref()));
12489        self
12490    }
12491    /// Identifies the authorization scope(s) for the method you are building.
12492    ///
12493    /// See [`Self::add_scope()`] for details.
12494    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12495    where
12496        I: IntoIterator<Item = St>,
12497        St: AsRef<str>,
12498    {
12499        self._scopes
12500            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12501        self
12502    }
12503
12504    /// Removes all scopes, and no default scope will be used either.
12505    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12506    /// for details).
12507    pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
12508        self._scopes.clear();
12509        self
12510    }
12511}
12512
12513/// Updates the SafetyNetConfig for the specified app. While this configuration is incomplete or invalid, the app will be unable to exchange SafetyNet tokens for App Check tokens.
12514///
12515/// A builder for the *apps.safetyNetConfig.patch* method supported by a *project* resource.
12516/// It is not used directly, but through a [`ProjectMethods`] instance.
12517///
12518/// # Example
12519///
12520/// Instantiate a resource method builder
12521///
12522/// ```test_harness,no_run
12523/// # extern crate hyper;
12524/// # extern crate hyper_rustls;
12525/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12526/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaSafetyNetConfig;
12527/// # async fn dox() {
12528/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12529///
12530/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12531/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12532/// #     .with_native_roots()
12533/// #     .unwrap()
12534/// #     .https_only()
12535/// #     .enable_http2()
12536/// #     .build();
12537///
12538/// # let executor = hyper_util::rt::TokioExecutor::new();
12539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12540/// #     secret,
12541/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12542/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12543/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12544/// #     ),
12545/// # ).build().await.unwrap();
12546///
12547/// # let client = hyper_util::client::legacy::Client::builder(
12548/// #     hyper_util::rt::TokioExecutor::new()
12549/// # )
12550/// # .build(
12551/// #     hyper_rustls::HttpsConnectorBuilder::new()
12552/// #         .with_native_roots()
12553/// #         .unwrap()
12554/// #         .https_or_http()
12555/// #         .enable_http2()
12556/// #         .build()
12557/// # );
12558/// # let mut hub = Firebaseappcheck::new(client, auth);
12559/// // As the method needs a request, you would usually fill it with the desired information
12560/// // into the respective structure. Some of the parts shown here might not be applicable !
12561/// // Values shown here are possibly random and not representative !
12562/// let mut req = GoogleFirebaseAppcheckV1betaSafetyNetConfig::default();
12563///
12564/// // You can configure optional parameters by calling the respective setters at will, and
12565/// // execute the final call using `doit()`.
12566/// // Values shown here are possibly random and not representative !
12567/// let result = hub.projects().apps_safety_net_config_patch(req, "name")
12568///              .update_mask(FieldMask::new::<&str>(&[]))
12569///              .doit().await;
12570/// # }
12571/// ```
12572pub struct ProjectAppSafetyNetConfigPatchCall<'a, C>
12573where
12574    C: 'a,
12575{
12576    hub: &'a Firebaseappcheck<C>,
12577    _request: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12578    _name: String,
12579    _update_mask: Option<common::FieldMask>,
12580    _delegate: Option<&'a mut dyn common::Delegate>,
12581    _additional_params: HashMap<String, String>,
12582    _scopes: BTreeSet<String>,
12583}
12584
12585impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigPatchCall<'a, C> {}
12586
12587impl<'a, C> ProjectAppSafetyNetConfigPatchCall<'a, C>
12588where
12589    C: common::Connector,
12590{
12591    /// Perform the operation you have build so far.
12592    pub async fn doit(
12593        mut self,
12594    ) -> common::Result<(
12595        common::Response,
12596        GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12597    )> {
12598        use std::borrow::Cow;
12599        use std::io::{Read, Seek};
12600
12601        use common::{url::Params, ToParts};
12602        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12603
12604        let mut dd = common::DefaultDelegate;
12605        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12606        dlg.begin(common::MethodInfo {
12607            id: "firebaseappcheck.projects.apps.safetyNetConfig.patch",
12608            http_method: hyper::Method::PATCH,
12609        });
12610
12611        for &field in ["alt", "name", "updateMask"].iter() {
12612            if self._additional_params.contains_key(field) {
12613                dlg.finished(false);
12614                return Err(common::Error::FieldClash(field));
12615            }
12616        }
12617
12618        let mut params = Params::with_capacity(5 + self._additional_params.len());
12619        params.push("name", self._name);
12620        if let Some(value) = self._update_mask.as_ref() {
12621            params.push("updateMask", value.to_string());
12622        }
12623
12624        params.extend(self._additional_params.iter());
12625
12626        params.push("alt", "json");
12627        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
12628        if self._scopes.is_empty() {
12629            self._scopes
12630                .insert(Scope::CloudPlatform.as_ref().to_string());
12631        }
12632
12633        #[allow(clippy::single_element_loop)]
12634        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12635            url = params.uri_replacement(url, param_name, find_this, true);
12636        }
12637        {
12638            let to_remove = ["name"];
12639            params.remove_params(&to_remove);
12640        }
12641
12642        let url = params.parse_with_url(&url);
12643
12644        let mut json_mime_type = mime::APPLICATION_JSON;
12645        let mut request_value_reader = {
12646            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12647            common::remove_json_null_values(&mut value);
12648            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12649            serde_json::to_writer(&mut dst, &value).unwrap();
12650            dst
12651        };
12652        let request_size = request_value_reader
12653            .seek(std::io::SeekFrom::End(0))
12654            .unwrap();
12655        request_value_reader
12656            .seek(std::io::SeekFrom::Start(0))
12657            .unwrap();
12658
12659        loop {
12660            let token = match self
12661                .hub
12662                .auth
12663                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12664                .await
12665            {
12666                Ok(token) => token,
12667                Err(e) => match dlg.token(e) {
12668                    Ok(token) => token,
12669                    Err(e) => {
12670                        dlg.finished(false);
12671                        return Err(common::Error::MissingToken(e));
12672                    }
12673                },
12674            };
12675            request_value_reader
12676                .seek(std::io::SeekFrom::Start(0))
12677                .unwrap();
12678            let mut req_result = {
12679                let client = &self.hub.client;
12680                dlg.pre_request();
12681                let mut req_builder = hyper::Request::builder()
12682                    .method(hyper::Method::PATCH)
12683                    .uri(url.as_str())
12684                    .header(USER_AGENT, self.hub._user_agent.clone());
12685
12686                if let Some(token) = token.as_ref() {
12687                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12688                }
12689
12690                let request = req_builder
12691                    .header(CONTENT_TYPE, json_mime_type.to_string())
12692                    .header(CONTENT_LENGTH, request_size as u64)
12693                    .body(common::to_body(
12694                        request_value_reader.get_ref().clone().into(),
12695                    ));
12696
12697                client.request(request.unwrap()).await
12698            };
12699
12700            match req_result {
12701                Err(err) => {
12702                    if let common::Retry::After(d) = dlg.http_error(&err) {
12703                        sleep(d).await;
12704                        continue;
12705                    }
12706                    dlg.finished(false);
12707                    return Err(common::Error::HttpError(err));
12708                }
12709                Ok(res) => {
12710                    let (mut parts, body) = res.into_parts();
12711                    let mut body = common::Body::new(body);
12712                    if !parts.status.is_success() {
12713                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12714                        let error = serde_json::from_str(&common::to_string(&bytes));
12715                        let response = common::to_response(parts, bytes.into());
12716
12717                        if let common::Retry::After(d) =
12718                            dlg.http_failure(&response, error.as_ref().ok())
12719                        {
12720                            sleep(d).await;
12721                            continue;
12722                        }
12723
12724                        dlg.finished(false);
12725
12726                        return Err(match error {
12727                            Ok(value) => common::Error::BadRequest(value),
12728                            _ => common::Error::Failure(response),
12729                        });
12730                    }
12731                    let response = {
12732                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12733                        let encoded = common::to_string(&bytes);
12734                        match serde_json::from_str(&encoded) {
12735                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12736                            Err(error) => {
12737                                dlg.response_json_decode_error(&encoded, &error);
12738                                return Err(common::Error::JsonDecodeError(
12739                                    encoded.to_string(),
12740                                    error,
12741                                ));
12742                            }
12743                        }
12744                    };
12745
12746                    dlg.finished(true);
12747                    return Ok(response);
12748                }
12749            }
12750        }
12751    }
12752
12753    ///
12754    /// Sets the *request* property to the given value.
12755    ///
12756    /// Even though the property as already been set when instantiating this call,
12757    /// we provide this method for API completeness.
12758    pub fn request(
12759        mut self,
12760        new_value: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12761    ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12762        self._request = new_value;
12763        self
12764    }
12765    /// Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
12766    ///
12767    /// Sets the *name* path property to the given value.
12768    ///
12769    /// Even though the property as already been set when instantiating this call,
12770    /// we provide this method for API completeness.
12771    pub fn name(mut self, new_value: &str) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12772        self._name = new_value.to_string();
12773        self
12774    }
12775    /// Required. A comma-separated list of names of fields in the SafetyNetConfig to update. Example: `token_ttl`.
12776    ///
12777    /// Sets the *update mask* query property to the given value.
12778    pub fn update_mask(
12779        mut self,
12780        new_value: common::FieldMask,
12781    ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12782        self._update_mask = Some(new_value);
12783        self
12784    }
12785    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12786    /// while executing the actual API request.
12787    ///
12788    /// ````text
12789    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12790    /// ````
12791    ///
12792    /// Sets the *delegate* property to the given value.
12793    pub fn delegate(
12794        mut self,
12795        new_value: &'a mut dyn common::Delegate,
12796    ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12797        self._delegate = Some(new_value);
12798        self
12799    }
12800
12801    /// Set any additional parameter of the query string used in the request.
12802    /// It should be used to set parameters which are not yet available through their own
12803    /// setters.
12804    ///
12805    /// Please note that this method must not be used to set any of the known parameters
12806    /// which have their own setter method. If done anyway, the request will fail.
12807    ///
12808    /// # Additional Parameters
12809    ///
12810    /// * *$.xgafv* (query-string) - V1 error format.
12811    /// * *access_token* (query-string) - OAuth access token.
12812    /// * *alt* (query-string) - Data format for response.
12813    /// * *callback* (query-string) - JSONP
12814    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12815    /// * *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.
12816    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12817    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12818    /// * *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.
12819    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12820    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12821    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12822    where
12823        T: AsRef<str>,
12824    {
12825        self._additional_params
12826            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12827        self
12828    }
12829
12830    /// Identifies the authorization scope for the method you are building.
12831    ///
12832    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12833    /// [`Scope::CloudPlatform`].
12834    ///
12835    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12836    /// tokens for more than one scope.
12837    ///
12838    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12839    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12840    /// sufficient, a read-write scope will do as well.
12841    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12842    where
12843        St: AsRef<str>,
12844    {
12845        self._scopes.insert(String::from(scope.as_ref()));
12846        self
12847    }
12848    /// Identifies the authorization scope(s) for the method you are building.
12849    ///
12850    /// See [`Self::add_scope()`] for details.
12851    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12852    where
12853        I: IntoIterator<Item = St>,
12854        St: AsRef<str>,
12855    {
12856        self._scopes
12857            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12858        self
12859    }
12860
12861    /// Removes all scopes, and no default scope will be used either.
12862    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12863    /// for details).
12864    pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12865        self._scopes.clear();
12866        self
12867    }
12868}
12869
12870/// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
12871///
12872/// A builder for the *apps.exchangeAppAttestAssertion* method supported by a *project* resource.
12873/// It is not used directly, but through a [`ProjectMethods`] instance.
12874///
12875/// # Example
12876///
12877/// Instantiate a resource method builder
12878///
12879/// ```test_harness,no_run
12880/// # extern crate hyper;
12881/// # extern crate hyper_rustls;
12882/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12883/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
12884/// # async fn dox() {
12885/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12886///
12887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12888/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12889/// #     .with_native_roots()
12890/// #     .unwrap()
12891/// #     .https_only()
12892/// #     .enable_http2()
12893/// #     .build();
12894///
12895/// # let executor = hyper_util::rt::TokioExecutor::new();
12896/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12897/// #     secret,
12898/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12899/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12900/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12901/// #     ),
12902/// # ).build().await.unwrap();
12903///
12904/// # let client = hyper_util::client::legacy::Client::builder(
12905/// #     hyper_util::rt::TokioExecutor::new()
12906/// # )
12907/// # .build(
12908/// #     hyper_rustls::HttpsConnectorBuilder::new()
12909/// #         .with_native_roots()
12910/// #         .unwrap()
12911/// #         .https_or_http()
12912/// #         .enable_http2()
12913/// #         .build()
12914/// # );
12915/// # let mut hub = Firebaseappcheck::new(client, auth);
12916/// // As the method needs a request, you would usually fill it with the desired information
12917/// // into the respective structure. Some of the parts shown here might not be applicable !
12918/// // Values shown here are possibly random and not representative !
12919/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
12920///
12921/// // You can configure optional parameters by calling the respective setters at will, and
12922/// // execute the final call using `doit()`.
12923/// // Values shown here are possibly random and not representative !
12924/// let result = hub.projects().apps_exchange_app_attest_assertion(req, "app")
12925///              .doit().await;
12926/// # }
12927/// ```
12928pub struct ProjectAppExchangeAppAttestAssertionCall<'a, C>
12929where
12930    C: 'a,
12931{
12932    hub: &'a Firebaseappcheck<C>,
12933    _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
12934    _app: String,
12935    _delegate: Option<&'a mut dyn common::Delegate>,
12936    _additional_params: HashMap<String, String>,
12937    _scopes: BTreeSet<String>,
12938}
12939
12940impl<'a, C> common::CallBuilder for ProjectAppExchangeAppAttestAssertionCall<'a, C> {}
12941
12942impl<'a, C> ProjectAppExchangeAppAttestAssertionCall<'a, C>
12943where
12944    C: common::Connector,
12945{
12946    /// Perform the operation you have build so far.
12947    pub async fn doit(
12948        mut self,
12949    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
12950        use std::borrow::Cow;
12951        use std::io::{Read, Seek};
12952
12953        use common::{url::Params, ToParts};
12954        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12955
12956        let mut dd = common::DefaultDelegate;
12957        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12958        dlg.begin(common::MethodInfo {
12959            id: "firebaseappcheck.projects.apps.exchangeAppAttestAssertion",
12960            http_method: hyper::Method::POST,
12961        });
12962
12963        for &field in ["alt", "app"].iter() {
12964            if self._additional_params.contains_key(field) {
12965                dlg.finished(false);
12966                return Err(common::Error::FieldClash(field));
12967            }
12968        }
12969
12970        let mut params = Params::with_capacity(4 + self._additional_params.len());
12971        params.push("app", self._app);
12972
12973        params.extend(self._additional_params.iter());
12974
12975        params.push("alt", "json");
12976        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAssertion";
12977        if self._scopes.is_empty() {
12978            self._scopes
12979                .insert(Scope::CloudPlatform.as_ref().to_string());
12980        }
12981
12982        #[allow(clippy::single_element_loop)]
12983        for &(find_this, param_name) in [("{+app}", "app")].iter() {
12984            url = params.uri_replacement(url, param_name, find_this, true);
12985        }
12986        {
12987            let to_remove = ["app"];
12988            params.remove_params(&to_remove);
12989        }
12990
12991        let url = params.parse_with_url(&url);
12992
12993        let mut json_mime_type = mime::APPLICATION_JSON;
12994        let mut request_value_reader = {
12995            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12996            common::remove_json_null_values(&mut value);
12997            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12998            serde_json::to_writer(&mut dst, &value).unwrap();
12999            dst
13000        };
13001        let request_size = request_value_reader
13002            .seek(std::io::SeekFrom::End(0))
13003            .unwrap();
13004        request_value_reader
13005            .seek(std::io::SeekFrom::Start(0))
13006            .unwrap();
13007
13008        loop {
13009            let token = match self
13010                .hub
13011                .auth
13012                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13013                .await
13014            {
13015                Ok(token) => token,
13016                Err(e) => match dlg.token(e) {
13017                    Ok(token) => token,
13018                    Err(e) => {
13019                        dlg.finished(false);
13020                        return Err(common::Error::MissingToken(e));
13021                    }
13022                },
13023            };
13024            request_value_reader
13025                .seek(std::io::SeekFrom::Start(0))
13026                .unwrap();
13027            let mut req_result = {
13028                let client = &self.hub.client;
13029                dlg.pre_request();
13030                let mut req_builder = hyper::Request::builder()
13031                    .method(hyper::Method::POST)
13032                    .uri(url.as_str())
13033                    .header(USER_AGENT, self.hub._user_agent.clone());
13034
13035                if let Some(token) = token.as_ref() {
13036                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13037                }
13038
13039                let request = req_builder
13040                    .header(CONTENT_TYPE, json_mime_type.to_string())
13041                    .header(CONTENT_LENGTH, request_size as u64)
13042                    .body(common::to_body(
13043                        request_value_reader.get_ref().clone().into(),
13044                    ));
13045
13046                client.request(request.unwrap()).await
13047            };
13048
13049            match req_result {
13050                Err(err) => {
13051                    if let common::Retry::After(d) = dlg.http_error(&err) {
13052                        sleep(d).await;
13053                        continue;
13054                    }
13055                    dlg.finished(false);
13056                    return Err(common::Error::HttpError(err));
13057                }
13058                Ok(res) => {
13059                    let (mut parts, body) = res.into_parts();
13060                    let mut body = common::Body::new(body);
13061                    if !parts.status.is_success() {
13062                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13063                        let error = serde_json::from_str(&common::to_string(&bytes));
13064                        let response = common::to_response(parts, bytes.into());
13065
13066                        if let common::Retry::After(d) =
13067                            dlg.http_failure(&response, error.as_ref().ok())
13068                        {
13069                            sleep(d).await;
13070                            continue;
13071                        }
13072
13073                        dlg.finished(false);
13074
13075                        return Err(match error {
13076                            Ok(value) => common::Error::BadRequest(value),
13077                            _ => common::Error::Failure(response),
13078                        });
13079                    }
13080                    let response = {
13081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13082                        let encoded = common::to_string(&bytes);
13083                        match serde_json::from_str(&encoded) {
13084                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13085                            Err(error) => {
13086                                dlg.response_json_decode_error(&encoded, &error);
13087                                return Err(common::Error::JsonDecodeError(
13088                                    encoded.to_string(),
13089                                    error,
13090                                ));
13091                            }
13092                        }
13093                    };
13094
13095                    dlg.finished(true);
13096                    return Ok(response);
13097                }
13098            }
13099        }
13100    }
13101
13102    ///
13103    /// Sets the *request* property to the given value.
13104    ///
13105    /// Even though the property as already been set when instantiating this call,
13106    /// we provide this method for API completeness.
13107    pub fn request(
13108        mut self,
13109        new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
13110    ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
13111        self._request = new_value;
13112        self
13113    }
13114    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
13115    ///
13116    /// Sets the *app* path property to the given value.
13117    ///
13118    /// Even though the property as already been set when instantiating this call,
13119    /// we provide this method for API completeness.
13120    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
13121        self._app = new_value.to_string();
13122        self
13123    }
13124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13125    /// while executing the actual API request.
13126    ///
13127    /// ````text
13128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13129    /// ````
13130    ///
13131    /// Sets the *delegate* property to the given value.
13132    pub fn delegate(
13133        mut self,
13134        new_value: &'a mut dyn common::Delegate,
13135    ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
13136        self._delegate = Some(new_value);
13137        self
13138    }
13139
13140    /// Set any additional parameter of the query string used in the request.
13141    /// It should be used to set parameters which are not yet available through their own
13142    /// setters.
13143    ///
13144    /// Please note that this method must not be used to set any of the known parameters
13145    /// which have their own setter method. If done anyway, the request will fail.
13146    ///
13147    /// # Additional Parameters
13148    ///
13149    /// * *$.xgafv* (query-string) - V1 error format.
13150    /// * *access_token* (query-string) - OAuth access token.
13151    /// * *alt* (query-string) - Data format for response.
13152    /// * *callback* (query-string) - JSONP
13153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13154    /// * *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.
13155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13157    /// * *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.
13158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13160    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
13161    where
13162        T: AsRef<str>,
13163    {
13164        self._additional_params
13165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13166        self
13167    }
13168
13169    /// Identifies the authorization scope for the method you are building.
13170    ///
13171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13172    /// [`Scope::CloudPlatform`].
13173    ///
13174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13175    /// tokens for more than one scope.
13176    ///
13177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13179    /// sufficient, a read-write scope will do as well.
13180    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
13181    where
13182        St: AsRef<str>,
13183    {
13184        self._scopes.insert(String::from(scope.as_ref()));
13185        self
13186    }
13187    /// Identifies the authorization scope(s) for the method you are building.
13188    ///
13189    /// See [`Self::add_scope()`] for details.
13190    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
13191    where
13192        I: IntoIterator<Item = St>,
13193        St: AsRef<str>,
13194    {
13195        self._scopes
13196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13197        self
13198    }
13199
13200    /// Removes all scopes, and no default scope will be used either.
13201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13202    /// for details).
13203    pub fn clear_scopes(mut self) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
13204        self._scopes.clear();
13205        self
13206    }
13207}
13208
13209/// Accepts an App Attest CBOR attestation and verifies it with Apple using your preconfigured team and bundle IDs. If valid, returns an attestation artifact that can later be exchanged for an AppCheckToken using ExchangeAppAttestAssertion. For convenience and performance, this method's response object will also contain an AppCheckToken (if the verification is successful).
13210///
13211/// A builder for the *apps.exchangeAppAttestAttestation* method supported by a *project* resource.
13212/// It is not used directly, but through a [`ProjectMethods`] instance.
13213///
13214/// # Example
13215///
13216/// Instantiate a resource method builder
13217///
13218/// ```test_harness,no_run
13219/// # extern crate hyper;
13220/// # extern crate hyper_rustls;
13221/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13222/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest;
13223/// # async fn dox() {
13224/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13225///
13226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13227/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13228/// #     .with_native_roots()
13229/// #     .unwrap()
13230/// #     .https_only()
13231/// #     .enable_http2()
13232/// #     .build();
13233///
13234/// # let executor = hyper_util::rt::TokioExecutor::new();
13235/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13236/// #     secret,
13237/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13238/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13239/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13240/// #     ),
13241/// # ).build().await.unwrap();
13242///
13243/// # let client = hyper_util::client::legacy::Client::builder(
13244/// #     hyper_util::rt::TokioExecutor::new()
13245/// # )
13246/// # .build(
13247/// #     hyper_rustls::HttpsConnectorBuilder::new()
13248/// #         .with_native_roots()
13249/// #         .unwrap()
13250/// #         .https_or_http()
13251/// #         .enable_http2()
13252/// #         .build()
13253/// # );
13254/// # let mut hub = Firebaseappcheck::new(client, auth);
13255/// // As the method needs a request, you would usually fill it with the desired information
13256/// // into the respective structure. Some of the parts shown here might not be applicable !
13257/// // Values shown here are possibly random and not representative !
13258/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest::default();
13259///
13260/// // You can configure optional parameters by calling the respective setters at will, and
13261/// // execute the final call using `doit()`.
13262/// // Values shown here are possibly random and not representative !
13263/// let result = hub.projects().apps_exchange_app_attest_attestation(req, "app")
13264///              .doit().await;
13265/// # }
13266/// ```
13267pub struct ProjectAppExchangeAppAttestAttestationCall<'a, C>
13268where
13269    C: 'a,
13270{
13271    hub: &'a Firebaseappcheck<C>,
13272    _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
13273    _app: String,
13274    _delegate: Option<&'a mut dyn common::Delegate>,
13275    _additional_params: HashMap<String, String>,
13276    _scopes: BTreeSet<String>,
13277}
13278
13279impl<'a, C> common::CallBuilder for ProjectAppExchangeAppAttestAttestationCall<'a, C> {}
13280
13281impl<'a, C> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13282where
13283    C: common::Connector,
13284{
13285    /// Perform the operation you have build so far.
13286    pub async fn doit(
13287        mut self,
13288    ) -> common::Result<(
13289        common::Response,
13290        GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse,
13291    )> {
13292        use std::borrow::Cow;
13293        use std::io::{Read, Seek};
13294
13295        use common::{url::Params, ToParts};
13296        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13297
13298        let mut dd = common::DefaultDelegate;
13299        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13300        dlg.begin(common::MethodInfo {
13301            id: "firebaseappcheck.projects.apps.exchangeAppAttestAttestation",
13302            http_method: hyper::Method::POST,
13303        });
13304
13305        for &field in ["alt", "app"].iter() {
13306            if self._additional_params.contains_key(field) {
13307                dlg.finished(false);
13308                return Err(common::Error::FieldClash(field));
13309            }
13310        }
13311
13312        let mut params = Params::with_capacity(4 + self._additional_params.len());
13313        params.push("app", self._app);
13314
13315        params.extend(self._additional_params.iter());
13316
13317        params.push("alt", "json");
13318        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAttestation";
13319        if self._scopes.is_empty() {
13320            self._scopes
13321                .insert(Scope::CloudPlatform.as_ref().to_string());
13322        }
13323
13324        #[allow(clippy::single_element_loop)]
13325        for &(find_this, param_name) in [("{+app}", "app")].iter() {
13326            url = params.uri_replacement(url, param_name, find_this, true);
13327        }
13328        {
13329            let to_remove = ["app"];
13330            params.remove_params(&to_remove);
13331        }
13332
13333        let url = params.parse_with_url(&url);
13334
13335        let mut json_mime_type = mime::APPLICATION_JSON;
13336        let mut request_value_reader = {
13337            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13338            common::remove_json_null_values(&mut value);
13339            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13340            serde_json::to_writer(&mut dst, &value).unwrap();
13341            dst
13342        };
13343        let request_size = request_value_reader
13344            .seek(std::io::SeekFrom::End(0))
13345            .unwrap();
13346        request_value_reader
13347            .seek(std::io::SeekFrom::Start(0))
13348            .unwrap();
13349
13350        loop {
13351            let token = match self
13352                .hub
13353                .auth
13354                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13355                .await
13356            {
13357                Ok(token) => token,
13358                Err(e) => match dlg.token(e) {
13359                    Ok(token) => token,
13360                    Err(e) => {
13361                        dlg.finished(false);
13362                        return Err(common::Error::MissingToken(e));
13363                    }
13364                },
13365            };
13366            request_value_reader
13367                .seek(std::io::SeekFrom::Start(0))
13368                .unwrap();
13369            let mut req_result = {
13370                let client = &self.hub.client;
13371                dlg.pre_request();
13372                let mut req_builder = hyper::Request::builder()
13373                    .method(hyper::Method::POST)
13374                    .uri(url.as_str())
13375                    .header(USER_AGENT, self.hub._user_agent.clone());
13376
13377                if let Some(token) = token.as_ref() {
13378                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13379                }
13380
13381                let request = req_builder
13382                    .header(CONTENT_TYPE, json_mime_type.to_string())
13383                    .header(CONTENT_LENGTH, request_size as u64)
13384                    .body(common::to_body(
13385                        request_value_reader.get_ref().clone().into(),
13386                    ));
13387
13388                client.request(request.unwrap()).await
13389            };
13390
13391            match req_result {
13392                Err(err) => {
13393                    if let common::Retry::After(d) = dlg.http_error(&err) {
13394                        sleep(d).await;
13395                        continue;
13396                    }
13397                    dlg.finished(false);
13398                    return Err(common::Error::HttpError(err));
13399                }
13400                Ok(res) => {
13401                    let (mut parts, body) = res.into_parts();
13402                    let mut body = common::Body::new(body);
13403                    if !parts.status.is_success() {
13404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13405                        let error = serde_json::from_str(&common::to_string(&bytes));
13406                        let response = common::to_response(parts, bytes.into());
13407
13408                        if let common::Retry::After(d) =
13409                            dlg.http_failure(&response, error.as_ref().ok())
13410                        {
13411                            sleep(d).await;
13412                            continue;
13413                        }
13414
13415                        dlg.finished(false);
13416
13417                        return Err(match error {
13418                            Ok(value) => common::Error::BadRequest(value),
13419                            _ => common::Error::Failure(response),
13420                        });
13421                    }
13422                    let response = {
13423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13424                        let encoded = common::to_string(&bytes);
13425                        match serde_json::from_str(&encoded) {
13426                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13427                            Err(error) => {
13428                                dlg.response_json_decode_error(&encoded, &error);
13429                                return Err(common::Error::JsonDecodeError(
13430                                    encoded.to_string(),
13431                                    error,
13432                                ));
13433                            }
13434                        }
13435                    };
13436
13437                    dlg.finished(true);
13438                    return Ok(response);
13439                }
13440            }
13441        }
13442    }
13443
13444    ///
13445    /// Sets the *request* property to the given value.
13446    ///
13447    /// Even though the property as already been set when instantiating this call,
13448    /// we provide this method for API completeness.
13449    pub fn request(
13450        mut self,
13451        new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
13452    ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
13453        self._request = new_value;
13454        self
13455    }
13456    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
13457    ///
13458    /// Sets the *app* path property to the given value.
13459    ///
13460    /// Even though the property as already been set when instantiating this call,
13461    /// we provide this method for API completeness.
13462    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
13463        self._app = new_value.to_string();
13464        self
13465    }
13466    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13467    /// while executing the actual API request.
13468    ///
13469    /// ````text
13470    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13471    /// ````
13472    ///
13473    /// Sets the *delegate* property to the given value.
13474    pub fn delegate(
13475        mut self,
13476        new_value: &'a mut dyn common::Delegate,
13477    ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
13478        self._delegate = Some(new_value);
13479        self
13480    }
13481
13482    /// Set any additional parameter of the query string used in the request.
13483    /// It should be used to set parameters which are not yet available through their own
13484    /// setters.
13485    ///
13486    /// Please note that this method must not be used to set any of the known parameters
13487    /// which have their own setter method. If done anyway, the request will fail.
13488    ///
13489    /// # Additional Parameters
13490    ///
13491    /// * *$.xgafv* (query-string) - V1 error format.
13492    /// * *access_token* (query-string) - OAuth access token.
13493    /// * *alt* (query-string) - Data format for response.
13494    /// * *callback* (query-string) - JSONP
13495    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13496    /// * *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.
13497    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13498    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13499    /// * *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.
13500    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13501    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13502    pub fn param<T>(
13503        mut self,
13504        name: T,
13505        value: T,
13506    ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13507    where
13508        T: AsRef<str>,
13509    {
13510        self._additional_params
13511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13512        self
13513    }
13514
13515    /// Identifies the authorization scope for the method you are building.
13516    ///
13517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13518    /// [`Scope::CloudPlatform`].
13519    ///
13520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13521    /// tokens for more than one scope.
13522    ///
13523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13525    /// sufficient, a read-write scope will do as well.
13526    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13527    where
13528        St: AsRef<str>,
13529    {
13530        self._scopes.insert(String::from(scope.as_ref()));
13531        self
13532    }
13533    /// Identifies the authorization scope(s) for the method you are building.
13534    ///
13535    /// See [`Self::add_scope()`] for details.
13536    pub fn add_scopes<I, St>(
13537        mut self,
13538        scopes: I,
13539    ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13540    where
13541        I: IntoIterator<Item = St>,
13542        St: AsRef<str>,
13543    {
13544        self._scopes
13545            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13546        self
13547    }
13548
13549    /// Removes all scopes, and no default scope will be used either.
13550    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13551    /// for details).
13552    pub fn clear_scopes(mut self) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
13553        self._scopes.clear();
13554        self
13555    }
13556}
13557
13558/// Validates a custom token signed using your project's Admin SDK service account credentials. If valid, returns an AppCheckToken.
13559///
13560/// A builder for the *apps.exchangeCustomToken* method supported by a *project* resource.
13561/// It is not used directly, but through a [`ProjectMethods`] instance.
13562///
13563/// # Example
13564///
13565/// Instantiate a resource method builder
13566///
13567/// ```test_harness,no_run
13568/// # extern crate hyper;
13569/// # extern crate hyper_rustls;
13570/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13571/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest;
13572/// # async fn dox() {
13573/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13574///
13575/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13576/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13577/// #     .with_native_roots()
13578/// #     .unwrap()
13579/// #     .https_only()
13580/// #     .enable_http2()
13581/// #     .build();
13582///
13583/// # let executor = hyper_util::rt::TokioExecutor::new();
13584/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13585/// #     secret,
13586/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13587/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13588/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13589/// #     ),
13590/// # ).build().await.unwrap();
13591///
13592/// # let client = hyper_util::client::legacy::Client::builder(
13593/// #     hyper_util::rt::TokioExecutor::new()
13594/// # )
13595/// # .build(
13596/// #     hyper_rustls::HttpsConnectorBuilder::new()
13597/// #         .with_native_roots()
13598/// #         .unwrap()
13599/// #         .https_or_http()
13600/// #         .enable_http2()
13601/// #         .build()
13602/// # );
13603/// # let mut hub = Firebaseappcheck::new(client, auth);
13604/// // As the method needs a request, you would usually fill it with the desired information
13605/// // into the respective structure. Some of the parts shown here might not be applicable !
13606/// // Values shown here are possibly random and not representative !
13607/// let mut req = GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest::default();
13608///
13609/// // You can configure optional parameters by calling the respective setters at will, and
13610/// // execute the final call using `doit()`.
13611/// // Values shown here are possibly random and not representative !
13612/// let result = hub.projects().apps_exchange_custom_token(req, "app")
13613///              .doit().await;
13614/// # }
13615/// ```
13616pub struct ProjectAppExchangeCustomTokenCall<'a, C>
13617where
13618    C: 'a,
13619{
13620    hub: &'a Firebaseappcheck<C>,
13621    _request: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
13622    _app: String,
13623    _delegate: Option<&'a mut dyn common::Delegate>,
13624    _additional_params: HashMap<String, String>,
13625    _scopes: BTreeSet<String>,
13626}
13627
13628impl<'a, C> common::CallBuilder for ProjectAppExchangeCustomTokenCall<'a, C> {}
13629
13630impl<'a, C> ProjectAppExchangeCustomTokenCall<'a, C>
13631where
13632    C: common::Connector,
13633{
13634    /// Perform the operation you have build so far.
13635    pub async fn doit(
13636        mut self,
13637    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
13638        use std::borrow::Cow;
13639        use std::io::{Read, Seek};
13640
13641        use common::{url::Params, ToParts};
13642        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13643
13644        let mut dd = common::DefaultDelegate;
13645        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13646        dlg.begin(common::MethodInfo {
13647            id: "firebaseappcheck.projects.apps.exchangeCustomToken",
13648            http_method: hyper::Method::POST,
13649        });
13650
13651        for &field in ["alt", "app"].iter() {
13652            if self._additional_params.contains_key(field) {
13653                dlg.finished(false);
13654                return Err(common::Error::FieldClash(field));
13655            }
13656        }
13657
13658        let mut params = Params::with_capacity(4 + self._additional_params.len());
13659        params.push("app", self._app);
13660
13661        params.extend(self._additional_params.iter());
13662
13663        params.push("alt", "json");
13664        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeCustomToken";
13665        if self._scopes.is_empty() {
13666            self._scopes
13667                .insert(Scope::CloudPlatform.as_ref().to_string());
13668        }
13669
13670        #[allow(clippy::single_element_loop)]
13671        for &(find_this, param_name) in [("{+app}", "app")].iter() {
13672            url = params.uri_replacement(url, param_name, find_this, true);
13673        }
13674        {
13675            let to_remove = ["app"];
13676            params.remove_params(&to_remove);
13677        }
13678
13679        let url = params.parse_with_url(&url);
13680
13681        let mut json_mime_type = mime::APPLICATION_JSON;
13682        let mut request_value_reader = {
13683            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13684            common::remove_json_null_values(&mut value);
13685            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13686            serde_json::to_writer(&mut dst, &value).unwrap();
13687            dst
13688        };
13689        let request_size = request_value_reader
13690            .seek(std::io::SeekFrom::End(0))
13691            .unwrap();
13692        request_value_reader
13693            .seek(std::io::SeekFrom::Start(0))
13694            .unwrap();
13695
13696        loop {
13697            let token = match self
13698                .hub
13699                .auth
13700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13701                .await
13702            {
13703                Ok(token) => token,
13704                Err(e) => match dlg.token(e) {
13705                    Ok(token) => token,
13706                    Err(e) => {
13707                        dlg.finished(false);
13708                        return Err(common::Error::MissingToken(e));
13709                    }
13710                },
13711            };
13712            request_value_reader
13713                .seek(std::io::SeekFrom::Start(0))
13714                .unwrap();
13715            let mut req_result = {
13716                let client = &self.hub.client;
13717                dlg.pre_request();
13718                let mut req_builder = hyper::Request::builder()
13719                    .method(hyper::Method::POST)
13720                    .uri(url.as_str())
13721                    .header(USER_AGENT, self.hub._user_agent.clone());
13722
13723                if let Some(token) = token.as_ref() {
13724                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13725                }
13726
13727                let request = req_builder
13728                    .header(CONTENT_TYPE, json_mime_type.to_string())
13729                    .header(CONTENT_LENGTH, request_size as u64)
13730                    .body(common::to_body(
13731                        request_value_reader.get_ref().clone().into(),
13732                    ));
13733
13734                client.request(request.unwrap()).await
13735            };
13736
13737            match req_result {
13738                Err(err) => {
13739                    if let common::Retry::After(d) = dlg.http_error(&err) {
13740                        sleep(d).await;
13741                        continue;
13742                    }
13743                    dlg.finished(false);
13744                    return Err(common::Error::HttpError(err));
13745                }
13746                Ok(res) => {
13747                    let (mut parts, body) = res.into_parts();
13748                    let mut body = common::Body::new(body);
13749                    if !parts.status.is_success() {
13750                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13751                        let error = serde_json::from_str(&common::to_string(&bytes));
13752                        let response = common::to_response(parts, bytes.into());
13753
13754                        if let common::Retry::After(d) =
13755                            dlg.http_failure(&response, error.as_ref().ok())
13756                        {
13757                            sleep(d).await;
13758                            continue;
13759                        }
13760
13761                        dlg.finished(false);
13762
13763                        return Err(match error {
13764                            Ok(value) => common::Error::BadRequest(value),
13765                            _ => common::Error::Failure(response),
13766                        });
13767                    }
13768                    let response = {
13769                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13770                        let encoded = common::to_string(&bytes);
13771                        match serde_json::from_str(&encoded) {
13772                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13773                            Err(error) => {
13774                                dlg.response_json_decode_error(&encoded, &error);
13775                                return Err(common::Error::JsonDecodeError(
13776                                    encoded.to_string(),
13777                                    error,
13778                                ));
13779                            }
13780                        }
13781                    };
13782
13783                    dlg.finished(true);
13784                    return Ok(response);
13785                }
13786            }
13787        }
13788    }
13789
13790    ///
13791    /// Sets the *request* property to the given value.
13792    ///
13793    /// Even though the property as already been set when instantiating this call,
13794    /// we provide this method for API completeness.
13795    pub fn request(
13796        mut self,
13797        new_value: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
13798    ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13799        self._request = new_value;
13800        self
13801    }
13802    /// Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
13803    ///
13804    /// Sets the *app* path property to the given value.
13805    ///
13806    /// Even though the property as already been set when instantiating this call,
13807    /// we provide this method for API completeness.
13808    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13809        self._app = new_value.to_string();
13810        self
13811    }
13812    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13813    /// while executing the actual API request.
13814    ///
13815    /// ````text
13816    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13817    /// ````
13818    ///
13819    /// Sets the *delegate* property to the given value.
13820    pub fn delegate(
13821        mut self,
13822        new_value: &'a mut dyn common::Delegate,
13823    ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13824        self._delegate = Some(new_value);
13825        self
13826    }
13827
13828    /// Set any additional parameter of the query string used in the request.
13829    /// It should be used to set parameters which are not yet available through their own
13830    /// setters.
13831    ///
13832    /// Please note that this method must not be used to set any of the known parameters
13833    /// which have their own setter method. If done anyway, the request will fail.
13834    ///
13835    /// # Additional Parameters
13836    ///
13837    /// * *$.xgafv* (query-string) - V1 error format.
13838    /// * *access_token* (query-string) - OAuth access token.
13839    /// * *alt* (query-string) - Data format for response.
13840    /// * *callback* (query-string) - JSONP
13841    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13842    /// * *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.
13843    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13844    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13845    /// * *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.
13846    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13847    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13848    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeCustomTokenCall<'a, C>
13849    where
13850        T: AsRef<str>,
13851    {
13852        self._additional_params
13853            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13854        self
13855    }
13856
13857    /// Identifies the authorization scope for the method you are building.
13858    ///
13859    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13860    /// [`Scope::CloudPlatform`].
13861    ///
13862    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13863    /// tokens for more than one scope.
13864    ///
13865    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13866    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13867    /// sufficient, a read-write scope will do as well.
13868    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeCustomTokenCall<'a, C>
13869    where
13870        St: AsRef<str>,
13871    {
13872        self._scopes.insert(String::from(scope.as_ref()));
13873        self
13874    }
13875    /// Identifies the authorization scope(s) for the method you are building.
13876    ///
13877    /// See [`Self::add_scope()`] for details.
13878    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeCustomTokenCall<'a, C>
13879    where
13880        I: IntoIterator<Item = St>,
13881        St: AsRef<str>,
13882    {
13883        self._scopes
13884            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13885        self
13886    }
13887
13888    /// Removes all scopes, and no default scope will be used either.
13889    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13890    /// for details).
13891    pub fn clear_scopes(mut self) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13892        self._scopes.clear();
13893        self
13894    }
13895}
13896
13897/// Validates a debug token secret that you have previously created using CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive quota is enforced on this method to prevent accidental exposure of the app to abuse.
13898///
13899/// A builder for the *apps.exchangeDebugToken* method supported by a *project* resource.
13900/// It is not used directly, but through a [`ProjectMethods`] instance.
13901///
13902/// # Example
13903///
13904/// Instantiate a resource method builder
13905///
13906/// ```test_harness,no_run
13907/// # extern crate hyper;
13908/// # extern crate hyper_rustls;
13909/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13910/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest;
13911/// # async fn dox() {
13912/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13913///
13914/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13915/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13916/// #     .with_native_roots()
13917/// #     .unwrap()
13918/// #     .https_only()
13919/// #     .enable_http2()
13920/// #     .build();
13921///
13922/// # let executor = hyper_util::rt::TokioExecutor::new();
13923/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13924/// #     secret,
13925/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13926/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13927/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13928/// #     ),
13929/// # ).build().await.unwrap();
13930///
13931/// # let client = hyper_util::client::legacy::Client::builder(
13932/// #     hyper_util::rt::TokioExecutor::new()
13933/// # )
13934/// # .build(
13935/// #     hyper_rustls::HttpsConnectorBuilder::new()
13936/// #         .with_native_roots()
13937/// #         .unwrap()
13938/// #         .https_or_http()
13939/// #         .enable_http2()
13940/// #         .build()
13941/// # );
13942/// # let mut hub = Firebaseappcheck::new(client, auth);
13943/// // As the method needs a request, you would usually fill it with the desired information
13944/// // into the respective structure. Some of the parts shown here might not be applicable !
13945/// // Values shown here are possibly random and not representative !
13946/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest::default();
13947///
13948/// // You can configure optional parameters by calling the respective setters at will, and
13949/// // execute the final call using `doit()`.
13950/// // Values shown here are possibly random and not representative !
13951/// let result = hub.projects().apps_exchange_debug_token(req, "app")
13952///              .doit().await;
13953/// # }
13954/// ```
13955pub struct ProjectAppExchangeDebugTokenCall<'a, C>
13956where
13957    C: 'a,
13958{
13959    hub: &'a Firebaseappcheck<C>,
13960    _request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
13961    _app: String,
13962    _delegate: Option<&'a mut dyn common::Delegate>,
13963    _additional_params: HashMap<String, String>,
13964    _scopes: BTreeSet<String>,
13965}
13966
13967impl<'a, C> common::CallBuilder for ProjectAppExchangeDebugTokenCall<'a, C> {}
13968
13969impl<'a, C> ProjectAppExchangeDebugTokenCall<'a, C>
13970where
13971    C: common::Connector,
13972{
13973    /// Perform the operation you have build so far.
13974    pub async fn doit(
13975        mut self,
13976    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
13977        use std::borrow::Cow;
13978        use std::io::{Read, Seek};
13979
13980        use common::{url::Params, ToParts};
13981        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13982
13983        let mut dd = common::DefaultDelegate;
13984        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13985        dlg.begin(common::MethodInfo {
13986            id: "firebaseappcheck.projects.apps.exchangeDebugToken",
13987            http_method: hyper::Method::POST,
13988        });
13989
13990        for &field in ["alt", "app"].iter() {
13991            if self._additional_params.contains_key(field) {
13992                dlg.finished(false);
13993                return Err(common::Error::FieldClash(field));
13994            }
13995        }
13996
13997        let mut params = Params::with_capacity(4 + self._additional_params.len());
13998        params.push("app", self._app);
13999
14000        params.extend(self._additional_params.iter());
14001
14002        params.push("alt", "json");
14003        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDebugToken";
14004        if self._scopes.is_empty() {
14005            self._scopes
14006                .insert(Scope::CloudPlatform.as_ref().to_string());
14007        }
14008
14009        #[allow(clippy::single_element_loop)]
14010        for &(find_this, param_name) in [("{+app}", "app")].iter() {
14011            url = params.uri_replacement(url, param_name, find_this, true);
14012        }
14013        {
14014            let to_remove = ["app"];
14015            params.remove_params(&to_remove);
14016        }
14017
14018        let url = params.parse_with_url(&url);
14019
14020        let mut json_mime_type = mime::APPLICATION_JSON;
14021        let mut request_value_reader = {
14022            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14023            common::remove_json_null_values(&mut value);
14024            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14025            serde_json::to_writer(&mut dst, &value).unwrap();
14026            dst
14027        };
14028        let request_size = request_value_reader
14029            .seek(std::io::SeekFrom::End(0))
14030            .unwrap();
14031        request_value_reader
14032            .seek(std::io::SeekFrom::Start(0))
14033            .unwrap();
14034
14035        loop {
14036            let token = match self
14037                .hub
14038                .auth
14039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14040                .await
14041            {
14042                Ok(token) => token,
14043                Err(e) => match dlg.token(e) {
14044                    Ok(token) => token,
14045                    Err(e) => {
14046                        dlg.finished(false);
14047                        return Err(common::Error::MissingToken(e));
14048                    }
14049                },
14050            };
14051            request_value_reader
14052                .seek(std::io::SeekFrom::Start(0))
14053                .unwrap();
14054            let mut req_result = {
14055                let client = &self.hub.client;
14056                dlg.pre_request();
14057                let mut req_builder = hyper::Request::builder()
14058                    .method(hyper::Method::POST)
14059                    .uri(url.as_str())
14060                    .header(USER_AGENT, self.hub._user_agent.clone());
14061
14062                if let Some(token) = token.as_ref() {
14063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14064                }
14065
14066                let request = req_builder
14067                    .header(CONTENT_TYPE, json_mime_type.to_string())
14068                    .header(CONTENT_LENGTH, request_size as u64)
14069                    .body(common::to_body(
14070                        request_value_reader.get_ref().clone().into(),
14071                    ));
14072
14073                client.request(request.unwrap()).await
14074            };
14075
14076            match req_result {
14077                Err(err) => {
14078                    if let common::Retry::After(d) = dlg.http_error(&err) {
14079                        sleep(d).await;
14080                        continue;
14081                    }
14082                    dlg.finished(false);
14083                    return Err(common::Error::HttpError(err));
14084                }
14085                Ok(res) => {
14086                    let (mut parts, body) = res.into_parts();
14087                    let mut body = common::Body::new(body);
14088                    if !parts.status.is_success() {
14089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14090                        let error = serde_json::from_str(&common::to_string(&bytes));
14091                        let response = common::to_response(parts, bytes.into());
14092
14093                        if let common::Retry::After(d) =
14094                            dlg.http_failure(&response, error.as_ref().ok())
14095                        {
14096                            sleep(d).await;
14097                            continue;
14098                        }
14099
14100                        dlg.finished(false);
14101
14102                        return Err(match error {
14103                            Ok(value) => common::Error::BadRequest(value),
14104                            _ => common::Error::Failure(response),
14105                        });
14106                    }
14107                    let response = {
14108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14109                        let encoded = common::to_string(&bytes);
14110                        match serde_json::from_str(&encoded) {
14111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14112                            Err(error) => {
14113                                dlg.response_json_decode_error(&encoded, &error);
14114                                return Err(common::Error::JsonDecodeError(
14115                                    encoded.to_string(),
14116                                    error,
14117                                ));
14118                            }
14119                        }
14120                    };
14121
14122                    dlg.finished(true);
14123                    return Ok(response);
14124                }
14125            }
14126        }
14127    }
14128
14129    ///
14130    /// Sets the *request* property to the given value.
14131    ///
14132    /// Even though the property as already been set when instantiating this call,
14133    /// we provide this method for API completeness.
14134    pub fn request(
14135        mut self,
14136        new_value: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
14137    ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
14138        self._request = new_value;
14139        self
14140    }
14141    /// Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
14142    ///
14143    /// Sets the *app* path property to the given value.
14144    ///
14145    /// Even though the property as already been set when instantiating this call,
14146    /// we provide this method for API completeness.
14147    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeDebugTokenCall<'a, C> {
14148        self._app = new_value.to_string();
14149        self
14150    }
14151    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14152    /// while executing the actual API request.
14153    ///
14154    /// ````text
14155    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14156    /// ````
14157    ///
14158    /// Sets the *delegate* property to the given value.
14159    pub fn delegate(
14160        mut self,
14161        new_value: &'a mut dyn common::Delegate,
14162    ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
14163        self._delegate = Some(new_value);
14164        self
14165    }
14166
14167    /// Set any additional parameter of the query string used in the request.
14168    /// It should be used to set parameters which are not yet available through their own
14169    /// setters.
14170    ///
14171    /// Please note that this method must not be used to set any of the known parameters
14172    /// which have their own setter method. If done anyway, the request will fail.
14173    ///
14174    /// # Additional Parameters
14175    ///
14176    /// * *$.xgafv* (query-string) - V1 error format.
14177    /// * *access_token* (query-string) - OAuth access token.
14178    /// * *alt* (query-string) - Data format for response.
14179    /// * *callback* (query-string) - JSONP
14180    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14181    /// * *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.
14182    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14183    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14184    /// * *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.
14185    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14186    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14187    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeDebugTokenCall<'a, C>
14188    where
14189        T: AsRef<str>,
14190    {
14191        self._additional_params
14192            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14193        self
14194    }
14195
14196    /// Identifies the authorization scope for the method you are building.
14197    ///
14198    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14199    /// [`Scope::CloudPlatform`].
14200    ///
14201    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14202    /// tokens for more than one scope.
14203    ///
14204    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14205    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14206    /// sufficient, a read-write scope will do as well.
14207    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeDebugTokenCall<'a, C>
14208    where
14209        St: AsRef<str>,
14210    {
14211        self._scopes.insert(String::from(scope.as_ref()));
14212        self
14213    }
14214    /// Identifies the authorization scope(s) for the method you are building.
14215    ///
14216    /// See [`Self::add_scope()`] for details.
14217    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeDebugTokenCall<'a, C>
14218    where
14219        I: IntoIterator<Item = St>,
14220        St: AsRef<str>,
14221    {
14222        self._scopes
14223            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14224        self
14225    }
14226
14227    /// Removes all scopes, and no default scope will be used either.
14228    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14229    /// for details).
14230    pub fn clear_scopes(mut self) -> ProjectAppExchangeDebugTokenCall<'a, C> {
14231        self._scopes.clear();
14232        self
14233    }
14234}
14235
14236/// Accepts a [`device_token`](https://developer.apple.com/documentation/devicecheck/dcdevice) issued by DeviceCheck, and attempts to validate it with Apple. If valid, returns an AppCheckToken.
14237///
14238/// A builder for the *apps.exchangeDeviceCheckToken* method supported by a *project* resource.
14239/// It is not used directly, but through a [`ProjectMethods`] instance.
14240///
14241/// # Example
14242///
14243/// Instantiate a resource method builder
14244///
14245/// ```test_harness,no_run
14246/// # extern crate hyper;
14247/// # extern crate hyper_rustls;
14248/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14249/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest;
14250/// # async fn dox() {
14251/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14252///
14253/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14254/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14255/// #     .with_native_roots()
14256/// #     .unwrap()
14257/// #     .https_only()
14258/// #     .enable_http2()
14259/// #     .build();
14260///
14261/// # let executor = hyper_util::rt::TokioExecutor::new();
14262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14263/// #     secret,
14264/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14265/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14266/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14267/// #     ),
14268/// # ).build().await.unwrap();
14269///
14270/// # let client = hyper_util::client::legacy::Client::builder(
14271/// #     hyper_util::rt::TokioExecutor::new()
14272/// # )
14273/// # .build(
14274/// #     hyper_rustls::HttpsConnectorBuilder::new()
14275/// #         .with_native_roots()
14276/// #         .unwrap()
14277/// #         .https_or_http()
14278/// #         .enable_http2()
14279/// #         .build()
14280/// # );
14281/// # let mut hub = Firebaseappcheck::new(client, auth);
14282/// // As the method needs a request, you would usually fill it with the desired information
14283/// // into the respective structure. Some of the parts shown here might not be applicable !
14284/// // Values shown here are possibly random and not representative !
14285/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest::default();
14286///
14287/// // You can configure optional parameters by calling the respective setters at will, and
14288/// // execute the final call using `doit()`.
14289/// // Values shown here are possibly random and not representative !
14290/// let result = hub.projects().apps_exchange_device_check_token(req, "app")
14291///              .doit().await;
14292/// # }
14293/// ```
14294pub struct ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14295where
14296    C: 'a,
14297{
14298    hub: &'a Firebaseappcheck<C>,
14299    _request: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
14300    _app: String,
14301    _delegate: Option<&'a mut dyn common::Delegate>,
14302    _additional_params: HashMap<String, String>,
14303    _scopes: BTreeSet<String>,
14304}
14305
14306impl<'a, C> common::CallBuilder for ProjectAppExchangeDeviceCheckTokenCall<'a, C> {}
14307
14308impl<'a, C> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14309where
14310    C: common::Connector,
14311{
14312    /// Perform the operation you have build so far.
14313    pub async fn doit(
14314        mut self,
14315    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14316        use std::borrow::Cow;
14317        use std::io::{Read, Seek};
14318
14319        use common::{url::Params, ToParts};
14320        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14321
14322        let mut dd = common::DefaultDelegate;
14323        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14324        dlg.begin(common::MethodInfo {
14325            id: "firebaseappcheck.projects.apps.exchangeDeviceCheckToken",
14326            http_method: hyper::Method::POST,
14327        });
14328
14329        for &field in ["alt", "app"].iter() {
14330            if self._additional_params.contains_key(field) {
14331                dlg.finished(false);
14332                return Err(common::Error::FieldClash(field));
14333            }
14334        }
14335
14336        let mut params = Params::with_capacity(4 + self._additional_params.len());
14337        params.push("app", self._app);
14338
14339        params.extend(self._additional_params.iter());
14340
14341        params.push("alt", "json");
14342        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDeviceCheckToken";
14343        if self._scopes.is_empty() {
14344            self._scopes
14345                .insert(Scope::CloudPlatform.as_ref().to_string());
14346        }
14347
14348        #[allow(clippy::single_element_loop)]
14349        for &(find_this, param_name) in [("{+app}", "app")].iter() {
14350            url = params.uri_replacement(url, param_name, find_this, true);
14351        }
14352        {
14353            let to_remove = ["app"];
14354            params.remove_params(&to_remove);
14355        }
14356
14357        let url = params.parse_with_url(&url);
14358
14359        let mut json_mime_type = mime::APPLICATION_JSON;
14360        let mut request_value_reader = {
14361            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14362            common::remove_json_null_values(&mut value);
14363            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14364            serde_json::to_writer(&mut dst, &value).unwrap();
14365            dst
14366        };
14367        let request_size = request_value_reader
14368            .seek(std::io::SeekFrom::End(0))
14369            .unwrap();
14370        request_value_reader
14371            .seek(std::io::SeekFrom::Start(0))
14372            .unwrap();
14373
14374        loop {
14375            let token = match self
14376                .hub
14377                .auth
14378                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14379                .await
14380            {
14381                Ok(token) => token,
14382                Err(e) => match dlg.token(e) {
14383                    Ok(token) => token,
14384                    Err(e) => {
14385                        dlg.finished(false);
14386                        return Err(common::Error::MissingToken(e));
14387                    }
14388                },
14389            };
14390            request_value_reader
14391                .seek(std::io::SeekFrom::Start(0))
14392                .unwrap();
14393            let mut req_result = {
14394                let client = &self.hub.client;
14395                dlg.pre_request();
14396                let mut req_builder = hyper::Request::builder()
14397                    .method(hyper::Method::POST)
14398                    .uri(url.as_str())
14399                    .header(USER_AGENT, self.hub._user_agent.clone());
14400
14401                if let Some(token) = token.as_ref() {
14402                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14403                }
14404
14405                let request = req_builder
14406                    .header(CONTENT_TYPE, json_mime_type.to_string())
14407                    .header(CONTENT_LENGTH, request_size as u64)
14408                    .body(common::to_body(
14409                        request_value_reader.get_ref().clone().into(),
14410                    ));
14411
14412                client.request(request.unwrap()).await
14413            };
14414
14415            match req_result {
14416                Err(err) => {
14417                    if let common::Retry::After(d) = dlg.http_error(&err) {
14418                        sleep(d).await;
14419                        continue;
14420                    }
14421                    dlg.finished(false);
14422                    return Err(common::Error::HttpError(err));
14423                }
14424                Ok(res) => {
14425                    let (mut parts, body) = res.into_parts();
14426                    let mut body = common::Body::new(body);
14427                    if !parts.status.is_success() {
14428                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14429                        let error = serde_json::from_str(&common::to_string(&bytes));
14430                        let response = common::to_response(parts, bytes.into());
14431
14432                        if let common::Retry::After(d) =
14433                            dlg.http_failure(&response, error.as_ref().ok())
14434                        {
14435                            sleep(d).await;
14436                            continue;
14437                        }
14438
14439                        dlg.finished(false);
14440
14441                        return Err(match error {
14442                            Ok(value) => common::Error::BadRequest(value),
14443                            _ => common::Error::Failure(response),
14444                        });
14445                    }
14446                    let response = {
14447                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14448                        let encoded = common::to_string(&bytes);
14449                        match serde_json::from_str(&encoded) {
14450                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14451                            Err(error) => {
14452                                dlg.response_json_decode_error(&encoded, &error);
14453                                return Err(common::Error::JsonDecodeError(
14454                                    encoded.to_string(),
14455                                    error,
14456                                ));
14457                            }
14458                        }
14459                    };
14460
14461                    dlg.finished(true);
14462                    return Ok(response);
14463                }
14464            }
14465        }
14466    }
14467
14468    ///
14469    /// Sets the *request* property to the given value.
14470    ///
14471    /// Even though the property as already been set when instantiating this call,
14472    /// we provide this method for API completeness.
14473    pub fn request(
14474        mut self,
14475        new_value: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
14476    ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
14477        self._request = new_value;
14478        self
14479    }
14480    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
14481    ///
14482    /// Sets the *app* path property to the given value.
14483    ///
14484    /// Even though the property as already been set when instantiating this call,
14485    /// we provide this method for API completeness.
14486    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
14487        self._app = new_value.to_string();
14488        self
14489    }
14490    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14491    /// while executing the actual API request.
14492    ///
14493    /// ````text
14494    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14495    /// ````
14496    ///
14497    /// Sets the *delegate* property to the given value.
14498    pub fn delegate(
14499        mut self,
14500        new_value: &'a mut dyn common::Delegate,
14501    ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
14502        self._delegate = Some(new_value);
14503        self
14504    }
14505
14506    /// Set any additional parameter of the query string used in the request.
14507    /// It should be used to set parameters which are not yet available through their own
14508    /// setters.
14509    ///
14510    /// Please note that this method must not be used to set any of the known parameters
14511    /// which have their own setter method. If done anyway, the request will fail.
14512    ///
14513    /// # Additional Parameters
14514    ///
14515    /// * *$.xgafv* (query-string) - V1 error format.
14516    /// * *access_token* (query-string) - OAuth access token.
14517    /// * *alt* (query-string) - Data format for response.
14518    /// * *callback* (query-string) - JSONP
14519    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14520    /// * *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.
14521    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14522    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14523    /// * *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.
14524    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14525    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14526    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14527    where
14528        T: AsRef<str>,
14529    {
14530        self._additional_params
14531            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14532        self
14533    }
14534
14535    /// Identifies the authorization scope for the method you are building.
14536    ///
14537    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14538    /// [`Scope::CloudPlatform`].
14539    ///
14540    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14541    /// tokens for more than one scope.
14542    ///
14543    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14544    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14545    /// sufficient, a read-write scope will do as well.
14546    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14547    where
14548        St: AsRef<str>,
14549    {
14550        self._scopes.insert(String::from(scope.as_ref()));
14551        self
14552    }
14553    /// Identifies the authorization scope(s) for the method you are building.
14554    ///
14555    /// See [`Self::add_scope()`] for details.
14556    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14557    where
14558        I: IntoIterator<Item = St>,
14559        St: AsRef<str>,
14560    {
14561        self._scopes
14562            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14563        self
14564    }
14565
14566    /// Removes all scopes, and no default scope will be used either.
14567    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14568    /// for details).
14569    pub fn clear_scopes(mut self) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
14570        self._scopes.clear();
14571        self
14572    }
14573}
14574
14575/// Validates an [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify). If valid, returns an AppCheckToken.
14576///
14577/// A builder for the *apps.exchangePlayIntegrityToken* method supported by a *project* resource.
14578/// It is not used directly, but through a [`ProjectMethods`] instance.
14579///
14580/// # Example
14581///
14582/// Instantiate a resource method builder
14583///
14584/// ```test_harness,no_run
14585/// # extern crate hyper;
14586/// # extern crate hyper_rustls;
14587/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14588/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest;
14589/// # async fn dox() {
14590/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14591///
14592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14593/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14594/// #     .with_native_roots()
14595/// #     .unwrap()
14596/// #     .https_only()
14597/// #     .enable_http2()
14598/// #     .build();
14599///
14600/// # let executor = hyper_util::rt::TokioExecutor::new();
14601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14602/// #     secret,
14603/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14604/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14605/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14606/// #     ),
14607/// # ).build().await.unwrap();
14608///
14609/// # let client = hyper_util::client::legacy::Client::builder(
14610/// #     hyper_util::rt::TokioExecutor::new()
14611/// # )
14612/// # .build(
14613/// #     hyper_rustls::HttpsConnectorBuilder::new()
14614/// #         .with_native_roots()
14615/// #         .unwrap()
14616/// #         .https_or_http()
14617/// #         .enable_http2()
14618/// #         .build()
14619/// # );
14620/// # let mut hub = Firebaseappcheck::new(client, auth);
14621/// // As the method needs a request, you would usually fill it with the desired information
14622/// // into the respective structure. Some of the parts shown here might not be applicable !
14623/// // Values shown here are possibly random and not representative !
14624/// let mut req = GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest::default();
14625///
14626/// // You can configure optional parameters by calling the respective setters at will, and
14627/// // execute the final call using `doit()`.
14628/// // Values shown here are possibly random and not representative !
14629/// let result = hub.projects().apps_exchange_play_integrity_token(req, "app")
14630///              .doit().await;
14631/// # }
14632/// ```
14633pub struct ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14634where
14635    C: 'a,
14636{
14637    hub: &'a Firebaseappcheck<C>,
14638    _request: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
14639    _app: String,
14640    _delegate: Option<&'a mut dyn common::Delegate>,
14641    _additional_params: HashMap<String, String>,
14642    _scopes: BTreeSet<String>,
14643}
14644
14645impl<'a, C> common::CallBuilder for ProjectAppExchangePlayIntegrityTokenCall<'a, C> {}
14646
14647impl<'a, C> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14648where
14649    C: common::Connector,
14650{
14651    /// Perform the operation you have build so far.
14652    pub async fn doit(
14653        mut self,
14654    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14655        use std::borrow::Cow;
14656        use std::io::{Read, Seek};
14657
14658        use common::{url::Params, ToParts};
14659        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14660
14661        let mut dd = common::DefaultDelegate;
14662        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14663        dlg.begin(common::MethodInfo {
14664            id: "firebaseappcheck.projects.apps.exchangePlayIntegrityToken",
14665            http_method: hyper::Method::POST,
14666        });
14667
14668        for &field in ["alt", "app"].iter() {
14669            if self._additional_params.contains_key(field) {
14670                dlg.finished(false);
14671                return Err(common::Error::FieldClash(field));
14672            }
14673        }
14674
14675        let mut params = Params::with_capacity(4 + self._additional_params.len());
14676        params.push("app", self._app);
14677
14678        params.extend(self._additional_params.iter());
14679
14680        params.push("alt", "json");
14681        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangePlayIntegrityToken";
14682        if self._scopes.is_empty() {
14683            self._scopes
14684                .insert(Scope::CloudPlatform.as_ref().to_string());
14685        }
14686
14687        #[allow(clippy::single_element_loop)]
14688        for &(find_this, param_name) in [("{+app}", "app")].iter() {
14689            url = params.uri_replacement(url, param_name, find_this, true);
14690        }
14691        {
14692            let to_remove = ["app"];
14693            params.remove_params(&to_remove);
14694        }
14695
14696        let url = params.parse_with_url(&url);
14697
14698        let mut json_mime_type = mime::APPLICATION_JSON;
14699        let mut request_value_reader = {
14700            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14701            common::remove_json_null_values(&mut value);
14702            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14703            serde_json::to_writer(&mut dst, &value).unwrap();
14704            dst
14705        };
14706        let request_size = request_value_reader
14707            .seek(std::io::SeekFrom::End(0))
14708            .unwrap();
14709        request_value_reader
14710            .seek(std::io::SeekFrom::Start(0))
14711            .unwrap();
14712
14713        loop {
14714            let token = match self
14715                .hub
14716                .auth
14717                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14718                .await
14719            {
14720                Ok(token) => token,
14721                Err(e) => match dlg.token(e) {
14722                    Ok(token) => token,
14723                    Err(e) => {
14724                        dlg.finished(false);
14725                        return Err(common::Error::MissingToken(e));
14726                    }
14727                },
14728            };
14729            request_value_reader
14730                .seek(std::io::SeekFrom::Start(0))
14731                .unwrap();
14732            let mut req_result = {
14733                let client = &self.hub.client;
14734                dlg.pre_request();
14735                let mut req_builder = hyper::Request::builder()
14736                    .method(hyper::Method::POST)
14737                    .uri(url.as_str())
14738                    .header(USER_AGENT, self.hub._user_agent.clone());
14739
14740                if let Some(token) = token.as_ref() {
14741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14742                }
14743
14744                let request = req_builder
14745                    .header(CONTENT_TYPE, json_mime_type.to_string())
14746                    .header(CONTENT_LENGTH, request_size as u64)
14747                    .body(common::to_body(
14748                        request_value_reader.get_ref().clone().into(),
14749                    ));
14750
14751                client.request(request.unwrap()).await
14752            };
14753
14754            match req_result {
14755                Err(err) => {
14756                    if let common::Retry::After(d) = dlg.http_error(&err) {
14757                        sleep(d).await;
14758                        continue;
14759                    }
14760                    dlg.finished(false);
14761                    return Err(common::Error::HttpError(err));
14762                }
14763                Ok(res) => {
14764                    let (mut parts, body) = res.into_parts();
14765                    let mut body = common::Body::new(body);
14766                    if !parts.status.is_success() {
14767                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14768                        let error = serde_json::from_str(&common::to_string(&bytes));
14769                        let response = common::to_response(parts, bytes.into());
14770
14771                        if let common::Retry::After(d) =
14772                            dlg.http_failure(&response, error.as_ref().ok())
14773                        {
14774                            sleep(d).await;
14775                            continue;
14776                        }
14777
14778                        dlg.finished(false);
14779
14780                        return Err(match error {
14781                            Ok(value) => common::Error::BadRequest(value),
14782                            _ => common::Error::Failure(response),
14783                        });
14784                    }
14785                    let response = {
14786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14787                        let encoded = common::to_string(&bytes);
14788                        match serde_json::from_str(&encoded) {
14789                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14790                            Err(error) => {
14791                                dlg.response_json_decode_error(&encoded, &error);
14792                                return Err(common::Error::JsonDecodeError(
14793                                    encoded.to_string(),
14794                                    error,
14795                                ));
14796                            }
14797                        }
14798                    };
14799
14800                    dlg.finished(true);
14801                    return Ok(response);
14802                }
14803            }
14804        }
14805    }
14806
14807    ///
14808    /// Sets the *request* property to the given value.
14809    ///
14810    /// Even though the property as already been set when instantiating this call,
14811    /// we provide this method for API completeness.
14812    pub fn request(
14813        mut self,
14814        new_value: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
14815    ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14816        self._request = new_value;
14817        self
14818    }
14819    /// Required. The relative resource name of the Android app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
14820    ///
14821    /// Sets the *app* path property to the given value.
14822    ///
14823    /// Even though the property as already been set when instantiating this call,
14824    /// we provide this method for API completeness.
14825    pub fn app(mut self, new_value: &str) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14826        self._app = new_value.to_string();
14827        self
14828    }
14829    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14830    /// while executing the actual API request.
14831    ///
14832    /// ````text
14833    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14834    /// ````
14835    ///
14836    /// Sets the *delegate* property to the given value.
14837    pub fn delegate(
14838        mut self,
14839        new_value: &'a mut dyn common::Delegate,
14840    ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14841        self._delegate = Some(new_value);
14842        self
14843    }
14844
14845    /// Set any additional parameter of the query string used in the request.
14846    /// It should be used to set parameters which are not yet available through their own
14847    /// setters.
14848    ///
14849    /// Please note that this method must not be used to set any of the known parameters
14850    /// which have their own setter method. If done anyway, the request will fail.
14851    ///
14852    /// # Additional Parameters
14853    ///
14854    /// * *$.xgafv* (query-string) - V1 error format.
14855    /// * *access_token* (query-string) - OAuth access token.
14856    /// * *alt* (query-string) - Data format for response.
14857    /// * *callback* (query-string) - JSONP
14858    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14859    /// * *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.
14860    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14861    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14862    /// * *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.
14863    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14864    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14865    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14866    where
14867        T: AsRef<str>,
14868    {
14869        self._additional_params
14870            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14871        self
14872    }
14873
14874    /// Identifies the authorization scope for the method you are building.
14875    ///
14876    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14877    /// [`Scope::CloudPlatform`].
14878    ///
14879    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14880    /// tokens for more than one scope.
14881    ///
14882    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14883    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14884    /// sufficient, a read-write scope will do as well.
14885    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14886    where
14887        St: AsRef<str>,
14888    {
14889        self._scopes.insert(String::from(scope.as_ref()));
14890        self
14891    }
14892    /// Identifies the authorization scope(s) for the method you are building.
14893    ///
14894    /// See [`Self::add_scope()`] for details.
14895    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14896    where
14897        I: IntoIterator<Item = St>,
14898        St: AsRef<str>,
14899    {
14900        self._scopes
14901            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14902        self
14903    }
14904
14905    /// Removes all scopes, and no default scope will be used either.
14906    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14907    /// for details).
14908    pub fn clear_scopes(mut self) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14909        self._scopes.clear();
14910        self
14911    }
14912}
14913
14914/// Validates a [reCAPTCHA Enterprise response token](https://cloud.google.com/recaptcha-enterprise/docs/create-assessment#retrieve_token). If valid, returns an App Check token AppCheckToken.
14915///
14916/// A builder for the *apps.exchangeRecaptchaEnterpriseToken* method supported by a *project* resource.
14917/// It is not used directly, but through a [`ProjectMethods`] instance.
14918///
14919/// # Example
14920///
14921/// Instantiate a resource method builder
14922///
14923/// ```test_harness,no_run
14924/// # extern crate hyper;
14925/// # extern crate hyper_rustls;
14926/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14927/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest;
14928/// # async fn dox() {
14929/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14930///
14931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14933/// #     .with_native_roots()
14934/// #     .unwrap()
14935/// #     .https_only()
14936/// #     .enable_http2()
14937/// #     .build();
14938///
14939/// # let executor = hyper_util::rt::TokioExecutor::new();
14940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14941/// #     secret,
14942/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14943/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14944/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14945/// #     ),
14946/// # ).build().await.unwrap();
14947///
14948/// # let client = hyper_util::client::legacy::Client::builder(
14949/// #     hyper_util::rt::TokioExecutor::new()
14950/// # )
14951/// # .build(
14952/// #     hyper_rustls::HttpsConnectorBuilder::new()
14953/// #         .with_native_roots()
14954/// #         .unwrap()
14955/// #         .https_or_http()
14956/// #         .enable_http2()
14957/// #         .build()
14958/// # );
14959/// # let mut hub = Firebaseappcheck::new(client, auth);
14960/// // As the method needs a request, you would usually fill it with the desired information
14961/// // into the respective structure. Some of the parts shown here might not be applicable !
14962/// // Values shown here are possibly random and not representative !
14963/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest::default();
14964///
14965/// // You can configure optional parameters by calling the respective setters at will, and
14966/// // execute the final call using `doit()`.
14967/// // Values shown here are possibly random and not representative !
14968/// let result = hub.projects().apps_exchange_recaptcha_enterprise_token(req, "app")
14969///              .doit().await;
14970/// # }
14971/// ```
14972pub struct ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14973where
14974    C: 'a,
14975{
14976    hub: &'a Firebaseappcheck<C>,
14977    _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
14978    _app: String,
14979    _delegate: Option<&'a mut dyn common::Delegate>,
14980    _additional_params: HashMap<String, String>,
14981    _scopes: BTreeSet<String>,
14982}
14983
14984impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {}
14985
14986impl<'a, C> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14987where
14988    C: common::Connector,
14989{
14990    /// Perform the operation you have build so far.
14991    pub async fn doit(
14992        mut self,
14993    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14994        use std::borrow::Cow;
14995        use std::io::{Read, Seek};
14996
14997        use common::{url::Params, ToParts};
14998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14999
15000        let mut dd = common::DefaultDelegate;
15001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15002        dlg.begin(common::MethodInfo {
15003            id: "firebaseappcheck.projects.apps.exchangeRecaptchaEnterpriseToken",
15004            http_method: hyper::Method::POST,
15005        });
15006
15007        for &field in ["alt", "app"].iter() {
15008            if self._additional_params.contains_key(field) {
15009                dlg.finished(false);
15010                return Err(common::Error::FieldClash(field));
15011            }
15012        }
15013
15014        let mut params = Params::with_capacity(4 + self._additional_params.len());
15015        params.push("app", self._app);
15016
15017        params.extend(self._additional_params.iter());
15018
15019        params.push("alt", "json");
15020        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaEnterpriseToken";
15021        if self._scopes.is_empty() {
15022            self._scopes
15023                .insert(Scope::CloudPlatform.as_ref().to_string());
15024        }
15025
15026        #[allow(clippy::single_element_loop)]
15027        for &(find_this, param_name) in [("{+app}", "app")].iter() {
15028            url = params.uri_replacement(url, param_name, find_this, true);
15029        }
15030        {
15031            let to_remove = ["app"];
15032            params.remove_params(&to_remove);
15033        }
15034
15035        let url = params.parse_with_url(&url);
15036
15037        let mut json_mime_type = mime::APPLICATION_JSON;
15038        let mut request_value_reader = {
15039            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15040            common::remove_json_null_values(&mut value);
15041            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15042            serde_json::to_writer(&mut dst, &value).unwrap();
15043            dst
15044        };
15045        let request_size = request_value_reader
15046            .seek(std::io::SeekFrom::End(0))
15047            .unwrap();
15048        request_value_reader
15049            .seek(std::io::SeekFrom::Start(0))
15050            .unwrap();
15051
15052        loop {
15053            let token = match self
15054                .hub
15055                .auth
15056                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15057                .await
15058            {
15059                Ok(token) => token,
15060                Err(e) => match dlg.token(e) {
15061                    Ok(token) => token,
15062                    Err(e) => {
15063                        dlg.finished(false);
15064                        return Err(common::Error::MissingToken(e));
15065                    }
15066                },
15067            };
15068            request_value_reader
15069                .seek(std::io::SeekFrom::Start(0))
15070                .unwrap();
15071            let mut req_result = {
15072                let client = &self.hub.client;
15073                dlg.pre_request();
15074                let mut req_builder = hyper::Request::builder()
15075                    .method(hyper::Method::POST)
15076                    .uri(url.as_str())
15077                    .header(USER_AGENT, self.hub._user_agent.clone());
15078
15079                if let Some(token) = token.as_ref() {
15080                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15081                }
15082
15083                let request = req_builder
15084                    .header(CONTENT_TYPE, json_mime_type.to_string())
15085                    .header(CONTENT_LENGTH, request_size as u64)
15086                    .body(common::to_body(
15087                        request_value_reader.get_ref().clone().into(),
15088                    ));
15089
15090                client.request(request.unwrap()).await
15091            };
15092
15093            match req_result {
15094                Err(err) => {
15095                    if let common::Retry::After(d) = dlg.http_error(&err) {
15096                        sleep(d).await;
15097                        continue;
15098                    }
15099                    dlg.finished(false);
15100                    return Err(common::Error::HttpError(err));
15101                }
15102                Ok(res) => {
15103                    let (mut parts, body) = res.into_parts();
15104                    let mut body = common::Body::new(body);
15105                    if !parts.status.is_success() {
15106                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15107                        let error = serde_json::from_str(&common::to_string(&bytes));
15108                        let response = common::to_response(parts, bytes.into());
15109
15110                        if let common::Retry::After(d) =
15111                            dlg.http_failure(&response, error.as_ref().ok())
15112                        {
15113                            sleep(d).await;
15114                            continue;
15115                        }
15116
15117                        dlg.finished(false);
15118
15119                        return Err(match error {
15120                            Ok(value) => common::Error::BadRequest(value),
15121                            _ => common::Error::Failure(response),
15122                        });
15123                    }
15124                    let response = {
15125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15126                        let encoded = common::to_string(&bytes);
15127                        match serde_json::from_str(&encoded) {
15128                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15129                            Err(error) => {
15130                                dlg.response_json_decode_error(&encoded, &error);
15131                                return Err(common::Error::JsonDecodeError(
15132                                    encoded.to_string(),
15133                                    error,
15134                                ));
15135                            }
15136                        }
15137                    };
15138
15139                    dlg.finished(true);
15140                    return Ok(response);
15141                }
15142            }
15143        }
15144    }
15145
15146    ///
15147    /// Sets the *request* property to the given value.
15148    ///
15149    /// Even though the property as already been set when instantiating this call,
15150    /// we provide this method for API completeness.
15151    pub fn request(
15152        mut self,
15153        new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
15154    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
15155        self._request = new_value;
15156        self
15157    }
15158    /// Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
15159    ///
15160    /// Sets the *app* path property to the given value.
15161    ///
15162    /// Even though the property as already been set when instantiating this call,
15163    /// we provide this method for API completeness.
15164    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
15165        self._app = new_value.to_string();
15166        self
15167    }
15168    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15169    /// while executing the actual API request.
15170    ///
15171    /// ````text
15172    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15173    /// ````
15174    ///
15175    /// Sets the *delegate* property to the given value.
15176    pub fn delegate(
15177        mut self,
15178        new_value: &'a mut dyn common::Delegate,
15179    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
15180        self._delegate = Some(new_value);
15181        self
15182    }
15183
15184    /// Set any additional parameter of the query string used in the request.
15185    /// It should be used to set parameters which are not yet available through their own
15186    /// setters.
15187    ///
15188    /// Please note that this method must not be used to set any of the known parameters
15189    /// which have their own setter method. If done anyway, the request will fail.
15190    ///
15191    /// # Additional Parameters
15192    ///
15193    /// * *$.xgafv* (query-string) - V1 error format.
15194    /// * *access_token* (query-string) - OAuth access token.
15195    /// * *alt* (query-string) - Data format for response.
15196    /// * *callback* (query-string) - JSONP
15197    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15198    /// * *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.
15199    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15200    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15201    /// * *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.
15202    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15203    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15204    pub fn param<T>(
15205        mut self,
15206        name: T,
15207        value: T,
15208    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
15209    where
15210        T: AsRef<str>,
15211    {
15212        self._additional_params
15213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15214        self
15215    }
15216
15217    /// Identifies the authorization scope for the method you are building.
15218    ///
15219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15220    /// [`Scope::CloudPlatform`].
15221    ///
15222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15223    /// tokens for more than one scope.
15224    ///
15225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15227    /// sufficient, a read-write scope will do as well.
15228    pub fn add_scope<St>(
15229        mut self,
15230        scope: St,
15231    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
15232    where
15233        St: AsRef<str>,
15234    {
15235        self._scopes.insert(String::from(scope.as_ref()));
15236        self
15237    }
15238    /// Identifies the authorization scope(s) for the method you are building.
15239    ///
15240    /// See [`Self::add_scope()`] for details.
15241    pub fn add_scopes<I, St>(
15242        mut self,
15243        scopes: I,
15244    ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
15245    where
15246        I: IntoIterator<Item = St>,
15247        St: AsRef<str>,
15248    {
15249        self._scopes
15250            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15251        self
15252    }
15253
15254    /// Removes all scopes, and no default scope will be used either.
15255    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15256    /// for details).
15257    pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
15258        self._scopes.clear();
15259        self
15260    }
15261}
15262
15263/// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
15264///
15265/// A builder for the *apps.exchangeRecaptchaToken* method supported by a *project* resource.
15266/// It is not used directly, but through a [`ProjectMethods`] instance.
15267///
15268/// # Example
15269///
15270/// Instantiate a resource method builder
15271///
15272/// ```test_harness,no_run
15273/// # extern crate hyper;
15274/// # extern crate hyper_rustls;
15275/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15276/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest;
15277/// # async fn dox() {
15278/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15279///
15280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15282/// #     .with_native_roots()
15283/// #     .unwrap()
15284/// #     .https_only()
15285/// #     .enable_http2()
15286/// #     .build();
15287///
15288/// # let executor = hyper_util::rt::TokioExecutor::new();
15289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15290/// #     secret,
15291/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15292/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15293/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15294/// #     ),
15295/// # ).build().await.unwrap();
15296///
15297/// # let client = hyper_util::client::legacy::Client::builder(
15298/// #     hyper_util::rt::TokioExecutor::new()
15299/// # )
15300/// # .build(
15301/// #     hyper_rustls::HttpsConnectorBuilder::new()
15302/// #         .with_native_roots()
15303/// #         .unwrap()
15304/// #         .https_or_http()
15305/// #         .enable_http2()
15306/// #         .build()
15307/// # );
15308/// # let mut hub = Firebaseappcheck::new(client, auth);
15309/// // As the method needs a request, you would usually fill it with the desired information
15310/// // into the respective structure. Some of the parts shown here might not be applicable !
15311/// // Values shown here are possibly random and not representative !
15312/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest::default();
15313///
15314/// // You can configure optional parameters by calling the respective setters at will, and
15315/// // execute the final call using `doit()`.
15316/// // Values shown here are possibly random and not representative !
15317/// let result = hub.projects().apps_exchange_recaptcha_token(req, "app")
15318///              .doit().await;
15319/// # }
15320/// ```
15321pub struct ProjectAppExchangeRecaptchaTokenCall<'a, C>
15322where
15323    C: 'a,
15324{
15325    hub: &'a Firebaseappcheck<C>,
15326    _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
15327    _app: String,
15328    _delegate: Option<&'a mut dyn common::Delegate>,
15329    _additional_params: HashMap<String, String>,
15330    _scopes: BTreeSet<String>,
15331}
15332
15333impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaTokenCall<'a, C> {}
15334
15335impl<'a, C> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15336where
15337    C: common::Connector,
15338{
15339    /// Perform the operation you have build so far.
15340    pub async fn doit(
15341        mut self,
15342    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
15343        use std::borrow::Cow;
15344        use std::io::{Read, Seek};
15345
15346        use common::{url::Params, ToParts};
15347        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15348
15349        let mut dd = common::DefaultDelegate;
15350        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15351        dlg.begin(common::MethodInfo {
15352            id: "firebaseappcheck.projects.apps.exchangeRecaptchaToken",
15353            http_method: hyper::Method::POST,
15354        });
15355
15356        for &field in ["alt", "app"].iter() {
15357            if self._additional_params.contains_key(field) {
15358                dlg.finished(false);
15359                return Err(common::Error::FieldClash(field));
15360            }
15361        }
15362
15363        let mut params = Params::with_capacity(4 + self._additional_params.len());
15364        params.push("app", self._app);
15365
15366        params.extend(self._additional_params.iter());
15367
15368        params.push("alt", "json");
15369        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaToken";
15370        if self._scopes.is_empty() {
15371            self._scopes
15372                .insert(Scope::CloudPlatform.as_ref().to_string());
15373        }
15374
15375        #[allow(clippy::single_element_loop)]
15376        for &(find_this, param_name) in [("{+app}", "app")].iter() {
15377            url = params.uri_replacement(url, param_name, find_this, true);
15378        }
15379        {
15380            let to_remove = ["app"];
15381            params.remove_params(&to_remove);
15382        }
15383
15384        let url = params.parse_with_url(&url);
15385
15386        let mut json_mime_type = mime::APPLICATION_JSON;
15387        let mut request_value_reader = {
15388            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15389            common::remove_json_null_values(&mut value);
15390            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15391            serde_json::to_writer(&mut dst, &value).unwrap();
15392            dst
15393        };
15394        let request_size = request_value_reader
15395            .seek(std::io::SeekFrom::End(0))
15396            .unwrap();
15397        request_value_reader
15398            .seek(std::io::SeekFrom::Start(0))
15399            .unwrap();
15400
15401        loop {
15402            let token = match self
15403                .hub
15404                .auth
15405                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15406                .await
15407            {
15408                Ok(token) => token,
15409                Err(e) => match dlg.token(e) {
15410                    Ok(token) => token,
15411                    Err(e) => {
15412                        dlg.finished(false);
15413                        return Err(common::Error::MissingToken(e));
15414                    }
15415                },
15416            };
15417            request_value_reader
15418                .seek(std::io::SeekFrom::Start(0))
15419                .unwrap();
15420            let mut req_result = {
15421                let client = &self.hub.client;
15422                dlg.pre_request();
15423                let mut req_builder = hyper::Request::builder()
15424                    .method(hyper::Method::POST)
15425                    .uri(url.as_str())
15426                    .header(USER_AGENT, self.hub._user_agent.clone());
15427
15428                if let Some(token) = token.as_ref() {
15429                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15430                }
15431
15432                let request = req_builder
15433                    .header(CONTENT_TYPE, json_mime_type.to_string())
15434                    .header(CONTENT_LENGTH, request_size as u64)
15435                    .body(common::to_body(
15436                        request_value_reader.get_ref().clone().into(),
15437                    ));
15438
15439                client.request(request.unwrap()).await
15440            };
15441
15442            match req_result {
15443                Err(err) => {
15444                    if let common::Retry::After(d) = dlg.http_error(&err) {
15445                        sleep(d).await;
15446                        continue;
15447                    }
15448                    dlg.finished(false);
15449                    return Err(common::Error::HttpError(err));
15450                }
15451                Ok(res) => {
15452                    let (mut parts, body) = res.into_parts();
15453                    let mut body = common::Body::new(body);
15454                    if !parts.status.is_success() {
15455                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15456                        let error = serde_json::from_str(&common::to_string(&bytes));
15457                        let response = common::to_response(parts, bytes.into());
15458
15459                        if let common::Retry::After(d) =
15460                            dlg.http_failure(&response, error.as_ref().ok())
15461                        {
15462                            sleep(d).await;
15463                            continue;
15464                        }
15465
15466                        dlg.finished(false);
15467
15468                        return Err(match error {
15469                            Ok(value) => common::Error::BadRequest(value),
15470                            _ => common::Error::Failure(response),
15471                        });
15472                    }
15473                    let response = {
15474                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15475                        let encoded = common::to_string(&bytes);
15476                        match serde_json::from_str(&encoded) {
15477                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15478                            Err(error) => {
15479                                dlg.response_json_decode_error(&encoded, &error);
15480                                return Err(common::Error::JsonDecodeError(
15481                                    encoded.to_string(),
15482                                    error,
15483                                ));
15484                            }
15485                        }
15486                    };
15487
15488                    dlg.finished(true);
15489                    return Ok(response);
15490                }
15491            }
15492        }
15493    }
15494
15495    ///
15496    /// Sets the *request* property to the given value.
15497    ///
15498    /// Even though the property as already been set when instantiating this call,
15499    /// we provide this method for API completeness.
15500    pub fn request(
15501        mut self,
15502        new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
15503    ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
15504        self._request = new_value;
15505        self
15506    }
15507    /// Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
15508    ///
15509    /// Sets the *app* path property to the given value.
15510    ///
15511    /// Even though the property as already been set when instantiating this call,
15512    /// we provide this method for API completeness.
15513    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
15514        self._app = new_value.to_string();
15515        self
15516    }
15517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15518    /// while executing the actual API request.
15519    ///
15520    /// ````text
15521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15522    /// ````
15523    ///
15524    /// Sets the *delegate* property to the given value.
15525    pub fn delegate(
15526        mut self,
15527        new_value: &'a mut dyn common::Delegate,
15528    ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
15529        self._delegate = Some(new_value);
15530        self
15531    }
15532
15533    /// Set any additional parameter of the query string used in the request.
15534    /// It should be used to set parameters which are not yet available through their own
15535    /// setters.
15536    ///
15537    /// Please note that this method must not be used to set any of the known parameters
15538    /// which have their own setter method. If done anyway, the request will fail.
15539    ///
15540    /// # Additional Parameters
15541    ///
15542    /// * *$.xgafv* (query-string) - V1 error format.
15543    /// * *access_token* (query-string) - OAuth access token.
15544    /// * *alt* (query-string) - Data format for response.
15545    /// * *callback* (query-string) - JSONP
15546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15547    /// * *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.
15548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15550    /// * *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.
15551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15553    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15554    where
15555        T: AsRef<str>,
15556    {
15557        self._additional_params
15558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15559        self
15560    }
15561
15562    /// Identifies the authorization scope for the method you are building.
15563    ///
15564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15565    /// [`Scope::CloudPlatform`].
15566    ///
15567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15568    /// tokens for more than one scope.
15569    ///
15570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15572    /// sufficient, a read-write scope will do as well.
15573    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15574    where
15575        St: AsRef<str>,
15576    {
15577        self._scopes.insert(String::from(scope.as_ref()));
15578        self
15579    }
15580    /// Identifies the authorization scope(s) for the method you are building.
15581    ///
15582    /// See [`Self::add_scope()`] for details.
15583    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15584    where
15585        I: IntoIterator<Item = St>,
15586        St: AsRef<str>,
15587    {
15588        self._scopes
15589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15590        self
15591    }
15592
15593    /// Removes all scopes, and no default scope will be used either.
15594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15595    /// for details).
15596    pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
15597        self._scopes.clear();
15598        self
15599    }
15600}
15601
15602/// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
15603///
15604/// A builder for the *apps.exchangeRecaptchaV3Token* method supported by a *project* resource.
15605/// It is not used directly, but through a [`ProjectMethods`] instance.
15606///
15607/// # Example
15608///
15609/// Instantiate a resource method builder
15610///
15611/// ```test_harness,no_run
15612/// # extern crate hyper;
15613/// # extern crate hyper_rustls;
15614/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15615/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest;
15616/// # async fn dox() {
15617/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15618///
15619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15621/// #     .with_native_roots()
15622/// #     .unwrap()
15623/// #     .https_only()
15624/// #     .enable_http2()
15625/// #     .build();
15626///
15627/// # let executor = hyper_util::rt::TokioExecutor::new();
15628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15629/// #     secret,
15630/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15631/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15632/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15633/// #     ),
15634/// # ).build().await.unwrap();
15635///
15636/// # let client = hyper_util::client::legacy::Client::builder(
15637/// #     hyper_util::rt::TokioExecutor::new()
15638/// # )
15639/// # .build(
15640/// #     hyper_rustls::HttpsConnectorBuilder::new()
15641/// #         .with_native_roots()
15642/// #         .unwrap()
15643/// #         .https_or_http()
15644/// #         .enable_http2()
15645/// #         .build()
15646/// # );
15647/// # let mut hub = Firebaseappcheck::new(client, auth);
15648/// // As the method needs a request, you would usually fill it with the desired information
15649/// // into the respective structure. Some of the parts shown here might not be applicable !
15650/// // Values shown here are possibly random and not representative !
15651/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest::default();
15652///
15653/// // You can configure optional parameters by calling the respective setters at will, and
15654/// // execute the final call using `doit()`.
15655/// // Values shown here are possibly random and not representative !
15656/// let result = hub.projects().apps_exchange_recaptcha_v3_token(req, "app")
15657///              .doit().await;
15658/// # }
15659/// ```
15660pub struct ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15661where
15662    C: 'a,
15663{
15664    hub: &'a Firebaseappcheck<C>,
15665    _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
15666    _app: String,
15667    _delegate: Option<&'a mut dyn common::Delegate>,
15668    _additional_params: HashMap<String, String>,
15669    _scopes: BTreeSet<String>,
15670}
15671
15672impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {}
15673
15674impl<'a, C> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15675where
15676    C: common::Connector,
15677{
15678    /// Perform the operation you have build so far.
15679    pub async fn doit(
15680        mut self,
15681    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
15682        use std::borrow::Cow;
15683        use std::io::{Read, Seek};
15684
15685        use common::{url::Params, ToParts};
15686        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15687
15688        let mut dd = common::DefaultDelegate;
15689        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15690        dlg.begin(common::MethodInfo {
15691            id: "firebaseappcheck.projects.apps.exchangeRecaptchaV3Token",
15692            http_method: hyper::Method::POST,
15693        });
15694
15695        for &field in ["alt", "app"].iter() {
15696            if self._additional_params.contains_key(field) {
15697                dlg.finished(false);
15698                return Err(common::Error::FieldClash(field));
15699            }
15700        }
15701
15702        let mut params = Params::with_capacity(4 + self._additional_params.len());
15703        params.push("app", self._app);
15704
15705        params.extend(self._additional_params.iter());
15706
15707        params.push("alt", "json");
15708        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaV3Token";
15709        if self._scopes.is_empty() {
15710            self._scopes
15711                .insert(Scope::CloudPlatform.as_ref().to_string());
15712        }
15713
15714        #[allow(clippy::single_element_loop)]
15715        for &(find_this, param_name) in [("{+app}", "app")].iter() {
15716            url = params.uri_replacement(url, param_name, find_this, true);
15717        }
15718        {
15719            let to_remove = ["app"];
15720            params.remove_params(&to_remove);
15721        }
15722
15723        let url = params.parse_with_url(&url);
15724
15725        let mut json_mime_type = mime::APPLICATION_JSON;
15726        let mut request_value_reader = {
15727            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15728            common::remove_json_null_values(&mut value);
15729            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15730            serde_json::to_writer(&mut dst, &value).unwrap();
15731            dst
15732        };
15733        let request_size = request_value_reader
15734            .seek(std::io::SeekFrom::End(0))
15735            .unwrap();
15736        request_value_reader
15737            .seek(std::io::SeekFrom::Start(0))
15738            .unwrap();
15739
15740        loop {
15741            let token = match self
15742                .hub
15743                .auth
15744                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15745                .await
15746            {
15747                Ok(token) => token,
15748                Err(e) => match dlg.token(e) {
15749                    Ok(token) => token,
15750                    Err(e) => {
15751                        dlg.finished(false);
15752                        return Err(common::Error::MissingToken(e));
15753                    }
15754                },
15755            };
15756            request_value_reader
15757                .seek(std::io::SeekFrom::Start(0))
15758                .unwrap();
15759            let mut req_result = {
15760                let client = &self.hub.client;
15761                dlg.pre_request();
15762                let mut req_builder = hyper::Request::builder()
15763                    .method(hyper::Method::POST)
15764                    .uri(url.as_str())
15765                    .header(USER_AGENT, self.hub._user_agent.clone());
15766
15767                if let Some(token) = token.as_ref() {
15768                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15769                }
15770
15771                let request = req_builder
15772                    .header(CONTENT_TYPE, json_mime_type.to_string())
15773                    .header(CONTENT_LENGTH, request_size as u64)
15774                    .body(common::to_body(
15775                        request_value_reader.get_ref().clone().into(),
15776                    ));
15777
15778                client.request(request.unwrap()).await
15779            };
15780
15781            match req_result {
15782                Err(err) => {
15783                    if let common::Retry::After(d) = dlg.http_error(&err) {
15784                        sleep(d).await;
15785                        continue;
15786                    }
15787                    dlg.finished(false);
15788                    return Err(common::Error::HttpError(err));
15789                }
15790                Ok(res) => {
15791                    let (mut parts, body) = res.into_parts();
15792                    let mut body = common::Body::new(body);
15793                    if !parts.status.is_success() {
15794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15795                        let error = serde_json::from_str(&common::to_string(&bytes));
15796                        let response = common::to_response(parts, bytes.into());
15797
15798                        if let common::Retry::After(d) =
15799                            dlg.http_failure(&response, error.as_ref().ok())
15800                        {
15801                            sleep(d).await;
15802                            continue;
15803                        }
15804
15805                        dlg.finished(false);
15806
15807                        return Err(match error {
15808                            Ok(value) => common::Error::BadRequest(value),
15809                            _ => common::Error::Failure(response),
15810                        });
15811                    }
15812                    let response = {
15813                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15814                        let encoded = common::to_string(&bytes);
15815                        match serde_json::from_str(&encoded) {
15816                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15817                            Err(error) => {
15818                                dlg.response_json_decode_error(&encoded, &error);
15819                                return Err(common::Error::JsonDecodeError(
15820                                    encoded.to_string(),
15821                                    error,
15822                                ));
15823                            }
15824                        }
15825                    };
15826
15827                    dlg.finished(true);
15828                    return Ok(response);
15829                }
15830            }
15831        }
15832    }
15833
15834    ///
15835    /// Sets the *request* property to the given value.
15836    ///
15837    /// Even though the property as already been set when instantiating this call,
15838    /// we provide this method for API completeness.
15839    pub fn request(
15840        mut self,
15841        new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
15842    ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15843        self._request = new_value;
15844        self
15845    }
15846    /// Required. The relative resource name of the web app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
15847    ///
15848    /// Sets the *app* path property to the given value.
15849    ///
15850    /// Even though the property as already been set when instantiating this call,
15851    /// we provide this method for API completeness.
15852    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15853        self._app = new_value.to_string();
15854        self
15855    }
15856    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15857    /// while executing the actual API request.
15858    ///
15859    /// ````text
15860    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15861    /// ````
15862    ///
15863    /// Sets the *delegate* property to the given value.
15864    pub fn delegate(
15865        mut self,
15866        new_value: &'a mut dyn common::Delegate,
15867    ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15868        self._delegate = Some(new_value);
15869        self
15870    }
15871
15872    /// Set any additional parameter of the query string used in the request.
15873    /// It should be used to set parameters which are not yet available through their own
15874    /// setters.
15875    ///
15876    /// Please note that this method must not be used to set any of the known parameters
15877    /// which have their own setter method. If done anyway, the request will fail.
15878    ///
15879    /// # Additional Parameters
15880    ///
15881    /// * *$.xgafv* (query-string) - V1 error format.
15882    /// * *access_token* (query-string) - OAuth access token.
15883    /// * *alt* (query-string) - Data format for response.
15884    /// * *callback* (query-string) - JSONP
15885    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15886    /// * *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.
15887    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15888    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15889    /// * *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.
15890    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15891    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15892    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15893    where
15894        T: AsRef<str>,
15895    {
15896        self._additional_params
15897            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15898        self
15899    }
15900
15901    /// Identifies the authorization scope for the method you are building.
15902    ///
15903    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15904    /// [`Scope::CloudPlatform`].
15905    ///
15906    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15907    /// tokens for more than one scope.
15908    ///
15909    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15910    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15911    /// sufficient, a read-write scope will do as well.
15912    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15913    where
15914        St: AsRef<str>,
15915    {
15916        self._scopes.insert(String::from(scope.as_ref()));
15917        self
15918    }
15919    /// Identifies the authorization scope(s) for the method you are building.
15920    ///
15921    /// See [`Self::add_scope()`] for details.
15922    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15923    where
15924        I: IntoIterator<Item = St>,
15925        St: AsRef<str>,
15926    {
15927        self._scopes
15928            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15929        self
15930    }
15931
15932    /// Removes all scopes, and no default scope will be used either.
15933    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15934    /// for details).
15935    pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15936        self._scopes.clear();
15937        self
15938    }
15939}
15940
15941/// Validates a [SafetyNet token](https://developer.android.com/training/safetynet/attestation#request-attestation-step). If valid, returns an AppCheckToken.
15942///
15943/// A builder for the *apps.exchangeSafetyNetToken* method supported by a *project* resource.
15944/// It is not used directly, but through a [`ProjectMethods`] instance.
15945///
15946/// # Example
15947///
15948/// Instantiate a resource method builder
15949///
15950/// ```test_harness,no_run
15951/// # extern crate hyper;
15952/// # extern crate hyper_rustls;
15953/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15954/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest;
15955/// # async fn dox() {
15956/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15957///
15958/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15959/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15960/// #     .with_native_roots()
15961/// #     .unwrap()
15962/// #     .https_only()
15963/// #     .enable_http2()
15964/// #     .build();
15965///
15966/// # let executor = hyper_util::rt::TokioExecutor::new();
15967/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15968/// #     secret,
15969/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15970/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15971/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15972/// #     ),
15973/// # ).build().await.unwrap();
15974///
15975/// # let client = hyper_util::client::legacy::Client::builder(
15976/// #     hyper_util::rt::TokioExecutor::new()
15977/// # )
15978/// # .build(
15979/// #     hyper_rustls::HttpsConnectorBuilder::new()
15980/// #         .with_native_roots()
15981/// #         .unwrap()
15982/// #         .https_or_http()
15983/// #         .enable_http2()
15984/// #         .build()
15985/// # );
15986/// # let mut hub = Firebaseappcheck::new(client, auth);
15987/// // As the method needs a request, you would usually fill it with the desired information
15988/// // into the respective structure. Some of the parts shown here might not be applicable !
15989/// // Values shown here are possibly random and not representative !
15990/// let mut req = GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest::default();
15991///
15992/// // You can configure optional parameters by calling the respective setters at will, and
15993/// // execute the final call using `doit()`.
15994/// // Values shown here are possibly random and not representative !
15995/// let result = hub.projects().apps_exchange_safety_net_token(req, "app")
15996///              .doit().await;
15997/// # }
15998/// ```
15999pub struct ProjectAppExchangeSafetyNetTokenCall<'a, C>
16000where
16001    C: 'a,
16002{
16003    hub: &'a Firebaseappcheck<C>,
16004    _request: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
16005    _app: String,
16006    _delegate: Option<&'a mut dyn common::Delegate>,
16007    _additional_params: HashMap<String, String>,
16008    _scopes: BTreeSet<String>,
16009}
16010
16011impl<'a, C> common::CallBuilder for ProjectAppExchangeSafetyNetTokenCall<'a, C> {}
16012
16013impl<'a, C> ProjectAppExchangeSafetyNetTokenCall<'a, C>
16014where
16015    C: common::Connector,
16016{
16017    /// Perform the operation you have build so far.
16018    pub async fn doit(
16019        mut self,
16020    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
16021        use std::borrow::Cow;
16022        use std::io::{Read, Seek};
16023
16024        use common::{url::Params, ToParts};
16025        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16026
16027        let mut dd = common::DefaultDelegate;
16028        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16029        dlg.begin(common::MethodInfo {
16030            id: "firebaseappcheck.projects.apps.exchangeSafetyNetToken",
16031            http_method: hyper::Method::POST,
16032        });
16033
16034        for &field in ["alt", "app"].iter() {
16035            if self._additional_params.contains_key(field) {
16036                dlg.finished(false);
16037                return Err(common::Error::FieldClash(field));
16038            }
16039        }
16040
16041        let mut params = Params::with_capacity(4 + self._additional_params.len());
16042        params.push("app", self._app);
16043
16044        params.extend(self._additional_params.iter());
16045
16046        params.push("alt", "json");
16047        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeSafetyNetToken";
16048        if self._scopes.is_empty() {
16049            self._scopes
16050                .insert(Scope::CloudPlatform.as_ref().to_string());
16051        }
16052
16053        #[allow(clippy::single_element_loop)]
16054        for &(find_this, param_name) in [("{+app}", "app")].iter() {
16055            url = params.uri_replacement(url, param_name, find_this, true);
16056        }
16057        {
16058            let to_remove = ["app"];
16059            params.remove_params(&to_remove);
16060        }
16061
16062        let url = params.parse_with_url(&url);
16063
16064        let mut json_mime_type = mime::APPLICATION_JSON;
16065        let mut request_value_reader = {
16066            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16067            common::remove_json_null_values(&mut value);
16068            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16069            serde_json::to_writer(&mut dst, &value).unwrap();
16070            dst
16071        };
16072        let request_size = request_value_reader
16073            .seek(std::io::SeekFrom::End(0))
16074            .unwrap();
16075        request_value_reader
16076            .seek(std::io::SeekFrom::Start(0))
16077            .unwrap();
16078
16079        loop {
16080            let token = match self
16081                .hub
16082                .auth
16083                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16084                .await
16085            {
16086                Ok(token) => token,
16087                Err(e) => match dlg.token(e) {
16088                    Ok(token) => token,
16089                    Err(e) => {
16090                        dlg.finished(false);
16091                        return Err(common::Error::MissingToken(e));
16092                    }
16093                },
16094            };
16095            request_value_reader
16096                .seek(std::io::SeekFrom::Start(0))
16097                .unwrap();
16098            let mut req_result = {
16099                let client = &self.hub.client;
16100                dlg.pre_request();
16101                let mut req_builder = hyper::Request::builder()
16102                    .method(hyper::Method::POST)
16103                    .uri(url.as_str())
16104                    .header(USER_AGENT, self.hub._user_agent.clone());
16105
16106                if let Some(token) = token.as_ref() {
16107                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16108                }
16109
16110                let request = req_builder
16111                    .header(CONTENT_TYPE, json_mime_type.to_string())
16112                    .header(CONTENT_LENGTH, request_size as u64)
16113                    .body(common::to_body(
16114                        request_value_reader.get_ref().clone().into(),
16115                    ));
16116
16117                client.request(request.unwrap()).await
16118            };
16119
16120            match req_result {
16121                Err(err) => {
16122                    if let common::Retry::After(d) = dlg.http_error(&err) {
16123                        sleep(d).await;
16124                        continue;
16125                    }
16126                    dlg.finished(false);
16127                    return Err(common::Error::HttpError(err));
16128                }
16129                Ok(res) => {
16130                    let (mut parts, body) = res.into_parts();
16131                    let mut body = common::Body::new(body);
16132                    if !parts.status.is_success() {
16133                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16134                        let error = serde_json::from_str(&common::to_string(&bytes));
16135                        let response = common::to_response(parts, bytes.into());
16136
16137                        if let common::Retry::After(d) =
16138                            dlg.http_failure(&response, error.as_ref().ok())
16139                        {
16140                            sleep(d).await;
16141                            continue;
16142                        }
16143
16144                        dlg.finished(false);
16145
16146                        return Err(match error {
16147                            Ok(value) => common::Error::BadRequest(value),
16148                            _ => common::Error::Failure(response),
16149                        });
16150                    }
16151                    let response = {
16152                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16153                        let encoded = common::to_string(&bytes);
16154                        match serde_json::from_str(&encoded) {
16155                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16156                            Err(error) => {
16157                                dlg.response_json_decode_error(&encoded, &error);
16158                                return Err(common::Error::JsonDecodeError(
16159                                    encoded.to_string(),
16160                                    error,
16161                                ));
16162                            }
16163                        }
16164                    };
16165
16166                    dlg.finished(true);
16167                    return Ok(response);
16168                }
16169            }
16170        }
16171    }
16172
16173    ///
16174    /// Sets the *request* property to the given value.
16175    ///
16176    /// Even though the property as already been set when instantiating this call,
16177    /// we provide this method for API completeness.
16178    pub fn request(
16179        mut self,
16180        new_value: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
16181    ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
16182        self._request = new_value;
16183        self
16184    }
16185    /// Required. The relative resource name of the Android app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
16186    ///
16187    /// Sets the *app* path property to the given value.
16188    ///
16189    /// Even though the property as already been set when instantiating this call,
16190    /// we provide this method for API completeness.
16191    pub fn app(mut self, new_value: &str) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
16192        self._app = new_value.to_string();
16193        self
16194    }
16195    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16196    /// while executing the actual API request.
16197    ///
16198    /// ````text
16199    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16200    /// ````
16201    ///
16202    /// Sets the *delegate* property to the given value.
16203    pub fn delegate(
16204        mut self,
16205        new_value: &'a mut dyn common::Delegate,
16206    ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
16207        self._delegate = Some(new_value);
16208        self
16209    }
16210
16211    /// Set any additional parameter of the query string used in the request.
16212    /// It should be used to set parameters which are not yet available through their own
16213    /// setters.
16214    ///
16215    /// Please note that this method must not be used to set any of the known parameters
16216    /// which have their own setter method. If done anyway, the request will fail.
16217    ///
16218    /// # Additional Parameters
16219    ///
16220    /// * *$.xgafv* (query-string) - V1 error format.
16221    /// * *access_token* (query-string) - OAuth access token.
16222    /// * *alt* (query-string) - Data format for response.
16223    /// * *callback* (query-string) - JSONP
16224    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16225    /// * *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.
16226    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16227    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16228    /// * *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.
16229    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16230    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16231    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
16232    where
16233        T: AsRef<str>,
16234    {
16235        self._additional_params
16236            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16237        self
16238    }
16239
16240    /// Identifies the authorization scope for the method you are building.
16241    ///
16242    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16243    /// [`Scope::CloudPlatform`].
16244    ///
16245    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16246    /// tokens for more than one scope.
16247    ///
16248    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16249    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16250    /// sufficient, a read-write scope will do as well.
16251    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
16252    where
16253        St: AsRef<str>,
16254    {
16255        self._scopes.insert(String::from(scope.as_ref()));
16256        self
16257    }
16258    /// Identifies the authorization scope(s) for the method you are building.
16259    ///
16260    /// See [`Self::add_scope()`] for details.
16261    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
16262    where
16263        I: IntoIterator<Item = St>,
16264        St: AsRef<str>,
16265    {
16266        self._scopes
16267            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16268        self
16269    }
16270
16271    /// Removes all scopes, and no default scope will be used either.
16272    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16273    /// for details).
16274    pub fn clear_scopes(mut self) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
16275        self._scopes.clear();
16276        self
16277    }
16278}
16279
16280/// Generates a challenge that protects the integrity of an immediately following call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A challenge should not be reused for multiple calls.
16281///
16282/// A builder for the *apps.generateAppAttestChallenge* method supported by a *project* resource.
16283/// It is not used directly, but through a [`ProjectMethods`] instance.
16284///
16285/// # Example
16286///
16287/// Instantiate a resource method builder
16288///
16289/// ```test_harness,no_run
16290/// # extern crate hyper;
16291/// # extern crate hyper_rustls;
16292/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16293/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest;
16294/// # async fn dox() {
16295/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16296///
16297/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16298/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16299/// #     .with_native_roots()
16300/// #     .unwrap()
16301/// #     .https_only()
16302/// #     .enable_http2()
16303/// #     .build();
16304///
16305/// # let executor = hyper_util::rt::TokioExecutor::new();
16306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16307/// #     secret,
16308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16309/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16310/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16311/// #     ),
16312/// # ).build().await.unwrap();
16313///
16314/// # let client = hyper_util::client::legacy::Client::builder(
16315/// #     hyper_util::rt::TokioExecutor::new()
16316/// # )
16317/// # .build(
16318/// #     hyper_rustls::HttpsConnectorBuilder::new()
16319/// #         .with_native_roots()
16320/// #         .unwrap()
16321/// #         .https_or_http()
16322/// #         .enable_http2()
16323/// #         .build()
16324/// # );
16325/// # let mut hub = Firebaseappcheck::new(client, auth);
16326/// // As the method needs a request, you would usually fill it with the desired information
16327/// // into the respective structure. Some of the parts shown here might not be applicable !
16328/// // Values shown here are possibly random and not representative !
16329/// let mut req = GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest::default();
16330///
16331/// // You can configure optional parameters by calling the respective setters at will, and
16332/// // execute the final call using `doit()`.
16333/// // Values shown here are possibly random and not representative !
16334/// let result = hub.projects().apps_generate_app_attest_challenge(req, "app")
16335///              .doit().await;
16336/// # }
16337/// ```
16338pub struct ProjectAppGenerateAppAttestChallengeCall<'a, C>
16339where
16340    C: 'a,
16341{
16342    hub: &'a Firebaseappcheck<C>,
16343    _request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
16344    _app: String,
16345    _delegate: Option<&'a mut dyn common::Delegate>,
16346    _additional_params: HashMap<String, String>,
16347    _scopes: BTreeSet<String>,
16348}
16349
16350impl<'a, C> common::CallBuilder for ProjectAppGenerateAppAttestChallengeCall<'a, C> {}
16351
16352impl<'a, C> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16353where
16354    C: common::Connector,
16355{
16356    /// Perform the operation you have build so far.
16357    pub async fn doit(
16358        mut self,
16359    ) -> common::Result<(
16360        common::Response,
16361        GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse,
16362    )> {
16363        use std::borrow::Cow;
16364        use std::io::{Read, Seek};
16365
16366        use common::{url::Params, ToParts};
16367        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16368
16369        let mut dd = common::DefaultDelegate;
16370        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16371        dlg.begin(common::MethodInfo {
16372            id: "firebaseappcheck.projects.apps.generateAppAttestChallenge",
16373            http_method: hyper::Method::POST,
16374        });
16375
16376        for &field in ["alt", "app"].iter() {
16377            if self._additional_params.contains_key(field) {
16378                dlg.finished(false);
16379                return Err(common::Error::FieldClash(field));
16380            }
16381        }
16382
16383        let mut params = Params::with_capacity(4 + self._additional_params.len());
16384        params.push("app", self._app);
16385
16386        params.extend(self._additional_params.iter());
16387
16388        params.push("alt", "json");
16389        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generateAppAttestChallenge";
16390        if self._scopes.is_empty() {
16391            self._scopes
16392                .insert(Scope::CloudPlatform.as_ref().to_string());
16393        }
16394
16395        #[allow(clippy::single_element_loop)]
16396        for &(find_this, param_name) in [("{+app}", "app")].iter() {
16397            url = params.uri_replacement(url, param_name, find_this, true);
16398        }
16399        {
16400            let to_remove = ["app"];
16401            params.remove_params(&to_remove);
16402        }
16403
16404        let url = params.parse_with_url(&url);
16405
16406        let mut json_mime_type = mime::APPLICATION_JSON;
16407        let mut request_value_reader = {
16408            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16409            common::remove_json_null_values(&mut value);
16410            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16411            serde_json::to_writer(&mut dst, &value).unwrap();
16412            dst
16413        };
16414        let request_size = request_value_reader
16415            .seek(std::io::SeekFrom::End(0))
16416            .unwrap();
16417        request_value_reader
16418            .seek(std::io::SeekFrom::Start(0))
16419            .unwrap();
16420
16421        loop {
16422            let token = match self
16423                .hub
16424                .auth
16425                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16426                .await
16427            {
16428                Ok(token) => token,
16429                Err(e) => match dlg.token(e) {
16430                    Ok(token) => token,
16431                    Err(e) => {
16432                        dlg.finished(false);
16433                        return Err(common::Error::MissingToken(e));
16434                    }
16435                },
16436            };
16437            request_value_reader
16438                .seek(std::io::SeekFrom::Start(0))
16439                .unwrap();
16440            let mut req_result = {
16441                let client = &self.hub.client;
16442                dlg.pre_request();
16443                let mut req_builder = hyper::Request::builder()
16444                    .method(hyper::Method::POST)
16445                    .uri(url.as_str())
16446                    .header(USER_AGENT, self.hub._user_agent.clone());
16447
16448                if let Some(token) = token.as_ref() {
16449                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16450                }
16451
16452                let request = req_builder
16453                    .header(CONTENT_TYPE, json_mime_type.to_string())
16454                    .header(CONTENT_LENGTH, request_size as u64)
16455                    .body(common::to_body(
16456                        request_value_reader.get_ref().clone().into(),
16457                    ));
16458
16459                client.request(request.unwrap()).await
16460            };
16461
16462            match req_result {
16463                Err(err) => {
16464                    if let common::Retry::After(d) = dlg.http_error(&err) {
16465                        sleep(d).await;
16466                        continue;
16467                    }
16468                    dlg.finished(false);
16469                    return Err(common::Error::HttpError(err));
16470                }
16471                Ok(res) => {
16472                    let (mut parts, body) = res.into_parts();
16473                    let mut body = common::Body::new(body);
16474                    if !parts.status.is_success() {
16475                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16476                        let error = serde_json::from_str(&common::to_string(&bytes));
16477                        let response = common::to_response(parts, bytes.into());
16478
16479                        if let common::Retry::After(d) =
16480                            dlg.http_failure(&response, error.as_ref().ok())
16481                        {
16482                            sleep(d).await;
16483                            continue;
16484                        }
16485
16486                        dlg.finished(false);
16487
16488                        return Err(match error {
16489                            Ok(value) => common::Error::BadRequest(value),
16490                            _ => common::Error::Failure(response),
16491                        });
16492                    }
16493                    let response = {
16494                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16495                        let encoded = common::to_string(&bytes);
16496                        match serde_json::from_str(&encoded) {
16497                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16498                            Err(error) => {
16499                                dlg.response_json_decode_error(&encoded, &error);
16500                                return Err(common::Error::JsonDecodeError(
16501                                    encoded.to_string(),
16502                                    error,
16503                                ));
16504                            }
16505                        }
16506                    };
16507
16508                    dlg.finished(true);
16509                    return Ok(response);
16510                }
16511            }
16512        }
16513    }
16514
16515    ///
16516    /// Sets the *request* property to the given value.
16517    ///
16518    /// Even though the property as already been set when instantiating this call,
16519    /// we provide this method for API completeness.
16520    pub fn request(
16521        mut self,
16522        new_value: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
16523    ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
16524        self._request = new_value;
16525        self
16526    }
16527    /// Required. The relative resource name of the iOS app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard. Alternatively, if this method is being called for an OAuth client protected by App Check, this field can also be in the format: ``` oauthClients/{oauth_client_id} ``` You can view the OAuth client ID for your OAuth clients in the Google Cloud console. Note that only iOS OAuth clients are supported at this time, and they must be linked to corresponding iOS Firebase apps. Please see [the documentation](https://developers.google.com/identity/sign-in/ios/appcheck/get-started#project-setup) for more information.
16528    ///
16529    /// Sets the *app* path property to the given value.
16530    ///
16531    /// Even though the property as already been set when instantiating this call,
16532    /// we provide this method for API completeness.
16533    pub fn app(mut self, new_value: &str) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
16534        self._app = new_value.to_string();
16535        self
16536    }
16537    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16538    /// while executing the actual API request.
16539    ///
16540    /// ````text
16541    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16542    /// ````
16543    ///
16544    /// Sets the *delegate* property to the given value.
16545    pub fn delegate(
16546        mut self,
16547        new_value: &'a mut dyn common::Delegate,
16548    ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
16549        self._delegate = Some(new_value);
16550        self
16551    }
16552
16553    /// Set any additional parameter of the query string used in the request.
16554    /// It should be used to set parameters which are not yet available through their own
16555    /// setters.
16556    ///
16557    /// Please note that this method must not be used to set any of the known parameters
16558    /// which have their own setter method. If done anyway, the request will fail.
16559    ///
16560    /// # Additional Parameters
16561    ///
16562    /// * *$.xgafv* (query-string) - V1 error format.
16563    /// * *access_token* (query-string) - OAuth access token.
16564    /// * *alt* (query-string) - Data format for response.
16565    /// * *callback* (query-string) - JSONP
16566    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16567    /// * *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.
16568    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16569    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16570    /// * *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.
16571    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16572    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16573    pub fn param<T>(mut self, name: T, value: T) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16574    where
16575        T: AsRef<str>,
16576    {
16577        self._additional_params
16578            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16579        self
16580    }
16581
16582    /// Identifies the authorization scope for the method you are building.
16583    ///
16584    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16585    /// [`Scope::CloudPlatform`].
16586    ///
16587    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16588    /// tokens for more than one scope.
16589    ///
16590    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16591    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16592    /// sufficient, a read-write scope will do as well.
16593    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16594    where
16595        St: AsRef<str>,
16596    {
16597        self._scopes.insert(String::from(scope.as_ref()));
16598        self
16599    }
16600    /// Identifies the authorization scope(s) for the method you are building.
16601    ///
16602    /// See [`Self::add_scope()`] for details.
16603    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16604    where
16605        I: IntoIterator<Item = St>,
16606        St: AsRef<str>,
16607    {
16608        self._scopes
16609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16610        self
16611    }
16612
16613    /// Removes all scopes, and no default scope will be used either.
16614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16615    /// for details).
16616    pub fn clear_scopes(mut self) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
16617        self._scopes.clear();
16618        self
16619    }
16620}
16621
16622/// Generates a challenge that protects the integrity of an immediately following integrity verdict request to the Play Integrity API. The next call to ExchangePlayIntegrityToken using the resulting integrity token will verify the presence and validity of the challenge. A challenge should not be reused for multiple calls.
16623///
16624/// A builder for the *apps.generatePlayIntegrityChallenge* method supported by a *project* resource.
16625/// It is not used directly, but through a [`ProjectMethods`] instance.
16626///
16627/// # Example
16628///
16629/// Instantiate a resource method builder
16630///
16631/// ```test_harness,no_run
16632/// # extern crate hyper;
16633/// # extern crate hyper_rustls;
16634/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16635/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest;
16636/// # async fn dox() {
16637/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16638///
16639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16640/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16641/// #     .with_native_roots()
16642/// #     .unwrap()
16643/// #     .https_only()
16644/// #     .enable_http2()
16645/// #     .build();
16646///
16647/// # let executor = hyper_util::rt::TokioExecutor::new();
16648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16649/// #     secret,
16650/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16651/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16652/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16653/// #     ),
16654/// # ).build().await.unwrap();
16655///
16656/// # let client = hyper_util::client::legacy::Client::builder(
16657/// #     hyper_util::rt::TokioExecutor::new()
16658/// # )
16659/// # .build(
16660/// #     hyper_rustls::HttpsConnectorBuilder::new()
16661/// #         .with_native_roots()
16662/// #         .unwrap()
16663/// #         .https_or_http()
16664/// #         .enable_http2()
16665/// #         .build()
16666/// # );
16667/// # let mut hub = Firebaseappcheck::new(client, auth);
16668/// // As the method needs a request, you would usually fill it with the desired information
16669/// // into the respective structure. Some of the parts shown here might not be applicable !
16670/// // Values shown here are possibly random and not representative !
16671/// let mut req = GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest::default();
16672///
16673/// // You can configure optional parameters by calling the respective setters at will, and
16674/// // execute the final call using `doit()`.
16675/// // Values shown here are possibly random and not representative !
16676/// let result = hub.projects().apps_generate_play_integrity_challenge(req, "app")
16677///              .doit().await;
16678/// # }
16679/// ```
16680pub struct ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16681where
16682    C: 'a,
16683{
16684    hub: &'a Firebaseappcheck<C>,
16685    _request: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
16686    _app: String,
16687    _delegate: Option<&'a mut dyn common::Delegate>,
16688    _additional_params: HashMap<String, String>,
16689    _scopes: BTreeSet<String>,
16690}
16691
16692impl<'a, C> common::CallBuilder for ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {}
16693
16694impl<'a, C> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16695where
16696    C: common::Connector,
16697{
16698    /// Perform the operation you have build so far.
16699    pub async fn doit(
16700        mut self,
16701    ) -> common::Result<(
16702        common::Response,
16703        GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse,
16704    )> {
16705        use std::borrow::Cow;
16706        use std::io::{Read, Seek};
16707
16708        use common::{url::Params, ToParts};
16709        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16710
16711        let mut dd = common::DefaultDelegate;
16712        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16713        dlg.begin(common::MethodInfo {
16714            id: "firebaseappcheck.projects.apps.generatePlayIntegrityChallenge",
16715            http_method: hyper::Method::POST,
16716        });
16717
16718        for &field in ["alt", "app"].iter() {
16719            if self._additional_params.contains_key(field) {
16720                dlg.finished(false);
16721                return Err(common::Error::FieldClash(field));
16722            }
16723        }
16724
16725        let mut params = Params::with_capacity(4 + self._additional_params.len());
16726        params.push("app", self._app);
16727
16728        params.extend(self._additional_params.iter());
16729
16730        params.push("alt", "json");
16731        let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generatePlayIntegrityChallenge";
16732        if self._scopes.is_empty() {
16733            self._scopes
16734                .insert(Scope::CloudPlatform.as_ref().to_string());
16735        }
16736
16737        #[allow(clippy::single_element_loop)]
16738        for &(find_this, param_name) in [("{+app}", "app")].iter() {
16739            url = params.uri_replacement(url, param_name, find_this, true);
16740        }
16741        {
16742            let to_remove = ["app"];
16743            params.remove_params(&to_remove);
16744        }
16745
16746        let url = params.parse_with_url(&url);
16747
16748        let mut json_mime_type = mime::APPLICATION_JSON;
16749        let mut request_value_reader = {
16750            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16751            common::remove_json_null_values(&mut value);
16752            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16753            serde_json::to_writer(&mut dst, &value).unwrap();
16754            dst
16755        };
16756        let request_size = request_value_reader
16757            .seek(std::io::SeekFrom::End(0))
16758            .unwrap();
16759        request_value_reader
16760            .seek(std::io::SeekFrom::Start(0))
16761            .unwrap();
16762
16763        loop {
16764            let token = match self
16765                .hub
16766                .auth
16767                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16768                .await
16769            {
16770                Ok(token) => token,
16771                Err(e) => match dlg.token(e) {
16772                    Ok(token) => token,
16773                    Err(e) => {
16774                        dlg.finished(false);
16775                        return Err(common::Error::MissingToken(e));
16776                    }
16777                },
16778            };
16779            request_value_reader
16780                .seek(std::io::SeekFrom::Start(0))
16781                .unwrap();
16782            let mut req_result = {
16783                let client = &self.hub.client;
16784                dlg.pre_request();
16785                let mut req_builder = hyper::Request::builder()
16786                    .method(hyper::Method::POST)
16787                    .uri(url.as_str())
16788                    .header(USER_AGENT, self.hub._user_agent.clone());
16789
16790                if let Some(token) = token.as_ref() {
16791                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16792                }
16793
16794                let request = req_builder
16795                    .header(CONTENT_TYPE, json_mime_type.to_string())
16796                    .header(CONTENT_LENGTH, request_size as u64)
16797                    .body(common::to_body(
16798                        request_value_reader.get_ref().clone().into(),
16799                    ));
16800
16801                client.request(request.unwrap()).await
16802            };
16803
16804            match req_result {
16805                Err(err) => {
16806                    if let common::Retry::After(d) = dlg.http_error(&err) {
16807                        sleep(d).await;
16808                        continue;
16809                    }
16810                    dlg.finished(false);
16811                    return Err(common::Error::HttpError(err));
16812                }
16813                Ok(res) => {
16814                    let (mut parts, body) = res.into_parts();
16815                    let mut body = common::Body::new(body);
16816                    if !parts.status.is_success() {
16817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16818                        let error = serde_json::from_str(&common::to_string(&bytes));
16819                        let response = common::to_response(parts, bytes.into());
16820
16821                        if let common::Retry::After(d) =
16822                            dlg.http_failure(&response, error.as_ref().ok())
16823                        {
16824                            sleep(d).await;
16825                            continue;
16826                        }
16827
16828                        dlg.finished(false);
16829
16830                        return Err(match error {
16831                            Ok(value) => common::Error::BadRequest(value),
16832                            _ => common::Error::Failure(response),
16833                        });
16834                    }
16835                    let response = {
16836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16837                        let encoded = common::to_string(&bytes);
16838                        match serde_json::from_str(&encoded) {
16839                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16840                            Err(error) => {
16841                                dlg.response_json_decode_error(&encoded, &error);
16842                                return Err(common::Error::JsonDecodeError(
16843                                    encoded.to_string(),
16844                                    error,
16845                                ));
16846                            }
16847                        }
16848                    };
16849
16850                    dlg.finished(true);
16851                    return Ok(response);
16852                }
16853            }
16854        }
16855    }
16856
16857    ///
16858    /// Sets the *request* property to the given value.
16859    ///
16860    /// Even though the property as already been set when instantiating this call,
16861    /// we provide this method for API completeness.
16862    pub fn request(
16863        mut self,
16864        new_value: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
16865    ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16866        self._request = new_value;
16867        self
16868    }
16869    /// Required. The relative resource name of the app, in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
16870    ///
16871    /// Sets the *app* path property to the given value.
16872    ///
16873    /// Even though the property as already been set when instantiating this call,
16874    /// we provide this method for API completeness.
16875    pub fn app(mut self, new_value: &str) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16876        self._app = new_value.to_string();
16877        self
16878    }
16879    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16880    /// while executing the actual API request.
16881    ///
16882    /// ````text
16883    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16884    /// ````
16885    ///
16886    /// Sets the *delegate* property to the given value.
16887    pub fn delegate(
16888        mut self,
16889        new_value: &'a mut dyn common::Delegate,
16890    ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16891        self._delegate = Some(new_value);
16892        self
16893    }
16894
16895    /// Set any additional parameter of the query string used in the request.
16896    /// It should be used to set parameters which are not yet available through their own
16897    /// setters.
16898    ///
16899    /// Please note that this method must not be used to set any of the known parameters
16900    /// which have their own setter method. If done anyway, the request will fail.
16901    ///
16902    /// # Additional Parameters
16903    ///
16904    /// * *$.xgafv* (query-string) - V1 error format.
16905    /// * *access_token* (query-string) - OAuth access token.
16906    /// * *alt* (query-string) - Data format for response.
16907    /// * *callback* (query-string) - JSONP
16908    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16909    /// * *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.
16910    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16911    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16912    /// * *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.
16913    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16914    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16915    pub fn param<T>(
16916        mut self,
16917        name: T,
16918        value: T,
16919    ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16920    where
16921        T: AsRef<str>,
16922    {
16923        self._additional_params
16924            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16925        self
16926    }
16927
16928    /// Identifies the authorization scope for the method you are building.
16929    ///
16930    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16931    /// [`Scope::CloudPlatform`].
16932    ///
16933    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16934    /// tokens for more than one scope.
16935    ///
16936    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16937    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16938    /// sufficient, a read-write scope will do as well.
16939    pub fn add_scope<St>(mut self, scope: St) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16940    where
16941        St: AsRef<str>,
16942    {
16943        self._scopes.insert(String::from(scope.as_ref()));
16944        self
16945    }
16946    /// Identifies the authorization scope(s) for the method you are building.
16947    ///
16948    /// See [`Self::add_scope()`] for details.
16949    pub fn add_scopes<I, St>(
16950        mut self,
16951        scopes: I,
16952    ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16953    where
16954        I: IntoIterator<Item = St>,
16955        St: AsRef<str>,
16956    {
16957        self._scopes
16958            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16959        self
16960    }
16961
16962    /// Removes all scopes, and no default scope will be used either.
16963    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16964    /// for details).
16965    pub fn clear_scopes(mut self) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16966        self._scopes.clear();
16967        self
16968    }
16969}
16970
16971/// Atomically updates the specified ResourcePolicy configurations.
16972///
16973/// A builder for the *services.resourcePolicies.batchUpdate* method supported by a *project* resource.
16974/// It is not used directly, but through a [`ProjectMethods`] instance.
16975///
16976/// # Example
16977///
16978/// Instantiate a resource method builder
16979///
16980/// ```test_harness,no_run
16981/// # extern crate hyper;
16982/// # extern crate hyper_rustls;
16983/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16984/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest;
16985/// # async fn dox() {
16986/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16987///
16988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16990/// #     .with_native_roots()
16991/// #     .unwrap()
16992/// #     .https_only()
16993/// #     .enable_http2()
16994/// #     .build();
16995///
16996/// # let executor = hyper_util::rt::TokioExecutor::new();
16997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16998/// #     secret,
16999/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17000/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17001/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17002/// #     ),
17003/// # ).build().await.unwrap();
17004///
17005/// # let client = hyper_util::client::legacy::Client::builder(
17006/// #     hyper_util::rt::TokioExecutor::new()
17007/// # )
17008/// # .build(
17009/// #     hyper_rustls::HttpsConnectorBuilder::new()
17010/// #         .with_native_roots()
17011/// #         .unwrap()
17012/// #         .https_or_http()
17013/// #         .enable_http2()
17014/// #         .build()
17015/// # );
17016/// # let mut hub = Firebaseappcheck::new(client, auth);
17017/// // As the method needs a request, you would usually fill it with the desired information
17018/// // into the respective structure. Some of the parts shown here might not be applicable !
17019/// // Values shown here are possibly random and not representative !
17020/// let mut req = GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest::default();
17021///
17022/// // You can configure optional parameters by calling the respective setters at will, and
17023/// // execute the final call using `doit()`.
17024/// // Values shown here are possibly random and not representative !
17025/// let result = hub.projects().services_resource_policies_batch_update(req, "parent")
17026///              .doit().await;
17027/// # }
17028/// ```
17029pub struct ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
17030where
17031    C: 'a,
17032{
17033    hub: &'a Firebaseappcheck<C>,
17034    _request: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
17035    _parent: String,
17036    _delegate: Option<&'a mut dyn common::Delegate>,
17037    _additional_params: HashMap<String, String>,
17038    _scopes: BTreeSet<String>,
17039}
17040
17041impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {}
17042
17043impl<'a, C> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
17044where
17045    C: common::Connector,
17046{
17047    /// Perform the operation you have build so far.
17048    pub async fn doit(
17049        mut self,
17050    ) -> common::Result<(
17051        common::Response,
17052        GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse,
17053    )> {
17054        use std::borrow::Cow;
17055        use std::io::{Read, Seek};
17056
17057        use common::{url::Params, ToParts};
17058        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17059
17060        let mut dd = common::DefaultDelegate;
17061        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17062        dlg.begin(common::MethodInfo {
17063            id: "firebaseappcheck.projects.services.resourcePolicies.batchUpdate",
17064            http_method: hyper::Method::POST,
17065        });
17066
17067        for &field in ["alt", "parent"].iter() {
17068            if self._additional_params.contains_key(field) {
17069                dlg.finished(false);
17070                return Err(common::Error::FieldClash(field));
17071            }
17072        }
17073
17074        let mut params = Params::with_capacity(4 + self._additional_params.len());
17075        params.push("parent", self._parent);
17076
17077        params.extend(self._additional_params.iter());
17078
17079        params.push("alt", "json");
17080        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies:batchUpdate";
17081        if self._scopes.is_empty() {
17082            self._scopes
17083                .insert(Scope::CloudPlatform.as_ref().to_string());
17084        }
17085
17086        #[allow(clippy::single_element_loop)]
17087        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17088            url = params.uri_replacement(url, param_name, find_this, true);
17089        }
17090        {
17091            let to_remove = ["parent"];
17092            params.remove_params(&to_remove);
17093        }
17094
17095        let url = params.parse_with_url(&url);
17096
17097        let mut json_mime_type = mime::APPLICATION_JSON;
17098        let mut request_value_reader = {
17099            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17100            common::remove_json_null_values(&mut value);
17101            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17102            serde_json::to_writer(&mut dst, &value).unwrap();
17103            dst
17104        };
17105        let request_size = request_value_reader
17106            .seek(std::io::SeekFrom::End(0))
17107            .unwrap();
17108        request_value_reader
17109            .seek(std::io::SeekFrom::Start(0))
17110            .unwrap();
17111
17112        loop {
17113            let token = match self
17114                .hub
17115                .auth
17116                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17117                .await
17118            {
17119                Ok(token) => token,
17120                Err(e) => match dlg.token(e) {
17121                    Ok(token) => token,
17122                    Err(e) => {
17123                        dlg.finished(false);
17124                        return Err(common::Error::MissingToken(e));
17125                    }
17126                },
17127            };
17128            request_value_reader
17129                .seek(std::io::SeekFrom::Start(0))
17130                .unwrap();
17131            let mut req_result = {
17132                let client = &self.hub.client;
17133                dlg.pre_request();
17134                let mut req_builder = hyper::Request::builder()
17135                    .method(hyper::Method::POST)
17136                    .uri(url.as_str())
17137                    .header(USER_AGENT, self.hub._user_agent.clone());
17138
17139                if let Some(token) = token.as_ref() {
17140                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17141                }
17142
17143                let request = req_builder
17144                    .header(CONTENT_TYPE, json_mime_type.to_string())
17145                    .header(CONTENT_LENGTH, request_size as u64)
17146                    .body(common::to_body(
17147                        request_value_reader.get_ref().clone().into(),
17148                    ));
17149
17150                client.request(request.unwrap()).await
17151            };
17152
17153            match req_result {
17154                Err(err) => {
17155                    if let common::Retry::After(d) = dlg.http_error(&err) {
17156                        sleep(d).await;
17157                        continue;
17158                    }
17159                    dlg.finished(false);
17160                    return Err(common::Error::HttpError(err));
17161                }
17162                Ok(res) => {
17163                    let (mut parts, body) = res.into_parts();
17164                    let mut body = common::Body::new(body);
17165                    if !parts.status.is_success() {
17166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17167                        let error = serde_json::from_str(&common::to_string(&bytes));
17168                        let response = common::to_response(parts, bytes.into());
17169
17170                        if let common::Retry::After(d) =
17171                            dlg.http_failure(&response, error.as_ref().ok())
17172                        {
17173                            sleep(d).await;
17174                            continue;
17175                        }
17176
17177                        dlg.finished(false);
17178
17179                        return Err(match error {
17180                            Ok(value) => common::Error::BadRequest(value),
17181                            _ => common::Error::Failure(response),
17182                        });
17183                    }
17184                    let response = {
17185                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17186                        let encoded = common::to_string(&bytes);
17187                        match serde_json::from_str(&encoded) {
17188                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17189                            Err(error) => {
17190                                dlg.response_json_decode_error(&encoded, &error);
17191                                return Err(common::Error::JsonDecodeError(
17192                                    encoded.to_string(),
17193                                    error,
17194                                ));
17195                            }
17196                        }
17197                    };
17198
17199                    dlg.finished(true);
17200                    return Ok(response);
17201                }
17202            }
17203        }
17204    }
17205
17206    ///
17207    /// Sets the *request* property to the given value.
17208    ///
17209    /// Even though the property as already been set when instantiating this call,
17210    /// we provide this method for API completeness.
17211    pub fn request(
17212        mut self,
17213        new_value: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
17214    ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
17215        self._request = new_value;
17216        self
17217    }
17218    /// Required. The parent service name, in the format ``` projects/{project_number}/services/{service_id} ``` The parent collection in the `name` field of any resource being updated must match this field, or the entire batch fails.
17219    ///
17220    /// Sets the *parent* path property to the given value.
17221    ///
17222    /// Even though the property as already been set when instantiating this call,
17223    /// we provide this method for API completeness.
17224    pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
17225        self._parent = new_value.to_string();
17226        self
17227    }
17228    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17229    /// while executing the actual API request.
17230    ///
17231    /// ````text
17232    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17233    /// ````
17234    ///
17235    /// Sets the *delegate* property to the given value.
17236    pub fn delegate(
17237        mut self,
17238        new_value: &'a mut dyn common::Delegate,
17239    ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
17240        self._delegate = Some(new_value);
17241        self
17242    }
17243
17244    /// Set any additional parameter of the query string used in the request.
17245    /// It should be used to set parameters which are not yet available through their own
17246    /// setters.
17247    ///
17248    /// Please note that this method must not be used to set any of the known parameters
17249    /// which have their own setter method. If done anyway, the request will fail.
17250    ///
17251    /// # Additional Parameters
17252    ///
17253    /// * *$.xgafv* (query-string) - V1 error format.
17254    /// * *access_token* (query-string) - OAuth access token.
17255    /// * *alt* (query-string) - Data format for response.
17256    /// * *callback* (query-string) - JSONP
17257    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17258    /// * *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.
17259    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17260    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17261    /// * *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.
17262    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17263    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17264    pub fn param<T>(
17265        mut self,
17266        name: T,
17267        value: T,
17268    ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
17269    where
17270        T: AsRef<str>,
17271    {
17272        self._additional_params
17273            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17274        self
17275    }
17276
17277    /// Identifies the authorization scope for the method you are building.
17278    ///
17279    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17280    /// [`Scope::CloudPlatform`].
17281    ///
17282    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17283    /// tokens for more than one scope.
17284    ///
17285    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17286    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17287    /// sufficient, a read-write scope will do as well.
17288    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
17289    where
17290        St: AsRef<str>,
17291    {
17292        self._scopes.insert(String::from(scope.as_ref()));
17293        self
17294    }
17295    /// Identifies the authorization scope(s) for the method you are building.
17296    ///
17297    /// See [`Self::add_scope()`] for details.
17298    pub fn add_scopes<I, St>(
17299        mut self,
17300        scopes: I,
17301    ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
17302    where
17303        I: IntoIterator<Item = St>,
17304        St: AsRef<str>,
17305    {
17306        self._scopes
17307            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17308        self
17309    }
17310
17311    /// Removes all scopes, and no default scope will be used either.
17312    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17313    /// for details).
17314    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
17315        self._scopes.clear();
17316        self
17317    }
17318}
17319
17320/// Creates the specified ResourcePolicy configuration.
17321///
17322/// A builder for the *services.resourcePolicies.create* method supported by a *project* resource.
17323/// It is not used directly, but through a [`ProjectMethods`] instance.
17324///
17325/// # Example
17326///
17327/// Instantiate a resource method builder
17328///
17329/// ```test_harness,no_run
17330/// # extern crate hyper;
17331/// # extern crate hyper_rustls;
17332/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17333/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaResourcePolicy;
17334/// # async fn dox() {
17335/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17336///
17337/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17338/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17339/// #     .with_native_roots()
17340/// #     .unwrap()
17341/// #     .https_only()
17342/// #     .enable_http2()
17343/// #     .build();
17344///
17345/// # let executor = hyper_util::rt::TokioExecutor::new();
17346/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17347/// #     secret,
17348/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17349/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17350/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17351/// #     ),
17352/// # ).build().await.unwrap();
17353///
17354/// # let client = hyper_util::client::legacy::Client::builder(
17355/// #     hyper_util::rt::TokioExecutor::new()
17356/// # )
17357/// # .build(
17358/// #     hyper_rustls::HttpsConnectorBuilder::new()
17359/// #         .with_native_roots()
17360/// #         .unwrap()
17361/// #         .https_or_http()
17362/// #         .enable_http2()
17363/// #         .build()
17364/// # );
17365/// # let mut hub = Firebaseappcheck::new(client, auth);
17366/// // As the method needs a request, you would usually fill it with the desired information
17367/// // into the respective structure. Some of the parts shown here might not be applicable !
17368/// // Values shown here are possibly random and not representative !
17369/// let mut req = GoogleFirebaseAppcheckV1betaResourcePolicy::default();
17370///
17371/// // You can configure optional parameters by calling the respective setters at will, and
17372/// // execute the final call using `doit()`.
17373/// // Values shown here are possibly random and not representative !
17374/// let result = hub.projects().services_resource_policies_create(req, "parent")
17375///              .doit().await;
17376/// # }
17377/// ```
17378pub struct ProjectServiceResourcePolicyCreateCall<'a, C>
17379where
17380    C: 'a,
17381{
17382    hub: &'a Firebaseappcheck<C>,
17383    _request: GoogleFirebaseAppcheckV1betaResourcePolicy,
17384    _parent: String,
17385    _delegate: Option<&'a mut dyn common::Delegate>,
17386    _additional_params: HashMap<String, String>,
17387    _scopes: BTreeSet<String>,
17388}
17389
17390impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyCreateCall<'a, C> {}
17391
17392impl<'a, C> ProjectServiceResourcePolicyCreateCall<'a, C>
17393where
17394    C: common::Connector,
17395{
17396    /// Perform the operation you have build so far.
17397    pub async fn doit(
17398        mut self,
17399    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
17400        use std::borrow::Cow;
17401        use std::io::{Read, Seek};
17402
17403        use common::{url::Params, ToParts};
17404        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17405
17406        let mut dd = common::DefaultDelegate;
17407        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17408        dlg.begin(common::MethodInfo {
17409            id: "firebaseappcheck.projects.services.resourcePolicies.create",
17410            http_method: hyper::Method::POST,
17411        });
17412
17413        for &field in ["alt", "parent"].iter() {
17414            if self._additional_params.contains_key(field) {
17415                dlg.finished(false);
17416                return Err(common::Error::FieldClash(field));
17417            }
17418        }
17419
17420        let mut params = Params::with_capacity(4 + self._additional_params.len());
17421        params.push("parent", self._parent);
17422
17423        params.extend(self._additional_params.iter());
17424
17425        params.push("alt", "json");
17426        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies";
17427        if self._scopes.is_empty() {
17428            self._scopes
17429                .insert(Scope::CloudPlatform.as_ref().to_string());
17430        }
17431
17432        #[allow(clippy::single_element_loop)]
17433        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17434            url = params.uri_replacement(url, param_name, find_this, true);
17435        }
17436        {
17437            let to_remove = ["parent"];
17438            params.remove_params(&to_remove);
17439        }
17440
17441        let url = params.parse_with_url(&url);
17442
17443        let mut json_mime_type = mime::APPLICATION_JSON;
17444        let mut request_value_reader = {
17445            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17446            common::remove_json_null_values(&mut value);
17447            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17448            serde_json::to_writer(&mut dst, &value).unwrap();
17449            dst
17450        };
17451        let request_size = request_value_reader
17452            .seek(std::io::SeekFrom::End(0))
17453            .unwrap();
17454        request_value_reader
17455            .seek(std::io::SeekFrom::Start(0))
17456            .unwrap();
17457
17458        loop {
17459            let token = match self
17460                .hub
17461                .auth
17462                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17463                .await
17464            {
17465                Ok(token) => token,
17466                Err(e) => match dlg.token(e) {
17467                    Ok(token) => token,
17468                    Err(e) => {
17469                        dlg.finished(false);
17470                        return Err(common::Error::MissingToken(e));
17471                    }
17472                },
17473            };
17474            request_value_reader
17475                .seek(std::io::SeekFrom::Start(0))
17476                .unwrap();
17477            let mut req_result = {
17478                let client = &self.hub.client;
17479                dlg.pre_request();
17480                let mut req_builder = hyper::Request::builder()
17481                    .method(hyper::Method::POST)
17482                    .uri(url.as_str())
17483                    .header(USER_AGENT, self.hub._user_agent.clone());
17484
17485                if let Some(token) = token.as_ref() {
17486                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17487                }
17488
17489                let request = req_builder
17490                    .header(CONTENT_TYPE, json_mime_type.to_string())
17491                    .header(CONTENT_LENGTH, request_size as u64)
17492                    .body(common::to_body(
17493                        request_value_reader.get_ref().clone().into(),
17494                    ));
17495
17496                client.request(request.unwrap()).await
17497            };
17498
17499            match req_result {
17500                Err(err) => {
17501                    if let common::Retry::After(d) = dlg.http_error(&err) {
17502                        sleep(d).await;
17503                        continue;
17504                    }
17505                    dlg.finished(false);
17506                    return Err(common::Error::HttpError(err));
17507                }
17508                Ok(res) => {
17509                    let (mut parts, body) = res.into_parts();
17510                    let mut body = common::Body::new(body);
17511                    if !parts.status.is_success() {
17512                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17513                        let error = serde_json::from_str(&common::to_string(&bytes));
17514                        let response = common::to_response(parts, bytes.into());
17515
17516                        if let common::Retry::After(d) =
17517                            dlg.http_failure(&response, error.as_ref().ok())
17518                        {
17519                            sleep(d).await;
17520                            continue;
17521                        }
17522
17523                        dlg.finished(false);
17524
17525                        return Err(match error {
17526                            Ok(value) => common::Error::BadRequest(value),
17527                            _ => common::Error::Failure(response),
17528                        });
17529                    }
17530                    let response = {
17531                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17532                        let encoded = common::to_string(&bytes);
17533                        match serde_json::from_str(&encoded) {
17534                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17535                            Err(error) => {
17536                                dlg.response_json_decode_error(&encoded, &error);
17537                                return Err(common::Error::JsonDecodeError(
17538                                    encoded.to_string(),
17539                                    error,
17540                                ));
17541                            }
17542                        }
17543                    };
17544
17545                    dlg.finished(true);
17546                    return Ok(response);
17547                }
17548            }
17549        }
17550    }
17551
17552    ///
17553    /// Sets the *request* property to the given value.
17554    ///
17555    /// Even though the property as already been set when instantiating this call,
17556    /// we provide this method for API completeness.
17557    pub fn request(
17558        mut self,
17559        new_value: GoogleFirebaseAppcheckV1betaResourcePolicy,
17560    ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
17561        self._request = new_value;
17562        self
17563    }
17564    /// Required. The relative resource name of the parent Service in which the specified ResourcePolicy will be created, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
17565    ///
17566    /// Sets the *parent* path property to the given value.
17567    ///
17568    /// Even though the property as already been set when instantiating this call,
17569    /// we provide this method for API completeness.
17570    pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
17571        self._parent = new_value.to_string();
17572        self
17573    }
17574    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17575    /// while executing the actual API request.
17576    ///
17577    /// ````text
17578    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17579    /// ````
17580    ///
17581    /// Sets the *delegate* property to the given value.
17582    pub fn delegate(
17583        mut self,
17584        new_value: &'a mut dyn common::Delegate,
17585    ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
17586        self._delegate = Some(new_value);
17587        self
17588    }
17589
17590    /// Set any additional parameter of the query string used in the request.
17591    /// It should be used to set parameters which are not yet available through their own
17592    /// setters.
17593    ///
17594    /// Please note that this method must not be used to set any of the known parameters
17595    /// which have their own setter method. If done anyway, the request will fail.
17596    ///
17597    /// # Additional Parameters
17598    ///
17599    /// * *$.xgafv* (query-string) - V1 error format.
17600    /// * *access_token* (query-string) - OAuth access token.
17601    /// * *alt* (query-string) - Data format for response.
17602    /// * *callback* (query-string) - JSONP
17603    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17604    /// * *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.
17605    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17606    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17607    /// * *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.
17608    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17609    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17610    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyCreateCall<'a, C>
17611    where
17612        T: AsRef<str>,
17613    {
17614        self._additional_params
17615            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17616        self
17617    }
17618
17619    /// Identifies the authorization scope for the method you are building.
17620    ///
17621    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17622    /// [`Scope::CloudPlatform`].
17623    ///
17624    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17625    /// tokens for more than one scope.
17626    ///
17627    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17628    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17629    /// sufficient, a read-write scope will do as well.
17630    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyCreateCall<'a, C>
17631    where
17632        St: AsRef<str>,
17633    {
17634        self._scopes.insert(String::from(scope.as_ref()));
17635        self
17636    }
17637    /// Identifies the authorization scope(s) for the method you are building.
17638    ///
17639    /// See [`Self::add_scope()`] for details.
17640    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyCreateCall<'a, C>
17641    where
17642        I: IntoIterator<Item = St>,
17643        St: AsRef<str>,
17644    {
17645        self._scopes
17646            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17647        self
17648    }
17649
17650    /// Removes all scopes, and no default scope will be used either.
17651    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17652    /// for details).
17653    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
17654        self._scopes.clear();
17655        self
17656    }
17657}
17658
17659/// Deletes the specified ResourcePolicy configuration.
17660///
17661/// A builder for the *services.resourcePolicies.delete* method supported by a *project* resource.
17662/// It is not used directly, but through a [`ProjectMethods`] instance.
17663///
17664/// # Example
17665///
17666/// Instantiate a resource method builder
17667///
17668/// ```test_harness,no_run
17669/// # extern crate hyper;
17670/// # extern crate hyper_rustls;
17671/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17672/// # async fn dox() {
17673/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17674///
17675/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17676/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17677/// #     .with_native_roots()
17678/// #     .unwrap()
17679/// #     .https_only()
17680/// #     .enable_http2()
17681/// #     .build();
17682///
17683/// # let executor = hyper_util::rt::TokioExecutor::new();
17684/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17685/// #     secret,
17686/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17687/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17688/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17689/// #     ),
17690/// # ).build().await.unwrap();
17691///
17692/// # let client = hyper_util::client::legacy::Client::builder(
17693/// #     hyper_util::rt::TokioExecutor::new()
17694/// # )
17695/// # .build(
17696/// #     hyper_rustls::HttpsConnectorBuilder::new()
17697/// #         .with_native_roots()
17698/// #         .unwrap()
17699/// #         .https_or_http()
17700/// #         .enable_http2()
17701/// #         .build()
17702/// # );
17703/// # let mut hub = Firebaseappcheck::new(client, auth);
17704/// // You can configure optional parameters by calling the respective setters at will, and
17705/// // execute the final call using `doit()`.
17706/// // Values shown here are possibly random and not representative !
17707/// let result = hub.projects().services_resource_policies_delete("name")
17708///              .etag("dolor")
17709///              .doit().await;
17710/// # }
17711/// ```
17712pub struct ProjectServiceResourcePolicyDeleteCall<'a, C>
17713where
17714    C: 'a,
17715{
17716    hub: &'a Firebaseappcheck<C>,
17717    _name: String,
17718    _etag: Option<String>,
17719    _delegate: Option<&'a mut dyn common::Delegate>,
17720    _additional_params: HashMap<String, String>,
17721    _scopes: BTreeSet<String>,
17722}
17723
17724impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyDeleteCall<'a, C> {}
17725
17726impl<'a, C> ProjectServiceResourcePolicyDeleteCall<'a, C>
17727where
17728    C: common::Connector,
17729{
17730    /// Perform the operation you have build so far.
17731    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
17732        use std::borrow::Cow;
17733        use std::io::{Read, Seek};
17734
17735        use common::{url::Params, ToParts};
17736        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17737
17738        let mut dd = common::DefaultDelegate;
17739        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17740        dlg.begin(common::MethodInfo {
17741            id: "firebaseappcheck.projects.services.resourcePolicies.delete",
17742            http_method: hyper::Method::DELETE,
17743        });
17744
17745        for &field in ["alt", "name", "etag"].iter() {
17746            if self._additional_params.contains_key(field) {
17747                dlg.finished(false);
17748                return Err(common::Error::FieldClash(field));
17749            }
17750        }
17751
17752        let mut params = Params::with_capacity(4 + self._additional_params.len());
17753        params.push("name", self._name);
17754        if let Some(value) = self._etag.as_ref() {
17755            params.push("etag", value);
17756        }
17757
17758        params.extend(self._additional_params.iter());
17759
17760        params.push("alt", "json");
17761        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
17762        if self._scopes.is_empty() {
17763            self._scopes
17764                .insert(Scope::CloudPlatform.as_ref().to_string());
17765        }
17766
17767        #[allow(clippy::single_element_loop)]
17768        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17769            url = params.uri_replacement(url, param_name, find_this, true);
17770        }
17771        {
17772            let to_remove = ["name"];
17773            params.remove_params(&to_remove);
17774        }
17775
17776        let url = params.parse_with_url(&url);
17777
17778        loop {
17779            let token = match self
17780                .hub
17781                .auth
17782                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17783                .await
17784            {
17785                Ok(token) => token,
17786                Err(e) => match dlg.token(e) {
17787                    Ok(token) => token,
17788                    Err(e) => {
17789                        dlg.finished(false);
17790                        return Err(common::Error::MissingToken(e));
17791                    }
17792                },
17793            };
17794            let mut req_result = {
17795                let client = &self.hub.client;
17796                dlg.pre_request();
17797                let mut req_builder = hyper::Request::builder()
17798                    .method(hyper::Method::DELETE)
17799                    .uri(url.as_str())
17800                    .header(USER_AGENT, self.hub._user_agent.clone());
17801
17802                if let Some(token) = token.as_ref() {
17803                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17804                }
17805
17806                let request = req_builder
17807                    .header(CONTENT_LENGTH, 0_u64)
17808                    .body(common::to_body::<String>(None));
17809
17810                client.request(request.unwrap()).await
17811            };
17812
17813            match req_result {
17814                Err(err) => {
17815                    if let common::Retry::After(d) = dlg.http_error(&err) {
17816                        sleep(d).await;
17817                        continue;
17818                    }
17819                    dlg.finished(false);
17820                    return Err(common::Error::HttpError(err));
17821                }
17822                Ok(res) => {
17823                    let (mut parts, body) = res.into_parts();
17824                    let mut body = common::Body::new(body);
17825                    if !parts.status.is_success() {
17826                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17827                        let error = serde_json::from_str(&common::to_string(&bytes));
17828                        let response = common::to_response(parts, bytes.into());
17829
17830                        if let common::Retry::After(d) =
17831                            dlg.http_failure(&response, error.as_ref().ok())
17832                        {
17833                            sleep(d).await;
17834                            continue;
17835                        }
17836
17837                        dlg.finished(false);
17838
17839                        return Err(match error {
17840                            Ok(value) => common::Error::BadRequest(value),
17841                            _ => common::Error::Failure(response),
17842                        });
17843                    }
17844                    let response = {
17845                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17846                        let encoded = common::to_string(&bytes);
17847                        match serde_json::from_str(&encoded) {
17848                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17849                            Err(error) => {
17850                                dlg.response_json_decode_error(&encoded, &error);
17851                                return Err(common::Error::JsonDecodeError(
17852                                    encoded.to_string(),
17853                                    error,
17854                                ));
17855                            }
17856                        }
17857                    };
17858
17859                    dlg.finished(true);
17860                    return Ok(response);
17861                }
17862            }
17863        }
17864    }
17865
17866    /// Required. The relative resource name of the ResourcePolicy to delete, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ```
17867    ///
17868    /// Sets the *name* path property to the given value.
17869    ///
17870    /// Even though the property as already been set when instantiating this call,
17871    /// we provide this method for API completeness.
17872    pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17873        self._name = new_value.to_string();
17874        self
17875    }
17876    /// The checksum to be validated against the current ResourcePolicy, to ensure the client has an up-to-date value before proceeding. This checksum is computed by the server based on the values of fields in the ResourcePolicy object, and can be obtained from the ResourcePolicy object received from the last CreateResourcePolicy, GetResourcePolicy, ListResourcePolicies, UpdateResourcePolicy, or BatchUpdateResourcePolicies call. This etag is strongly validated as defined by RFC 7232.
17877    ///
17878    /// Sets the *etag* query property to the given value.
17879    pub fn etag(mut self, new_value: &str) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17880        self._etag = Some(new_value.to_string());
17881        self
17882    }
17883    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17884    /// while executing the actual API request.
17885    ///
17886    /// ````text
17887    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17888    /// ````
17889    ///
17890    /// Sets the *delegate* property to the given value.
17891    pub fn delegate(
17892        mut self,
17893        new_value: &'a mut dyn common::Delegate,
17894    ) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17895        self._delegate = Some(new_value);
17896        self
17897    }
17898
17899    /// Set any additional parameter of the query string used in the request.
17900    /// It should be used to set parameters which are not yet available through their own
17901    /// setters.
17902    ///
17903    /// Please note that this method must not be used to set any of the known parameters
17904    /// which have their own setter method. If done anyway, the request will fail.
17905    ///
17906    /// # Additional Parameters
17907    ///
17908    /// * *$.xgafv* (query-string) - V1 error format.
17909    /// * *access_token* (query-string) - OAuth access token.
17910    /// * *alt* (query-string) - Data format for response.
17911    /// * *callback* (query-string) - JSONP
17912    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17913    /// * *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.
17914    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17915    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17916    /// * *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.
17917    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17918    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17919    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17920    where
17921        T: AsRef<str>,
17922    {
17923        self._additional_params
17924            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17925        self
17926    }
17927
17928    /// Identifies the authorization scope for the method you are building.
17929    ///
17930    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17931    /// [`Scope::CloudPlatform`].
17932    ///
17933    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17934    /// tokens for more than one scope.
17935    ///
17936    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17937    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17938    /// sufficient, a read-write scope will do as well.
17939    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17940    where
17941        St: AsRef<str>,
17942    {
17943        self._scopes.insert(String::from(scope.as_ref()));
17944        self
17945    }
17946    /// Identifies the authorization scope(s) for the method you are building.
17947    ///
17948    /// See [`Self::add_scope()`] for details.
17949    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17950    where
17951        I: IntoIterator<Item = St>,
17952        St: AsRef<str>,
17953    {
17954        self._scopes
17955            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17956        self
17957    }
17958
17959    /// Removes all scopes, and no default scope will be used either.
17960    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17961    /// for details).
17962    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17963        self._scopes.clear();
17964        self
17965    }
17966}
17967
17968/// Gets the requested ResourcePolicy configuration.
17969///
17970/// A builder for the *services.resourcePolicies.get* method supported by a *project* resource.
17971/// It is not used directly, but through a [`ProjectMethods`] instance.
17972///
17973/// # Example
17974///
17975/// Instantiate a resource method builder
17976///
17977/// ```test_harness,no_run
17978/// # extern crate hyper;
17979/// # extern crate hyper_rustls;
17980/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17981/// # async fn dox() {
17982/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17983///
17984/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17985/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17986/// #     .with_native_roots()
17987/// #     .unwrap()
17988/// #     .https_only()
17989/// #     .enable_http2()
17990/// #     .build();
17991///
17992/// # let executor = hyper_util::rt::TokioExecutor::new();
17993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17994/// #     secret,
17995/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17996/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17997/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17998/// #     ),
17999/// # ).build().await.unwrap();
18000///
18001/// # let client = hyper_util::client::legacy::Client::builder(
18002/// #     hyper_util::rt::TokioExecutor::new()
18003/// # )
18004/// # .build(
18005/// #     hyper_rustls::HttpsConnectorBuilder::new()
18006/// #         .with_native_roots()
18007/// #         .unwrap()
18008/// #         .https_or_http()
18009/// #         .enable_http2()
18010/// #         .build()
18011/// # );
18012/// # let mut hub = Firebaseappcheck::new(client, auth);
18013/// // You can configure optional parameters by calling the respective setters at will, and
18014/// // execute the final call using `doit()`.
18015/// // Values shown here are possibly random and not representative !
18016/// let result = hub.projects().services_resource_policies_get("name")
18017///              .doit().await;
18018/// # }
18019/// ```
18020pub struct ProjectServiceResourcePolicyGetCall<'a, C>
18021where
18022    C: 'a,
18023{
18024    hub: &'a Firebaseappcheck<C>,
18025    _name: String,
18026    _delegate: Option<&'a mut dyn common::Delegate>,
18027    _additional_params: HashMap<String, String>,
18028    _scopes: BTreeSet<String>,
18029}
18030
18031impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyGetCall<'a, C> {}
18032
18033impl<'a, C> ProjectServiceResourcePolicyGetCall<'a, C>
18034where
18035    C: common::Connector,
18036{
18037    /// Perform the operation you have build so far.
18038    pub async fn doit(
18039        mut self,
18040    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
18041        use std::borrow::Cow;
18042        use std::io::{Read, Seek};
18043
18044        use common::{url::Params, ToParts};
18045        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18046
18047        let mut dd = common::DefaultDelegate;
18048        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18049        dlg.begin(common::MethodInfo {
18050            id: "firebaseappcheck.projects.services.resourcePolicies.get",
18051            http_method: hyper::Method::GET,
18052        });
18053
18054        for &field in ["alt", "name"].iter() {
18055            if self._additional_params.contains_key(field) {
18056                dlg.finished(false);
18057                return Err(common::Error::FieldClash(field));
18058            }
18059        }
18060
18061        let mut params = Params::with_capacity(3 + self._additional_params.len());
18062        params.push("name", self._name);
18063
18064        params.extend(self._additional_params.iter());
18065
18066        params.push("alt", "json");
18067        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
18068        if self._scopes.is_empty() {
18069            self._scopes
18070                .insert(Scope::CloudPlatform.as_ref().to_string());
18071        }
18072
18073        #[allow(clippy::single_element_loop)]
18074        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18075            url = params.uri_replacement(url, param_name, find_this, true);
18076        }
18077        {
18078            let to_remove = ["name"];
18079            params.remove_params(&to_remove);
18080        }
18081
18082        let url = params.parse_with_url(&url);
18083
18084        loop {
18085            let token = match self
18086                .hub
18087                .auth
18088                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18089                .await
18090            {
18091                Ok(token) => token,
18092                Err(e) => match dlg.token(e) {
18093                    Ok(token) => token,
18094                    Err(e) => {
18095                        dlg.finished(false);
18096                        return Err(common::Error::MissingToken(e));
18097                    }
18098                },
18099            };
18100            let mut req_result = {
18101                let client = &self.hub.client;
18102                dlg.pre_request();
18103                let mut req_builder = hyper::Request::builder()
18104                    .method(hyper::Method::GET)
18105                    .uri(url.as_str())
18106                    .header(USER_AGENT, self.hub._user_agent.clone());
18107
18108                if let Some(token) = token.as_ref() {
18109                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18110                }
18111
18112                let request = req_builder
18113                    .header(CONTENT_LENGTH, 0_u64)
18114                    .body(common::to_body::<String>(None));
18115
18116                client.request(request.unwrap()).await
18117            };
18118
18119            match req_result {
18120                Err(err) => {
18121                    if let common::Retry::After(d) = dlg.http_error(&err) {
18122                        sleep(d).await;
18123                        continue;
18124                    }
18125                    dlg.finished(false);
18126                    return Err(common::Error::HttpError(err));
18127                }
18128                Ok(res) => {
18129                    let (mut parts, body) = res.into_parts();
18130                    let mut body = common::Body::new(body);
18131                    if !parts.status.is_success() {
18132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18133                        let error = serde_json::from_str(&common::to_string(&bytes));
18134                        let response = common::to_response(parts, bytes.into());
18135
18136                        if let common::Retry::After(d) =
18137                            dlg.http_failure(&response, error.as_ref().ok())
18138                        {
18139                            sleep(d).await;
18140                            continue;
18141                        }
18142
18143                        dlg.finished(false);
18144
18145                        return Err(match error {
18146                            Ok(value) => common::Error::BadRequest(value),
18147                            _ => common::Error::Failure(response),
18148                        });
18149                    }
18150                    let response = {
18151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18152                        let encoded = common::to_string(&bytes);
18153                        match serde_json::from_str(&encoded) {
18154                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18155                            Err(error) => {
18156                                dlg.response_json_decode_error(&encoded, &error);
18157                                return Err(common::Error::JsonDecodeError(
18158                                    encoded.to_string(),
18159                                    error,
18160                                ));
18161                            }
18162                        }
18163                    };
18164
18165                    dlg.finished(true);
18166                    return Ok(response);
18167                }
18168            }
18169        }
18170    }
18171
18172    /// Required. The relative resource name of the ResourcePolicy to retrieve, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
18173    ///
18174    /// Sets the *name* path property to the given value.
18175    ///
18176    /// Even though the property as already been set when instantiating this call,
18177    /// we provide this method for API completeness.
18178    pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyGetCall<'a, C> {
18179        self._name = new_value.to_string();
18180        self
18181    }
18182    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18183    /// while executing the actual API request.
18184    ///
18185    /// ````text
18186    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18187    /// ````
18188    ///
18189    /// Sets the *delegate* property to the given value.
18190    pub fn delegate(
18191        mut self,
18192        new_value: &'a mut dyn common::Delegate,
18193    ) -> ProjectServiceResourcePolicyGetCall<'a, C> {
18194        self._delegate = Some(new_value);
18195        self
18196    }
18197
18198    /// Set any additional parameter of the query string used in the request.
18199    /// It should be used to set parameters which are not yet available through their own
18200    /// setters.
18201    ///
18202    /// Please note that this method must not be used to set any of the known parameters
18203    /// which have their own setter method. If done anyway, the request will fail.
18204    ///
18205    /// # Additional Parameters
18206    ///
18207    /// * *$.xgafv* (query-string) - V1 error format.
18208    /// * *access_token* (query-string) - OAuth access token.
18209    /// * *alt* (query-string) - Data format for response.
18210    /// * *callback* (query-string) - JSONP
18211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18212    /// * *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.
18213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18215    /// * *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.
18216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18218    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyGetCall<'a, C>
18219    where
18220        T: AsRef<str>,
18221    {
18222        self._additional_params
18223            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18224        self
18225    }
18226
18227    /// Identifies the authorization scope for the method you are building.
18228    ///
18229    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18230    /// [`Scope::CloudPlatform`].
18231    ///
18232    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18233    /// tokens for more than one scope.
18234    ///
18235    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18236    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18237    /// sufficient, a read-write scope will do as well.
18238    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyGetCall<'a, C>
18239    where
18240        St: AsRef<str>,
18241    {
18242        self._scopes.insert(String::from(scope.as_ref()));
18243        self
18244    }
18245    /// Identifies the authorization scope(s) for the method you are building.
18246    ///
18247    /// See [`Self::add_scope()`] for details.
18248    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyGetCall<'a, C>
18249    where
18250        I: IntoIterator<Item = St>,
18251        St: AsRef<str>,
18252    {
18253        self._scopes
18254            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18255        self
18256    }
18257
18258    /// Removes all scopes, and no default scope will be used either.
18259    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18260    /// for details).
18261    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyGetCall<'a, C> {
18262        self._scopes.clear();
18263        self
18264    }
18265}
18266
18267/// Lists all ResourcePolicy configurations for the specified project and service.
18268///
18269/// A builder for the *services.resourcePolicies.list* method supported by a *project* resource.
18270/// It is not used directly, but through a [`ProjectMethods`] instance.
18271///
18272/// # Example
18273///
18274/// Instantiate a resource method builder
18275///
18276/// ```test_harness,no_run
18277/// # extern crate hyper;
18278/// # extern crate hyper_rustls;
18279/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18280/// # async fn dox() {
18281/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18282///
18283/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18284/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18285/// #     .with_native_roots()
18286/// #     .unwrap()
18287/// #     .https_only()
18288/// #     .enable_http2()
18289/// #     .build();
18290///
18291/// # let executor = hyper_util::rt::TokioExecutor::new();
18292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18293/// #     secret,
18294/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18295/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18296/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18297/// #     ),
18298/// # ).build().await.unwrap();
18299///
18300/// # let client = hyper_util::client::legacy::Client::builder(
18301/// #     hyper_util::rt::TokioExecutor::new()
18302/// # )
18303/// # .build(
18304/// #     hyper_rustls::HttpsConnectorBuilder::new()
18305/// #         .with_native_roots()
18306/// #         .unwrap()
18307/// #         .https_or_http()
18308/// #         .enable_http2()
18309/// #         .build()
18310/// # );
18311/// # let mut hub = Firebaseappcheck::new(client, auth);
18312/// // You can configure optional parameters by calling the respective setters at will, and
18313/// // execute the final call using `doit()`.
18314/// // Values shown here are possibly random and not representative !
18315/// let result = hub.projects().services_resource_policies_list("parent")
18316///              .page_token("sadipscing")
18317///              .page_size(-15)
18318///              .filter("dolor")
18319///              .doit().await;
18320/// # }
18321/// ```
18322pub struct ProjectServiceResourcePolicyListCall<'a, C>
18323where
18324    C: 'a,
18325{
18326    hub: &'a Firebaseappcheck<C>,
18327    _parent: String,
18328    _page_token: Option<String>,
18329    _page_size: Option<i32>,
18330    _filter: Option<String>,
18331    _delegate: Option<&'a mut dyn common::Delegate>,
18332    _additional_params: HashMap<String, String>,
18333    _scopes: BTreeSet<String>,
18334}
18335
18336impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyListCall<'a, C> {}
18337
18338impl<'a, C> ProjectServiceResourcePolicyListCall<'a, C>
18339where
18340    C: common::Connector,
18341{
18342    /// Perform the operation you have build so far.
18343    pub async fn doit(
18344        mut self,
18345    ) -> common::Result<(
18346        common::Response,
18347        GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse,
18348    )> {
18349        use std::borrow::Cow;
18350        use std::io::{Read, Seek};
18351
18352        use common::{url::Params, ToParts};
18353        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18354
18355        let mut dd = common::DefaultDelegate;
18356        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18357        dlg.begin(common::MethodInfo {
18358            id: "firebaseappcheck.projects.services.resourcePolicies.list",
18359            http_method: hyper::Method::GET,
18360        });
18361
18362        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
18363            if self._additional_params.contains_key(field) {
18364                dlg.finished(false);
18365                return Err(common::Error::FieldClash(field));
18366            }
18367        }
18368
18369        let mut params = Params::with_capacity(6 + self._additional_params.len());
18370        params.push("parent", self._parent);
18371        if let Some(value) = self._page_token.as_ref() {
18372            params.push("pageToken", value);
18373        }
18374        if let Some(value) = self._page_size.as_ref() {
18375            params.push("pageSize", value.to_string());
18376        }
18377        if let Some(value) = self._filter.as_ref() {
18378            params.push("filter", value);
18379        }
18380
18381        params.extend(self._additional_params.iter());
18382
18383        params.push("alt", "json");
18384        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies";
18385        if self._scopes.is_empty() {
18386            self._scopes
18387                .insert(Scope::CloudPlatform.as_ref().to_string());
18388        }
18389
18390        #[allow(clippy::single_element_loop)]
18391        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18392            url = params.uri_replacement(url, param_name, find_this, true);
18393        }
18394        {
18395            let to_remove = ["parent"];
18396            params.remove_params(&to_remove);
18397        }
18398
18399        let url = params.parse_with_url(&url);
18400
18401        loop {
18402            let token = match self
18403                .hub
18404                .auth
18405                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18406                .await
18407            {
18408                Ok(token) => token,
18409                Err(e) => match dlg.token(e) {
18410                    Ok(token) => token,
18411                    Err(e) => {
18412                        dlg.finished(false);
18413                        return Err(common::Error::MissingToken(e));
18414                    }
18415                },
18416            };
18417            let mut req_result = {
18418                let client = &self.hub.client;
18419                dlg.pre_request();
18420                let mut req_builder = hyper::Request::builder()
18421                    .method(hyper::Method::GET)
18422                    .uri(url.as_str())
18423                    .header(USER_AGENT, self.hub._user_agent.clone());
18424
18425                if let Some(token) = token.as_ref() {
18426                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18427                }
18428
18429                let request = req_builder
18430                    .header(CONTENT_LENGTH, 0_u64)
18431                    .body(common::to_body::<String>(None));
18432
18433                client.request(request.unwrap()).await
18434            };
18435
18436            match req_result {
18437                Err(err) => {
18438                    if let common::Retry::After(d) = dlg.http_error(&err) {
18439                        sleep(d).await;
18440                        continue;
18441                    }
18442                    dlg.finished(false);
18443                    return Err(common::Error::HttpError(err));
18444                }
18445                Ok(res) => {
18446                    let (mut parts, body) = res.into_parts();
18447                    let mut body = common::Body::new(body);
18448                    if !parts.status.is_success() {
18449                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18450                        let error = serde_json::from_str(&common::to_string(&bytes));
18451                        let response = common::to_response(parts, bytes.into());
18452
18453                        if let common::Retry::After(d) =
18454                            dlg.http_failure(&response, error.as_ref().ok())
18455                        {
18456                            sleep(d).await;
18457                            continue;
18458                        }
18459
18460                        dlg.finished(false);
18461
18462                        return Err(match error {
18463                            Ok(value) => common::Error::BadRequest(value),
18464                            _ => common::Error::Failure(response),
18465                        });
18466                    }
18467                    let response = {
18468                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18469                        let encoded = common::to_string(&bytes);
18470                        match serde_json::from_str(&encoded) {
18471                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18472                            Err(error) => {
18473                                dlg.response_json_decode_error(&encoded, &error);
18474                                return Err(common::Error::JsonDecodeError(
18475                                    encoded.to_string(),
18476                                    error,
18477                                ));
18478                            }
18479                        }
18480                    };
18481
18482                    dlg.finished(true);
18483                    return Ok(response);
18484                }
18485            }
18486        }
18487    }
18488
18489    /// Required. The relative resource name of the parent Service for which to list each associated ResourcePolicy, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS)
18490    ///
18491    /// Sets the *parent* path property to the given value.
18492    ///
18493    /// Even though the property as already been set when instantiating this call,
18494    /// we provide this method for API completeness.
18495    pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
18496        self._parent = new_value.to_string();
18497        self
18498    }
18499    /// Token returned from a previous call to ListResourcePolicies indicating where in the set of ResourcePolicy objects to resume listing. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListResourcePolicies must match the call that provided the page token; if they do not match, the result is undefined.
18500    ///
18501    /// Sets the *page token* query property to the given value.
18502    pub fn page_token(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
18503        self._page_token = Some(new_value.to_string());
18504        self
18505    }
18506    /// The maximum number of ResourcePolicy objects to return in the response. The server may return fewer than this at its own discretion. If no value is specified (or too large a value is specified), the server will impose its own limit.
18507    ///
18508    /// Sets the *page size* query property to the given value.
18509    pub fn page_size(mut self, new_value: i32) -> ProjectServiceResourcePolicyListCall<'a, C> {
18510        self._page_size = Some(new_value);
18511        self
18512    }
18513    /// Optional. Filters the results by the specified rule. For the exact syntax of this field, please consult the [AIP-160](https://google.aip.dev/160) standard. Currently, since the only fields in the ResourcePolicy resource are the scalar fields `enforcement_mode` and `target_resource`, this method does not support the traversal operator (`.`) or the has operator (`:`). Here are some examples of valid filters: * `enforcement_mode = ENFORCED` * `target_resource = "//oauth2.googleapis.com/projects/12345/oauthClients/"` * `enforcement_mode = ENFORCED AND target_resource = "//oauth2.googleapis.com/projects/12345/oauthClients/"`
18514    ///
18515    /// Sets the *filter* query property to the given value.
18516    pub fn filter(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
18517        self._filter = Some(new_value.to_string());
18518        self
18519    }
18520    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18521    /// while executing the actual API request.
18522    ///
18523    /// ````text
18524    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18525    /// ````
18526    ///
18527    /// Sets the *delegate* property to the given value.
18528    pub fn delegate(
18529        mut self,
18530        new_value: &'a mut dyn common::Delegate,
18531    ) -> ProjectServiceResourcePolicyListCall<'a, C> {
18532        self._delegate = Some(new_value);
18533        self
18534    }
18535
18536    /// Set any additional parameter of the query string used in the request.
18537    /// It should be used to set parameters which are not yet available through their own
18538    /// setters.
18539    ///
18540    /// Please note that this method must not be used to set any of the known parameters
18541    /// which have their own setter method. If done anyway, the request will fail.
18542    ///
18543    /// # Additional Parameters
18544    ///
18545    /// * *$.xgafv* (query-string) - V1 error format.
18546    /// * *access_token* (query-string) - OAuth access token.
18547    /// * *alt* (query-string) - Data format for response.
18548    /// * *callback* (query-string) - JSONP
18549    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18550    /// * *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.
18551    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18552    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18553    /// * *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.
18554    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18555    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18556    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyListCall<'a, C>
18557    where
18558        T: AsRef<str>,
18559    {
18560        self._additional_params
18561            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18562        self
18563    }
18564
18565    /// Identifies the authorization scope for the method you are building.
18566    ///
18567    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18568    /// [`Scope::CloudPlatform`].
18569    ///
18570    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18571    /// tokens for more than one scope.
18572    ///
18573    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18574    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18575    /// sufficient, a read-write scope will do as well.
18576    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyListCall<'a, C>
18577    where
18578        St: AsRef<str>,
18579    {
18580        self._scopes.insert(String::from(scope.as_ref()));
18581        self
18582    }
18583    /// Identifies the authorization scope(s) for the method you are building.
18584    ///
18585    /// See [`Self::add_scope()`] for details.
18586    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyListCall<'a, C>
18587    where
18588        I: IntoIterator<Item = St>,
18589        St: AsRef<str>,
18590    {
18591        self._scopes
18592            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18593        self
18594    }
18595
18596    /// Removes all scopes, and no default scope will be used either.
18597    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18598    /// for details).
18599    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyListCall<'a, C> {
18600        self._scopes.clear();
18601        self
18602    }
18603}
18604
18605/// Updates the specified ResourcePolicy configuration.
18606///
18607/// A builder for the *services.resourcePolicies.patch* method supported by a *project* resource.
18608/// It is not used directly, but through a [`ProjectMethods`] instance.
18609///
18610/// # Example
18611///
18612/// Instantiate a resource method builder
18613///
18614/// ```test_harness,no_run
18615/// # extern crate hyper;
18616/// # extern crate hyper_rustls;
18617/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18618/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaResourcePolicy;
18619/// # async fn dox() {
18620/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18621///
18622/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18623/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18624/// #     .with_native_roots()
18625/// #     .unwrap()
18626/// #     .https_only()
18627/// #     .enable_http2()
18628/// #     .build();
18629///
18630/// # let executor = hyper_util::rt::TokioExecutor::new();
18631/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18632/// #     secret,
18633/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18634/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18635/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18636/// #     ),
18637/// # ).build().await.unwrap();
18638///
18639/// # let client = hyper_util::client::legacy::Client::builder(
18640/// #     hyper_util::rt::TokioExecutor::new()
18641/// # )
18642/// # .build(
18643/// #     hyper_rustls::HttpsConnectorBuilder::new()
18644/// #         .with_native_roots()
18645/// #         .unwrap()
18646/// #         .https_or_http()
18647/// #         .enable_http2()
18648/// #         .build()
18649/// # );
18650/// # let mut hub = Firebaseappcheck::new(client, auth);
18651/// // As the method needs a request, you would usually fill it with the desired information
18652/// // into the respective structure. Some of the parts shown here might not be applicable !
18653/// // Values shown here are possibly random and not representative !
18654/// let mut req = GoogleFirebaseAppcheckV1betaResourcePolicy::default();
18655///
18656/// // You can configure optional parameters by calling the respective setters at will, and
18657/// // execute the final call using `doit()`.
18658/// // Values shown here are possibly random and not representative !
18659/// let result = hub.projects().services_resource_policies_patch(req, "name")
18660///              .update_mask(FieldMask::new::<&str>(&[]))
18661///              .doit().await;
18662/// # }
18663/// ```
18664pub struct ProjectServiceResourcePolicyPatchCall<'a, C>
18665where
18666    C: 'a,
18667{
18668    hub: &'a Firebaseappcheck<C>,
18669    _request: GoogleFirebaseAppcheckV1betaResourcePolicy,
18670    _name: String,
18671    _update_mask: Option<common::FieldMask>,
18672    _delegate: Option<&'a mut dyn common::Delegate>,
18673    _additional_params: HashMap<String, String>,
18674    _scopes: BTreeSet<String>,
18675}
18676
18677impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyPatchCall<'a, C> {}
18678
18679impl<'a, C> ProjectServiceResourcePolicyPatchCall<'a, C>
18680where
18681    C: common::Connector,
18682{
18683    /// Perform the operation you have build so far.
18684    pub async fn doit(
18685        mut self,
18686    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
18687        use std::borrow::Cow;
18688        use std::io::{Read, Seek};
18689
18690        use common::{url::Params, ToParts};
18691        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18692
18693        let mut dd = common::DefaultDelegate;
18694        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18695        dlg.begin(common::MethodInfo {
18696            id: "firebaseappcheck.projects.services.resourcePolicies.patch",
18697            http_method: hyper::Method::PATCH,
18698        });
18699
18700        for &field in ["alt", "name", "updateMask"].iter() {
18701            if self._additional_params.contains_key(field) {
18702                dlg.finished(false);
18703                return Err(common::Error::FieldClash(field));
18704            }
18705        }
18706
18707        let mut params = Params::with_capacity(5 + self._additional_params.len());
18708        params.push("name", self._name);
18709        if let Some(value) = self._update_mask.as_ref() {
18710            params.push("updateMask", value.to_string());
18711        }
18712
18713        params.extend(self._additional_params.iter());
18714
18715        params.push("alt", "json");
18716        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
18717        if self._scopes.is_empty() {
18718            self._scopes
18719                .insert(Scope::CloudPlatform.as_ref().to_string());
18720        }
18721
18722        #[allow(clippy::single_element_loop)]
18723        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18724            url = params.uri_replacement(url, param_name, find_this, true);
18725        }
18726        {
18727            let to_remove = ["name"];
18728            params.remove_params(&to_remove);
18729        }
18730
18731        let url = params.parse_with_url(&url);
18732
18733        let mut json_mime_type = mime::APPLICATION_JSON;
18734        let mut request_value_reader = {
18735            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18736            common::remove_json_null_values(&mut value);
18737            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18738            serde_json::to_writer(&mut dst, &value).unwrap();
18739            dst
18740        };
18741        let request_size = request_value_reader
18742            .seek(std::io::SeekFrom::End(0))
18743            .unwrap();
18744        request_value_reader
18745            .seek(std::io::SeekFrom::Start(0))
18746            .unwrap();
18747
18748        loop {
18749            let token = match self
18750                .hub
18751                .auth
18752                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18753                .await
18754            {
18755                Ok(token) => token,
18756                Err(e) => match dlg.token(e) {
18757                    Ok(token) => token,
18758                    Err(e) => {
18759                        dlg.finished(false);
18760                        return Err(common::Error::MissingToken(e));
18761                    }
18762                },
18763            };
18764            request_value_reader
18765                .seek(std::io::SeekFrom::Start(0))
18766                .unwrap();
18767            let mut req_result = {
18768                let client = &self.hub.client;
18769                dlg.pre_request();
18770                let mut req_builder = hyper::Request::builder()
18771                    .method(hyper::Method::PATCH)
18772                    .uri(url.as_str())
18773                    .header(USER_AGENT, self.hub._user_agent.clone());
18774
18775                if let Some(token) = token.as_ref() {
18776                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18777                }
18778
18779                let request = req_builder
18780                    .header(CONTENT_TYPE, json_mime_type.to_string())
18781                    .header(CONTENT_LENGTH, request_size as u64)
18782                    .body(common::to_body(
18783                        request_value_reader.get_ref().clone().into(),
18784                    ));
18785
18786                client.request(request.unwrap()).await
18787            };
18788
18789            match req_result {
18790                Err(err) => {
18791                    if let common::Retry::After(d) = dlg.http_error(&err) {
18792                        sleep(d).await;
18793                        continue;
18794                    }
18795                    dlg.finished(false);
18796                    return Err(common::Error::HttpError(err));
18797                }
18798                Ok(res) => {
18799                    let (mut parts, body) = res.into_parts();
18800                    let mut body = common::Body::new(body);
18801                    if !parts.status.is_success() {
18802                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18803                        let error = serde_json::from_str(&common::to_string(&bytes));
18804                        let response = common::to_response(parts, bytes.into());
18805
18806                        if let common::Retry::After(d) =
18807                            dlg.http_failure(&response, error.as_ref().ok())
18808                        {
18809                            sleep(d).await;
18810                            continue;
18811                        }
18812
18813                        dlg.finished(false);
18814
18815                        return Err(match error {
18816                            Ok(value) => common::Error::BadRequest(value),
18817                            _ => common::Error::Failure(response),
18818                        });
18819                    }
18820                    let response = {
18821                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18822                        let encoded = common::to_string(&bytes);
18823                        match serde_json::from_str(&encoded) {
18824                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18825                            Err(error) => {
18826                                dlg.response_json_decode_error(&encoded, &error);
18827                                return Err(common::Error::JsonDecodeError(
18828                                    encoded.to_string(),
18829                                    error,
18830                                ));
18831                            }
18832                        }
18833                    };
18834
18835                    dlg.finished(true);
18836                    return Ok(response);
18837                }
18838            }
18839        }
18840    }
18841
18842    ///
18843    /// Sets the *request* property to the given value.
18844    ///
18845    /// Even though the property as already been set when instantiating this call,
18846    /// we provide this method for API completeness.
18847    pub fn request(
18848        mut self,
18849        new_value: GoogleFirebaseAppcheckV1betaResourcePolicy,
18850    ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18851        self._request = new_value;
18852        self
18853    }
18854    /// Required. Identifier. The relative name of the resource policy object, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `oauth2.googleapis.com` (Google Identity for iOS) `resource_policy_id` is a system-generated UID.
18855    ///
18856    /// Sets the *name* path property to the given value.
18857    ///
18858    /// Even though the property as already been set when instantiating this call,
18859    /// we provide this method for API completeness.
18860    pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18861        self._name = new_value.to_string();
18862        self
18863    }
18864    /// Required. A comma-separated list of names of fields in the ResourcePolicy to update. Example: `enforcement_mode`.
18865    ///
18866    /// Sets the *update mask* query property to the given value.
18867    pub fn update_mask(
18868        mut self,
18869        new_value: common::FieldMask,
18870    ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18871        self._update_mask = Some(new_value);
18872        self
18873    }
18874    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18875    /// while executing the actual API request.
18876    ///
18877    /// ````text
18878    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18879    /// ````
18880    ///
18881    /// Sets the *delegate* property to the given value.
18882    pub fn delegate(
18883        mut self,
18884        new_value: &'a mut dyn common::Delegate,
18885    ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18886        self._delegate = Some(new_value);
18887        self
18888    }
18889
18890    /// Set any additional parameter of the query string used in the request.
18891    /// It should be used to set parameters which are not yet available through their own
18892    /// setters.
18893    ///
18894    /// Please note that this method must not be used to set any of the known parameters
18895    /// which have their own setter method. If done anyway, the request will fail.
18896    ///
18897    /// # Additional Parameters
18898    ///
18899    /// * *$.xgafv* (query-string) - V1 error format.
18900    /// * *access_token* (query-string) - OAuth access token.
18901    /// * *alt* (query-string) - Data format for response.
18902    /// * *callback* (query-string) - JSONP
18903    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18904    /// * *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.
18905    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18906    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18907    /// * *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.
18908    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18909    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18910    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18911    where
18912        T: AsRef<str>,
18913    {
18914        self._additional_params
18915            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18916        self
18917    }
18918
18919    /// Identifies the authorization scope for the method you are building.
18920    ///
18921    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18922    /// [`Scope::CloudPlatform`].
18923    ///
18924    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18925    /// tokens for more than one scope.
18926    ///
18927    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18928    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18929    /// sufficient, a read-write scope will do as well.
18930    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18931    where
18932        St: AsRef<str>,
18933    {
18934        self._scopes.insert(String::from(scope.as_ref()));
18935        self
18936    }
18937    /// Identifies the authorization scope(s) for the method you are building.
18938    ///
18939    /// See [`Self::add_scope()`] for details.
18940    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18941    where
18942        I: IntoIterator<Item = St>,
18943        St: AsRef<str>,
18944    {
18945        self._scopes
18946            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18947        self
18948    }
18949
18950    /// Removes all scopes, and no default scope will be used either.
18951    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18952    /// for details).
18953    pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18954        self._scopes.clear();
18955        self
18956    }
18957}
18958
18959/// Atomically updates the specified Service configurations.
18960///
18961/// A builder for the *services.batchUpdate* method supported by a *project* resource.
18962/// It is not used directly, but through a [`ProjectMethods`] instance.
18963///
18964/// # Example
18965///
18966/// Instantiate a resource method builder
18967///
18968/// ```test_harness,no_run
18969/// # extern crate hyper;
18970/// # extern crate hyper_rustls;
18971/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18972/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest;
18973/// # async fn dox() {
18974/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18975///
18976/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18977/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18978/// #     .with_native_roots()
18979/// #     .unwrap()
18980/// #     .https_only()
18981/// #     .enable_http2()
18982/// #     .build();
18983///
18984/// # let executor = hyper_util::rt::TokioExecutor::new();
18985/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18986/// #     secret,
18987/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18988/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18989/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18990/// #     ),
18991/// # ).build().await.unwrap();
18992///
18993/// # let client = hyper_util::client::legacy::Client::builder(
18994/// #     hyper_util::rt::TokioExecutor::new()
18995/// # )
18996/// # .build(
18997/// #     hyper_rustls::HttpsConnectorBuilder::new()
18998/// #         .with_native_roots()
18999/// #         .unwrap()
19000/// #         .https_or_http()
19001/// #         .enable_http2()
19002/// #         .build()
19003/// # );
19004/// # let mut hub = Firebaseappcheck::new(client, auth);
19005/// // As the method needs a request, you would usually fill it with the desired information
19006/// // into the respective structure. Some of the parts shown here might not be applicable !
19007/// // Values shown here are possibly random and not representative !
19008/// let mut req = GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest::default();
19009///
19010/// // You can configure optional parameters by calling the respective setters at will, and
19011/// // execute the final call using `doit()`.
19012/// // Values shown here are possibly random and not representative !
19013/// let result = hub.projects().services_batch_update(req, "parent")
19014///              .doit().await;
19015/// # }
19016/// ```
19017pub struct ProjectServiceBatchUpdateCall<'a, C>
19018where
19019    C: 'a,
19020{
19021    hub: &'a Firebaseappcheck<C>,
19022    _request: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
19023    _parent: String,
19024    _delegate: Option<&'a mut dyn common::Delegate>,
19025    _additional_params: HashMap<String, String>,
19026    _scopes: BTreeSet<String>,
19027}
19028
19029impl<'a, C> common::CallBuilder for ProjectServiceBatchUpdateCall<'a, C> {}
19030
19031impl<'a, C> ProjectServiceBatchUpdateCall<'a, C>
19032where
19033    C: common::Connector,
19034{
19035    /// Perform the operation you have build so far.
19036    pub async fn doit(
19037        mut self,
19038    ) -> common::Result<(
19039        common::Response,
19040        GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse,
19041    )> {
19042        use std::borrow::Cow;
19043        use std::io::{Read, Seek};
19044
19045        use common::{url::Params, ToParts};
19046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19047
19048        let mut dd = common::DefaultDelegate;
19049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19050        dlg.begin(common::MethodInfo {
19051            id: "firebaseappcheck.projects.services.batchUpdate",
19052            http_method: hyper::Method::POST,
19053        });
19054
19055        for &field in ["alt", "parent"].iter() {
19056            if self._additional_params.contains_key(field) {
19057                dlg.finished(false);
19058                return Err(common::Error::FieldClash(field));
19059            }
19060        }
19061
19062        let mut params = Params::with_capacity(4 + self._additional_params.len());
19063        params.push("parent", self._parent);
19064
19065        params.extend(self._additional_params.iter());
19066
19067        params.push("alt", "json");
19068        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services:batchUpdate";
19069        if self._scopes.is_empty() {
19070            self._scopes
19071                .insert(Scope::CloudPlatform.as_ref().to_string());
19072        }
19073
19074        #[allow(clippy::single_element_loop)]
19075        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19076            url = params.uri_replacement(url, param_name, find_this, true);
19077        }
19078        {
19079            let to_remove = ["parent"];
19080            params.remove_params(&to_remove);
19081        }
19082
19083        let url = params.parse_with_url(&url);
19084
19085        let mut json_mime_type = mime::APPLICATION_JSON;
19086        let mut request_value_reader = {
19087            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19088            common::remove_json_null_values(&mut value);
19089            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19090            serde_json::to_writer(&mut dst, &value).unwrap();
19091            dst
19092        };
19093        let request_size = request_value_reader
19094            .seek(std::io::SeekFrom::End(0))
19095            .unwrap();
19096        request_value_reader
19097            .seek(std::io::SeekFrom::Start(0))
19098            .unwrap();
19099
19100        loop {
19101            let token = match self
19102                .hub
19103                .auth
19104                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19105                .await
19106            {
19107                Ok(token) => token,
19108                Err(e) => match dlg.token(e) {
19109                    Ok(token) => token,
19110                    Err(e) => {
19111                        dlg.finished(false);
19112                        return Err(common::Error::MissingToken(e));
19113                    }
19114                },
19115            };
19116            request_value_reader
19117                .seek(std::io::SeekFrom::Start(0))
19118                .unwrap();
19119            let mut req_result = {
19120                let client = &self.hub.client;
19121                dlg.pre_request();
19122                let mut req_builder = hyper::Request::builder()
19123                    .method(hyper::Method::POST)
19124                    .uri(url.as_str())
19125                    .header(USER_AGENT, self.hub._user_agent.clone());
19126
19127                if let Some(token) = token.as_ref() {
19128                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19129                }
19130
19131                let request = req_builder
19132                    .header(CONTENT_TYPE, json_mime_type.to_string())
19133                    .header(CONTENT_LENGTH, request_size as u64)
19134                    .body(common::to_body(
19135                        request_value_reader.get_ref().clone().into(),
19136                    ));
19137
19138                client.request(request.unwrap()).await
19139            };
19140
19141            match req_result {
19142                Err(err) => {
19143                    if let common::Retry::After(d) = dlg.http_error(&err) {
19144                        sleep(d).await;
19145                        continue;
19146                    }
19147                    dlg.finished(false);
19148                    return Err(common::Error::HttpError(err));
19149                }
19150                Ok(res) => {
19151                    let (mut parts, body) = res.into_parts();
19152                    let mut body = common::Body::new(body);
19153                    if !parts.status.is_success() {
19154                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19155                        let error = serde_json::from_str(&common::to_string(&bytes));
19156                        let response = common::to_response(parts, bytes.into());
19157
19158                        if let common::Retry::After(d) =
19159                            dlg.http_failure(&response, error.as_ref().ok())
19160                        {
19161                            sleep(d).await;
19162                            continue;
19163                        }
19164
19165                        dlg.finished(false);
19166
19167                        return Err(match error {
19168                            Ok(value) => common::Error::BadRequest(value),
19169                            _ => common::Error::Failure(response),
19170                        });
19171                    }
19172                    let response = {
19173                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19174                        let encoded = common::to_string(&bytes);
19175                        match serde_json::from_str(&encoded) {
19176                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19177                            Err(error) => {
19178                                dlg.response_json_decode_error(&encoded, &error);
19179                                return Err(common::Error::JsonDecodeError(
19180                                    encoded.to_string(),
19181                                    error,
19182                                ));
19183                            }
19184                        }
19185                    };
19186
19187                    dlg.finished(true);
19188                    return Ok(response);
19189                }
19190            }
19191        }
19192    }
19193
19194    ///
19195    /// Sets the *request* property to the given value.
19196    ///
19197    /// Even though the property as already been set when instantiating this call,
19198    /// we provide this method for API completeness.
19199    pub fn request(
19200        mut self,
19201        new_value: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
19202    ) -> ProjectServiceBatchUpdateCall<'a, C> {
19203        self._request = new_value;
19204        self
19205    }
19206    /// Required. The parent project name shared by all Service configurations being updated, in the format ``` projects/{project_number} ``` The parent collection in the `name` field of any resource being updated must match this field, or the entire batch fails.
19207    ///
19208    /// Sets the *parent* path property to the given value.
19209    ///
19210    /// Even though the property as already been set when instantiating this call,
19211    /// we provide this method for API completeness.
19212    pub fn parent(mut self, new_value: &str) -> ProjectServiceBatchUpdateCall<'a, C> {
19213        self._parent = new_value.to_string();
19214        self
19215    }
19216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19217    /// while executing the actual API request.
19218    ///
19219    /// ````text
19220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19221    /// ````
19222    ///
19223    /// Sets the *delegate* property to the given value.
19224    pub fn delegate(
19225        mut self,
19226        new_value: &'a mut dyn common::Delegate,
19227    ) -> ProjectServiceBatchUpdateCall<'a, C> {
19228        self._delegate = Some(new_value);
19229        self
19230    }
19231
19232    /// Set any additional parameter of the query string used in the request.
19233    /// It should be used to set parameters which are not yet available through their own
19234    /// setters.
19235    ///
19236    /// Please note that this method must not be used to set any of the known parameters
19237    /// which have their own setter method. If done anyway, the request will fail.
19238    ///
19239    /// # Additional Parameters
19240    ///
19241    /// * *$.xgafv* (query-string) - V1 error format.
19242    /// * *access_token* (query-string) - OAuth access token.
19243    /// * *alt* (query-string) - Data format for response.
19244    /// * *callback* (query-string) - JSONP
19245    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19246    /// * *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.
19247    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19248    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19249    /// * *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.
19250    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19251    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19252    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceBatchUpdateCall<'a, C>
19253    where
19254        T: AsRef<str>,
19255    {
19256        self._additional_params
19257            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19258        self
19259    }
19260
19261    /// Identifies the authorization scope for the method you are building.
19262    ///
19263    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19264    /// [`Scope::CloudPlatform`].
19265    ///
19266    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19267    /// tokens for more than one scope.
19268    ///
19269    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19270    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19271    /// sufficient, a read-write scope will do as well.
19272    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceBatchUpdateCall<'a, C>
19273    where
19274        St: AsRef<str>,
19275    {
19276        self._scopes.insert(String::from(scope.as_ref()));
19277        self
19278    }
19279    /// Identifies the authorization scope(s) for the method you are building.
19280    ///
19281    /// See [`Self::add_scope()`] for details.
19282    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceBatchUpdateCall<'a, C>
19283    where
19284        I: IntoIterator<Item = St>,
19285        St: AsRef<str>,
19286    {
19287        self._scopes
19288            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19289        self
19290    }
19291
19292    /// Removes all scopes, and no default scope will be used either.
19293    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19294    /// for details).
19295    pub fn clear_scopes(mut self) -> ProjectServiceBatchUpdateCall<'a, C> {
19296        self._scopes.clear();
19297        self
19298    }
19299}
19300
19301/// Gets the Service configuration for the specified service name.
19302///
19303/// A builder for the *services.get* method supported by a *project* resource.
19304/// It is not used directly, but through a [`ProjectMethods`] instance.
19305///
19306/// # Example
19307///
19308/// Instantiate a resource method builder
19309///
19310/// ```test_harness,no_run
19311/// # extern crate hyper;
19312/// # extern crate hyper_rustls;
19313/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
19314/// # async fn dox() {
19315/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19316///
19317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19318/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19319/// #     .with_native_roots()
19320/// #     .unwrap()
19321/// #     .https_only()
19322/// #     .enable_http2()
19323/// #     .build();
19324///
19325/// # let executor = hyper_util::rt::TokioExecutor::new();
19326/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19327/// #     secret,
19328/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19329/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19330/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19331/// #     ),
19332/// # ).build().await.unwrap();
19333///
19334/// # let client = hyper_util::client::legacy::Client::builder(
19335/// #     hyper_util::rt::TokioExecutor::new()
19336/// # )
19337/// # .build(
19338/// #     hyper_rustls::HttpsConnectorBuilder::new()
19339/// #         .with_native_roots()
19340/// #         .unwrap()
19341/// #         .https_or_http()
19342/// #         .enable_http2()
19343/// #         .build()
19344/// # );
19345/// # let mut hub = Firebaseappcheck::new(client, auth);
19346/// // You can configure optional parameters by calling the respective setters at will, and
19347/// // execute the final call using `doit()`.
19348/// // Values shown here are possibly random and not representative !
19349/// let result = hub.projects().services_get("name")
19350///              .doit().await;
19351/// # }
19352/// ```
19353pub struct ProjectServiceGetCall<'a, C>
19354where
19355    C: 'a,
19356{
19357    hub: &'a Firebaseappcheck<C>,
19358    _name: String,
19359    _delegate: Option<&'a mut dyn common::Delegate>,
19360    _additional_params: HashMap<String, String>,
19361    _scopes: BTreeSet<String>,
19362}
19363
19364impl<'a, C> common::CallBuilder for ProjectServiceGetCall<'a, C> {}
19365
19366impl<'a, C> ProjectServiceGetCall<'a, C>
19367where
19368    C: common::Connector,
19369{
19370    /// Perform the operation you have build so far.
19371    pub async fn doit(
19372        mut self,
19373    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaService)> {
19374        use std::borrow::Cow;
19375        use std::io::{Read, Seek};
19376
19377        use common::{url::Params, ToParts};
19378        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19379
19380        let mut dd = common::DefaultDelegate;
19381        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19382        dlg.begin(common::MethodInfo {
19383            id: "firebaseappcheck.projects.services.get",
19384            http_method: hyper::Method::GET,
19385        });
19386
19387        for &field in ["alt", "name"].iter() {
19388            if self._additional_params.contains_key(field) {
19389                dlg.finished(false);
19390                return Err(common::Error::FieldClash(field));
19391            }
19392        }
19393
19394        let mut params = Params::with_capacity(3 + self._additional_params.len());
19395        params.push("name", self._name);
19396
19397        params.extend(self._additional_params.iter());
19398
19399        params.push("alt", "json");
19400        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
19401        if self._scopes.is_empty() {
19402            self._scopes
19403                .insert(Scope::CloudPlatform.as_ref().to_string());
19404        }
19405
19406        #[allow(clippy::single_element_loop)]
19407        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19408            url = params.uri_replacement(url, param_name, find_this, true);
19409        }
19410        {
19411            let to_remove = ["name"];
19412            params.remove_params(&to_remove);
19413        }
19414
19415        let url = params.parse_with_url(&url);
19416
19417        loop {
19418            let token = match self
19419                .hub
19420                .auth
19421                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19422                .await
19423            {
19424                Ok(token) => token,
19425                Err(e) => match dlg.token(e) {
19426                    Ok(token) => token,
19427                    Err(e) => {
19428                        dlg.finished(false);
19429                        return Err(common::Error::MissingToken(e));
19430                    }
19431                },
19432            };
19433            let mut req_result = {
19434                let client = &self.hub.client;
19435                dlg.pre_request();
19436                let mut req_builder = hyper::Request::builder()
19437                    .method(hyper::Method::GET)
19438                    .uri(url.as_str())
19439                    .header(USER_AGENT, self.hub._user_agent.clone());
19440
19441                if let Some(token) = token.as_ref() {
19442                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19443                }
19444
19445                let request = req_builder
19446                    .header(CONTENT_LENGTH, 0_u64)
19447                    .body(common::to_body::<String>(None));
19448
19449                client.request(request.unwrap()).await
19450            };
19451
19452            match req_result {
19453                Err(err) => {
19454                    if let common::Retry::After(d) = dlg.http_error(&err) {
19455                        sleep(d).await;
19456                        continue;
19457                    }
19458                    dlg.finished(false);
19459                    return Err(common::Error::HttpError(err));
19460                }
19461                Ok(res) => {
19462                    let (mut parts, body) = res.into_parts();
19463                    let mut body = common::Body::new(body);
19464                    if !parts.status.is_success() {
19465                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19466                        let error = serde_json::from_str(&common::to_string(&bytes));
19467                        let response = common::to_response(parts, bytes.into());
19468
19469                        if let common::Retry::After(d) =
19470                            dlg.http_failure(&response, error.as_ref().ok())
19471                        {
19472                            sleep(d).await;
19473                            continue;
19474                        }
19475
19476                        dlg.finished(false);
19477
19478                        return Err(match error {
19479                            Ok(value) => common::Error::BadRequest(value),
19480                            _ => common::Error::Failure(response),
19481                        });
19482                    }
19483                    let response = {
19484                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19485                        let encoded = common::to_string(&bytes);
19486                        match serde_json::from_str(&encoded) {
19487                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19488                            Err(error) => {
19489                                dlg.response_json_decode_error(&encoded, &error);
19490                                return Err(common::Error::JsonDecodeError(
19491                                    encoded.to_string(),
19492                                    error,
19493                                ));
19494                            }
19495                        }
19496                    };
19497
19498                    dlg.finished(true);
19499                    return Ok(response);
19500                }
19501            }
19502        }
19503    }
19504
19505    /// Required. The relative resource name of the Service to retrieve, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS)
19506    ///
19507    /// Sets the *name* path property to the given value.
19508    ///
19509    /// Even though the property as already been set when instantiating this call,
19510    /// we provide this method for API completeness.
19511    pub fn name(mut self, new_value: &str) -> ProjectServiceGetCall<'a, C> {
19512        self._name = new_value.to_string();
19513        self
19514    }
19515    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19516    /// while executing the actual API request.
19517    ///
19518    /// ````text
19519    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19520    /// ````
19521    ///
19522    /// Sets the *delegate* property to the given value.
19523    pub fn delegate(
19524        mut self,
19525        new_value: &'a mut dyn common::Delegate,
19526    ) -> ProjectServiceGetCall<'a, C> {
19527        self._delegate = Some(new_value);
19528        self
19529    }
19530
19531    /// Set any additional parameter of the query string used in the request.
19532    /// It should be used to set parameters which are not yet available through their own
19533    /// setters.
19534    ///
19535    /// Please note that this method must not be used to set any of the known parameters
19536    /// which have their own setter method. If done anyway, the request will fail.
19537    ///
19538    /// # Additional Parameters
19539    ///
19540    /// * *$.xgafv* (query-string) - V1 error format.
19541    /// * *access_token* (query-string) - OAuth access token.
19542    /// * *alt* (query-string) - Data format for response.
19543    /// * *callback* (query-string) - JSONP
19544    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19545    /// * *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.
19546    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19547    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19548    /// * *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.
19549    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19550    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19551    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceGetCall<'a, C>
19552    where
19553        T: AsRef<str>,
19554    {
19555        self._additional_params
19556            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19557        self
19558    }
19559
19560    /// Identifies the authorization scope for the method you are building.
19561    ///
19562    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19563    /// [`Scope::CloudPlatform`].
19564    ///
19565    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19566    /// tokens for more than one scope.
19567    ///
19568    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19569    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19570    /// sufficient, a read-write scope will do as well.
19571    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceGetCall<'a, C>
19572    where
19573        St: AsRef<str>,
19574    {
19575        self._scopes.insert(String::from(scope.as_ref()));
19576        self
19577    }
19578    /// Identifies the authorization scope(s) for the method you are building.
19579    ///
19580    /// See [`Self::add_scope()`] for details.
19581    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceGetCall<'a, C>
19582    where
19583        I: IntoIterator<Item = St>,
19584        St: AsRef<str>,
19585    {
19586        self._scopes
19587            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19588        self
19589    }
19590
19591    /// Removes all scopes, and no default scope will be used either.
19592    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19593    /// for details).
19594    pub fn clear_scopes(mut self) -> ProjectServiceGetCall<'a, C> {
19595        self._scopes.clear();
19596        self
19597    }
19598}
19599
19600/// Lists all Service configurations for the specified project. Only Services which were explicitly configured using UpdateService or BatchUpdateServices will be returned.
19601///
19602/// A builder for the *services.list* method supported by a *project* resource.
19603/// It is not used directly, but through a [`ProjectMethods`] instance.
19604///
19605/// # Example
19606///
19607/// Instantiate a resource method builder
19608///
19609/// ```test_harness,no_run
19610/// # extern crate hyper;
19611/// # extern crate hyper_rustls;
19612/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
19613/// # async fn dox() {
19614/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19615///
19616/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19617/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19618/// #     .with_native_roots()
19619/// #     .unwrap()
19620/// #     .https_only()
19621/// #     .enable_http2()
19622/// #     .build();
19623///
19624/// # let executor = hyper_util::rt::TokioExecutor::new();
19625/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19626/// #     secret,
19627/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19628/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19629/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19630/// #     ),
19631/// # ).build().await.unwrap();
19632///
19633/// # let client = hyper_util::client::legacy::Client::builder(
19634/// #     hyper_util::rt::TokioExecutor::new()
19635/// # )
19636/// # .build(
19637/// #     hyper_rustls::HttpsConnectorBuilder::new()
19638/// #         .with_native_roots()
19639/// #         .unwrap()
19640/// #         .https_or_http()
19641/// #         .enable_http2()
19642/// #         .build()
19643/// # );
19644/// # let mut hub = Firebaseappcheck::new(client, auth);
19645/// // You can configure optional parameters by calling the respective setters at will, and
19646/// // execute the final call using `doit()`.
19647/// // Values shown here are possibly random and not representative !
19648/// let result = hub.projects().services_list("parent")
19649///              .page_token("Stet")
19650///              .page_size(-76)
19651///              .doit().await;
19652/// # }
19653/// ```
19654pub struct ProjectServiceListCall<'a, C>
19655where
19656    C: 'a,
19657{
19658    hub: &'a Firebaseappcheck<C>,
19659    _parent: String,
19660    _page_token: Option<String>,
19661    _page_size: Option<i32>,
19662    _delegate: Option<&'a mut dyn common::Delegate>,
19663    _additional_params: HashMap<String, String>,
19664    _scopes: BTreeSet<String>,
19665}
19666
19667impl<'a, C> common::CallBuilder for ProjectServiceListCall<'a, C> {}
19668
19669impl<'a, C> ProjectServiceListCall<'a, C>
19670where
19671    C: common::Connector,
19672{
19673    /// Perform the operation you have build so far.
19674    pub async fn doit(
19675        mut self,
19676    ) -> common::Result<(
19677        common::Response,
19678        GoogleFirebaseAppcheckV1betaListServicesResponse,
19679    )> {
19680        use std::borrow::Cow;
19681        use std::io::{Read, Seek};
19682
19683        use common::{url::Params, ToParts};
19684        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19685
19686        let mut dd = common::DefaultDelegate;
19687        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19688        dlg.begin(common::MethodInfo {
19689            id: "firebaseappcheck.projects.services.list",
19690            http_method: hyper::Method::GET,
19691        });
19692
19693        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19694            if self._additional_params.contains_key(field) {
19695                dlg.finished(false);
19696                return Err(common::Error::FieldClash(field));
19697            }
19698        }
19699
19700        let mut params = Params::with_capacity(5 + self._additional_params.len());
19701        params.push("parent", self._parent);
19702        if let Some(value) = self._page_token.as_ref() {
19703            params.push("pageToken", value);
19704        }
19705        if let Some(value) = self._page_size.as_ref() {
19706            params.push("pageSize", value.to_string());
19707        }
19708
19709        params.extend(self._additional_params.iter());
19710
19711        params.push("alt", "json");
19712        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services";
19713        if self._scopes.is_empty() {
19714            self._scopes
19715                .insert(Scope::CloudPlatform.as_ref().to_string());
19716        }
19717
19718        #[allow(clippy::single_element_loop)]
19719        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19720            url = params.uri_replacement(url, param_name, find_this, true);
19721        }
19722        {
19723            let to_remove = ["parent"];
19724            params.remove_params(&to_remove);
19725        }
19726
19727        let url = params.parse_with_url(&url);
19728
19729        loop {
19730            let token = match self
19731                .hub
19732                .auth
19733                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19734                .await
19735            {
19736                Ok(token) => token,
19737                Err(e) => match dlg.token(e) {
19738                    Ok(token) => token,
19739                    Err(e) => {
19740                        dlg.finished(false);
19741                        return Err(common::Error::MissingToken(e));
19742                    }
19743                },
19744            };
19745            let mut req_result = {
19746                let client = &self.hub.client;
19747                dlg.pre_request();
19748                let mut req_builder = hyper::Request::builder()
19749                    .method(hyper::Method::GET)
19750                    .uri(url.as_str())
19751                    .header(USER_AGENT, self.hub._user_agent.clone());
19752
19753                if let Some(token) = token.as_ref() {
19754                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19755                }
19756
19757                let request = req_builder
19758                    .header(CONTENT_LENGTH, 0_u64)
19759                    .body(common::to_body::<String>(None));
19760
19761                client.request(request.unwrap()).await
19762            };
19763
19764            match req_result {
19765                Err(err) => {
19766                    if let common::Retry::After(d) = dlg.http_error(&err) {
19767                        sleep(d).await;
19768                        continue;
19769                    }
19770                    dlg.finished(false);
19771                    return Err(common::Error::HttpError(err));
19772                }
19773                Ok(res) => {
19774                    let (mut parts, body) = res.into_parts();
19775                    let mut body = common::Body::new(body);
19776                    if !parts.status.is_success() {
19777                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19778                        let error = serde_json::from_str(&common::to_string(&bytes));
19779                        let response = common::to_response(parts, bytes.into());
19780
19781                        if let common::Retry::After(d) =
19782                            dlg.http_failure(&response, error.as_ref().ok())
19783                        {
19784                            sleep(d).await;
19785                            continue;
19786                        }
19787
19788                        dlg.finished(false);
19789
19790                        return Err(match error {
19791                            Ok(value) => common::Error::BadRequest(value),
19792                            _ => common::Error::Failure(response),
19793                        });
19794                    }
19795                    let response = {
19796                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19797                        let encoded = common::to_string(&bytes);
19798                        match serde_json::from_str(&encoded) {
19799                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19800                            Err(error) => {
19801                                dlg.response_json_decode_error(&encoded, &error);
19802                                return Err(common::Error::JsonDecodeError(
19803                                    encoded.to_string(),
19804                                    error,
19805                                ));
19806                            }
19807                        }
19808                    };
19809
19810                    dlg.finished(true);
19811                    return Ok(response);
19812                }
19813            }
19814        }
19815    }
19816
19817    /// Required. The relative resource name of the parent project for which to list each associated Service, in the format: ``` projects/{project_number} ```
19818    ///
19819    /// Sets the *parent* path property to the given value.
19820    ///
19821    /// Even though the property as already been set when instantiating this call,
19822    /// we provide this method for API completeness.
19823    pub fn parent(mut self, new_value: &str) -> ProjectServiceListCall<'a, C> {
19824        self._parent = new_value.to_string();
19825        self
19826    }
19827    /// Token returned from a previous call to ListServices indicating where in the set of Services to resume listing. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListServices must match the call that provided the page token; if they do not match, the result is undefined.
19828    ///
19829    /// Sets the *page token* query property to the given value.
19830    pub fn page_token(mut self, new_value: &str) -> ProjectServiceListCall<'a, C> {
19831        self._page_token = Some(new_value.to_string());
19832        self
19833    }
19834    /// The maximum number of Services to return in the response. Only explicitly configured services are returned. The server may return fewer than this at its own discretion. If no value is specified (or too large a value is specified), the server will impose its own limit.
19835    ///
19836    /// Sets the *page size* query property to the given value.
19837    pub fn page_size(mut self, new_value: i32) -> ProjectServiceListCall<'a, C> {
19838        self._page_size = Some(new_value);
19839        self
19840    }
19841    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19842    /// while executing the actual API request.
19843    ///
19844    /// ````text
19845    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19846    /// ````
19847    ///
19848    /// Sets the *delegate* property to the given value.
19849    pub fn delegate(
19850        mut self,
19851        new_value: &'a mut dyn common::Delegate,
19852    ) -> ProjectServiceListCall<'a, C> {
19853        self._delegate = Some(new_value);
19854        self
19855    }
19856
19857    /// Set any additional parameter of the query string used in the request.
19858    /// It should be used to set parameters which are not yet available through their own
19859    /// setters.
19860    ///
19861    /// Please note that this method must not be used to set any of the known parameters
19862    /// which have their own setter method. If done anyway, the request will fail.
19863    ///
19864    /// # Additional Parameters
19865    ///
19866    /// * *$.xgafv* (query-string) - V1 error format.
19867    /// * *access_token* (query-string) - OAuth access token.
19868    /// * *alt* (query-string) - Data format for response.
19869    /// * *callback* (query-string) - JSONP
19870    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19871    /// * *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.
19872    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19873    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19874    /// * *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.
19875    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19876    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19877    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceListCall<'a, C>
19878    where
19879        T: AsRef<str>,
19880    {
19881        self._additional_params
19882            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19883        self
19884    }
19885
19886    /// Identifies the authorization scope for the method you are building.
19887    ///
19888    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19889    /// [`Scope::CloudPlatform`].
19890    ///
19891    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19892    /// tokens for more than one scope.
19893    ///
19894    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19895    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19896    /// sufficient, a read-write scope will do as well.
19897    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceListCall<'a, C>
19898    where
19899        St: AsRef<str>,
19900    {
19901        self._scopes.insert(String::from(scope.as_ref()));
19902        self
19903    }
19904    /// Identifies the authorization scope(s) for the method you are building.
19905    ///
19906    /// See [`Self::add_scope()`] for details.
19907    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceListCall<'a, C>
19908    where
19909        I: IntoIterator<Item = St>,
19910        St: AsRef<str>,
19911    {
19912        self._scopes
19913            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19914        self
19915    }
19916
19917    /// Removes all scopes, and no default scope will be used either.
19918    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19919    /// for details).
19920    pub fn clear_scopes(mut self) -> ProjectServiceListCall<'a, C> {
19921        self._scopes.clear();
19922        self
19923    }
19924}
19925
19926/// Updates the specified Service configuration.
19927///
19928/// A builder for the *services.patch* method supported by a *project* resource.
19929/// It is not used directly, but through a [`ProjectMethods`] instance.
19930///
19931/// # Example
19932///
19933/// Instantiate a resource method builder
19934///
19935/// ```test_harness,no_run
19936/// # extern crate hyper;
19937/// # extern crate hyper_rustls;
19938/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
19939/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaService;
19940/// # async fn dox() {
19941/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19942///
19943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19944/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19945/// #     .with_native_roots()
19946/// #     .unwrap()
19947/// #     .https_only()
19948/// #     .enable_http2()
19949/// #     .build();
19950///
19951/// # let executor = hyper_util::rt::TokioExecutor::new();
19952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19953/// #     secret,
19954/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19955/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19956/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19957/// #     ),
19958/// # ).build().await.unwrap();
19959///
19960/// # let client = hyper_util::client::legacy::Client::builder(
19961/// #     hyper_util::rt::TokioExecutor::new()
19962/// # )
19963/// # .build(
19964/// #     hyper_rustls::HttpsConnectorBuilder::new()
19965/// #         .with_native_roots()
19966/// #         .unwrap()
19967/// #         .https_or_http()
19968/// #         .enable_http2()
19969/// #         .build()
19970/// # );
19971/// # let mut hub = Firebaseappcheck::new(client, auth);
19972/// // As the method needs a request, you would usually fill it with the desired information
19973/// // into the respective structure. Some of the parts shown here might not be applicable !
19974/// // Values shown here are possibly random and not representative !
19975/// let mut req = GoogleFirebaseAppcheckV1betaService::default();
19976///
19977/// // You can configure optional parameters by calling the respective setters at will, and
19978/// // execute the final call using `doit()`.
19979/// // Values shown here are possibly random and not representative !
19980/// let result = hub.projects().services_patch(req, "name")
19981///              .update_mask(FieldMask::new::<&str>(&[]))
19982///              .doit().await;
19983/// # }
19984/// ```
19985pub struct ProjectServicePatchCall<'a, C>
19986where
19987    C: 'a,
19988{
19989    hub: &'a Firebaseappcheck<C>,
19990    _request: GoogleFirebaseAppcheckV1betaService,
19991    _name: String,
19992    _update_mask: Option<common::FieldMask>,
19993    _delegate: Option<&'a mut dyn common::Delegate>,
19994    _additional_params: HashMap<String, String>,
19995    _scopes: BTreeSet<String>,
19996}
19997
19998impl<'a, C> common::CallBuilder for ProjectServicePatchCall<'a, C> {}
19999
20000impl<'a, C> ProjectServicePatchCall<'a, C>
20001where
20002    C: common::Connector,
20003{
20004    /// Perform the operation you have build so far.
20005    pub async fn doit(
20006        mut self,
20007    ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaService)> {
20008        use std::borrow::Cow;
20009        use std::io::{Read, Seek};
20010
20011        use common::{url::Params, ToParts};
20012        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20013
20014        let mut dd = common::DefaultDelegate;
20015        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20016        dlg.begin(common::MethodInfo {
20017            id: "firebaseappcheck.projects.services.patch",
20018            http_method: hyper::Method::PATCH,
20019        });
20020
20021        for &field in ["alt", "name", "updateMask"].iter() {
20022            if self._additional_params.contains_key(field) {
20023                dlg.finished(false);
20024                return Err(common::Error::FieldClash(field));
20025            }
20026        }
20027
20028        let mut params = Params::with_capacity(5 + self._additional_params.len());
20029        params.push("name", self._name);
20030        if let Some(value) = self._update_mask.as_ref() {
20031            params.push("updateMask", value.to_string());
20032        }
20033
20034        params.extend(self._additional_params.iter());
20035
20036        params.push("alt", "json");
20037        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
20038        if self._scopes.is_empty() {
20039            self._scopes
20040                .insert(Scope::CloudPlatform.as_ref().to_string());
20041        }
20042
20043        #[allow(clippy::single_element_loop)]
20044        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20045            url = params.uri_replacement(url, param_name, find_this, true);
20046        }
20047        {
20048            let to_remove = ["name"];
20049            params.remove_params(&to_remove);
20050        }
20051
20052        let url = params.parse_with_url(&url);
20053
20054        let mut json_mime_type = mime::APPLICATION_JSON;
20055        let mut request_value_reader = {
20056            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20057            common::remove_json_null_values(&mut value);
20058            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20059            serde_json::to_writer(&mut dst, &value).unwrap();
20060            dst
20061        };
20062        let request_size = request_value_reader
20063            .seek(std::io::SeekFrom::End(0))
20064            .unwrap();
20065        request_value_reader
20066            .seek(std::io::SeekFrom::Start(0))
20067            .unwrap();
20068
20069        loop {
20070            let token = match self
20071                .hub
20072                .auth
20073                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20074                .await
20075            {
20076                Ok(token) => token,
20077                Err(e) => match dlg.token(e) {
20078                    Ok(token) => token,
20079                    Err(e) => {
20080                        dlg.finished(false);
20081                        return Err(common::Error::MissingToken(e));
20082                    }
20083                },
20084            };
20085            request_value_reader
20086                .seek(std::io::SeekFrom::Start(0))
20087                .unwrap();
20088            let mut req_result = {
20089                let client = &self.hub.client;
20090                dlg.pre_request();
20091                let mut req_builder = hyper::Request::builder()
20092                    .method(hyper::Method::PATCH)
20093                    .uri(url.as_str())
20094                    .header(USER_AGENT, self.hub._user_agent.clone());
20095
20096                if let Some(token) = token.as_ref() {
20097                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20098                }
20099
20100                let request = req_builder
20101                    .header(CONTENT_TYPE, json_mime_type.to_string())
20102                    .header(CONTENT_LENGTH, request_size as u64)
20103                    .body(common::to_body(
20104                        request_value_reader.get_ref().clone().into(),
20105                    ));
20106
20107                client.request(request.unwrap()).await
20108            };
20109
20110            match req_result {
20111                Err(err) => {
20112                    if let common::Retry::After(d) = dlg.http_error(&err) {
20113                        sleep(d).await;
20114                        continue;
20115                    }
20116                    dlg.finished(false);
20117                    return Err(common::Error::HttpError(err));
20118                }
20119                Ok(res) => {
20120                    let (mut parts, body) = res.into_parts();
20121                    let mut body = common::Body::new(body);
20122                    if !parts.status.is_success() {
20123                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20124                        let error = serde_json::from_str(&common::to_string(&bytes));
20125                        let response = common::to_response(parts, bytes.into());
20126
20127                        if let common::Retry::After(d) =
20128                            dlg.http_failure(&response, error.as_ref().ok())
20129                        {
20130                            sleep(d).await;
20131                            continue;
20132                        }
20133
20134                        dlg.finished(false);
20135
20136                        return Err(match error {
20137                            Ok(value) => common::Error::BadRequest(value),
20138                            _ => common::Error::Failure(response),
20139                        });
20140                    }
20141                    let response = {
20142                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20143                        let encoded = common::to_string(&bytes);
20144                        match serde_json::from_str(&encoded) {
20145                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20146                            Err(error) => {
20147                                dlg.response_json_decode_error(&encoded, &error);
20148                                return Err(common::Error::JsonDecodeError(
20149                                    encoded.to_string(),
20150                                    error,
20151                                ));
20152                            }
20153                        }
20154                    };
20155
20156                    dlg.finished(true);
20157                    return Ok(response);
20158                }
20159            }
20160        }
20161    }
20162
20163    ///
20164    /// Sets the *request* property to the given value.
20165    ///
20166    /// Even though the property as already been set when instantiating this call,
20167    /// we provide this method for API completeness.
20168    pub fn request(
20169        mut self,
20170        new_value: GoogleFirebaseAppcheckV1betaService,
20171    ) -> ProjectServicePatchCall<'a, C> {
20172        self._request = new_value;
20173        self
20174    }
20175    /// Required. The relative resource name of the service configuration object, in the format: ``` projects/{project_number}/services/{service_id} ``` Note that the `service_id` element must be a supported service ID. Currently, the following service IDs are supported: * `firebasestorage.googleapis.com` (Cloud Storage for Firebase) * `firebasedatabase.googleapis.com` (Firebase Realtime Database) * `firestore.googleapis.com` (Cloud Firestore) * `identitytoolkit.googleapis.com` (Firebase Authentication with Identity Platform) * `oauth2.googleapis.com` (Google Identity for iOS)
20176    ///
20177    /// Sets the *name* path property to the given value.
20178    ///
20179    /// Even though the property as already been set when instantiating this call,
20180    /// we provide this method for API completeness.
20181    pub fn name(mut self, new_value: &str) -> ProjectServicePatchCall<'a, C> {
20182        self._name = new_value.to_string();
20183        self
20184    }
20185    /// Required. A comma-separated list of names of fields in the Service to update. Example: `enforcement_mode`.
20186    ///
20187    /// Sets the *update mask* query property to the given value.
20188    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectServicePatchCall<'a, C> {
20189        self._update_mask = Some(new_value);
20190        self
20191    }
20192    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20193    /// while executing the actual API request.
20194    ///
20195    /// ````text
20196    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20197    /// ````
20198    ///
20199    /// Sets the *delegate* property to the given value.
20200    pub fn delegate(
20201        mut self,
20202        new_value: &'a mut dyn common::Delegate,
20203    ) -> ProjectServicePatchCall<'a, C> {
20204        self._delegate = Some(new_value);
20205        self
20206    }
20207
20208    /// Set any additional parameter of the query string used in the request.
20209    /// It should be used to set parameters which are not yet available through their own
20210    /// setters.
20211    ///
20212    /// Please note that this method must not be used to set any of the known parameters
20213    /// which have their own setter method. If done anyway, the request will fail.
20214    ///
20215    /// # Additional Parameters
20216    ///
20217    /// * *$.xgafv* (query-string) - V1 error format.
20218    /// * *access_token* (query-string) - OAuth access token.
20219    /// * *alt* (query-string) - Data format for response.
20220    /// * *callback* (query-string) - JSONP
20221    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20222    /// * *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.
20223    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20224    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20225    /// * *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.
20226    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20227    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20228    pub fn param<T>(mut self, name: T, value: T) -> ProjectServicePatchCall<'a, C>
20229    where
20230        T: AsRef<str>,
20231    {
20232        self._additional_params
20233            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20234        self
20235    }
20236
20237    /// Identifies the authorization scope for the method you are building.
20238    ///
20239    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20240    /// [`Scope::CloudPlatform`].
20241    ///
20242    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20243    /// tokens for more than one scope.
20244    ///
20245    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20246    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20247    /// sufficient, a read-write scope will do as well.
20248    pub fn add_scope<St>(mut self, scope: St) -> ProjectServicePatchCall<'a, C>
20249    where
20250        St: AsRef<str>,
20251    {
20252        self._scopes.insert(String::from(scope.as_ref()));
20253        self
20254    }
20255    /// Identifies the authorization scope(s) for the method you are building.
20256    ///
20257    /// See [`Self::add_scope()`] for details.
20258    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServicePatchCall<'a, C>
20259    where
20260        I: IntoIterator<Item = St>,
20261        St: AsRef<str>,
20262    {
20263        self._scopes
20264            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20265        self
20266    }
20267
20268    /// Removes all scopes, and no default scope will be used either.
20269    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20270    /// for details).
20271    pub fn clear_scopes(mut self) -> ProjectServicePatchCall<'a, C> {
20272        self._scopes.clear();
20273        self
20274    }
20275}
20276
20277/// Verifies the given App Check token and returns token usage signals that callers may act upon. This method currently only supports App Check tokens exchanged from the following attestation providers: * Play Integrity API * App Attest * DeviceCheck (`DCDevice` tokens) * reCAPTCHA Enterprise * reCAPTCHA v3 * Custom providers App Check tokens exchanged from debug secrets are also supported. Calling this method on an otherwise valid App Check token with an unsupported provider will cause an HTTP 400 error to be returned. Returns whether this token was already consumed before this call. If this is the first time this method has seen the given App Check token, the field `already_consumed` in the response will be absent. The given token will then be marked as `already_consumed` (set to `true`) for all future invocations of this method for that token. Note that if the given App Check token is invalid, an HTTP 403 error is returned instead of a response object, regardless whether the token was already consumed. Currently, when evaluating whether an App Check token was already consumed, only calls to this exact method are counted. Use of the App Check token elsewhere will not mark the token as being already consumed. The caller must have the [`firebaseappcheck.appCheckTokens.verify`](https://firebase.google.com/docs/projects/iam/permissions#app-check) permission to call this method. This permission is part of the [Firebase App Check Token Verifier role](https://firebase.google.com/docs/projects/iam/roles-predefined-product#app-check).
20278///
20279/// A builder for the *verifyAppCheckToken* method supported by a *project* resource.
20280/// It is not used directly, but through a [`ProjectMethods`] instance.
20281///
20282/// # Example
20283///
20284/// Instantiate a resource method builder
20285///
20286/// ```test_harness,no_run
20287/// # extern crate hyper;
20288/// # extern crate hyper_rustls;
20289/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
20290/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest;
20291/// # async fn dox() {
20292/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20293///
20294/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20295/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20296/// #     .with_native_roots()
20297/// #     .unwrap()
20298/// #     .https_only()
20299/// #     .enable_http2()
20300/// #     .build();
20301///
20302/// # let executor = hyper_util::rt::TokioExecutor::new();
20303/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20304/// #     secret,
20305/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20306/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20307/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20308/// #     ),
20309/// # ).build().await.unwrap();
20310///
20311/// # let client = hyper_util::client::legacy::Client::builder(
20312/// #     hyper_util::rt::TokioExecutor::new()
20313/// # )
20314/// # .build(
20315/// #     hyper_rustls::HttpsConnectorBuilder::new()
20316/// #         .with_native_roots()
20317/// #         .unwrap()
20318/// #         .https_or_http()
20319/// #         .enable_http2()
20320/// #         .build()
20321/// # );
20322/// # let mut hub = Firebaseappcheck::new(client, auth);
20323/// // As the method needs a request, you would usually fill it with the desired information
20324/// // into the respective structure. Some of the parts shown here might not be applicable !
20325/// // Values shown here are possibly random and not representative !
20326/// let mut req = GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest::default();
20327///
20328/// // You can configure optional parameters by calling the respective setters at will, and
20329/// // execute the final call using `doit()`.
20330/// // Values shown here are possibly random and not representative !
20331/// let result = hub.projects().verify_app_check_token(req, "project")
20332///              .doit().await;
20333/// # }
20334/// ```
20335pub struct ProjectVerifyAppCheckTokenCall<'a, C>
20336where
20337    C: 'a,
20338{
20339    hub: &'a Firebaseappcheck<C>,
20340    _request: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
20341    _project: String,
20342    _delegate: Option<&'a mut dyn common::Delegate>,
20343    _additional_params: HashMap<String, String>,
20344    _scopes: BTreeSet<String>,
20345}
20346
20347impl<'a, C> common::CallBuilder for ProjectVerifyAppCheckTokenCall<'a, C> {}
20348
20349impl<'a, C> ProjectVerifyAppCheckTokenCall<'a, C>
20350where
20351    C: common::Connector,
20352{
20353    /// Perform the operation you have build so far.
20354    pub async fn doit(
20355        mut self,
20356    ) -> common::Result<(
20357        common::Response,
20358        GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse,
20359    )> {
20360        use std::borrow::Cow;
20361        use std::io::{Read, Seek};
20362
20363        use common::{url::Params, ToParts};
20364        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20365
20366        let mut dd = common::DefaultDelegate;
20367        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20368        dlg.begin(common::MethodInfo {
20369            id: "firebaseappcheck.projects.verifyAppCheckToken",
20370            http_method: hyper::Method::POST,
20371        });
20372
20373        for &field in ["alt", "project"].iter() {
20374            if self._additional_params.contains_key(field) {
20375                dlg.finished(false);
20376                return Err(common::Error::FieldClash(field));
20377            }
20378        }
20379
20380        let mut params = Params::with_capacity(4 + self._additional_params.len());
20381        params.push("project", self._project);
20382
20383        params.extend(self._additional_params.iter());
20384
20385        params.push("alt", "json");
20386        let mut url = self.hub._base_url.clone() + "v1beta/{+project}:verifyAppCheckToken";
20387        if self._scopes.is_empty() {
20388            self._scopes
20389                .insert(Scope::CloudPlatform.as_ref().to_string());
20390        }
20391
20392        #[allow(clippy::single_element_loop)]
20393        for &(find_this, param_name) in [("{+project}", "project")].iter() {
20394            url = params.uri_replacement(url, param_name, find_this, true);
20395        }
20396        {
20397            let to_remove = ["project"];
20398            params.remove_params(&to_remove);
20399        }
20400
20401        let url = params.parse_with_url(&url);
20402
20403        let mut json_mime_type = mime::APPLICATION_JSON;
20404        let mut request_value_reader = {
20405            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20406            common::remove_json_null_values(&mut value);
20407            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20408            serde_json::to_writer(&mut dst, &value).unwrap();
20409            dst
20410        };
20411        let request_size = request_value_reader
20412            .seek(std::io::SeekFrom::End(0))
20413            .unwrap();
20414        request_value_reader
20415            .seek(std::io::SeekFrom::Start(0))
20416            .unwrap();
20417
20418        loop {
20419            let token = match self
20420                .hub
20421                .auth
20422                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20423                .await
20424            {
20425                Ok(token) => token,
20426                Err(e) => match dlg.token(e) {
20427                    Ok(token) => token,
20428                    Err(e) => {
20429                        dlg.finished(false);
20430                        return Err(common::Error::MissingToken(e));
20431                    }
20432                },
20433            };
20434            request_value_reader
20435                .seek(std::io::SeekFrom::Start(0))
20436                .unwrap();
20437            let mut req_result = {
20438                let client = &self.hub.client;
20439                dlg.pre_request();
20440                let mut req_builder = hyper::Request::builder()
20441                    .method(hyper::Method::POST)
20442                    .uri(url.as_str())
20443                    .header(USER_AGENT, self.hub._user_agent.clone());
20444
20445                if let Some(token) = token.as_ref() {
20446                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20447                }
20448
20449                let request = req_builder
20450                    .header(CONTENT_TYPE, json_mime_type.to_string())
20451                    .header(CONTENT_LENGTH, request_size as u64)
20452                    .body(common::to_body(
20453                        request_value_reader.get_ref().clone().into(),
20454                    ));
20455
20456                client.request(request.unwrap()).await
20457            };
20458
20459            match req_result {
20460                Err(err) => {
20461                    if let common::Retry::After(d) = dlg.http_error(&err) {
20462                        sleep(d).await;
20463                        continue;
20464                    }
20465                    dlg.finished(false);
20466                    return Err(common::Error::HttpError(err));
20467                }
20468                Ok(res) => {
20469                    let (mut parts, body) = res.into_parts();
20470                    let mut body = common::Body::new(body);
20471                    if !parts.status.is_success() {
20472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20473                        let error = serde_json::from_str(&common::to_string(&bytes));
20474                        let response = common::to_response(parts, bytes.into());
20475
20476                        if let common::Retry::After(d) =
20477                            dlg.http_failure(&response, error.as_ref().ok())
20478                        {
20479                            sleep(d).await;
20480                            continue;
20481                        }
20482
20483                        dlg.finished(false);
20484
20485                        return Err(match error {
20486                            Ok(value) => common::Error::BadRequest(value),
20487                            _ => common::Error::Failure(response),
20488                        });
20489                    }
20490                    let response = {
20491                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20492                        let encoded = common::to_string(&bytes);
20493                        match serde_json::from_str(&encoded) {
20494                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20495                            Err(error) => {
20496                                dlg.response_json_decode_error(&encoded, &error);
20497                                return Err(common::Error::JsonDecodeError(
20498                                    encoded.to_string(),
20499                                    error,
20500                                ));
20501                            }
20502                        }
20503                    };
20504
20505                    dlg.finished(true);
20506                    return Ok(response);
20507                }
20508            }
20509        }
20510    }
20511
20512    ///
20513    /// Sets the *request* property to the given value.
20514    ///
20515    /// Even though the property as already been set when instantiating this call,
20516    /// we provide this method for API completeness.
20517    pub fn request(
20518        mut self,
20519        new_value: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
20520    ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
20521        self._request = new_value;
20522        self
20523    }
20524    /// Required. The relative resource name of the project for which the token was minted, in the format: ``` projects/{project_number} ``` If necessary, the `project_number` element can be replaced with the project ID of the Firebase project. Learn more about using project identifiers in Google's [AIP 2510](https://google.aip.dev/cloud/2510) standard.
20525    ///
20526    /// Sets the *project* path property to the given value.
20527    ///
20528    /// Even though the property as already been set when instantiating this call,
20529    /// we provide this method for API completeness.
20530    pub fn project(mut self, new_value: &str) -> ProjectVerifyAppCheckTokenCall<'a, C> {
20531        self._project = new_value.to_string();
20532        self
20533    }
20534    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20535    /// while executing the actual API request.
20536    ///
20537    /// ````text
20538    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20539    /// ````
20540    ///
20541    /// Sets the *delegate* property to the given value.
20542    pub fn delegate(
20543        mut self,
20544        new_value: &'a mut dyn common::Delegate,
20545    ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
20546        self._delegate = Some(new_value);
20547        self
20548    }
20549
20550    /// Set any additional parameter of the query string used in the request.
20551    /// It should be used to set parameters which are not yet available through their own
20552    /// setters.
20553    ///
20554    /// Please note that this method must not be used to set any of the known parameters
20555    /// which have their own setter method. If done anyway, the request will fail.
20556    ///
20557    /// # Additional Parameters
20558    ///
20559    /// * *$.xgafv* (query-string) - V1 error format.
20560    /// * *access_token* (query-string) - OAuth access token.
20561    /// * *alt* (query-string) - Data format for response.
20562    /// * *callback* (query-string) - JSONP
20563    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20564    /// * *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.
20565    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20566    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20567    /// * *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.
20568    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20569    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20570    pub fn param<T>(mut self, name: T, value: T) -> ProjectVerifyAppCheckTokenCall<'a, C>
20571    where
20572        T: AsRef<str>,
20573    {
20574        self._additional_params
20575            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20576        self
20577    }
20578
20579    /// Identifies the authorization scope for the method you are building.
20580    ///
20581    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20582    /// [`Scope::CloudPlatform`].
20583    ///
20584    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20585    /// tokens for more than one scope.
20586    ///
20587    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20588    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20589    /// sufficient, a read-write scope will do as well.
20590    pub fn add_scope<St>(mut self, scope: St) -> ProjectVerifyAppCheckTokenCall<'a, C>
20591    where
20592        St: AsRef<str>,
20593    {
20594        self._scopes.insert(String::from(scope.as_ref()));
20595        self
20596    }
20597    /// Identifies the authorization scope(s) for the method you are building.
20598    ///
20599    /// See [`Self::add_scope()`] for details.
20600    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectVerifyAppCheckTokenCall<'a, C>
20601    where
20602        I: IntoIterator<Item = St>,
20603        St: AsRef<str>,
20604    {
20605        self._scopes
20606            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20607        self
20608    }
20609
20610    /// Removes all scopes, and no default scope will be used either.
20611    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20612    /// for details).
20613    pub fn clear_scopes(mut self) -> ProjectVerifyAppCheckTokenCall<'a, C> {
20614        self._scopes.clear();
20615        self
20616    }
20617}