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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
67/// secret,
68/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
69/// ).build().await.unwrap();
70///
71/// let client = hyper_util::client::legacy::Client::builder(
72/// hyper_util::rt::TokioExecutor::new()
73/// )
74/// .build(
75/// hyper_rustls::HttpsConnectorBuilder::new()
76/// .with_native_roots()
77/// .unwrap()
78/// .https_or_http()
79/// .enable_http1()
80/// .build()
81/// );
82/// let mut hub = Firebaseappcheck::new(client, auth);
83/// // As the method needs a request, you would usually fill it with the desired information
84/// // into the respective structure. Some of the parts shown here might not be applicable !
85/// // Values shown here are possibly random and not representative !
86/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
87///
88/// // You can configure optional parameters by calling the respective setters at will, and
89/// // execute the final call using `doit()`.
90/// // Values shown here are possibly random and not representative !
91/// let result = hub.oauth_clients().exchange_app_attest_assertion(req, "app")
92/// .doit().await;
93///
94/// match result {
95/// Err(e) => match e {
96/// // The Error enum provides details about what exactly happened.
97/// // You can also just use its `Debug`, `Display` or `Error` traits
98/// Error::HttpError(_)
99/// |Error::Io(_)
100/// |Error::MissingAPIKey
101/// |Error::MissingToken(_)
102/// |Error::Cancelled
103/// |Error::UploadSizeLimitExceeded(_, _)
104/// |Error::Failure(_)
105/// |Error::BadRequest(_)
106/// |Error::FieldClash(_)
107/// |Error::JsonDecodeError(_, _) => println!("{}", e),
108/// },
109/// Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct Firebaseappcheck<C> {
115 pub client: common::Client<C>,
116 pub auth: Box<dyn common::GetToken>,
117 _user_agent: String,
118 _base_url: String,
119 _root_url: String,
120}
121
122impl<C> common::Hub for Firebaseappcheck<C> {}
123
124impl<'a, C> Firebaseappcheck<C> {
125 pub fn new<A: 'static + common::GetToken>(
126 client: common::Client<C>,
127 auth: A,
128 ) -> Firebaseappcheck<C> {
129 Firebaseappcheck {
130 client,
131 auth: Box::new(auth),
132 _user_agent: "google-api-rust-client/6.0.0".to_string(),
133 _base_url: "https://firebaseappcheck.googleapis.com/".to_string(),
134 _root_url: "https://firebaseappcheck.googleapis.com/".to_string(),
135 }
136 }
137
138 pub fn jwks(&'a self) -> JwkMethods<'a, C> {
139 JwkMethods { hub: self }
140 }
141 pub fn oauth_clients(&'a self) -> OauthClientMethods<'a, C> {
142 OauthClientMethods { hub: self }
143 }
144 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
145 ProjectMethods { hub: self }
146 }
147
148 /// Set the user-agent header field to use in all requests to the server.
149 /// It defaults to `google-api-rust-client/6.0.0`.
150 ///
151 /// Returns the previously set user-agent.
152 pub fn user_agent(&mut self, agent_name: String) -> String {
153 std::mem::replace(&mut self._user_agent, agent_name)
154 }
155
156 /// Set the base url to use in all requests to the server.
157 /// It defaults to `https://firebaseappcheck.googleapis.com/`.
158 ///
159 /// Returns the previously set base url.
160 pub fn base_url(&mut self, new_base_url: String) -> String {
161 std::mem::replace(&mut self._base_url, new_base_url)
162 }
163
164 /// Set the root url to use in all requests to the server.
165 /// It defaults to `https://firebaseappcheck.googleapis.com/`.
166 ///
167 /// Returns the previously set root url.
168 pub fn root_url(&mut self, new_root_url: String) -> String {
169 std::mem::replace(&mut self._root_url, new_root_url)
170 }
171}
172
173// ############
174// SCHEMAS ###
175// ##########
176/// 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).
177///
178/// # Activities
179///
180/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
181/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
182///
183/// * [apps app attest config get projects](ProjectAppAppAttestConfigGetCall) (response)
184/// * [apps app attest config patch projects](ProjectAppAppAttestConfigPatchCall) (request|response)
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct GoogleFirebaseAppcheckV1betaAppAttestConfig {
189 /// Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
190 pub name: Option<String>,
191 /// 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.
192 #[serde(rename = "tokenTtl")]
193 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
194 pub token_ttl: Option<chrono::Duration>,
195}
196
197impl common::RequestValue for GoogleFirebaseAppcheckV1betaAppAttestConfig {}
198impl common::ResponseResult for GoogleFirebaseAppcheckV1betaAppAttestConfig {}
199
200/// Encapsulates an *App Check token*, which are used to access Firebase services protected by App Check.
201///
202/// # Activities
203///
204/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
205/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
206///
207/// * [exchange app attest assertion oauth clients](OauthClientExchangeAppAttestAssertionCall) (response)
208/// * [exchange debug token oauth clients](OauthClientExchangeDebugTokenCall) (response)
209/// * [apps exchange app attest assertion projects](ProjectAppExchangeAppAttestAssertionCall) (response)
210/// * [apps exchange custom token projects](ProjectAppExchangeCustomTokenCall) (response)
211/// * [apps exchange debug token projects](ProjectAppExchangeDebugTokenCall) (response)
212/// * [apps exchange device check token projects](ProjectAppExchangeDeviceCheckTokenCall) (response)
213/// * [apps exchange play integrity token projects](ProjectAppExchangePlayIntegrityTokenCall) (response)
214/// * [apps exchange recaptcha enterprise token projects](ProjectAppExchangeRecaptchaEnterpriseTokenCall) (response)
215/// * [apps exchange recaptcha token projects](ProjectAppExchangeRecaptchaTokenCall) (response)
216/// * [apps exchange recaptcha v3 token projects](ProjectAppExchangeRecaptchaV3TokenCall) (response)
217/// * [apps exchange safety net token projects](ProjectAppExchangeSafetyNetTokenCall) (response)
218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
219#[serde_with::serde_as]
220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
221pub struct GoogleFirebaseAppcheckV1betaAppCheckToken {
222 /// 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.
223 #[serde(rename = "attestationToken")]
224 pub attestation_token: Option<String>,
225 /// 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.
226 pub token: Option<String>,
227 /// 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.
228 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
229 pub ttl: Option<chrono::Duration>,
230}
231
232impl common::ResponseResult for GoogleFirebaseAppcheckV1betaAppCheckToken {}
233
234/// Encapsulates an *App Check token*, which are used to access Firebase services protected by App Check.
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct GoogleFirebaseAppcheckV1betaAttestationTokenResponse {
242 /// 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.
243 #[serde(rename = "attestationToken")]
244 pub attestation_token: Option<String>,
245 /// 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.
246 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
247 pub ttl: Option<chrono::Duration>,
248}
249
250impl common::Part for GoogleFirebaseAppcheckV1betaAttestationTokenResponse {}
251
252/// Response message for the BatchGetAppAttestConfigs method.
253///
254/// # Activities
255///
256/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
257/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
258///
259/// * [apps app attest config batch get projects](ProjectAppAppAttestConfigBatchGetCall) (response)
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse {
264 /// AppAttestConfigs retrieved.
265 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaAppAttestConfig>>,
266}
267
268impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse {}
269
270/// Response message for the BatchGetDeviceCheckConfigs method.
271///
272/// # Activities
273///
274/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
275/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
276///
277/// * [apps device check config batch get projects](ProjectAppDeviceCheckConfigBatchGetCall) (response)
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse {
282 /// DeviceCheckConfigs retrieved.
283 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaDeviceCheckConfig>>,
284}
285
286impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse {}
287
288/// Response message for the BatchGetPlayIntegrityConfigs method.
289///
290/// # Activities
291///
292/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
293/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
294///
295/// * [apps play integrity config batch get projects](ProjectAppPlayIntegrityConfigBatchGetCall) (response)
296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
297#[serde_with::serde_as]
298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
299pub struct GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse {
300 /// PlayIntegrityConfigs retrieved.
301 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaPlayIntegrityConfig>>,
302}
303
304impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse {}
305
306/// Response message for the BatchGetRecaptchaConfigs method.
307///
308/// # Activities
309///
310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
312///
313/// * [apps recaptcha config batch get projects](ProjectAppRecaptchaConfigBatchGetCall) (response)
314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
315#[serde_with::serde_as]
316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
317pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse {
318 /// RecaptchaConfigs retrieved.
319 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaConfig>>,
320}
321
322impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse {}
323
324/// Response message for the BatchGetRecaptchaEnterpriseConfigs method.
325///
326/// # Activities
327///
328/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
329/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
330///
331/// * [apps recaptcha enterprise config batch get projects](ProjectAppRecaptchaEnterpriseConfigBatchGetCall) (response)
332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
333#[serde_with::serde_as]
334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
335pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse {
336 /// RecaptchaEnterpriseConfigs retrieved.
337 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig>>,
338}
339
340impl common::ResponseResult
341 for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse
342{
343}
344
345/// Response message for the BatchGetRecaptchaV3Configs method.
346///
347/// # Activities
348///
349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
351///
352/// * [apps recaptcha v3 config batch get projects](ProjectAppRecaptchaV3ConfigBatchGetCall) (response)
353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
354#[serde_with::serde_as]
355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
356pub struct GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse {
357 /// RecaptchaV3Configs retrieved.
358 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaRecaptchaV3Config>>,
359}
360
361impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse {}
362
363/// Response message for the BatchGetSafetyNetConfigs method.
364///
365/// # Activities
366///
367/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
368/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
369///
370/// * [apps safety net config batch get projects](ProjectAppSafetyNetConfigBatchGetCall) (response)
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse {
375 /// SafetyNetConfigs retrieved.
376 pub configs: Option<Vec<GoogleFirebaseAppcheckV1betaSafetyNetConfig>>,
377}
378
379impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse {}
380
381/// Request message for the BatchUpdateResourcePolicies method.
382///
383/// # Activities
384///
385/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
386/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
387///
388/// * [services resource policies batch update projects](ProjectServiceResourcePolicyBatchUpdateCall) (request)
389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
390#[serde_with::serde_as]
391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
392pub struct GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest {
393 /// Required. The request messages specifying the ResourcePolicy objects to update. A maximum of 100 objects can be updated in a batch.
394 pub requests: Option<Vec<GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest>>,
395 /// 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.
396 #[serde(rename = "updateMask")]
397 pub update_mask: Option<common::FieldMask>,
398}
399
400impl common::RequestValue for GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest {}
401
402/// Response message for the BatchUpdateResourcePolicies method.
403///
404/// # Activities
405///
406/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
407/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
408///
409/// * [services resource policies batch update projects](ProjectServiceResourcePolicyBatchUpdateCall) (response)
410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
411#[serde_with::serde_as]
412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
413pub struct GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse {
414 /// ResourcePolicy objects after the updates have been applied.
415 #[serde(rename = "resourcePolicies")]
416 pub resource_policies: Option<Vec<GoogleFirebaseAppcheckV1betaResourcePolicy>>,
417}
418
419impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse {}
420
421/// Request message for the BatchUpdateServices method.
422///
423/// # Activities
424///
425/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
426/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
427///
428/// * [services batch update projects](ProjectServiceBatchUpdateCall) (request)
429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
430#[serde_with::serde_as]
431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
432pub struct GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest {
433 /// Required. The request messages specifying the Services to update. A maximum of 100 objects can be updated in a batch.
434 pub requests: Option<Vec<GoogleFirebaseAppcheckV1betaUpdateServiceRequest>>,
435 /// 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.
436 #[serde(rename = "updateMask")]
437 pub update_mask: Option<common::FieldMask>,
438}
439
440impl common::RequestValue for GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest {}
441
442/// Response message for the BatchUpdateServices method.
443///
444/// # Activities
445///
446/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
447/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
448///
449/// * [services batch update projects](ProjectServiceBatchUpdateCall) (response)
450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
451#[serde_with::serde_as]
452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
453pub struct GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse {
454 /// Service objects after the updates have been applied.
455 pub services: Option<Vec<GoogleFirebaseAppcheckV1betaService>>,
456}
457
458impl common::ResponseResult for GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse {}
459
460/// 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.
461///
462/// # Activities
463///
464/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
465/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
466///
467/// * [apps debug tokens create projects](ProjectAppDebugTokenCreateCall) (request|response)
468/// * [apps debug tokens get projects](ProjectAppDebugTokenGetCall) (response)
469/// * [apps debug tokens patch projects](ProjectAppDebugTokenPatchCall) (request|response)
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct GoogleFirebaseAppcheckV1betaDebugToken {
474 /// Required. A human readable display name used to identify this debug token.
475 #[serde(rename = "displayName")]
476 pub display_name: Option<String>,
477 /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
478 pub name: Option<String>,
479 /// 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.
480 pub token: Option<String>,
481 /// Output only. Timestamp when this debug token was most recently updated.
482 #[serde(rename = "updateTime")]
483 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
484}
485
486impl common::RequestValue for GoogleFirebaseAppcheckV1betaDebugToken {}
487impl common::ResponseResult for GoogleFirebaseAppcheckV1betaDebugToken {}
488
489/// 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).
490///
491/// # Activities
492///
493/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
494/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
495///
496/// * [apps device check config get projects](ProjectAppDeviceCheckConfigGetCall) (response)
497/// * [apps device check config patch projects](ProjectAppDeviceCheckConfigPatchCall) (request|response)
498#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
499#[serde_with::serde_as]
500#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
501pub struct GoogleFirebaseAppcheckV1betaDeviceCheckConfig {
502 /// Required. The key identifier of a private key enabled with DeviceCheck, created in your Apple Developer account.
503 #[serde(rename = "keyId")]
504 pub key_id: Option<String>,
505 /// Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
506 pub name: Option<String>,
507 /// 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.
508 #[serde(rename = "privateKey")]
509 pub private_key: Option<String>,
510 /// 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.
511 #[serde(rename = "privateKeySet")]
512 pub private_key_set: Option<bool>,
513 /// 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.
514 #[serde(rename = "tokenTtl")]
515 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
516 pub token_ttl: Option<chrono::Duration>,
517}
518
519impl common::RequestValue for GoogleFirebaseAppcheckV1betaDeviceCheckConfig {}
520impl common::ResponseResult for GoogleFirebaseAppcheckV1betaDeviceCheckConfig {}
521
522/// Request message for the ExchangeAppAttestAssertion method.
523///
524/// # Activities
525///
526/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
527/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
528///
529/// * [exchange app attest assertion oauth clients](OauthClientExchangeAppAttestAssertionCall) (request)
530/// * [apps exchange app attest assertion projects](ProjectAppExchangeAppAttestAssertionCall) (request)
531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
532#[serde_with::serde_as]
533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
534pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest {
535 /// Required. The artifact returned by a previous call to ExchangeAppAttestAttestation.
536 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
537 pub artifact: Option<Vec<u8>>,
538 /// Required. The CBOR-encoded assertion returned by the client-side App Attest API.
539 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
540 pub assertion: Option<Vec<u8>>,
541 /// Required. A one-time challenge returned by an immediately prior call to GenerateAppAttestChallenge.
542 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
543 pub challenge: Option<Vec<u8>>,
544 /// 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`.
545 #[serde(rename = "limitedUse")]
546 pub limited_use: Option<bool>,
547}
548
549impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest {}
550
551/// Request message for the ExchangeAppAttestAttestation method.
552///
553/// # Activities
554///
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557///
558/// * [exchange app attest attestation oauth clients](OauthClientExchangeAppAttestAttestationCall) (request)
559/// * [apps exchange app attest attestation projects](ProjectAppExchangeAppAttestAttestationCall) (request)
560#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
561#[serde_with::serde_as]
562#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
563pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest {
564 /// Required. The App Attest statement returned by the client-side App Attest API. This is a base64url encoded CBOR object in the JSON response.
565 #[serde(rename = "attestationStatement")]
566 #[serde_as(as = "Option<common::serde::urlsafe_base64::Wrapper>")]
567 pub attestation_statement: Option<Vec<u8>>,
568 /// Required. A one-time challenge returned by an immediately prior call to GenerateAppAttestChallenge.
569 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
570 pub challenge: Option<Vec<u8>>,
571 /// Required. The key ID generated by App Attest for the client app.
572 #[serde(rename = "keyId")]
573 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
574 pub key_id: Option<Vec<u8>>,
575 /// 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`.
576 #[serde(rename = "limitedUse")]
577 pub limited_use: Option<bool>,
578}
579
580impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest {}
581
582/// Response message for the ExchangeAppAttestAttestation method.
583///
584/// # Activities
585///
586/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
587/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
588///
589/// * [exchange app attest attestation oauth clients](OauthClientExchangeAppAttestAttestationCall) (response)
590/// * [apps exchange app attest attestation projects](ProjectAppExchangeAppAttestAttestationCall) (response)
591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
592#[serde_with::serde_as]
593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
594pub struct GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse {
595 /// Encapsulates an App Check token.
596 #[serde(rename = "appCheckToken")]
597 pub app_check_token: Option<GoogleFirebaseAppcheckV1betaAppCheckToken>,
598 /// An artifact that can be used in future calls to ExchangeAppAttestAssertion.
599 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
600 pub artifact: Option<Vec<u8>>,
601 /// Encapsulates an App Check token.
602 #[serde(rename = "attestationToken")]
603 pub attestation_token: Option<GoogleFirebaseAppcheckV1betaAttestationTokenResponse>,
604}
605
606impl common::ResponseResult for GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse {}
607
608/// Request message for the ExchangeCustomToken method.
609///
610/// # Activities
611///
612/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
613/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
614///
615/// * [apps exchange custom token projects](ProjectAppExchangeCustomTokenCall) (request)
616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
617#[serde_with::serde_as]
618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
619pub struct GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest {
620 /// Required. A custom token signed using your project's Admin SDK service account credentials.
621 #[serde(rename = "customToken")]
622 pub custom_token: Option<String>,
623 /// 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`.
624 #[serde(rename = "limitedUse")]
625 pub limited_use: Option<bool>,
626}
627
628impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest {}
629
630/// Request message for the ExchangeDebugToken method.
631///
632/// # Activities
633///
634/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
635/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
636///
637/// * [exchange debug token oauth clients](OauthClientExchangeDebugTokenCall) (request)
638/// * [apps exchange debug token projects](ProjectAppExchangeDebugTokenCall) (request)
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest {
643 /// Required. A debug token secret. This string must match a debug token secret previously created using CreateDebugToken.
644 #[serde(rename = "debugToken")]
645 pub debug_token: Option<String>,
646 /// 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`.
647 #[serde(rename = "limitedUse")]
648 pub limited_use: Option<bool>,
649}
650
651impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest {}
652
653/// Request message for the ExchangeDeviceCheckToken method.
654///
655/// # Activities
656///
657/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
658/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
659///
660/// * [apps exchange device check token projects](ProjectAppExchangeDeviceCheckTokenCall) (request)
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest {
665 /// 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.
666 #[serde(rename = "deviceToken")]
667 pub device_token: Option<String>,
668 /// 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`.
669 #[serde(rename = "limitedUse")]
670 pub limited_use: Option<bool>,
671}
672
673impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest {}
674
675/// Request message for the ExchangePlayIntegrityToken method.
676///
677/// # Activities
678///
679/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
680/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
681///
682/// * [apps exchange play integrity token projects](ProjectAppExchangePlayIntegrityTokenCall) (request)
683#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
684#[serde_with::serde_as]
685#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
686pub struct GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest {
687 /// 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`.
688 #[serde(rename = "limitedUse")]
689 pub limited_use: Option<bool>,
690 /// Required. The [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify) issued to your app.
691 #[serde(rename = "playIntegrityToken")]
692 pub play_integrity_token: Option<String>,
693}
694
695impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest {}
696
697/// Request message for the ExchangeRecaptchaEnterpriseToken method.
698///
699/// # Activities
700///
701/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
702/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
703///
704/// * [apps exchange recaptcha enterprise token projects](ProjectAppExchangeRecaptchaEnterpriseTokenCall) (request)
705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
706#[serde_with::serde_as]
707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
708pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest {
709 /// 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`.
710 #[serde(rename = "limitedUse")]
711 pub limited_use: Option<bool>,
712 /// Required. The reCAPTCHA token as returned by the [reCAPTCHA Enterprise JavaScript API](https://cloud.google.com/recaptcha-enterprise/docs/instrument-web-pages).
713 #[serde(rename = "recaptchaEnterpriseToken")]
714 pub recaptcha_enterprise_token: Option<String>,
715}
716
717impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest {}
718
719/// Request message for the ExchangeRecaptchaToken method.
720///
721/// # Activities
722///
723/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
724/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
725///
726/// * [apps exchange recaptcha token projects](ProjectAppExchangeRecaptchaTokenCall) (request)
727#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
728#[serde_with::serde_as]
729#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
730pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest {
731 /// Required. The reCAPTCHA token as returned by the [reCAPTCHA v3 JavaScript API](https://developers.google.com/recaptcha/docs/v3).
732 #[serde(rename = "recaptchaToken")]
733 pub recaptcha_token: Option<String>,
734}
735
736impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest {}
737
738/// Request message for the ExchangeRecaptchaV3Token method.
739///
740/// # Activities
741///
742/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
743/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
744///
745/// * [apps exchange recaptcha v3 token projects](ProjectAppExchangeRecaptchaV3TokenCall) (request)
746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
747#[serde_with::serde_as]
748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
749pub struct GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest {
750 /// 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`.
751 #[serde(rename = "limitedUse")]
752 pub limited_use: Option<bool>,
753 /// Required. The reCAPTCHA token as returned by the [reCAPTCHA v3 JavaScript API](https://developers.google.com/recaptcha/docs/v3).
754 #[serde(rename = "recaptchaV3Token")]
755 pub recaptcha_v3_token: Option<String>,
756}
757
758impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest {}
759
760/// Request message for the ExchangeSafetyNetToken method.
761///
762/// # Activities
763///
764/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
765/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
766///
767/// * [apps exchange safety net token projects](ProjectAppExchangeSafetyNetTokenCall) (request)
768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
769#[serde_with::serde_as]
770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
771pub struct GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest {
772 /// Required. The [SafetyNet attestation response](https://developer.android.com/training/safetynet/attestation#request-attestation-step) issued to your app.
773 #[serde(rename = "safetyNetToken")]
774 pub safety_net_token: Option<String>,
775}
776
777impl common::RequestValue for GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest {}
778
779/// Request message for the GenerateAppAttestChallenge method.
780///
781/// # Activities
782///
783/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
784/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
785///
786/// * [generate app attest challenge oauth clients](OauthClientGenerateAppAttestChallengeCall) (request)
787/// * [apps generate app attest challenge projects](ProjectAppGenerateAppAttestChallengeCall) (request)
788#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
789#[serde_with::serde_as]
790#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
791pub struct GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest {
792 _never_set: Option<bool>,
793}
794
795impl common::RequestValue for GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest {}
796
797/// Response message for the GenerateAppAttestChallenge method.
798///
799/// # Activities
800///
801/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
802/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
803///
804/// * [generate app attest challenge oauth clients](OauthClientGenerateAppAttestChallengeCall) (response)
805/// * [apps generate app attest challenge projects](ProjectAppGenerateAppAttestChallengeCall) (response)
806#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
807#[serde_with::serde_as]
808#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
809pub struct GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse {
810 /// A one-time use challenge for the client to pass to the App Attest API.
811 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
812 pub challenge: Option<Vec<u8>>,
813 /// 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.
814 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
815 pub ttl: Option<chrono::Duration>,
816}
817
818impl common::ResponseResult for GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse {}
819
820/// Request message for the GeneratePlayIntegrityChallenge method.
821///
822/// # Activities
823///
824/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
825/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
826///
827/// * [apps generate play integrity challenge projects](ProjectAppGeneratePlayIntegrityChallengeCall) (request)
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest {
832 _never_set: Option<bool>,
833}
834
835impl common::RequestValue for GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest {}
836
837/// Response message for the GeneratePlayIntegrityChallenge method.
838///
839/// # Activities
840///
841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
843///
844/// * [apps generate play integrity challenge projects](ProjectAppGeneratePlayIntegrityChallengeCall) (response)
845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
846#[serde_with::serde_as]
847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
848pub struct GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse {
849 /// 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.
850 pub challenge: Option<String>,
851 /// 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.
852 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
853 pub ttl: Option<chrono::Duration>,
854}
855
856impl common::ResponseResult for GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse {}
857
858/// Response message for the ListDebugTokens method.
859///
860/// # Activities
861///
862/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
863/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
864///
865/// * [apps debug tokens list projects](ProjectAppDebugTokenListCall) (response)
866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
867#[serde_with::serde_as]
868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
869pub struct GoogleFirebaseAppcheckV1betaListDebugTokensResponse {
870 /// The DebugTokens retrieved.
871 #[serde(rename = "debugTokens")]
872 pub debug_tokens: Option<Vec<GoogleFirebaseAppcheckV1betaDebugToken>>,
873 /// 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.
874 #[serde(rename = "nextPageToken")]
875 pub next_page_token: Option<String>,
876}
877
878impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListDebugTokensResponse {}
879
880/// Response message for the ListResourcePolicies method.
881///
882/// # Activities
883///
884/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
885/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
886///
887/// * [services resource policies list projects](ProjectServiceResourcePolicyListCall) (response)
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse {
892 /// 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.
893 #[serde(rename = "nextPageToken")]
894 pub next_page_token: Option<String>,
895 /// The ResourcePolicy objects retrieved.
896 #[serde(rename = "resourcePolicies")]
897 pub resource_policies: Option<Vec<GoogleFirebaseAppcheckV1betaResourcePolicy>>,
898}
899
900impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse {}
901
902/// Response message for the ListServices method.
903///
904/// # Activities
905///
906/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
907/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
908///
909/// * [services list projects](ProjectServiceListCall) (response)
910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
911#[serde_with::serde_as]
912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
913pub struct GoogleFirebaseAppcheckV1betaListServicesResponse {
914 /// 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.
915 #[serde(rename = "nextPageToken")]
916 pub next_page_token: Option<String>,
917 /// The Services retrieved.
918 pub services: Option<Vec<GoogleFirebaseAppcheckV1betaService>>,
919}
920
921impl common::ResponseResult for GoogleFirebaseAppcheckV1betaListServicesResponse {}
922
923/// 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).
924///
925/// # Activities
926///
927/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
928/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
929///
930/// * [apps play integrity config get projects](ProjectAppPlayIntegrityConfigGetCall) (response)
931/// * [apps play integrity config patch projects](ProjectAppPlayIntegrityConfigPatchCall) (request|response)
932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
933#[serde_with::serde_as]
934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
935pub struct GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {
936 /// Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
937 pub name: Option<String>,
938 /// 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.
939 #[serde(rename = "tokenTtl")]
940 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
941 pub token_ttl: Option<chrono::Duration>,
942}
943
944impl common::RequestValue for GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {}
945impl common::ResponseResult for GoogleFirebaseAppcheckV1betaPlayIntegrityConfig {}
946
947/// 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).
948///
949/// This type is not used in any activity, and only used as *part* of another schema.
950///
951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
952#[serde_with::serde_as]
953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
954pub struct GoogleFirebaseAppcheckV1betaPublicJwk {
955 /// See [section 4.4 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.4).
956 pub alg: Option<String>,
957 /// See [section 6.3.1.2 of RFC 7518](https://tools.ietf.org/html/rfc7518#section-6.3.1.2).
958 pub e: Option<String>,
959 /// See [section 4.5 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.5).
960 pub kid: Option<String>,
961 /// See [section 4.1 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.1).
962 pub kty: Option<String>,
963 /// See [section 6.3.1.1 of RFC 7518](https://tools.ietf.org/html/rfc7518#section-6.3.1.1).
964 pub n: Option<String>,
965 /// See [section 4.2 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-4.2).
966 #[serde(rename = "use")]
967 pub use_: Option<String>,
968}
969
970impl common::Part for GoogleFirebaseAppcheckV1betaPublicJwk {}
971
972/// 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.
973///
974/// # Activities
975///
976/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
977/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
978///
979/// * [get jwks](JwkGetCall) (response)
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct GoogleFirebaseAppcheckV1betaPublicJwkSet {
984 /// The set of public keys. See [section 5.1 of RFC 7517](https://tools.ietf.org/html/rfc7517#section-5).
985 pub keys: Option<Vec<GoogleFirebaseAppcheckV1betaPublicJwk>>,
986}
987
988impl common::ResponseResult for GoogleFirebaseAppcheckV1betaPublicJwkSet {}
989
990/// 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.
991///
992/// # Activities
993///
994/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
995/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
996///
997/// * [apps recaptcha config get projects](ProjectAppRecaptchaConfigGetCall) (response)
998/// * [apps recaptcha config patch projects](ProjectAppRecaptchaConfigPatchCall) (request|response)
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct GoogleFirebaseAppcheckV1betaRecaptchaConfig {
1003 /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1004 pub name: Option<String>,
1005 /// 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.
1006 #[serde(rename = "siteSecret")]
1007 pub site_secret: Option<String>,
1008 /// 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.
1009 #[serde(rename = "siteSecretSet")]
1010 pub site_secret_set: Option<bool>,
1011 /// 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.
1012 #[serde(rename = "tokenTtl")]
1013 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1014 pub token_ttl: Option<chrono::Duration>,
1015}
1016
1017impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaConfig {}
1018impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaConfig {}
1019
1020/// 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.
1021///
1022/// # Activities
1023///
1024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1026///
1027/// * [apps recaptcha enterprise config get projects](ProjectAppRecaptchaEnterpriseConfigGetCall) (response)
1028/// * [apps recaptcha enterprise config patch projects](ProjectAppRecaptchaEnterpriseConfigPatchCall) (request|response)
1029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1030#[serde_with::serde_as]
1031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1032pub struct GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {
1033 /// Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
1034 pub name: Option<String>,
1035 /// 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.
1036 #[serde(rename = "siteKey")]
1037 pub site_key: Option<String>,
1038 /// 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.
1039 #[serde(rename = "tokenTtl")]
1040 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1041 pub token_ttl: Option<chrono::Duration>,
1042}
1043
1044impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {}
1045impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig {}
1046
1047/// 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.
1048///
1049/// # Activities
1050///
1051/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1052/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1053///
1054/// * [apps recaptcha v3 config get projects](ProjectAppRecaptchaV3ConfigGetCall) (response)
1055/// * [apps recaptcha v3 config patch projects](ProjectAppRecaptchaV3ConfigPatchCall) (request|response)
1056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1057#[serde_with::serde_as]
1058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1059pub struct GoogleFirebaseAppcheckV1betaRecaptchaV3Config {
1060 /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
1061 pub name: Option<String>,
1062 /// 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.
1063 #[serde(rename = "siteSecret")]
1064 pub site_secret: Option<String>,
1065 /// 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.
1066 #[serde(rename = "siteSecretSet")]
1067 pub site_secret_set: Option<bool>,
1068 /// 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.
1069 #[serde(rename = "tokenTtl")]
1070 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1071 pub token_ttl: Option<chrono::Duration>,
1072}
1073
1074impl common::RequestValue for GoogleFirebaseAppcheckV1betaRecaptchaV3Config {}
1075impl common::ResponseResult for GoogleFirebaseAppcheckV1betaRecaptchaV3Config {}
1076
1077/// App Check enforcement policy for a specific resource of a Firebase service supported by App Check. Note that this policy will override the service-level configuration.
1078///
1079/// # Activities
1080///
1081/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1082/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1083///
1084/// * [services resource policies create projects](ProjectServiceResourcePolicyCreateCall) (request|response)
1085/// * [services resource policies get projects](ProjectServiceResourcePolicyGetCall) (response)
1086/// * [services resource policies patch projects](ProjectServiceResourcePolicyPatchCall) (request|response)
1087#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1088#[serde_with::serde_as]
1089#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1090pub struct GoogleFirebaseAppcheckV1betaResourcePolicy {
1091 /// Required. The App Check enforcement mode for this resource. This will override the EnforcementMode setting on the parent service.
1092 #[serde(rename = "enforcementMode")]
1093 pub enforcement_mode: Option<String>,
1094 /// 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.
1095 pub etag: Option<String>,
1096 /// 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.
1097 pub name: Option<String>,
1098 /// Required. Service specific name of the resource object to which this policy applies, in the format: * `//oauth2.googleapis.com/projects/{project_number}/oauthClients/{oauth_client_id}` (Google Identity for iOS) 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.
1099 #[serde(rename = "targetResource")]
1100 pub target_resource: Option<String>,
1101 /// Output only. Timestamp when this resource policy configuration object was most recently updated.
1102 #[serde(rename = "updateTime")]
1103 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1104}
1105
1106impl common::RequestValue for GoogleFirebaseAppcheckV1betaResourcePolicy {}
1107impl common::ResponseResult for GoogleFirebaseAppcheckV1betaResourcePolicy {}
1108
1109/// 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).
1110///
1111/// # Activities
1112///
1113/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1114/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1115///
1116/// * [apps safety net config get projects](ProjectAppSafetyNetConfigGetCall) (response)
1117/// * [apps safety net config patch projects](ProjectAppSafetyNetConfigPatchCall) (request|response)
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct GoogleFirebaseAppcheckV1betaSafetyNetConfig {
1122 /// Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
1123 pub name: Option<String>,
1124 /// 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.
1125 #[serde(rename = "tokenTtl")]
1126 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1127 pub token_ttl: Option<chrono::Duration>,
1128}
1129
1130impl common::RequestValue for GoogleFirebaseAppcheckV1betaSafetyNetConfig {}
1131impl common::ResponseResult for GoogleFirebaseAppcheckV1betaSafetyNetConfig {}
1132
1133/// The enforcement configuration for a Firebase service supported by App Check.
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/// * [services get projects](ProjectServiceGetCall) (response)
1141/// * [services patch projects](ProjectServicePatchCall) (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 GoogleFirebaseAppcheckV1betaService {
1146 /// Required. The App Check enforcement mode for this service.
1147 #[serde(rename = "enforcementMode")]
1148 pub enforcement_mode: Option<String>,
1149 /// 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.
1150 pub etag: Option<String>,
1151 /// 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)
1152 pub name: Option<String>,
1153 /// Output only. Timestamp when this service configuration object was most recently updated.
1154 #[serde(rename = "updateTime")]
1155 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1156}
1157
1158impl common::RequestValue for GoogleFirebaseAppcheckV1betaService {}
1159impl common::ResponseResult for GoogleFirebaseAppcheckV1betaService {}
1160
1161/// Request message for the UpdateResourcePolicy method as well as an individual update message for the BatchUpdateResourcePolicies method.
1162///
1163/// This type is not used in any activity, and only used as *part* of another schema.
1164///
1165#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1166#[serde_with::serde_as]
1167#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1168pub struct GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest {
1169 /// 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)
1170 #[serde(rename = "resourcePolicy")]
1171 pub resource_policy: Option<GoogleFirebaseAppcheckV1betaResourcePolicy>,
1172 /// Required. A comma-separated list of names of fields in the ResourcePolicy to update. Example: `enforcement_mode`.
1173 #[serde(rename = "updateMask")]
1174 pub update_mask: Option<common::FieldMask>,
1175}
1176
1177impl common::Part for GoogleFirebaseAppcheckV1betaUpdateResourcePolicyRequest {}
1178
1179/// Request message for the UpdateService method as well as an individual update message for the BatchUpdateServices method.
1180///
1181/// This type is not used in any activity, and only used as *part* of another schema.
1182///
1183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1184#[serde_with::serde_as]
1185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1186pub struct GoogleFirebaseAppcheckV1betaUpdateServiceRequest {
1187 /// 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).
1188 pub service: Option<GoogleFirebaseAppcheckV1betaService>,
1189 /// Required. A comma-separated list of names of fields in the Service to update. Example: `enforcement_mode`.
1190 #[serde(rename = "updateMask")]
1191 pub update_mask: Option<common::FieldMask>,
1192}
1193
1194impl common::Part for GoogleFirebaseAppcheckV1betaUpdateServiceRequest {}
1195
1196/// Request message for the VerifyAppCheckToken method.
1197///
1198/// # Activities
1199///
1200/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1201/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1202///
1203/// * [verify app check token projects](ProjectVerifyAppCheckTokenCall) (request)
1204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1205#[serde_with::serde_as]
1206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1207pub struct GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest {
1208 /// 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.
1209 #[serde(rename = "appCheckToken")]
1210 pub app_check_token: Option<String>,
1211}
1212
1213impl common::RequestValue for GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest {}
1214
1215/// Response message for the VerifyAppCheckToken method.
1216///
1217/// # Activities
1218///
1219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1221///
1222/// * [verify app check token projects](ProjectVerifyAppCheckTokenCall) (response)
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse {
1227 /// 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.
1228 #[serde(rename = "alreadyConsumed")]
1229 pub already_consumed: Option<bool>,
1230}
1231
1232impl common::ResponseResult for GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse {}
1233
1234/// 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); }
1235///
1236/// # Activities
1237///
1238/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1239/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1240///
1241/// * [apps debug tokens delete projects](ProjectAppDebugTokenDeleteCall) (response)
1242/// * [services resource policies delete projects](ProjectServiceResourcePolicyDeleteCall) (response)
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct GoogleProtobufEmpty {
1247 _never_set: Option<bool>,
1248}
1249
1250impl common::ResponseResult for GoogleProtobufEmpty {}
1251
1252// ###################
1253// MethodBuilders ###
1254// #################
1255
1256/// A builder providing access to all methods supported on *jwk* resources.
1257/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1258///
1259/// # Example
1260///
1261/// Instantiate a resource builder
1262///
1263/// ```test_harness,no_run
1264/// extern crate hyper;
1265/// extern crate hyper_rustls;
1266/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1267///
1268/// # async fn dox() {
1269/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1270///
1271/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1272/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1273/// secret,
1274/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1275/// ).build().await.unwrap();
1276///
1277/// let client = hyper_util::client::legacy::Client::builder(
1278/// hyper_util::rt::TokioExecutor::new()
1279/// )
1280/// .build(
1281/// hyper_rustls::HttpsConnectorBuilder::new()
1282/// .with_native_roots()
1283/// .unwrap()
1284/// .https_or_http()
1285/// .enable_http1()
1286/// .build()
1287/// );
1288/// let mut hub = Firebaseappcheck::new(client, auth);
1289/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1290/// // like `get(...)`
1291/// // to build up your call.
1292/// let rb = hub.jwks();
1293/// # }
1294/// ```
1295pub struct JwkMethods<'a, C>
1296where
1297 C: 'a,
1298{
1299 hub: &'a Firebaseappcheck<C>,
1300}
1301
1302impl<'a, C> common::MethodsBuilder for JwkMethods<'a, C> {}
1303
1304impl<'a, C> JwkMethods<'a, C> {
1305 /// Create a builder to help you perform the following task:
1306 ///
1307 /// 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.
1308 ///
1309 /// # Arguments
1310 ///
1311 /// * `name` - Required. The relative resource name to the public JWK set. Must always be exactly the string `jwks`.
1312 pub fn get(&self, name: &str) -> JwkGetCall<'a, C> {
1313 JwkGetCall {
1314 hub: self.hub,
1315 _name: name.to_string(),
1316 _delegate: Default::default(),
1317 _additional_params: Default::default(),
1318 _scopes: Default::default(),
1319 }
1320 }
1321}
1322
1323/// A builder providing access to all methods supported on *oauthClient* resources.
1324/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1325///
1326/// # Example
1327///
1328/// Instantiate a resource builder
1329///
1330/// ```test_harness,no_run
1331/// extern crate hyper;
1332/// extern crate hyper_rustls;
1333/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1334///
1335/// # async fn dox() {
1336/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1337///
1338/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1339/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1340/// secret,
1341/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1342/// ).build().await.unwrap();
1343///
1344/// let client = hyper_util::client::legacy::Client::builder(
1345/// hyper_util::rt::TokioExecutor::new()
1346/// )
1347/// .build(
1348/// hyper_rustls::HttpsConnectorBuilder::new()
1349/// .with_native_roots()
1350/// .unwrap()
1351/// .https_or_http()
1352/// .enable_http1()
1353/// .build()
1354/// );
1355/// let mut hub = Firebaseappcheck::new(client, auth);
1356/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1357/// // like `exchange_app_attest_assertion(...)`, `exchange_app_attest_attestation(...)`, `exchange_debug_token(...)` and `generate_app_attest_challenge(...)`
1358/// // to build up your call.
1359/// let rb = hub.oauth_clients();
1360/// # }
1361/// ```
1362pub struct OauthClientMethods<'a, C>
1363where
1364 C: 'a,
1365{
1366 hub: &'a Firebaseappcheck<C>,
1367}
1368
1369impl<'a, C> common::MethodsBuilder for OauthClientMethods<'a, C> {}
1370
1371impl<'a, C> OauthClientMethods<'a, C> {
1372 /// Create a builder to help you perform the following task:
1373 ///
1374 /// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
1375 ///
1376 /// # Arguments
1377 ///
1378 /// * `request` - No description provided.
1379 /// * `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.
1380 pub fn exchange_app_attest_assertion(
1381 &self,
1382 request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
1383 app: &str,
1384 ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
1385 OauthClientExchangeAppAttestAssertionCall {
1386 hub: self.hub,
1387 _request: request,
1388 _app: app.to_string(),
1389 _delegate: Default::default(),
1390 _additional_params: Default::default(),
1391 _scopes: Default::default(),
1392 }
1393 }
1394
1395 /// Create a builder to help you perform the following task:
1396 ///
1397 /// 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).
1398 ///
1399 /// # Arguments
1400 ///
1401 /// * `request` - No description provided.
1402 /// * `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.
1403 pub fn exchange_app_attest_attestation(
1404 &self,
1405 request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
1406 app: &str,
1407 ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
1408 OauthClientExchangeAppAttestAttestationCall {
1409 hub: self.hub,
1410 _request: request,
1411 _app: app.to_string(),
1412 _delegate: Default::default(),
1413 _additional_params: Default::default(),
1414 _scopes: Default::default(),
1415 }
1416 }
1417
1418 /// Create a builder to help you perform the following task:
1419 ///
1420 /// 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.
1421 ///
1422 /// # Arguments
1423 ///
1424 /// * `request` - No description provided.
1425 /// * `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.
1426 pub fn exchange_debug_token(
1427 &self,
1428 request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
1429 app: &str,
1430 ) -> OauthClientExchangeDebugTokenCall<'a, C> {
1431 OauthClientExchangeDebugTokenCall {
1432 hub: self.hub,
1433 _request: request,
1434 _app: app.to_string(),
1435 _delegate: Default::default(),
1436 _additional_params: Default::default(),
1437 _scopes: Default::default(),
1438 }
1439 }
1440
1441 /// Create a builder to help you perform the following task:
1442 ///
1443 /// 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.
1444 ///
1445 /// # Arguments
1446 ///
1447 /// * `request` - No description provided.
1448 /// * `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.
1449 pub fn generate_app_attest_challenge(
1450 &self,
1451 request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
1452 app: &str,
1453 ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
1454 OauthClientGenerateAppAttestChallengeCall {
1455 hub: self.hub,
1456 _request: request,
1457 _app: app.to_string(),
1458 _delegate: Default::default(),
1459 _additional_params: Default::default(),
1460 _scopes: Default::default(),
1461 }
1462 }
1463}
1464
1465/// A builder providing access to all methods supported on *project* resources.
1466/// It is not used directly, but through the [`Firebaseappcheck`] hub.
1467///
1468/// # Example
1469///
1470/// Instantiate a resource builder
1471///
1472/// ```test_harness,no_run
1473/// extern crate hyper;
1474/// extern crate hyper_rustls;
1475/// extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
1476///
1477/// # async fn dox() {
1478/// use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1479///
1480/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1481/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1482/// secret,
1483/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1484/// ).build().await.unwrap();
1485///
1486/// let client = hyper_util::client::legacy::Client::builder(
1487/// hyper_util::rt::TokioExecutor::new()
1488/// )
1489/// .build(
1490/// hyper_rustls::HttpsConnectorBuilder::new()
1491/// .with_native_roots()
1492/// .unwrap()
1493/// .https_or_http()
1494/// .enable_http1()
1495/// .build()
1496/// );
1497/// let mut hub = Firebaseappcheck::new(client, auth);
1498/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1499/// // 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(...)`
1500/// // to build up your call.
1501/// let rb = hub.projects();
1502/// # }
1503/// ```
1504pub struct ProjectMethods<'a, C>
1505where
1506 C: 'a,
1507{
1508 hub: &'a Firebaseappcheck<C>,
1509}
1510
1511impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1512
1513impl<'a, C> ProjectMethods<'a, C> {
1514 /// Create a builder to help you perform the following task:
1515 ///
1516 /// Atomically gets the AppAttestConfigs for the specified list of apps.
1517 ///
1518 /// # Arguments
1519 ///
1520 /// * `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.
1521 pub fn apps_app_attest_config_batch_get(
1522 &self,
1523 parent: &str,
1524 ) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
1525 ProjectAppAppAttestConfigBatchGetCall {
1526 hub: self.hub,
1527 _parent: parent.to_string(),
1528 _names: Default::default(),
1529 _delegate: Default::default(),
1530 _additional_params: Default::default(),
1531 _scopes: Default::default(),
1532 }
1533 }
1534
1535 /// Create a builder to help you perform the following task:
1536 ///
1537 /// Gets the AppAttestConfig for the specified app.
1538 ///
1539 /// # Arguments
1540 ///
1541 /// * `name` - Required. The relative resource name of the AppAttestConfig, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
1542 pub fn apps_app_attest_config_get(
1543 &self,
1544 name: &str,
1545 ) -> ProjectAppAppAttestConfigGetCall<'a, C> {
1546 ProjectAppAppAttestConfigGetCall {
1547 hub: self.hub,
1548 _name: name.to_string(),
1549 _delegate: Default::default(),
1550 _additional_params: Default::default(),
1551 _scopes: Default::default(),
1552 }
1553 }
1554
1555 /// Create a builder to help you perform the following task:
1556 ///
1557 /// 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.
1558 ///
1559 /// # Arguments
1560 ///
1561 /// * `request` - No description provided.
1562 /// * `name` - Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
1563 pub fn apps_app_attest_config_patch(
1564 &self,
1565 request: GoogleFirebaseAppcheckV1betaAppAttestConfig,
1566 name: &str,
1567 ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
1568 ProjectAppAppAttestConfigPatchCall {
1569 hub: self.hub,
1570 _request: request,
1571 _name: name.to_string(),
1572 _update_mask: Default::default(),
1573 _delegate: Default::default(),
1574 _additional_params: Default::default(),
1575 _scopes: Default::default(),
1576 }
1577 }
1578
1579 /// Create a builder to help you perform the following task:
1580 ///
1581 /// 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.
1582 ///
1583 /// # Arguments
1584 ///
1585 /// * `request` - No description provided.
1586 /// * `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} ```
1587 pub fn apps_debug_tokens_create(
1588 &self,
1589 request: GoogleFirebaseAppcheckV1betaDebugToken,
1590 parent: &str,
1591 ) -> ProjectAppDebugTokenCreateCall<'a, C> {
1592 ProjectAppDebugTokenCreateCall {
1593 hub: self.hub,
1594 _request: request,
1595 _parent: parent.to_string(),
1596 _delegate: Default::default(),
1597 _additional_params: Default::default(),
1598 _scopes: Default::default(),
1599 }
1600 }
1601
1602 /// Create a builder to help you perform the following task:
1603 ///
1604 /// 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.
1605 ///
1606 /// # Arguments
1607 ///
1608 /// * `name` - Required. The relative resource name of the DebugToken to delete, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1609 pub fn apps_debug_tokens_delete(&self, name: &str) -> ProjectAppDebugTokenDeleteCall<'a, C> {
1610 ProjectAppDebugTokenDeleteCall {
1611 hub: self.hub,
1612 _name: name.to_string(),
1613 _delegate: Default::default(),
1614 _additional_params: Default::default(),
1615 _scopes: Default::default(),
1616 }
1617 }
1618
1619 /// Create a builder to help you perform the following task:
1620 ///
1621 /// Gets the specified DebugToken. For security reasons, the `token` field is never populated in the response.
1622 ///
1623 /// # Arguments
1624 ///
1625 /// * `name` - Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1626 pub fn apps_debug_tokens_get(&self, name: &str) -> ProjectAppDebugTokenGetCall<'a, C> {
1627 ProjectAppDebugTokenGetCall {
1628 hub: self.hub,
1629 _name: name.to_string(),
1630 _delegate: Default::default(),
1631 _additional_params: Default::default(),
1632 _scopes: Default::default(),
1633 }
1634 }
1635
1636 /// Create a builder to help you perform the following task:
1637 ///
1638 /// Lists all DebugTokens for the specified app. For security reasons, the `token` field is never populated in the response.
1639 ///
1640 /// # Arguments
1641 ///
1642 /// * `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} ```
1643 pub fn apps_debug_tokens_list(&self, parent: &str) -> ProjectAppDebugTokenListCall<'a, C> {
1644 ProjectAppDebugTokenListCall {
1645 hub: self.hub,
1646 _parent: parent.to_string(),
1647 _page_token: Default::default(),
1648 _page_size: Default::default(),
1649 _delegate: Default::default(),
1650 _additional_params: Default::default(),
1651 _scopes: Default::default(),
1652 }
1653 }
1654
1655 /// Create a builder to help you perform the following task:
1656 ///
1657 /// 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.
1658 ///
1659 /// # Arguments
1660 ///
1661 /// * `request` - No description provided.
1662 /// * `name` - Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
1663 pub fn apps_debug_tokens_patch(
1664 &self,
1665 request: GoogleFirebaseAppcheckV1betaDebugToken,
1666 name: &str,
1667 ) -> ProjectAppDebugTokenPatchCall<'a, C> {
1668 ProjectAppDebugTokenPatchCall {
1669 hub: self.hub,
1670 _request: request,
1671 _name: name.to_string(),
1672 _update_mask: Default::default(),
1673 _delegate: Default::default(),
1674 _additional_params: Default::default(),
1675 _scopes: Default::default(),
1676 }
1677 }
1678
1679 /// Create a builder to help you perform the following task:
1680 ///
1681 /// Atomically gets the DeviceCheckConfigs for the specified list of apps. For security reasons, the `private_key` field is never populated in the response.
1682 ///
1683 /// # Arguments
1684 ///
1685 /// * `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.
1686 pub fn apps_device_check_config_batch_get(
1687 &self,
1688 parent: &str,
1689 ) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
1690 ProjectAppDeviceCheckConfigBatchGetCall {
1691 hub: self.hub,
1692 _parent: parent.to_string(),
1693 _names: Default::default(),
1694 _delegate: Default::default(),
1695 _additional_params: Default::default(),
1696 _scopes: Default::default(),
1697 }
1698 }
1699
1700 /// Create a builder to help you perform the following task:
1701 ///
1702 /// Gets the DeviceCheckConfig for the specified app. For security reasons, the `private_key` field is never populated in the response.
1703 ///
1704 /// # Arguments
1705 ///
1706 /// * `name` - Required. The relative resource name of the DeviceCheckConfig, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
1707 pub fn apps_device_check_config_get(
1708 &self,
1709 name: &str,
1710 ) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
1711 ProjectAppDeviceCheckConfigGetCall {
1712 hub: self.hub,
1713 _name: name.to_string(),
1714 _delegate: Default::default(),
1715 _additional_params: Default::default(),
1716 _scopes: Default::default(),
1717 }
1718 }
1719
1720 /// Create a builder to help you perform the following task:
1721 ///
1722 /// 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.
1723 ///
1724 /// # Arguments
1725 ///
1726 /// * `request` - No description provided.
1727 /// * `name` - Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
1728 pub fn apps_device_check_config_patch(
1729 &self,
1730 request: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
1731 name: &str,
1732 ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
1733 ProjectAppDeviceCheckConfigPatchCall {
1734 hub: self.hub,
1735 _request: request,
1736 _name: name.to_string(),
1737 _update_mask: Default::default(),
1738 _delegate: Default::default(),
1739 _additional_params: Default::default(),
1740 _scopes: Default::default(),
1741 }
1742 }
1743
1744 /// Create a builder to help you perform the following task:
1745 ///
1746 /// Atomically gets the PlayIntegrityConfigs for the specified list of apps.
1747 ///
1748 /// # Arguments
1749 ///
1750 /// * `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.
1751 pub fn apps_play_integrity_config_batch_get(
1752 &self,
1753 parent: &str,
1754 ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
1755 ProjectAppPlayIntegrityConfigBatchGetCall {
1756 hub: self.hub,
1757 _parent: parent.to_string(),
1758 _names: Default::default(),
1759 _delegate: Default::default(),
1760 _additional_params: Default::default(),
1761 _scopes: Default::default(),
1762 }
1763 }
1764
1765 /// Create a builder to help you perform the following task:
1766 ///
1767 /// Gets the PlayIntegrityConfig for the specified app.
1768 ///
1769 /// # Arguments
1770 ///
1771 /// * `name` - Required. The relative resource name of the PlayIntegrityConfig, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
1772 pub fn apps_play_integrity_config_get(
1773 &self,
1774 name: &str,
1775 ) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
1776 ProjectAppPlayIntegrityConfigGetCall {
1777 hub: self.hub,
1778 _name: name.to_string(),
1779 _delegate: Default::default(),
1780 _additional_params: Default::default(),
1781 _scopes: Default::default(),
1782 }
1783 }
1784
1785 /// Create a builder to help you perform the following task:
1786 ///
1787 /// 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.
1788 ///
1789 /// # Arguments
1790 ///
1791 /// * `request` - No description provided.
1792 /// * `name` - Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
1793 pub fn apps_play_integrity_config_patch(
1794 &self,
1795 request: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
1796 name: &str,
1797 ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
1798 ProjectAppPlayIntegrityConfigPatchCall {
1799 hub: self.hub,
1800 _request: request,
1801 _name: name.to_string(),
1802 _update_mask: Default::default(),
1803 _delegate: Default::default(),
1804 _additional_params: Default::default(),
1805 _scopes: Default::default(),
1806 }
1807 }
1808
1809 /// Create a builder to help you perform the following task:
1810 ///
1811 /// Atomically gets the RecaptchaConfigs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
1812 ///
1813 /// # Arguments
1814 ///
1815 /// * `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.
1816 pub fn apps_recaptcha_config_batch_get(
1817 &self,
1818 parent: &str,
1819 ) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
1820 ProjectAppRecaptchaConfigBatchGetCall {
1821 hub: self.hub,
1822 _parent: parent.to_string(),
1823 _names: Default::default(),
1824 _delegate: Default::default(),
1825 _additional_params: Default::default(),
1826 _scopes: Default::default(),
1827 }
1828 }
1829
1830 /// Create a builder to help you perform the following task:
1831 ///
1832 /// Gets the RecaptchaConfig for the specified app. For security reasons, the `site_secret` field is never populated in the response.
1833 ///
1834 /// # Arguments
1835 ///
1836 /// * `name` - Required. The relative resource name of the RecaptchaConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1837 pub fn apps_recaptcha_config_get(&self, name: &str) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
1838 ProjectAppRecaptchaConfigGetCall {
1839 hub: self.hub,
1840 _name: name.to_string(),
1841 _delegate: Default::default(),
1842 _additional_params: Default::default(),
1843 _scopes: Default::default(),
1844 }
1845 }
1846
1847 /// Create a builder to help you perform the following task:
1848 ///
1849 /// 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.
1850 ///
1851 /// # Arguments
1852 ///
1853 /// * `request` - No description provided.
1854 /// * `name` - Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
1855 pub fn apps_recaptcha_config_patch(
1856 &self,
1857 request: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
1858 name: &str,
1859 ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
1860 ProjectAppRecaptchaConfigPatchCall {
1861 hub: self.hub,
1862 _request: request,
1863 _name: name.to_string(),
1864 _update_mask: Default::default(),
1865 _delegate: Default::default(),
1866 _additional_params: Default::default(),
1867 _scopes: Default::default(),
1868 }
1869 }
1870
1871 /// Create a builder to help you perform the following task:
1872 ///
1873 /// Atomically gets the RecaptchaEnterpriseConfigs for the specified list of apps.
1874 ///
1875 /// # Arguments
1876 ///
1877 /// * `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.
1878 pub fn apps_recaptcha_enterprise_config_batch_get(
1879 &self,
1880 parent: &str,
1881 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
1882 ProjectAppRecaptchaEnterpriseConfigBatchGetCall {
1883 hub: self.hub,
1884 _parent: parent.to_string(),
1885 _names: Default::default(),
1886 _delegate: Default::default(),
1887 _additional_params: Default::default(),
1888 _scopes: Default::default(),
1889 }
1890 }
1891
1892 /// Create a builder to help you perform the following task:
1893 ///
1894 /// Gets the RecaptchaEnterpriseConfig for the specified app.
1895 ///
1896 /// # Arguments
1897 ///
1898 /// * `name` - Required. The relative resource name of the RecaptchaEnterpriseConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
1899 pub fn apps_recaptcha_enterprise_config_get(
1900 &self,
1901 name: &str,
1902 ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
1903 ProjectAppRecaptchaEnterpriseConfigGetCall {
1904 hub: self.hub,
1905 _name: name.to_string(),
1906 _delegate: Default::default(),
1907 _additional_params: Default::default(),
1908 _scopes: Default::default(),
1909 }
1910 }
1911
1912 /// Create a builder to help you perform the following task:
1913 ///
1914 /// 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.
1915 ///
1916 /// # Arguments
1917 ///
1918 /// * `request` - No description provided.
1919 /// * `name` - Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
1920 pub fn apps_recaptcha_enterprise_config_patch(
1921 &self,
1922 request: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
1923 name: &str,
1924 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
1925 ProjectAppRecaptchaEnterpriseConfigPatchCall {
1926 hub: self.hub,
1927 _request: request,
1928 _name: name.to_string(),
1929 _update_mask: Default::default(),
1930 _delegate: Default::default(),
1931 _additional_params: Default::default(),
1932 _scopes: Default::default(),
1933 }
1934 }
1935
1936 /// Create a builder to help you perform the following task:
1937 ///
1938 /// Atomically gets the RecaptchaV3Configs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
1939 ///
1940 /// # Arguments
1941 ///
1942 /// * `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.
1943 pub fn apps_recaptcha_v3_config_batch_get(
1944 &self,
1945 parent: &str,
1946 ) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
1947 ProjectAppRecaptchaV3ConfigBatchGetCall {
1948 hub: self.hub,
1949 _parent: parent.to_string(),
1950 _names: Default::default(),
1951 _delegate: Default::default(),
1952 _additional_params: Default::default(),
1953 _scopes: Default::default(),
1954 }
1955 }
1956
1957 /// Create a builder to help you perform the following task:
1958 ///
1959 /// Gets the RecaptchaV3Config for the specified app. For security reasons, the `site_secret` field is never populated in the response.
1960 ///
1961 /// # Arguments
1962 ///
1963 /// * `name` - Required. The relative resource name of the RecaptchaV3Config, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
1964 pub fn apps_recaptcha_v3_config_get(
1965 &self,
1966 name: &str,
1967 ) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
1968 ProjectAppRecaptchaV3ConfigGetCall {
1969 hub: self.hub,
1970 _name: name.to_string(),
1971 _delegate: Default::default(),
1972 _additional_params: Default::default(),
1973 _scopes: Default::default(),
1974 }
1975 }
1976
1977 /// Create a builder to help you perform the following task:
1978 ///
1979 /// 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.
1980 ///
1981 /// # Arguments
1982 ///
1983 /// * `request` - No description provided.
1984 /// * `name` - Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
1985 pub fn apps_recaptcha_v3_config_patch(
1986 &self,
1987 request: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
1988 name: &str,
1989 ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
1990 ProjectAppRecaptchaV3ConfigPatchCall {
1991 hub: self.hub,
1992 _request: request,
1993 _name: name.to_string(),
1994 _update_mask: Default::default(),
1995 _delegate: Default::default(),
1996 _additional_params: Default::default(),
1997 _scopes: Default::default(),
1998 }
1999 }
2000
2001 /// Create a builder to help you perform the following task:
2002 ///
2003 /// Atomically gets the SafetyNetConfigs for the specified list of apps.
2004 ///
2005 /// # Arguments
2006 ///
2007 /// * `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.
2008 pub fn apps_safety_net_config_batch_get(
2009 &self,
2010 parent: &str,
2011 ) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
2012 ProjectAppSafetyNetConfigBatchGetCall {
2013 hub: self.hub,
2014 _parent: parent.to_string(),
2015 _names: Default::default(),
2016 _delegate: Default::default(),
2017 _additional_params: Default::default(),
2018 _scopes: Default::default(),
2019 }
2020 }
2021
2022 /// Create a builder to help you perform the following task:
2023 ///
2024 /// Gets the SafetyNetConfig for the specified app.
2025 ///
2026 /// # Arguments
2027 ///
2028 /// * `name` - Required. The relative resource name of the SafetyNetConfig, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
2029 pub fn apps_safety_net_config_get(
2030 &self,
2031 name: &str,
2032 ) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
2033 ProjectAppSafetyNetConfigGetCall {
2034 hub: self.hub,
2035 _name: name.to_string(),
2036 _delegate: Default::default(),
2037 _additional_params: Default::default(),
2038 _scopes: Default::default(),
2039 }
2040 }
2041
2042 /// Create a builder to help you perform the following task:
2043 ///
2044 /// 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.
2045 ///
2046 /// # Arguments
2047 ///
2048 /// * `request` - No description provided.
2049 /// * `name` - Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
2050 pub fn apps_safety_net_config_patch(
2051 &self,
2052 request: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
2053 name: &str,
2054 ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
2055 ProjectAppSafetyNetConfigPatchCall {
2056 hub: self.hub,
2057 _request: request,
2058 _name: name.to_string(),
2059 _update_mask: Default::default(),
2060 _delegate: Default::default(),
2061 _additional_params: Default::default(),
2062 _scopes: Default::default(),
2063 }
2064 }
2065
2066 /// Create a builder to help you perform the following task:
2067 ///
2068 /// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
2069 ///
2070 /// # Arguments
2071 ///
2072 /// * `request` - No description provided.
2073 /// * `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.
2074 pub fn apps_exchange_app_attest_assertion(
2075 &self,
2076 request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
2077 app: &str,
2078 ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
2079 ProjectAppExchangeAppAttestAssertionCall {
2080 hub: self.hub,
2081 _request: request,
2082 _app: app.to_string(),
2083 _delegate: Default::default(),
2084 _additional_params: Default::default(),
2085 _scopes: Default::default(),
2086 }
2087 }
2088
2089 /// Create a builder to help you perform the following task:
2090 ///
2091 /// 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).
2092 ///
2093 /// # Arguments
2094 ///
2095 /// * `request` - No description provided.
2096 /// * `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.
2097 pub fn apps_exchange_app_attest_attestation(
2098 &self,
2099 request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
2100 app: &str,
2101 ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
2102 ProjectAppExchangeAppAttestAttestationCall {
2103 hub: self.hub,
2104 _request: request,
2105 _app: app.to_string(),
2106 _delegate: Default::default(),
2107 _additional_params: Default::default(),
2108 _scopes: Default::default(),
2109 }
2110 }
2111
2112 /// Create a builder to help you perform the following task:
2113 ///
2114 /// Validates a custom token signed using your project's Admin SDK service account credentials. If valid, returns an AppCheckToken.
2115 ///
2116 /// # Arguments
2117 ///
2118 /// * `request` - No description provided.
2119 /// * `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.
2120 pub fn apps_exchange_custom_token(
2121 &self,
2122 request: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
2123 app: &str,
2124 ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
2125 ProjectAppExchangeCustomTokenCall {
2126 hub: self.hub,
2127 _request: request,
2128 _app: app.to_string(),
2129 _delegate: Default::default(),
2130 _additional_params: Default::default(),
2131 _scopes: Default::default(),
2132 }
2133 }
2134
2135 /// Create a builder to help you perform the following task:
2136 ///
2137 /// 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.
2138 ///
2139 /// # Arguments
2140 ///
2141 /// * `request` - No description provided.
2142 /// * `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.
2143 pub fn apps_exchange_debug_token(
2144 &self,
2145 request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
2146 app: &str,
2147 ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
2148 ProjectAppExchangeDebugTokenCall {
2149 hub: self.hub,
2150 _request: request,
2151 _app: app.to_string(),
2152 _delegate: Default::default(),
2153 _additional_params: Default::default(),
2154 _scopes: Default::default(),
2155 }
2156 }
2157
2158 /// Create a builder to help you perform the following task:
2159 ///
2160 /// 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.
2161 ///
2162 /// # Arguments
2163 ///
2164 /// * `request` - No description provided.
2165 /// * `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.
2166 pub fn apps_exchange_device_check_token(
2167 &self,
2168 request: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
2169 app: &str,
2170 ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
2171 ProjectAppExchangeDeviceCheckTokenCall {
2172 hub: self.hub,
2173 _request: request,
2174 _app: app.to_string(),
2175 _delegate: Default::default(),
2176 _additional_params: Default::default(),
2177 _scopes: Default::default(),
2178 }
2179 }
2180
2181 /// Create a builder to help you perform the following task:
2182 ///
2183 /// Validates an [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify). If valid, returns an AppCheckToken.
2184 ///
2185 /// # Arguments
2186 ///
2187 /// * `request` - No description provided.
2188 /// * `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.
2189 pub fn apps_exchange_play_integrity_token(
2190 &self,
2191 request: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
2192 app: &str,
2193 ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
2194 ProjectAppExchangePlayIntegrityTokenCall {
2195 hub: self.hub,
2196 _request: request,
2197 _app: app.to_string(),
2198 _delegate: Default::default(),
2199 _additional_params: Default::default(),
2200 _scopes: Default::default(),
2201 }
2202 }
2203
2204 /// Create a builder to help you perform the following task:
2205 ///
2206 /// 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.
2207 ///
2208 /// # Arguments
2209 ///
2210 /// * `request` - No description provided.
2211 /// * `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.
2212 pub fn apps_exchange_recaptcha_enterprise_token(
2213 &self,
2214 request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
2215 app: &str,
2216 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
2217 ProjectAppExchangeRecaptchaEnterpriseTokenCall {
2218 hub: self.hub,
2219 _request: request,
2220 _app: app.to_string(),
2221 _delegate: Default::default(),
2222 _additional_params: Default::default(),
2223 _scopes: Default::default(),
2224 }
2225 }
2226
2227 /// Create a builder to help you perform the following task:
2228 ///
2229 /// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
2230 ///
2231 /// # Arguments
2232 ///
2233 /// * `request` - No description provided.
2234 /// * `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.
2235 pub fn apps_exchange_recaptcha_token(
2236 &self,
2237 request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
2238 app: &str,
2239 ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
2240 ProjectAppExchangeRecaptchaTokenCall {
2241 hub: self.hub,
2242 _request: request,
2243 _app: app.to_string(),
2244 _delegate: Default::default(),
2245 _additional_params: Default::default(),
2246 _scopes: Default::default(),
2247 }
2248 }
2249
2250 /// Create a builder to help you perform the following task:
2251 ///
2252 /// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
2253 ///
2254 /// # Arguments
2255 ///
2256 /// * `request` - No description provided.
2257 /// * `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.
2258 pub fn apps_exchange_recaptcha_v3_token(
2259 &self,
2260 request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
2261 app: &str,
2262 ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
2263 ProjectAppExchangeRecaptchaV3TokenCall {
2264 hub: self.hub,
2265 _request: request,
2266 _app: app.to_string(),
2267 _delegate: Default::default(),
2268 _additional_params: Default::default(),
2269 _scopes: Default::default(),
2270 }
2271 }
2272
2273 /// Create a builder to help you perform the following task:
2274 ///
2275 /// Validates a [SafetyNet token](https://developer.android.com/training/safetynet/attestation#request-attestation-step). If valid, returns an AppCheckToken.
2276 ///
2277 /// # Arguments
2278 ///
2279 /// * `request` - No description provided.
2280 /// * `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.
2281 pub fn apps_exchange_safety_net_token(
2282 &self,
2283 request: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
2284 app: &str,
2285 ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
2286 ProjectAppExchangeSafetyNetTokenCall {
2287 hub: self.hub,
2288 _request: request,
2289 _app: app.to_string(),
2290 _delegate: Default::default(),
2291 _additional_params: Default::default(),
2292 _scopes: Default::default(),
2293 }
2294 }
2295
2296 /// Create a builder to help you perform the following task:
2297 ///
2298 /// 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.
2299 ///
2300 /// # Arguments
2301 ///
2302 /// * `request` - No description provided.
2303 /// * `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.
2304 pub fn apps_generate_app_attest_challenge(
2305 &self,
2306 request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
2307 app: &str,
2308 ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
2309 ProjectAppGenerateAppAttestChallengeCall {
2310 hub: self.hub,
2311 _request: request,
2312 _app: app.to_string(),
2313 _delegate: Default::default(),
2314 _additional_params: Default::default(),
2315 _scopes: Default::default(),
2316 }
2317 }
2318
2319 /// Create a builder to help you perform the following task:
2320 ///
2321 /// 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.
2322 ///
2323 /// # Arguments
2324 ///
2325 /// * `request` - No description provided.
2326 /// * `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.
2327 pub fn apps_generate_play_integrity_challenge(
2328 &self,
2329 request: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
2330 app: &str,
2331 ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
2332 ProjectAppGeneratePlayIntegrityChallengeCall {
2333 hub: self.hub,
2334 _request: request,
2335 _app: app.to_string(),
2336 _delegate: Default::default(),
2337 _additional_params: Default::default(),
2338 _scopes: Default::default(),
2339 }
2340 }
2341
2342 /// Create a builder to help you perform the following task:
2343 ///
2344 /// Atomically updates the specified ResourcePolicy configurations.
2345 ///
2346 /// # Arguments
2347 ///
2348 /// * `request` - No description provided.
2349 /// * `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.
2350 pub fn services_resource_policies_batch_update(
2351 &self,
2352 request: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
2353 parent: &str,
2354 ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
2355 ProjectServiceResourcePolicyBatchUpdateCall {
2356 hub: self.hub,
2357 _request: request,
2358 _parent: parent.to_string(),
2359 _delegate: Default::default(),
2360 _additional_params: Default::default(),
2361 _scopes: Default::default(),
2362 }
2363 }
2364
2365 /// Create a builder to help you perform the following task:
2366 ///
2367 /// Creates the specified ResourcePolicy configuration.
2368 ///
2369 /// # Arguments
2370 ///
2371 /// * `request` - No description provided.
2372 /// * `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)
2373 pub fn services_resource_policies_create(
2374 &self,
2375 request: GoogleFirebaseAppcheckV1betaResourcePolicy,
2376 parent: &str,
2377 ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
2378 ProjectServiceResourcePolicyCreateCall {
2379 hub: self.hub,
2380 _request: request,
2381 _parent: parent.to_string(),
2382 _delegate: Default::default(),
2383 _additional_params: Default::default(),
2384 _scopes: Default::default(),
2385 }
2386 }
2387
2388 /// Create a builder to help you perform the following task:
2389 ///
2390 /// Deletes the specified ResourcePolicy configuration.
2391 ///
2392 /// # Arguments
2393 ///
2394 /// * `name` - Required. The relative resource name of the ResourcePolicy to delete, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ```
2395 pub fn services_resource_policies_delete(
2396 &self,
2397 name: &str,
2398 ) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
2399 ProjectServiceResourcePolicyDeleteCall {
2400 hub: self.hub,
2401 _name: name.to_string(),
2402 _etag: Default::default(),
2403 _delegate: Default::default(),
2404 _additional_params: Default::default(),
2405 _scopes: Default::default(),
2406 }
2407 }
2408
2409 /// Create a builder to help you perform the following task:
2410 ///
2411 /// Gets the requested ResourcePolicy configuration.
2412 ///
2413 /// # Arguments
2414 ///
2415 /// * `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)
2416 pub fn services_resource_policies_get(
2417 &self,
2418 name: &str,
2419 ) -> ProjectServiceResourcePolicyGetCall<'a, C> {
2420 ProjectServiceResourcePolicyGetCall {
2421 hub: self.hub,
2422 _name: name.to_string(),
2423 _delegate: Default::default(),
2424 _additional_params: Default::default(),
2425 _scopes: Default::default(),
2426 }
2427 }
2428
2429 /// Create a builder to help you perform the following task:
2430 ///
2431 /// Lists all ResourcePolicy configurations for the specified project and service.
2432 ///
2433 /// # Arguments
2434 ///
2435 /// * `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)
2436 pub fn services_resource_policies_list(
2437 &self,
2438 parent: &str,
2439 ) -> ProjectServiceResourcePolicyListCall<'a, C> {
2440 ProjectServiceResourcePolicyListCall {
2441 hub: self.hub,
2442 _parent: parent.to_string(),
2443 _page_token: Default::default(),
2444 _page_size: Default::default(),
2445 _filter: Default::default(),
2446 _delegate: Default::default(),
2447 _additional_params: Default::default(),
2448 _scopes: Default::default(),
2449 }
2450 }
2451
2452 /// Create a builder to help you perform the following task:
2453 ///
2454 /// Updates the specified ResourcePolicy configuration.
2455 ///
2456 /// # Arguments
2457 ///
2458 /// * `request` - No description provided.
2459 /// * `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.
2460 pub fn services_resource_policies_patch(
2461 &self,
2462 request: GoogleFirebaseAppcheckV1betaResourcePolicy,
2463 name: &str,
2464 ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
2465 ProjectServiceResourcePolicyPatchCall {
2466 hub: self.hub,
2467 _request: request,
2468 _name: name.to_string(),
2469 _update_mask: Default::default(),
2470 _delegate: Default::default(),
2471 _additional_params: Default::default(),
2472 _scopes: Default::default(),
2473 }
2474 }
2475
2476 /// Create a builder to help you perform the following task:
2477 ///
2478 /// Atomically updates the specified Service configurations.
2479 ///
2480 /// # Arguments
2481 ///
2482 /// * `request` - No description provided.
2483 /// * `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.
2484 pub fn services_batch_update(
2485 &self,
2486 request: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
2487 parent: &str,
2488 ) -> ProjectServiceBatchUpdateCall<'a, C> {
2489 ProjectServiceBatchUpdateCall {
2490 hub: self.hub,
2491 _request: request,
2492 _parent: parent.to_string(),
2493 _delegate: Default::default(),
2494 _additional_params: Default::default(),
2495 _scopes: Default::default(),
2496 }
2497 }
2498
2499 /// Create a builder to help you perform the following task:
2500 ///
2501 /// Gets the Service configuration for the specified service name.
2502 ///
2503 /// # Arguments
2504 ///
2505 /// * `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)
2506 pub fn services_get(&self, name: &str) -> ProjectServiceGetCall<'a, C> {
2507 ProjectServiceGetCall {
2508 hub: self.hub,
2509 _name: name.to_string(),
2510 _delegate: Default::default(),
2511 _additional_params: Default::default(),
2512 _scopes: Default::default(),
2513 }
2514 }
2515
2516 /// Create a builder to help you perform the following task:
2517 ///
2518 /// Lists all Service configurations for the specified project. Only Services which were explicitly configured using UpdateService or BatchUpdateServices will be returned.
2519 ///
2520 /// # Arguments
2521 ///
2522 /// * `parent` - Required. The relative resource name of the parent project for which to list each associated Service, in the format: ``` projects/{project_number} ```
2523 pub fn services_list(&self, parent: &str) -> ProjectServiceListCall<'a, C> {
2524 ProjectServiceListCall {
2525 hub: self.hub,
2526 _parent: parent.to_string(),
2527 _page_token: Default::default(),
2528 _page_size: Default::default(),
2529 _delegate: Default::default(),
2530 _additional_params: Default::default(),
2531 _scopes: Default::default(),
2532 }
2533 }
2534
2535 /// Create a builder to help you perform the following task:
2536 ///
2537 /// Updates the specified Service configuration.
2538 ///
2539 /// # Arguments
2540 ///
2541 /// * `request` - No description provided.
2542 /// * `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)
2543 pub fn services_patch(
2544 &self,
2545 request: GoogleFirebaseAppcheckV1betaService,
2546 name: &str,
2547 ) -> ProjectServicePatchCall<'a, C> {
2548 ProjectServicePatchCall {
2549 hub: self.hub,
2550 _request: request,
2551 _name: name.to_string(),
2552 _update_mask: Default::default(),
2553 _delegate: Default::default(),
2554 _additional_params: Default::default(),
2555 _scopes: Default::default(),
2556 }
2557 }
2558
2559 /// Create a builder to help you perform the following task:
2560 ///
2561 /// 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).
2562 ///
2563 /// # Arguments
2564 ///
2565 /// * `request` - No description provided.
2566 /// * `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.
2567 pub fn verify_app_check_token(
2568 &self,
2569 request: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
2570 project: &str,
2571 ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
2572 ProjectVerifyAppCheckTokenCall {
2573 hub: self.hub,
2574 _request: request,
2575 _project: project.to_string(),
2576 _delegate: Default::default(),
2577 _additional_params: Default::default(),
2578 _scopes: Default::default(),
2579 }
2580 }
2581}
2582
2583// ###################
2584// CallBuilders ###
2585// #################
2586
2587/// 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.
2588///
2589/// A builder for the *get* method supported by a *jwk* resource.
2590/// It is not used directly, but through a [`JwkMethods`] instance.
2591///
2592/// # Example
2593///
2594/// Instantiate a resource method builder
2595///
2596/// ```test_harness,no_run
2597/// # extern crate hyper;
2598/// # extern crate hyper_rustls;
2599/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
2600/// # async fn dox() {
2601/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2602///
2603/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2604/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2605/// # secret,
2606/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2607/// # ).build().await.unwrap();
2608///
2609/// # let client = hyper_util::client::legacy::Client::builder(
2610/// # hyper_util::rt::TokioExecutor::new()
2611/// # )
2612/// # .build(
2613/// # hyper_rustls::HttpsConnectorBuilder::new()
2614/// # .with_native_roots()
2615/// # .unwrap()
2616/// # .https_or_http()
2617/// # .enable_http1()
2618/// # .build()
2619/// # );
2620/// # let mut hub = Firebaseappcheck::new(client, auth);
2621/// // You can configure optional parameters by calling the respective setters at will, and
2622/// // execute the final call using `doit()`.
2623/// // Values shown here are possibly random and not representative !
2624/// let result = hub.jwks().get("name")
2625/// .doit().await;
2626/// # }
2627/// ```
2628pub struct JwkGetCall<'a, C>
2629where
2630 C: 'a,
2631{
2632 hub: &'a Firebaseappcheck<C>,
2633 _name: String,
2634 _delegate: Option<&'a mut dyn common::Delegate>,
2635 _additional_params: HashMap<String, String>,
2636 _scopes: BTreeSet<String>,
2637}
2638
2639impl<'a, C> common::CallBuilder for JwkGetCall<'a, C> {}
2640
2641impl<'a, C> JwkGetCall<'a, C>
2642where
2643 C: common::Connector,
2644{
2645 /// Perform the operation you have build so far.
2646 pub async fn doit(
2647 mut self,
2648 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaPublicJwkSet)> {
2649 use std::borrow::Cow;
2650 use std::io::{Read, Seek};
2651
2652 use common::{url::Params, ToParts};
2653 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2654
2655 let mut dd = common::DefaultDelegate;
2656 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2657 dlg.begin(common::MethodInfo {
2658 id: "firebaseappcheck.jwks.get",
2659 http_method: hyper::Method::GET,
2660 });
2661
2662 for &field in ["alt", "name"].iter() {
2663 if self._additional_params.contains_key(field) {
2664 dlg.finished(false);
2665 return Err(common::Error::FieldClash(field));
2666 }
2667 }
2668
2669 let mut params = Params::with_capacity(3 + self._additional_params.len());
2670 params.push("name", self._name);
2671
2672 params.extend(self._additional_params.iter());
2673
2674 params.push("alt", "json");
2675 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
2676 if self._scopes.is_empty() {
2677 self._scopes
2678 .insert(Scope::CloudPlatform.as_ref().to_string());
2679 }
2680
2681 #[allow(clippy::single_element_loop)]
2682 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2683 url = params.uri_replacement(url, param_name, find_this, true);
2684 }
2685 {
2686 let to_remove = ["name"];
2687 params.remove_params(&to_remove);
2688 }
2689
2690 let url = params.parse_with_url(&url);
2691
2692 loop {
2693 let token = match self
2694 .hub
2695 .auth
2696 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2697 .await
2698 {
2699 Ok(token) => token,
2700 Err(e) => match dlg.token(e) {
2701 Ok(token) => token,
2702 Err(e) => {
2703 dlg.finished(false);
2704 return Err(common::Error::MissingToken(e));
2705 }
2706 },
2707 };
2708 let mut req_result = {
2709 let client = &self.hub.client;
2710 dlg.pre_request();
2711 let mut req_builder = hyper::Request::builder()
2712 .method(hyper::Method::GET)
2713 .uri(url.as_str())
2714 .header(USER_AGENT, self.hub._user_agent.clone());
2715
2716 if let Some(token) = token.as_ref() {
2717 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2718 }
2719
2720 let request = req_builder
2721 .header(CONTENT_LENGTH, 0_u64)
2722 .body(common::to_body::<String>(None));
2723
2724 client.request(request.unwrap()).await
2725 };
2726
2727 match req_result {
2728 Err(err) => {
2729 if let common::Retry::After(d) = dlg.http_error(&err) {
2730 sleep(d).await;
2731 continue;
2732 }
2733 dlg.finished(false);
2734 return Err(common::Error::HttpError(err));
2735 }
2736 Ok(res) => {
2737 let (mut parts, body) = res.into_parts();
2738 let mut body = common::Body::new(body);
2739 if !parts.status.is_success() {
2740 let bytes = common::to_bytes(body).await.unwrap_or_default();
2741 let error = serde_json::from_str(&common::to_string(&bytes));
2742 let response = common::to_response(parts, bytes.into());
2743
2744 if let common::Retry::After(d) =
2745 dlg.http_failure(&response, error.as_ref().ok())
2746 {
2747 sleep(d).await;
2748 continue;
2749 }
2750
2751 dlg.finished(false);
2752
2753 return Err(match error {
2754 Ok(value) => common::Error::BadRequest(value),
2755 _ => common::Error::Failure(response),
2756 });
2757 }
2758 let response = {
2759 let bytes = common::to_bytes(body).await.unwrap_or_default();
2760 let encoded = common::to_string(&bytes);
2761 match serde_json::from_str(&encoded) {
2762 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2763 Err(error) => {
2764 dlg.response_json_decode_error(&encoded, &error);
2765 return Err(common::Error::JsonDecodeError(
2766 encoded.to_string(),
2767 error,
2768 ));
2769 }
2770 }
2771 };
2772
2773 dlg.finished(true);
2774 return Ok(response);
2775 }
2776 }
2777 }
2778 }
2779
2780 /// Required. The relative resource name to the public JWK set. Must always be exactly the string `jwks`.
2781 ///
2782 /// Sets the *name* path property to the given value.
2783 ///
2784 /// Even though the property as already been set when instantiating this call,
2785 /// we provide this method for API completeness.
2786 pub fn name(mut self, new_value: &str) -> JwkGetCall<'a, C> {
2787 self._name = new_value.to_string();
2788 self
2789 }
2790 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2791 /// while executing the actual API request.
2792 ///
2793 /// ````text
2794 /// It should be used to handle progress information, and to implement a certain level of resilience.
2795 /// ````
2796 ///
2797 /// Sets the *delegate* property to the given value.
2798 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JwkGetCall<'a, C> {
2799 self._delegate = Some(new_value);
2800 self
2801 }
2802
2803 /// Set any additional parameter of the query string used in the request.
2804 /// It should be used to set parameters which are not yet available through their own
2805 /// setters.
2806 ///
2807 /// Please note that this method must not be used to set any of the known parameters
2808 /// which have their own setter method. If done anyway, the request will fail.
2809 ///
2810 /// # Additional Parameters
2811 ///
2812 /// * *$.xgafv* (query-string) - V1 error format.
2813 /// * *access_token* (query-string) - OAuth access token.
2814 /// * *alt* (query-string) - Data format for response.
2815 /// * *callback* (query-string) - JSONP
2816 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2817 /// * *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.
2818 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2819 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2820 /// * *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.
2821 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2822 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2823 pub fn param<T>(mut self, name: T, value: T) -> JwkGetCall<'a, C>
2824 where
2825 T: AsRef<str>,
2826 {
2827 self._additional_params
2828 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2829 self
2830 }
2831
2832 /// Identifies the authorization scope for the method you are building.
2833 ///
2834 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2835 /// [`Scope::CloudPlatform`].
2836 ///
2837 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2838 /// tokens for more than one scope.
2839 ///
2840 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2841 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2842 /// sufficient, a read-write scope will do as well.
2843 pub fn add_scope<St>(mut self, scope: St) -> JwkGetCall<'a, C>
2844 where
2845 St: AsRef<str>,
2846 {
2847 self._scopes.insert(String::from(scope.as_ref()));
2848 self
2849 }
2850 /// Identifies the authorization scope(s) for the method you are building.
2851 ///
2852 /// See [`Self::add_scope()`] for details.
2853 pub fn add_scopes<I, St>(mut self, scopes: I) -> JwkGetCall<'a, C>
2854 where
2855 I: IntoIterator<Item = St>,
2856 St: AsRef<str>,
2857 {
2858 self._scopes
2859 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2860 self
2861 }
2862
2863 /// Removes all scopes, and no default scope will be used either.
2864 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2865 /// for details).
2866 pub fn clear_scopes(mut self) -> JwkGetCall<'a, C> {
2867 self._scopes.clear();
2868 self
2869 }
2870}
2871
2872/// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
2873///
2874/// A builder for the *exchangeAppAttestAssertion* method supported by a *oauthClient* resource.
2875/// It is not used directly, but through a [`OauthClientMethods`] instance.
2876///
2877/// # Example
2878///
2879/// Instantiate a resource method builder
2880///
2881/// ```test_harness,no_run
2882/// # extern crate hyper;
2883/// # extern crate hyper_rustls;
2884/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
2885/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
2886/// # async fn dox() {
2887/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2888///
2889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2891/// # secret,
2892/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2893/// # ).build().await.unwrap();
2894///
2895/// # let client = hyper_util::client::legacy::Client::builder(
2896/// # hyper_util::rt::TokioExecutor::new()
2897/// # )
2898/// # .build(
2899/// # hyper_rustls::HttpsConnectorBuilder::new()
2900/// # .with_native_roots()
2901/// # .unwrap()
2902/// # .https_or_http()
2903/// # .enable_http1()
2904/// # .build()
2905/// # );
2906/// # let mut hub = Firebaseappcheck::new(client, auth);
2907/// // As the method needs a request, you would usually fill it with the desired information
2908/// // into the respective structure. Some of the parts shown here might not be applicable !
2909/// // Values shown here are possibly random and not representative !
2910/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
2911///
2912/// // You can configure optional parameters by calling the respective setters at will, and
2913/// // execute the final call using `doit()`.
2914/// // Values shown here are possibly random and not representative !
2915/// let result = hub.oauth_clients().exchange_app_attest_assertion(req, "app")
2916/// .doit().await;
2917/// # }
2918/// ```
2919pub struct OauthClientExchangeAppAttestAssertionCall<'a, C>
2920where
2921 C: 'a,
2922{
2923 hub: &'a Firebaseappcheck<C>,
2924 _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
2925 _app: String,
2926 _delegate: Option<&'a mut dyn common::Delegate>,
2927 _additional_params: HashMap<String, String>,
2928 _scopes: BTreeSet<String>,
2929}
2930
2931impl<'a, C> common::CallBuilder for OauthClientExchangeAppAttestAssertionCall<'a, C> {}
2932
2933impl<'a, C> OauthClientExchangeAppAttestAssertionCall<'a, C>
2934where
2935 C: common::Connector,
2936{
2937 /// Perform the operation you have build so far.
2938 pub async fn doit(
2939 mut self,
2940 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
2941 use std::borrow::Cow;
2942 use std::io::{Read, Seek};
2943
2944 use common::{url::Params, ToParts};
2945 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2946
2947 let mut dd = common::DefaultDelegate;
2948 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2949 dlg.begin(common::MethodInfo {
2950 id: "firebaseappcheck.oauthClients.exchangeAppAttestAssertion",
2951 http_method: hyper::Method::POST,
2952 });
2953
2954 for &field in ["alt", "app"].iter() {
2955 if self._additional_params.contains_key(field) {
2956 dlg.finished(false);
2957 return Err(common::Error::FieldClash(field));
2958 }
2959 }
2960
2961 let mut params = Params::with_capacity(4 + self._additional_params.len());
2962 params.push("app", self._app);
2963
2964 params.extend(self._additional_params.iter());
2965
2966 params.push("alt", "json");
2967 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAssertion";
2968 if self._scopes.is_empty() {
2969 self._scopes
2970 .insert(Scope::CloudPlatform.as_ref().to_string());
2971 }
2972
2973 #[allow(clippy::single_element_loop)]
2974 for &(find_this, param_name) in [("{+app}", "app")].iter() {
2975 url = params.uri_replacement(url, param_name, find_this, true);
2976 }
2977 {
2978 let to_remove = ["app"];
2979 params.remove_params(&to_remove);
2980 }
2981
2982 let url = params.parse_with_url(&url);
2983
2984 let mut json_mime_type = mime::APPLICATION_JSON;
2985 let mut request_value_reader = {
2986 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2987 common::remove_json_null_values(&mut value);
2988 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2989 serde_json::to_writer(&mut dst, &value).unwrap();
2990 dst
2991 };
2992 let request_size = request_value_reader
2993 .seek(std::io::SeekFrom::End(0))
2994 .unwrap();
2995 request_value_reader
2996 .seek(std::io::SeekFrom::Start(0))
2997 .unwrap();
2998
2999 loop {
3000 let token = match self
3001 .hub
3002 .auth
3003 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3004 .await
3005 {
3006 Ok(token) => token,
3007 Err(e) => match dlg.token(e) {
3008 Ok(token) => token,
3009 Err(e) => {
3010 dlg.finished(false);
3011 return Err(common::Error::MissingToken(e));
3012 }
3013 },
3014 };
3015 request_value_reader
3016 .seek(std::io::SeekFrom::Start(0))
3017 .unwrap();
3018 let mut req_result = {
3019 let client = &self.hub.client;
3020 dlg.pre_request();
3021 let mut req_builder = hyper::Request::builder()
3022 .method(hyper::Method::POST)
3023 .uri(url.as_str())
3024 .header(USER_AGENT, self.hub._user_agent.clone());
3025
3026 if let Some(token) = token.as_ref() {
3027 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3028 }
3029
3030 let request = req_builder
3031 .header(CONTENT_TYPE, json_mime_type.to_string())
3032 .header(CONTENT_LENGTH, request_size as u64)
3033 .body(common::to_body(
3034 request_value_reader.get_ref().clone().into(),
3035 ));
3036
3037 client.request(request.unwrap()).await
3038 };
3039
3040 match req_result {
3041 Err(err) => {
3042 if let common::Retry::After(d) = dlg.http_error(&err) {
3043 sleep(d).await;
3044 continue;
3045 }
3046 dlg.finished(false);
3047 return Err(common::Error::HttpError(err));
3048 }
3049 Ok(res) => {
3050 let (mut parts, body) = res.into_parts();
3051 let mut body = common::Body::new(body);
3052 if !parts.status.is_success() {
3053 let bytes = common::to_bytes(body).await.unwrap_or_default();
3054 let error = serde_json::from_str(&common::to_string(&bytes));
3055 let response = common::to_response(parts, bytes.into());
3056
3057 if let common::Retry::After(d) =
3058 dlg.http_failure(&response, error.as_ref().ok())
3059 {
3060 sleep(d).await;
3061 continue;
3062 }
3063
3064 dlg.finished(false);
3065
3066 return Err(match error {
3067 Ok(value) => common::Error::BadRequest(value),
3068 _ => common::Error::Failure(response),
3069 });
3070 }
3071 let response = {
3072 let bytes = common::to_bytes(body).await.unwrap_or_default();
3073 let encoded = common::to_string(&bytes);
3074 match serde_json::from_str(&encoded) {
3075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3076 Err(error) => {
3077 dlg.response_json_decode_error(&encoded, &error);
3078 return Err(common::Error::JsonDecodeError(
3079 encoded.to_string(),
3080 error,
3081 ));
3082 }
3083 }
3084 };
3085
3086 dlg.finished(true);
3087 return Ok(response);
3088 }
3089 }
3090 }
3091 }
3092
3093 ///
3094 /// Sets the *request* property to the given value.
3095 ///
3096 /// Even though the property as already been set when instantiating this call,
3097 /// we provide this method for API completeness.
3098 pub fn request(
3099 mut self,
3100 new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
3101 ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3102 self._request = new_value;
3103 self
3104 }
3105 /// 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.
3106 ///
3107 /// Sets the *app* path property to the given value.
3108 ///
3109 /// Even though the property as already been set when instantiating this call,
3110 /// we provide this method for API completeness.
3111 pub fn app(mut self, new_value: &str) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3112 self._app = new_value.to_string();
3113 self
3114 }
3115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3116 /// while executing the actual API request.
3117 ///
3118 /// ````text
3119 /// It should be used to handle progress information, and to implement a certain level of resilience.
3120 /// ````
3121 ///
3122 /// Sets the *delegate* property to the given value.
3123 pub fn delegate(
3124 mut self,
3125 new_value: &'a mut dyn common::Delegate,
3126 ) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3127 self._delegate = Some(new_value);
3128 self
3129 }
3130
3131 /// Set any additional parameter of the query string used in the request.
3132 /// It should be used to set parameters which are not yet available through their own
3133 /// setters.
3134 ///
3135 /// Please note that this method must not be used to set any of the known parameters
3136 /// which have their own setter method. If done anyway, the request will fail.
3137 ///
3138 /// # Additional Parameters
3139 ///
3140 /// * *$.xgafv* (query-string) - V1 error format.
3141 /// * *access_token* (query-string) - OAuth access token.
3142 /// * *alt* (query-string) - Data format for response.
3143 /// * *callback* (query-string) - JSONP
3144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3145 /// * *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.
3146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3148 /// * *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.
3149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3151 pub fn param<T>(mut self, name: T, value: T) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3152 where
3153 T: AsRef<str>,
3154 {
3155 self._additional_params
3156 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3157 self
3158 }
3159
3160 /// Identifies the authorization scope for the method you are building.
3161 ///
3162 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3163 /// [`Scope::CloudPlatform`].
3164 ///
3165 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3166 /// tokens for more than one scope.
3167 ///
3168 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3169 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3170 /// sufficient, a read-write scope will do as well.
3171 pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3172 where
3173 St: AsRef<str>,
3174 {
3175 self._scopes.insert(String::from(scope.as_ref()));
3176 self
3177 }
3178 /// Identifies the authorization scope(s) for the method you are building.
3179 ///
3180 /// See [`Self::add_scope()`] for details.
3181 pub fn add_scopes<I, St>(
3182 mut self,
3183 scopes: I,
3184 ) -> OauthClientExchangeAppAttestAssertionCall<'a, C>
3185 where
3186 I: IntoIterator<Item = St>,
3187 St: AsRef<str>,
3188 {
3189 self._scopes
3190 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3191 self
3192 }
3193
3194 /// Removes all scopes, and no default scope will be used either.
3195 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3196 /// for details).
3197 pub fn clear_scopes(mut self) -> OauthClientExchangeAppAttestAssertionCall<'a, C> {
3198 self._scopes.clear();
3199 self
3200 }
3201}
3202
3203/// 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).
3204///
3205/// A builder for the *exchangeAppAttestAttestation* method supported by a *oauthClient* resource.
3206/// It is not used directly, but through a [`OauthClientMethods`] instance.
3207///
3208/// # Example
3209///
3210/// Instantiate a resource method builder
3211///
3212/// ```test_harness,no_run
3213/// # extern crate hyper;
3214/// # extern crate hyper_rustls;
3215/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3216/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest;
3217/// # async fn dox() {
3218/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3219///
3220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3221/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3222/// # secret,
3223/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3224/// # ).build().await.unwrap();
3225///
3226/// # let client = hyper_util::client::legacy::Client::builder(
3227/// # hyper_util::rt::TokioExecutor::new()
3228/// # )
3229/// # .build(
3230/// # hyper_rustls::HttpsConnectorBuilder::new()
3231/// # .with_native_roots()
3232/// # .unwrap()
3233/// # .https_or_http()
3234/// # .enable_http1()
3235/// # .build()
3236/// # );
3237/// # let mut hub = Firebaseappcheck::new(client, auth);
3238/// // As the method needs a request, you would usually fill it with the desired information
3239/// // into the respective structure. Some of the parts shown here might not be applicable !
3240/// // Values shown here are possibly random and not representative !
3241/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest::default();
3242///
3243/// // You can configure optional parameters by calling the respective setters at will, and
3244/// // execute the final call using `doit()`.
3245/// // Values shown here are possibly random and not representative !
3246/// let result = hub.oauth_clients().exchange_app_attest_attestation(req, "app")
3247/// .doit().await;
3248/// # }
3249/// ```
3250pub struct OauthClientExchangeAppAttestAttestationCall<'a, C>
3251where
3252 C: 'a,
3253{
3254 hub: &'a Firebaseappcheck<C>,
3255 _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
3256 _app: String,
3257 _delegate: Option<&'a mut dyn common::Delegate>,
3258 _additional_params: HashMap<String, String>,
3259 _scopes: BTreeSet<String>,
3260}
3261
3262impl<'a, C> common::CallBuilder for OauthClientExchangeAppAttestAttestationCall<'a, C> {}
3263
3264impl<'a, C> OauthClientExchangeAppAttestAttestationCall<'a, C>
3265where
3266 C: common::Connector,
3267{
3268 /// Perform the operation you have build so far.
3269 pub async fn doit(
3270 mut self,
3271 ) -> common::Result<(
3272 common::Response,
3273 GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse,
3274 )> {
3275 use std::borrow::Cow;
3276 use std::io::{Read, Seek};
3277
3278 use common::{url::Params, ToParts};
3279 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3280
3281 let mut dd = common::DefaultDelegate;
3282 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3283 dlg.begin(common::MethodInfo {
3284 id: "firebaseappcheck.oauthClients.exchangeAppAttestAttestation",
3285 http_method: hyper::Method::POST,
3286 });
3287
3288 for &field in ["alt", "app"].iter() {
3289 if self._additional_params.contains_key(field) {
3290 dlg.finished(false);
3291 return Err(common::Error::FieldClash(field));
3292 }
3293 }
3294
3295 let mut params = Params::with_capacity(4 + self._additional_params.len());
3296 params.push("app", self._app);
3297
3298 params.extend(self._additional_params.iter());
3299
3300 params.push("alt", "json");
3301 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAttestation";
3302 if self._scopes.is_empty() {
3303 self._scopes
3304 .insert(Scope::CloudPlatform.as_ref().to_string());
3305 }
3306
3307 #[allow(clippy::single_element_loop)]
3308 for &(find_this, param_name) in [("{+app}", "app")].iter() {
3309 url = params.uri_replacement(url, param_name, find_this, true);
3310 }
3311 {
3312 let to_remove = ["app"];
3313 params.remove_params(&to_remove);
3314 }
3315
3316 let url = params.parse_with_url(&url);
3317
3318 let mut json_mime_type = mime::APPLICATION_JSON;
3319 let mut request_value_reader = {
3320 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3321 common::remove_json_null_values(&mut value);
3322 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3323 serde_json::to_writer(&mut dst, &value).unwrap();
3324 dst
3325 };
3326 let request_size = request_value_reader
3327 .seek(std::io::SeekFrom::End(0))
3328 .unwrap();
3329 request_value_reader
3330 .seek(std::io::SeekFrom::Start(0))
3331 .unwrap();
3332
3333 loop {
3334 let token = match self
3335 .hub
3336 .auth
3337 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3338 .await
3339 {
3340 Ok(token) => token,
3341 Err(e) => match dlg.token(e) {
3342 Ok(token) => token,
3343 Err(e) => {
3344 dlg.finished(false);
3345 return Err(common::Error::MissingToken(e));
3346 }
3347 },
3348 };
3349 request_value_reader
3350 .seek(std::io::SeekFrom::Start(0))
3351 .unwrap();
3352 let mut req_result = {
3353 let client = &self.hub.client;
3354 dlg.pre_request();
3355 let mut req_builder = hyper::Request::builder()
3356 .method(hyper::Method::POST)
3357 .uri(url.as_str())
3358 .header(USER_AGENT, self.hub._user_agent.clone());
3359
3360 if let Some(token) = token.as_ref() {
3361 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3362 }
3363
3364 let request = req_builder
3365 .header(CONTENT_TYPE, json_mime_type.to_string())
3366 .header(CONTENT_LENGTH, request_size as u64)
3367 .body(common::to_body(
3368 request_value_reader.get_ref().clone().into(),
3369 ));
3370
3371 client.request(request.unwrap()).await
3372 };
3373
3374 match req_result {
3375 Err(err) => {
3376 if let common::Retry::After(d) = dlg.http_error(&err) {
3377 sleep(d).await;
3378 continue;
3379 }
3380 dlg.finished(false);
3381 return Err(common::Error::HttpError(err));
3382 }
3383 Ok(res) => {
3384 let (mut parts, body) = res.into_parts();
3385 let mut body = common::Body::new(body);
3386 if !parts.status.is_success() {
3387 let bytes = common::to_bytes(body).await.unwrap_or_default();
3388 let error = serde_json::from_str(&common::to_string(&bytes));
3389 let response = common::to_response(parts, bytes.into());
3390
3391 if let common::Retry::After(d) =
3392 dlg.http_failure(&response, error.as_ref().ok())
3393 {
3394 sleep(d).await;
3395 continue;
3396 }
3397
3398 dlg.finished(false);
3399
3400 return Err(match error {
3401 Ok(value) => common::Error::BadRequest(value),
3402 _ => common::Error::Failure(response),
3403 });
3404 }
3405 let response = {
3406 let bytes = common::to_bytes(body).await.unwrap_or_default();
3407 let encoded = common::to_string(&bytes);
3408 match serde_json::from_str(&encoded) {
3409 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3410 Err(error) => {
3411 dlg.response_json_decode_error(&encoded, &error);
3412 return Err(common::Error::JsonDecodeError(
3413 encoded.to_string(),
3414 error,
3415 ));
3416 }
3417 }
3418 };
3419
3420 dlg.finished(true);
3421 return Ok(response);
3422 }
3423 }
3424 }
3425 }
3426
3427 ///
3428 /// Sets the *request* property to the given value.
3429 ///
3430 /// Even though the property as already been set when instantiating this call,
3431 /// we provide this method for API completeness.
3432 pub fn request(
3433 mut self,
3434 new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
3435 ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3436 self._request = new_value;
3437 self
3438 }
3439 /// 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.
3440 ///
3441 /// Sets the *app* path property to the given value.
3442 ///
3443 /// Even though the property as already been set when instantiating this call,
3444 /// we provide this method for API completeness.
3445 pub fn app(mut self, new_value: &str) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3446 self._app = new_value.to_string();
3447 self
3448 }
3449 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3450 /// while executing the actual API request.
3451 ///
3452 /// ````text
3453 /// It should be used to handle progress information, and to implement a certain level of resilience.
3454 /// ````
3455 ///
3456 /// Sets the *delegate* property to the given value.
3457 pub fn delegate(
3458 mut self,
3459 new_value: &'a mut dyn common::Delegate,
3460 ) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3461 self._delegate = Some(new_value);
3462 self
3463 }
3464
3465 /// Set any additional parameter of the query string used in the request.
3466 /// It should be used to set parameters which are not yet available through their own
3467 /// setters.
3468 ///
3469 /// Please note that this method must not be used to set any of the known parameters
3470 /// which have their own setter method. If done anyway, the request will fail.
3471 ///
3472 /// # Additional Parameters
3473 ///
3474 /// * *$.xgafv* (query-string) - V1 error format.
3475 /// * *access_token* (query-string) - OAuth access token.
3476 /// * *alt* (query-string) - Data format for response.
3477 /// * *callback* (query-string) - JSONP
3478 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3479 /// * *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.
3480 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3481 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3482 /// * *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.
3483 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3484 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3485 pub fn param<T>(
3486 mut self,
3487 name: T,
3488 value: T,
3489 ) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3490 where
3491 T: AsRef<str>,
3492 {
3493 self._additional_params
3494 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3495 self
3496 }
3497
3498 /// Identifies the authorization scope for the method you are building.
3499 ///
3500 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3501 /// [`Scope::CloudPlatform`].
3502 ///
3503 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3504 /// tokens for more than one scope.
3505 ///
3506 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3507 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3508 /// sufficient, a read-write scope will do as well.
3509 pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3510 where
3511 St: AsRef<str>,
3512 {
3513 self._scopes.insert(String::from(scope.as_ref()));
3514 self
3515 }
3516 /// Identifies the authorization scope(s) for the method you are building.
3517 ///
3518 /// See [`Self::add_scope()`] for details.
3519 pub fn add_scopes<I, St>(
3520 mut self,
3521 scopes: I,
3522 ) -> OauthClientExchangeAppAttestAttestationCall<'a, C>
3523 where
3524 I: IntoIterator<Item = St>,
3525 St: AsRef<str>,
3526 {
3527 self._scopes
3528 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3529 self
3530 }
3531
3532 /// Removes all scopes, and no default scope will be used either.
3533 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3534 /// for details).
3535 pub fn clear_scopes(mut self) -> OauthClientExchangeAppAttestAttestationCall<'a, C> {
3536 self._scopes.clear();
3537 self
3538 }
3539}
3540
3541/// 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.
3542///
3543/// A builder for the *exchangeDebugToken* method supported by a *oauthClient* resource.
3544/// It is not used directly, but through a [`OauthClientMethods`] instance.
3545///
3546/// # Example
3547///
3548/// Instantiate a resource method builder
3549///
3550/// ```test_harness,no_run
3551/// # extern crate hyper;
3552/// # extern crate hyper_rustls;
3553/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3554/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest;
3555/// # async fn dox() {
3556/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3557///
3558/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3559/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3560/// # secret,
3561/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3562/// # ).build().await.unwrap();
3563///
3564/// # let client = hyper_util::client::legacy::Client::builder(
3565/// # hyper_util::rt::TokioExecutor::new()
3566/// # )
3567/// # .build(
3568/// # hyper_rustls::HttpsConnectorBuilder::new()
3569/// # .with_native_roots()
3570/// # .unwrap()
3571/// # .https_or_http()
3572/// # .enable_http1()
3573/// # .build()
3574/// # );
3575/// # let mut hub = Firebaseappcheck::new(client, auth);
3576/// // As the method needs a request, you would usually fill it with the desired information
3577/// // into the respective structure. Some of the parts shown here might not be applicable !
3578/// // Values shown here are possibly random and not representative !
3579/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest::default();
3580///
3581/// // You can configure optional parameters by calling the respective setters at will, and
3582/// // execute the final call using `doit()`.
3583/// // Values shown here are possibly random and not representative !
3584/// let result = hub.oauth_clients().exchange_debug_token(req, "app")
3585/// .doit().await;
3586/// # }
3587/// ```
3588pub struct OauthClientExchangeDebugTokenCall<'a, C>
3589where
3590 C: 'a,
3591{
3592 hub: &'a Firebaseappcheck<C>,
3593 _request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
3594 _app: String,
3595 _delegate: Option<&'a mut dyn common::Delegate>,
3596 _additional_params: HashMap<String, String>,
3597 _scopes: BTreeSet<String>,
3598}
3599
3600impl<'a, C> common::CallBuilder for OauthClientExchangeDebugTokenCall<'a, C> {}
3601
3602impl<'a, C> OauthClientExchangeDebugTokenCall<'a, C>
3603where
3604 C: common::Connector,
3605{
3606 /// Perform the operation you have build so far.
3607 pub async fn doit(
3608 mut self,
3609 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
3610 use std::borrow::Cow;
3611 use std::io::{Read, Seek};
3612
3613 use common::{url::Params, ToParts};
3614 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3615
3616 let mut dd = common::DefaultDelegate;
3617 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3618 dlg.begin(common::MethodInfo {
3619 id: "firebaseappcheck.oauthClients.exchangeDebugToken",
3620 http_method: hyper::Method::POST,
3621 });
3622
3623 for &field in ["alt", "app"].iter() {
3624 if self._additional_params.contains_key(field) {
3625 dlg.finished(false);
3626 return Err(common::Error::FieldClash(field));
3627 }
3628 }
3629
3630 let mut params = Params::with_capacity(4 + self._additional_params.len());
3631 params.push("app", self._app);
3632
3633 params.extend(self._additional_params.iter());
3634
3635 params.push("alt", "json");
3636 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDebugToken";
3637 if self._scopes.is_empty() {
3638 self._scopes
3639 .insert(Scope::CloudPlatform.as_ref().to_string());
3640 }
3641
3642 #[allow(clippy::single_element_loop)]
3643 for &(find_this, param_name) in [("{+app}", "app")].iter() {
3644 url = params.uri_replacement(url, param_name, find_this, true);
3645 }
3646 {
3647 let to_remove = ["app"];
3648 params.remove_params(&to_remove);
3649 }
3650
3651 let url = params.parse_with_url(&url);
3652
3653 let mut json_mime_type = mime::APPLICATION_JSON;
3654 let mut request_value_reader = {
3655 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3656 common::remove_json_null_values(&mut value);
3657 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3658 serde_json::to_writer(&mut dst, &value).unwrap();
3659 dst
3660 };
3661 let request_size = request_value_reader
3662 .seek(std::io::SeekFrom::End(0))
3663 .unwrap();
3664 request_value_reader
3665 .seek(std::io::SeekFrom::Start(0))
3666 .unwrap();
3667
3668 loop {
3669 let token = match self
3670 .hub
3671 .auth
3672 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3673 .await
3674 {
3675 Ok(token) => token,
3676 Err(e) => match dlg.token(e) {
3677 Ok(token) => token,
3678 Err(e) => {
3679 dlg.finished(false);
3680 return Err(common::Error::MissingToken(e));
3681 }
3682 },
3683 };
3684 request_value_reader
3685 .seek(std::io::SeekFrom::Start(0))
3686 .unwrap();
3687 let mut req_result = {
3688 let client = &self.hub.client;
3689 dlg.pre_request();
3690 let mut req_builder = hyper::Request::builder()
3691 .method(hyper::Method::POST)
3692 .uri(url.as_str())
3693 .header(USER_AGENT, self.hub._user_agent.clone());
3694
3695 if let Some(token) = token.as_ref() {
3696 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3697 }
3698
3699 let request = req_builder
3700 .header(CONTENT_TYPE, json_mime_type.to_string())
3701 .header(CONTENT_LENGTH, request_size as u64)
3702 .body(common::to_body(
3703 request_value_reader.get_ref().clone().into(),
3704 ));
3705
3706 client.request(request.unwrap()).await
3707 };
3708
3709 match req_result {
3710 Err(err) => {
3711 if let common::Retry::After(d) = dlg.http_error(&err) {
3712 sleep(d).await;
3713 continue;
3714 }
3715 dlg.finished(false);
3716 return Err(common::Error::HttpError(err));
3717 }
3718 Ok(res) => {
3719 let (mut parts, body) = res.into_parts();
3720 let mut body = common::Body::new(body);
3721 if !parts.status.is_success() {
3722 let bytes = common::to_bytes(body).await.unwrap_or_default();
3723 let error = serde_json::from_str(&common::to_string(&bytes));
3724 let response = common::to_response(parts, bytes.into());
3725
3726 if let common::Retry::After(d) =
3727 dlg.http_failure(&response, error.as_ref().ok())
3728 {
3729 sleep(d).await;
3730 continue;
3731 }
3732
3733 dlg.finished(false);
3734
3735 return Err(match error {
3736 Ok(value) => common::Error::BadRequest(value),
3737 _ => common::Error::Failure(response),
3738 });
3739 }
3740 let response = {
3741 let bytes = common::to_bytes(body).await.unwrap_or_default();
3742 let encoded = common::to_string(&bytes);
3743 match serde_json::from_str(&encoded) {
3744 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3745 Err(error) => {
3746 dlg.response_json_decode_error(&encoded, &error);
3747 return Err(common::Error::JsonDecodeError(
3748 encoded.to_string(),
3749 error,
3750 ));
3751 }
3752 }
3753 };
3754
3755 dlg.finished(true);
3756 return Ok(response);
3757 }
3758 }
3759 }
3760 }
3761
3762 ///
3763 /// Sets the *request* property to the given value.
3764 ///
3765 /// Even though the property as already been set when instantiating this call,
3766 /// we provide this method for API completeness.
3767 pub fn request(
3768 mut self,
3769 new_value: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
3770 ) -> OauthClientExchangeDebugTokenCall<'a, C> {
3771 self._request = new_value;
3772 self
3773 }
3774 /// 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.
3775 ///
3776 /// Sets the *app* path property to the given value.
3777 ///
3778 /// Even though the property as already been set when instantiating this call,
3779 /// we provide this method for API completeness.
3780 pub fn app(mut self, new_value: &str) -> OauthClientExchangeDebugTokenCall<'a, C> {
3781 self._app = new_value.to_string();
3782 self
3783 }
3784 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3785 /// while executing the actual API request.
3786 ///
3787 /// ````text
3788 /// It should be used to handle progress information, and to implement a certain level of resilience.
3789 /// ````
3790 ///
3791 /// Sets the *delegate* property to the given value.
3792 pub fn delegate(
3793 mut self,
3794 new_value: &'a mut dyn common::Delegate,
3795 ) -> OauthClientExchangeDebugTokenCall<'a, C> {
3796 self._delegate = Some(new_value);
3797 self
3798 }
3799
3800 /// Set any additional parameter of the query string used in the request.
3801 /// It should be used to set parameters which are not yet available through their own
3802 /// setters.
3803 ///
3804 /// Please note that this method must not be used to set any of the known parameters
3805 /// which have their own setter method. If done anyway, the request will fail.
3806 ///
3807 /// # Additional Parameters
3808 ///
3809 /// * *$.xgafv* (query-string) - V1 error format.
3810 /// * *access_token* (query-string) - OAuth access token.
3811 /// * *alt* (query-string) - Data format for response.
3812 /// * *callback* (query-string) - JSONP
3813 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3814 /// * *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.
3815 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3816 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3817 /// * *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.
3818 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3819 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3820 pub fn param<T>(mut self, name: T, value: T) -> OauthClientExchangeDebugTokenCall<'a, C>
3821 where
3822 T: AsRef<str>,
3823 {
3824 self._additional_params
3825 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3826 self
3827 }
3828
3829 /// Identifies the authorization scope for the method you are building.
3830 ///
3831 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3832 /// [`Scope::CloudPlatform`].
3833 ///
3834 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3835 /// tokens for more than one scope.
3836 ///
3837 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3838 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3839 /// sufficient, a read-write scope will do as well.
3840 pub fn add_scope<St>(mut self, scope: St) -> OauthClientExchangeDebugTokenCall<'a, C>
3841 where
3842 St: AsRef<str>,
3843 {
3844 self._scopes.insert(String::from(scope.as_ref()));
3845 self
3846 }
3847 /// Identifies the authorization scope(s) for the method you are building.
3848 ///
3849 /// See [`Self::add_scope()`] for details.
3850 pub fn add_scopes<I, St>(mut self, scopes: I) -> OauthClientExchangeDebugTokenCall<'a, C>
3851 where
3852 I: IntoIterator<Item = St>,
3853 St: AsRef<str>,
3854 {
3855 self._scopes
3856 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3857 self
3858 }
3859
3860 /// Removes all scopes, and no default scope will be used either.
3861 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3862 /// for details).
3863 pub fn clear_scopes(mut self) -> OauthClientExchangeDebugTokenCall<'a, C> {
3864 self._scopes.clear();
3865 self
3866 }
3867}
3868
3869/// 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.
3870///
3871/// A builder for the *generateAppAttestChallenge* method supported by a *oauthClient* resource.
3872/// It is not used directly, but through a [`OauthClientMethods`] instance.
3873///
3874/// # Example
3875///
3876/// Instantiate a resource method builder
3877///
3878/// ```test_harness,no_run
3879/// # extern crate hyper;
3880/// # extern crate hyper_rustls;
3881/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
3882/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest;
3883/// # async fn dox() {
3884/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3885///
3886/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3888/// # secret,
3889/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3890/// # ).build().await.unwrap();
3891///
3892/// # let client = hyper_util::client::legacy::Client::builder(
3893/// # hyper_util::rt::TokioExecutor::new()
3894/// # )
3895/// # .build(
3896/// # hyper_rustls::HttpsConnectorBuilder::new()
3897/// # .with_native_roots()
3898/// # .unwrap()
3899/// # .https_or_http()
3900/// # .enable_http1()
3901/// # .build()
3902/// # );
3903/// # let mut hub = Firebaseappcheck::new(client, auth);
3904/// // As the method needs a request, you would usually fill it with the desired information
3905/// // into the respective structure. Some of the parts shown here might not be applicable !
3906/// // Values shown here are possibly random and not representative !
3907/// let mut req = GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest::default();
3908///
3909/// // You can configure optional parameters by calling the respective setters at will, and
3910/// // execute the final call using `doit()`.
3911/// // Values shown here are possibly random and not representative !
3912/// let result = hub.oauth_clients().generate_app_attest_challenge(req, "app")
3913/// .doit().await;
3914/// # }
3915/// ```
3916pub struct OauthClientGenerateAppAttestChallengeCall<'a, C>
3917where
3918 C: 'a,
3919{
3920 hub: &'a Firebaseappcheck<C>,
3921 _request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
3922 _app: String,
3923 _delegate: Option<&'a mut dyn common::Delegate>,
3924 _additional_params: HashMap<String, String>,
3925 _scopes: BTreeSet<String>,
3926}
3927
3928impl<'a, C> common::CallBuilder for OauthClientGenerateAppAttestChallengeCall<'a, C> {}
3929
3930impl<'a, C> OauthClientGenerateAppAttestChallengeCall<'a, C>
3931where
3932 C: common::Connector,
3933{
3934 /// Perform the operation you have build so far.
3935 pub async fn doit(
3936 mut self,
3937 ) -> common::Result<(
3938 common::Response,
3939 GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse,
3940 )> {
3941 use std::borrow::Cow;
3942 use std::io::{Read, Seek};
3943
3944 use common::{url::Params, ToParts};
3945 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3946
3947 let mut dd = common::DefaultDelegate;
3948 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3949 dlg.begin(common::MethodInfo {
3950 id: "firebaseappcheck.oauthClients.generateAppAttestChallenge",
3951 http_method: hyper::Method::POST,
3952 });
3953
3954 for &field in ["alt", "app"].iter() {
3955 if self._additional_params.contains_key(field) {
3956 dlg.finished(false);
3957 return Err(common::Error::FieldClash(field));
3958 }
3959 }
3960
3961 let mut params = Params::with_capacity(4 + self._additional_params.len());
3962 params.push("app", self._app);
3963
3964 params.extend(self._additional_params.iter());
3965
3966 params.push("alt", "json");
3967 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generateAppAttestChallenge";
3968 if self._scopes.is_empty() {
3969 self._scopes
3970 .insert(Scope::CloudPlatform.as_ref().to_string());
3971 }
3972
3973 #[allow(clippy::single_element_loop)]
3974 for &(find_this, param_name) in [("{+app}", "app")].iter() {
3975 url = params.uri_replacement(url, param_name, find_this, true);
3976 }
3977 {
3978 let to_remove = ["app"];
3979 params.remove_params(&to_remove);
3980 }
3981
3982 let url = params.parse_with_url(&url);
3983
3984 let mut json_mime_type = mime::APPLICATION_JSON;
3985 let mut request_value_reader = {
3986 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3987 common::remove_json_null_values(&mut value);
3988 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3989 serde_json::to_writer(&mut dst, &value).unwrap();
3990 dst
3991 };
3992 let request_size = request_value_reader
3993 .seek(std::io::SeekFrom::End(0))
3994 .unwrap();
3995 request_value_reader
3996 .seek(std::io::SeekFrom::Start(0))
3997 .unwrap();
3998
3999 loop {
4000 let token = match self
4001 .hub
4002 .auth
4003 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4004 .await
4005 {
4006 Ok(token) => token,
4007 Err(e) => match dlg.token(e) {
4008 Ok(token) => token,
4009 Err(e) => {
4010 dlg.finished(false);
4011 return Err(common::Error::MissingToken(e));
4012 }
4013 },
4014 };
4015 request_value_reader
4016 .seek(std::io::SeekFrom::Start(0))
4017 .unwrap();
4018 let mut req_result = {
4019 let client = &self.hub.client;
4020 dlg.pre_request();
4021 let mut req_builder = hyper::Request::builder()
4022 .method(hyper::Method::POST)
4023 .uri(url.as_str())
4024 .header(USER_AGENT, self.hub._user_agent.clone());
4025
4026 if let Some(token) = token.as_ref() {
4027 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4028 }
4029
4030 let request = req_builder
4031 .header(CONTENT_TYPE, json_mime_type.to_string())
4032 .header(CONTENT_LENGTH, request_size as u64)
4033 .body(common::to_body(
4034 request_value_reader.get_ref().clone().into(),
4035 ));
4036
4037 client.request(request.unwrap()).await
4038 };
4039
4040 match req_result {
4041 Err(err) => {
4042 if let common::Retry::After(d) = dlg.http_error(&err) {
4043 sleep(d).await;
4044 continue;
4045 }
4046 dlg.finished(false);
4047 return Err(common::Error::HttpError(err));
4048 }
4049 Ok(res) => {
4050 let (mut parts, body) = res.into_parts();
4051 let mut body = common::Body::new(body);
4052 if !parts.status.is_success() {
4053 let bytes = common::to_bytes(body).await.unwrap_or_default();
4054 let error = serde_json::from_str(&common::to_string(&bytes));
4055 let response = common::to_response(parts, bytes.into());
4056
4057 if let common::Retry::After(d) =
4058 dlg.http_failure(&response, error.as_ref().ok())
4059 {
4060 sleep(d).await;
4061 continue;
4062 }
4063
4064 dlg.finished(false);
4065
4066 return Err(match error {
4067 Ok(value) => common::Error::BadRequest(value),
4068 _ => common::Error::Failure(response),
4069 });
4070 }
4071 let response = {
4072 let bytes = common::to_bytes(body).await.unwrap_or_default();
4073 let encoded = common::to_string(&bytes);
4074 match serde_json::from_str(&encoded) {
4075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4076 Err(error) => {
4077 dlg.response_json_decode_error(&encoded, &error);
4078 return Err(common::Error::JsonDecodeError(
4079 encoded.to_string(),
4080 error,
4081 ));
4082 }
4083 }
4084 };
4085
4086 dlg.finished(true);
4087 return Ok(response);
4088 }
4089 }
4090 }
4091 }
4092
4093 ///
4094 /// Sets the *request* property to the given value.
4095 ///
4096 /// Even though the property as already been set when instantiating this call,
4097 /// we provide this method for API completeness.
4098 pub fn request(
4099 mut self,
4100 new_value: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
4101 ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4102 self._request = new_value;
4103 self
4104 }
4105 /// 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.
4106 ///
4107 /// Sets the *app* path property to the given value.
4108 ///
4109 /// Even though the property as already been set when instantiating this call,
4110 /// we provide this method for API completeness.
4111 pub fn app(mut self, new_value: &str) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4112 self._app = new_value.to_string();
4113 self
4114 }
4115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4116 /// while executing the actual API request.
4117 ///
4118 /// ````text
4119 /// It should be used to handle progress information, and to implement a certain level of resilience.
4120 /// ````
4121 ///
4122 /// Sets the *delegate* property to the given value.
4123 pub fn delegate(
4124 mut self,
4125 new_value: &'a mut dyn common::Delegate,
4126 ) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4127 self._delegate = Some(new_value);
4128 self
4129 }
4130
4131 /// Set any additional parameter of the query string used in the request.
4132 /// It should be used to set parameters which are not yet available through their own
4133 /// setters.
4134 ///
4135 /// Please note that this method must not be used to set any of the known parameters
4136 /// which have their own setter method. If done anyway, the request will fail.
4137 ///
4138 /// # Additional Parameters
4139 ///
4140 /// * *$.xgafv* (query-string) - V1 error format.
4141 /// * *access_token* (query-string) - OAuth access token.
4142 /// * *alt* (query-string) - Data format for response.
4143 /// * *callback* (query-string) - JSONP
4144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4145 /// * *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.
4146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4148 /// * *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.
4149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4151 pub fn param<T>(mut self, name: T, value: T) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4152 where
4153 T: AsRef<str>,
4154 {
4155 self._additional_params
4156 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4157 self
4158 }
4159
4160 /// Identifies the authorization scope for the method you are building.
4161 ///
4162 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4163 /// [`Scope::CloudPlatform`].
4164 ///
4165 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4166 /// tokens for more than one scope.
4167 ///
4168 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4169 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4170 /// sufficient, a read-write scope will do as well.
4171 pub fn add_scope<St>(mut self, scope: St) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4172 where
4173 St: AsRef<str>,
4174 {
4175 self._scopes.insert(String::from(scope.as_ref()));
4176 self
4177 }
4178 /// Identifies the authorization scope(s) for the method you are building.
4179 ///
4180 /// See [`Self::add_scope()`] for details.
4181 pub fn add_scopes<I, St>(
4182 mut self,
4183 scopes: I,
4184 ) -> OauthClientGenerateAppAttestChallengeCall<'a, C>
4185 where
4186 I: IntoIterator<Item = St>,
4187 St: AsRef<str>,
4188 {
4189 self._scopes
4190 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4191 self
4192 }
4193
4194 /// Removes all scopes, and no default scope will be used either.
4195 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4196 /// for details).
4197 pub fn clear_scopes(mut self) -> OauthClientGenerateAppAttestChallengeCall<'a, C> {
4198 self._scopes.clear();
4199 self
4200 }
4201}
4202
4203/// Atomically gets the AppAttestConfigs for the specified list of apps.
4204///
4205/// A builder for the *apps.appAttestConfig.batchGet* method supported by a *project* resource.
4206/// It is not used directly, but through a [`ProjectMethods`] instance.
4207///
4208/// # Example
4209///
4210/// Instantiate a resource method builder
4211///
4212/// ```test_harness,no_run
4213/// # extern crate hyper;
4214/// # extern crate hyper_rustls;
4215/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4216/// # async fn dox() {
4217/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4218///
4219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4221/// # secret,
4222/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4223/// # ).build().await.unwrap();
4224///
4225/// # let client = hyper_util::client::legacy::Client::builder(
4226/// # hyper_util::rt::TokioExecutor::new()
4227/// # )
4228/// # .build(
4229/// # hyper_rustls::HttpsConnectorBuilder::new()
4230/// # .with_native_roots()
4231/// # .unwrap()
4232/// # .https_or_http()
4233/// # .enable_http1()
4234/// # .build()
4235/// # );
4236/// # let mut hub = Firebaseappcheck::new(client, auth);
4237/// // You can configure optional parameters by calling the respective setters at will, and
4238/// // execute the final call using `doit()`.
4239/// // Values shown here are possibly random and not representative !
4240/// let result = hub.projects().apps_app_attest_config_batch_get("parent")
4241/// .add_names("takimata")
4242/// .doit().await;
4243/// # }
4244/// ```
4245pub struct ProjectAppAppAttestConfigBatchGetCall<'a, C>
4246where
4247 C: 'a,
4248{
4249 hub: &'a Firebaseappcheck<C>,
4250 _parent: String,
4251 _names: Vec<String>,
4252 _delegate: Option<&'a mut dyn common::Delegate>,
4253 _additional_params: HashMap<String, String>,
4254 _scopes: BTreeSet<String>,
4255}
4256
4257impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigBatchGetCall<'a, C> {}
4258
4259impl<'a, C> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4260where
4261 C: common::Connector,
4262{
4263 /// Perform the operation you have build so far.
4264 pub async fn doit(
4265 mut self,
4266 ) -> common::Result<(
4267 common::Response,
4268 GoogleFirebaseAppcheckV1betaBatchGetAppAttestConfigsResponse,
4269 )> {
4270 use std::borrow::Cow;
4271 use std::io::{Read, Seek};
4272
4273 use common::{url::Params, ToParts};
4274 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4275
4276 let mut dd = common::DefaultDelegate;
4277 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4278 dlg.begin(common::MethodInfo {
4279 id: "firebaseappcheck.projects.apps.appAttestConfig.batchGet",
4280 http_method: hyper::Method::GET,
4281 });
4282
4283 for &field in ["alt", "parent", "names"].iter() {
4284 if self._additional_params.contains_key(field) {
4285 dlg.finished(false);
4286 return Err(common::Error::FieldClash(field));
4287 }
4288 }
4289
4290 let mut params = Params::with_capacity(4 + self._additional_params.len());
4291 params.push("parent", self._parent);
4292 if !self._names.is_empty() {
4293 for f in self._names.iter() {
4294 params.push("names", f);
4295 }
4296 }
4297
4298 params.extend(self._additional_params.iter());
4299
4300 params.push("alt", "json");
4301 let mut url =
4302 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/appAttestConfig:batchGet";
4303 if self._scopes.is_empty() {
4304 self._scopes
4305 .insert(Scope::CloudPlatform.as_ref().to_string());
4306 }
4307
4308 #[allow(clippy::single_element_loop)]
4309 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4310 url = params.uri_replacement(url, param_name, find_this, true);
4311 }
4312 {
4313 let to_remove = ["parent"];
4314 params.remove_params(&to_remove);
4315 }
4316
4317 let url = params.parse_with_url(&url);
4318
4319 loop {
4320 let token = match self
4321 .hub
4322 .auth
4323 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4324 .await
4325 {
4326 Ok(token) => token,
4327 Err(e) => match dlg.token(e) {
4328 Ok(token) => token,
4329 Err(e) => {
4330 dlg.finished(false);
4331 return Err(common::Error::MissingToken(e));
4332 }
4333 },
4334 };
4335 let mut req_result = {
4336 let client = &self.hub.client;
4337 dlg.pre_request();
4338 let mut req_builder = hyper::Request::builder()
4339 .method(hyper::Method::GET)
4340 .uri(url.as_str())
4341 .header(USER_AGENT, self.hub._user_agent.clone());
4342
4343 if let Some(token) = token.as_ref() {
4344 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4345 }
4346
4347 let request = req_builder
4348 .header(CONTENT_LENGTH, 0_u64)
4349 .body(common::to_body::<String>(None));
4350
4351 client.request(request.unwrap()).await
4352 };
4353
4354 match req_result {
4355 Err(err) => {
4356 if let common::Retry::After(d) = dlg.http_error(&err) {
4357 sleep(d).await;
4358 continue;
4359 }
4360 dlg.finished(false);
4361 return Err(common::Error::HttpError(err));
4362 }
4363 Ok(res) => {
4364 let (mut parts, body) = res.into_parts();
4365 let mut body = common::Body::new(body);
4366 if !parts.status.is_success() {
4367 let bytes = common::to_bytes(body).await.unwrap_or_default();
4368 let error = serde_json::from_str(&common::to_string(&bytes));
4369 let response = common::to_response(parts, bytes.into());
4370
4371 if let common::Retry::After(d) =
4372 dlg.http_failure(&response, error.as_ref().ok())
4373 {
4374 sleep(d).await;
4375 continue;
4376 }
4377
4378 dlg.finished(false);
4379
4380 return Err(match error {
4381 Ok(value) => common::Error::BadRequest(value),
4382 _ => common::Error::Failure(response),
4383 });
4384 }
4385 let response = {
4386 let bytes = common::to_bytes(body).await.unwrap_or_default();
4387 let encoded = common::to_string(&bytes);
4388 match serde_json::from_str(&encoded) {
4389 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4390 Err(error) => {
4391 dlg.response_json_decode_error(&encoded, &error);
4392 return Err(common::Error::JsonDecodeError(
4393 encoded.to_string(),
4394 error,
4395 ));
4396 }
4397 }
4398 };
4399
4400 dlg.finished(true);
4401 return Ok(response);
4402 }
4403 }
4404 }
4405 }
4406
4407 /// 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.
4408 ///
4409 /// Sets the *parent* path property to the given value.
4410 ///
4411 /// Even though the property as already been set when instantiating this call,
4412 /// we provide this method for API completeness.
4413 pub fn parent(mut self, new_value: &str) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4414 self._parent = new_value.to_string();
4415 self
4416 }
4417 /// 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.
4418 ///
4419 /// Append the given value to the *names* query property.
4420 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4421 pub fn add_names(mut self, new_value: &str) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4422 self._names.push(new_value.to_string());
4423 self
4424 }
4425 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4426 /// while executing the actual API request.
4427 ///
4428 /// ````text
4429 /// It should be used to handle progress information, and to implement a certain level of resilience.
4430 /// ````
4431 ///
4432 /// Sets the *delegate* property to the given value.
4433 pub fn delegate(
4434 mut self,
4435 new_value: &'a mut dyn common::Delegate,
4436 ) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4437 self._delegate = Some(new_value);
4438 self
4439 }
4440
4441 /// Set any additional parameter of the query string used in the request.
4442 /// It should be used to set parameters which are not yet available through their own
4443 /// setters.
4444 ///
4445 /// Please note that this method must not be used to set any of the known parameters
4446 /// which have their own setter method. If done anyway, the request will fail.
4447 ///
4448 /// # Additional Parameters
4449 ///
4450 /// * *$.xgafv* (query-string) - V1 error format.
4451 /// * *access_token* (query-string) - OAuth access token.
4452 /// * *alt* (query-string) - Data format for response.
4453 /// * *callback* (query-string) - JSONP
4454 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4455 /// * *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.
4456 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4457 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4458 /// * *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.
4459 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4460 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4461 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4462 where
4463 T: AsRef<str>,
4464 {
4465 self._additional_params
4466 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4467 self
4468 }
4469
4470 /// Identifies the authorization scope for the method you are building.
4471 ///
4472 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4473 /// [`Scope::CloudPlatform`].
4474 ///
4475 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4476 /// tokens for more than one scope.
4477 ///
4478 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4479 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4480 /// sufficient, a read-write scope will do as well.
4481 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4482 where
4483 St: AsRef<str>,
4484 {
4485 self._scopes.insert(String::from(scope.as_ref()));
4486 self
4487 }
4488 /// Identifies the authorization scope(s) for the method you are building.
4489 ///
4490 /// See [`Self::add_scope()`] for details.
4491 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigBatchGetCall<'a, C>
4492 where
4493 I: IntoIterator<Item = St>,
4494 St: AsRef<str>,
4495 {
4496 self._scopes
4497 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4498 self
4499 }
4500
4501 /// Removes all scopes, and no default scope will be used either.
4502 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4503 /// for details).
4504 pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigBatchGetCall<'a, C> {
4505 self._scopes.clear();
4506 self
4507 }
4508}
4509
4510/// Gets the AppAttestConfig for the specified app.
4511///
4512/// A builder for the *apps.appAttestConfig.get* method supported by a *project* resource.
4513/// It is not used directly, but through a [`ProjectMethods`] instance.
4514///
4515/// # Example
4516///
4517/// Instantiate a resource method builder
4518///
4519/// ```test_harness,no_run
4520/// # extern crate hyper;
4521/// # extern crate hyper_rustls;
4522/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4523/// # async fn dox() {
4524/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4525///
4526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4528/// # secret,
4529/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4530/// # ).build().await.unwrap();
4531///
4532/// # let client = hyper_util::client::legacy::Client::builder(
4533/// # hyper_util::rt::TokioExecutor::new()
4534/// # )
4535/// # .build(
4536/// # hyper_rustls::HttpsConnectorBuilder::new()
4537/// # .with_native_roots()
4538/// # .unwrap()
4539/// # .https_or_http()
4540/// # .enable_http1()
4541/// # .build()
4542/// # );
4543/// # let mut hub = Firebaseappcheck::new(client, auth);
4544/// // You can configure optional parameters by calling the respective setters at will, and
4545/// // execute the final call using `doit()`.
4546/// // Values shown here are possibly random and not representative !
4547/// let result = hub.projects().apps_app_attest_config_get("name")
4548/// .doit().await;
4549/// # }
4550/// ```
4551pub struct ProjectAppAppAttestConfigGetCall<'a, C>
4552where
4553 C: 'a,
4554{
4555 hub: &'a Firebaseappcheck<C>,
4556 _name: String,
4557 _delegate: Option<&'a mut dyn common::Delegate>,
4558 _additional_params: HashMap<String, String>,
4559 _scopes: BTreeSet<String>,
4560}
4561
4562impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigGetCall<'a, C> {}
4563
4564impl<'a, C> ProjectAppAppAttestConfigGetCall<'a, C>
4565where
4566 C: common::Connector,
4567{
4568 /// Perform the operation you have build so far.
4569 pub async fn doit(
4570 mut self,
4571 ) -> common::Result<(
4572 common::Response,
4573 GoogleFirebaseAppcheckV1betaAppAttestConfig,
4574 )> {
4575 use std::borrow::Cow;
4576 use std::io::{Read, Seek};
4577
4578 use common::{url::Params, ToParts};
4579 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4580
4581 let mut dd = common::DefaultDelegate;
4582 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4583 dlg.begin(common::MethodInfo {
4584 id: "firebaseappcheck.projects.apps.appAttestConfig.get",
4585 http_method: hyper::Method::GET,
4586 });
4587
4588 for &field in ["alt", "name"].iter() {
4589 if self._additional_params.contains_key(field) {
4590 dlg.finished(false);
4591 return Err(common::Error::FieldClash(field));
4592 }
4593 }
4594
4595 let mut params = Params::with_capacity(3 + self._additional_params.len());
4596 params.push("name", self._name);
4597
4598 params.extend(self._additional_params.iter());
4599
4600 params.push("alt", "json");
4601 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
4602 if self._scopes.is_empty() {
4603 self._scopes
4604 .insert(Scope::CloudPlatform.as_ref().to_string());
4605 }
4606
4607 #[allow(clippy::single_element_loop)]
4608 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4609 url = params.uri_replacement(url, param_name, find_this, true);
4610 }
4611 {
4612 let to_remove = ["name"];
4613 params.remove_params(&to_remove);
4614 }
4615
4616 let url = params.parse_with_url(&url);
4617
4618 loop {
4619 let token = match self
4620 .hub
4621 .auth
4622 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4623 .await
4624 {
4625 Ok(token) => token,
4626 Err(e) => match dlg.token(e) {
4627 Ok(token) => token,
4628 Err(e) => {
4629 dlg.finished(false);
4630 return Err(common::Error::MissingToken(e));
4631 }
4632 },
4633 };
4634 let mut req_result = {
4635 let client = &self.hub.client;
4636 dlg.pre_request();
4637 let mut req_builder = hyper::Request::builder()
4638 .method(hyper::Method::GET)
4639 .uri(url.as_str())
4640 .header(USER_AGENT, self.hub._user_agent.clone());
4641
4642 if let Some(token) = token.as_ref() {
4643 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4644 }
4645
4646 let request = req_builder
4647 .header(CONTENT_LENGTH, 0_u64)
4648 .body(common::to_body::<String>(None));
4649
4650 client.request(request.unwrap()).await
4651 };
4652
4653 match req_result {
4654 Err(err) => {
4655 if let common::Retry::After(d) = dlg.http_error(&err) {
4656 sleep(d).await;
4657 continue;
4658 }
4659 dlg.finished(false);
4660 return Err(common::Error::HttpError(err));
4661 }
4662 Ok(res) => {
4663 let (mut parts, body) = res.into_parts();
4664 let mut body = common::Body::new(body);
4665 if !parts.status.is_success() {
4666 let bytes = common::to_bytes(body).await.unwrap_or_default();
4667 let error = serde_json::from_str(&common::to_string(&bytes));
4668 let response = common::to_response(parts, bytes.into());
4669
4670 if let common::Retry::After(d) =
4671 dlg.http_failure(&response, error.as_ref().ok())
4672 {
4673 sleep(d).await;
4674 continue;
4675 }
4676
4677 dlg.finished(false);
4678
4679 return Err(match error {
4680 Ok(value) => common::Error::BadRequest(value),
4681 _ => common::Error::Failure(response),
4682 });
4683 }
4684 let response = {
4685 let bytes = common::to_bytes(body).await.unwrap_or_default();
4686 let encoded = common::to_string(&bytes);
4687 match serde_json::from_str(&encoded) {
4688 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4689 Err(error) => {
4690 dlg.response_json_decode_error(&encoded, &error);
4691 return Err(common::Error::JsonDecodeError(
4692 encoded.to_string(),
4693 error,
4694 ));
4695 }
4696 }
4697 };
4698
4699 dlg.finished(true);
4700 return Ok(response);
4701 }
4702 }
4703 }
4704 }
4705
4706 /// Required. The relative resource name of the AppAttestConfig, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
4707 ///
4708 /// Sets the *name* path property to the given value.
4709 ///
4710 /// Even though the property as already been set when instantiating this call,
4711 /// we provide this method for API completeness.
4712 pub fn name(mut self, new_value: &str) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4713 self._name = new_value.to_string();
4714 self
4715 }
4716 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4717 /// while executing the actual API request.
4718 ///
4719 /// ````text
4720 /// It should be used to handle progress information, and to implement a certain level of resilience.
4721 /// ````
4722 ///
4723 /// Sets the *delegate* property to the given value.
4724 pub fn delegate(
4725 mut self,
4726 new_value: &'a mut dyn common::Delegate,
4727 ) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4728 self._delegate = Some(new_value);
4729 self
4730 }
4731
4732 /// Set any additional parameter of the query string used in the request.
4733 /// It should be used to set parameters which are not yet available through their own
4734 /// setters.
4735 ///
4736 /// Please note that this method must not be used to set any of the known parameters
4737 /// which have their own setter method. If done anyway, the request will fail.
4738 ///
4739 /// # Additional Parameters
4740 ///
4741 /// * *$.xgafv* (query-string) - V1 error format.
4742 /// * *access_token* (query-string) - OAuth access token.
4743 /// * *alt* (query-string) - Data format for response.
4744 /// * *callback* (query-string) - JSONP
4745 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4746 /// * *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.
4747 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4748 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4749 /// * *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.
4750 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4751 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4752 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigGetCall<'a, C>
4753 where
4754 T: AsRef<str>,
4755 {
4756 self._additional_params
4757 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4758 self
4759 }
4760
4761 /// Identifies the authorization scope for the method you are building.
4762 ///
4763 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4764 /// [`Scope::CloudPlatform`].
4765 ///
4766 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4767 /// tokens for more than one scope.
4768 ///
4769 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4770 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4771 /// sufficient, a read-write scope will do as well.
4772 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigGetCall<'a, C>
4773 where
4774 St: AsRef<str>,
4775 {
4776 self._scopes.insert(String::from(scope.as_ref()));
4777 self
4778 }
4779 /// Identifies the authorization scope(s) for the method you are building.
4780 ///
4781 /// See [`Self::add_scope()`] for details.
4782 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigGetCall<'a, C>
4783 where
4784 I: IntoIterator<Item = St>,
4785 St: AsRef<str>,
4786 {
4787 self._scopes
4788 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4789 self
4790 }
4791
4792 /// Removes all scopes, and no default scope will be used either.
4793 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4794 /// for details).
4795 pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigGetCall<'a, C> {
4796 self._scopes.clear();
4797 self
4798 }
4799}
4800
4801/// 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.
4802///
4803/// A builder for the *apps.appAttestConfig.patch* method supported by a *project* resource.
4804/// It is not used directly, but through a [`ProjectMethods`] instance.
4805///
4806/// # Example
4807///
4808/// Instantiate a resource method builder
4809///
4810/// ```test_harness,no_run
4811/// # extern crate hyper;
4812/// # extern crate hyper_rustls;
4813/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
4814/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaAppAttestConfig;
4815/// # async fn dox() {
4816/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4817///
4818/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4820/// # secret,
4821/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4822/// # ).build().await.unwrap();
4823///
4824/// # let client = hyper_util::client::legacy::Client::builder(
4825/// # hyper_util::rt::TokioExecutor::new()
4826/// # )
4827/// # .build(
4828/// # hyper_rustls::HttpsConnectorBuilder::new()
4829/// # .with_native_roots()
4830/// # .unwrap()
4831/// # .https_or_http()
4832/// # .enable_http1()
4833/// # .build()
4834/// # );
4835/// # let mut hub = Firebaseappcheck::new(client, auth);
4836/// // As the method needs a request, you would usually fill it with the desired information
4837/// // into the respective structure. Some of the parts shown here might not be applicable !
4838/// // Values shown here are possibly random and not representative !
4839/// let mut req = GoogleFirebaseAppcheckV1betaAppAttestConfig::default();
4840///
4841/// // You can configure optional parameters by calling the respective setters at will, and
4842/// // execute the final call using `doit()`.
4843/// // Values shown here are possibly random and not representative !
4844/// let result = hub.projects().apps_app_attest_config_patch(req, "name")
4845/// .update_mask(FieldMask::new::<&str>(&[]))
4846/// .doit().await;
4847/// # }
4848/// ```
4849pub struct ProjectAppAppAttestConfigPatchCall<'a, C>
4850where
4851 C: 'a,
4852{
4853 hub: &'a Firebaseappcheck<C>,
4854 _request: GoogleFirebaseAppcheckV1betaAppAttestConfig,
4855 _name: String,
4856 _update_mask: Option<common::FieldMask>,
4857 _delegate: Option<&'a mut dyn common::Delegate>,
4858 _additional_params: HashMap<String, String>,
4859 _scopes: BTreeSet<String>,
4860}
4861
4862impl<'a, C> common::CallBuilder for ProjectAppAppAttestConfigPatchCall<'a, C> {}
4863
4864impl<'a, C> ProjectAppAppAttestConfigPatchCall<'a, C>
4865where
4866 C: common::Connector,
4867{
4868 /// Perform the operation you have build so far.
4869 pub async fn doit(
4870 mut self,
4871 ) -> common::Result<(
4872 common::Response,
4873 GoogleFirebaseAppcheckV1betaAppAttestConfig,
4874 )> {
4875 use std::borrow::Cow;
4876 use std::io::{Read, Seek};
4877
4878 use common::{url::Params, ToParts};
4879 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4880
4881 let mut dd = common::DefaultDelegate;
4882 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4883 dlg.begin(common::MethodInfo {
4884 id: "firebaseappcheck.projects.apps.appAttestConfig.patch",
4885 http_method: hyper::Method::PATCH,
4886 });
4887
4888 for &field in ["alt", "name", "updateMask"].iter() {
4889 if self._additional_params.contains_key(field) {
4890 dlg.finished(false);
4891 return Err(common::Error::FieldClash(field));
4892 }
4893 }
4894
4895 let mut params = Params::with_capacity(5 + self._additional_params.len());
4896 params.push("name", self._name);
4897 if let Some(value) = self._update_mask.as_ref() {
4898 params.push("updateMask", value.to_string());
4899 }
4900
4901 params.extend(self._additional_params.iter());
4902
4903 params.push("alt", "json");
4904 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
4905 if self._scopes.is_empty() {
4906 self._scopes
4907 .insert(Scope::CloudPlatform.as_ref().to_string());
4908 }
4909
4910 #[allow(clippy::single_element_loop)]
4911 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4912 url = params.uri_replacement(url, param_name, find_this, true);
4913 }
4914 {
4915 let to_remove = ["name"];
4916 params.remove_params(&to_remove);
4917 }
4918
4919 let url = params.parse_with_url(&url);
4920
4921 let mut json_mime_type = mime::APPLICATION_JSON;
4922 let mut request_value_reader = {
4923 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4924 common::remove_json_null_values(&mut value);
4925 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4926 serde_json::to_writer(&mut dst, &value).unwrap();
4927 dst
4928 };
4929 let request_size = request_value_reader
4930 .seek(std::io::SeekFrom::End(0))
4931 .unwrap();
4932 request_value_reader
4933 .seek(std::io::SeekFrom::Start(0))
4934 .unwrap();
4935
4936 loop {
4937 let token = match self
4938 .hub
4939 .auth
4940 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4941 .await
4942 {
4943 Ok(token) => token,
4944 Err(e) => match dlg.token(e) {
4945 Ok(token) => token,
4946 Err(e) => {
4947 dlg.finished(false);
4948 return Err(common::Error::MissingToken(e));
4949 }
4950 },
4951 };
4952 request_value_reader
4953 .seek(std::io::SeekFrom::Start(0))
4954 .unwrap();
4955 let mut req_result = {
4956 let client = &self.hub.client;
4957 dlg.pre_request();
4958 let mut req_builder = hyper::Request::builder()
4959 .method(hyper::Method::PATCH)
4960 .uri(url.as_str())
4961 .header(USER_AGENT, self.hub._user_agent.clone());
4962
4963 if let Some(token) = token.as_ref() {
4964 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4965 }
4966
4967 let request = req_builder
4968 .header(CONTENT_TYPE, json_mime_type.to_string())
4969 .header(CONTENT_LENGTH, request_size as u64)
4970 .body(common::to_body(
4971 request_value_reader.get_ref().clone().into(),
4972 ));
4973
4974 client.request(request.unwrap()).await
4975 };
4976
4977 match req_result {
4978 Err(err) => {
4979 if let common::Retry::After(d) = dlg.http_error(&err) {
4980 sleep(d).await;
4981 continue;
4982 }
4983 dlg.finished(false);
4984 return Err(common::Error::HttpError(err));
4985 }
4986 Ok(res) => {
4987 let (mut parts, body) = res.into_parts();
4988 let mut body = common::Body::new(body);
4989 if !parts.status.is_success() {
4990 let bytes = common::to_bytes(body).await.unwrap_or_default();
4991 let error = serde_json::from_str(&common::to_string(&bytes));
4992 let response = common::to_response(parts, bytes.into());
4993
4994 if let common::Retry::After(d) =
4995 dlg.http_failure(&response, error.as_ref().ok())
4996 {
4997 sleep(d).await;
4998 continue;
4999 }
5000
5001 dlg.finished(false);
5002
5003 return Err(match error {
5004 Ok(value) => common::Error::BadRequest(value),
5005 _ => common::Error::Failure(response),
5006 });
5007 }
5008 let response = {
5009 let bytes = common::to_bytes(body).await.unwrap_or_default();
5010 let encoded = common::to_string(&bytes);
5011 match serde_json::from_str(&encoded) {
5012 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5013 Err(error) => {
5014 dlg.response_json_decode_error(&encoded, &error);
5015 return Err(common::Error::JsonDecodeError(
5016 encoded.to_string(),
5017 error,
5018 ));
5019 }
5020 }
5021 };
5022
5023 dlg.finished(true);
5024 return Ok(response);
5025 }
5026 }
5027 }
5028 }
5029
5030 ///
5031 /// Sets the *request* property to the given value.
5032 ///
5033 /// Even though the property as already been set when instantiating this call,
5034 /// we provide this method for API completeness.
5035 pub fn request(
5036 mut self,
5037 new_value: GoogleFirebaseAppcheckV1betaAppAttestConfig,
5038 ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5039 self._request = new_value;
5040 self
5041 }
5042 /// Required. The relative resource name of the App Attest configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/appAttestConfig ```
5043 ///
5044 /// Sets the *name* path property to the given value.
5045 ///
5046 /// Even though the property as already been set when instantiating this call,
5047 /// we provide this method for API completeness.
5048 pub fn name(mut self, new_value: &str) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5049 self._name = new_value.to_string();
5050 self
5051 }
5052 /// Required. A comma-separated list of names of fields in the AppAttestConfig to update. Example: `token_ttl`.
5053 ///
5054 /// Sets the *update mask* query property to the given value.
5055 pub fn update_mask(
5056 mut self,
5057 new_value: common::FieldMask,
5058 ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5059 self._update_mask = Some(new_value);
5060 self
5061 }
5062 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5063 /// while executing the actual API request.
5064 ///
5065 /// ````text
5066 /// It should be used to handle progress information, and to implement a certain level of resilience.
5067 /// ````
5068 ///
5069 /// Sets the *delegate* property to the given value.
5070 pub fn delegate(
5071 mut self,
5072 new_value: &'a mut dyn common::Delegate,
5073 ) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5074 self._delegate = Some(new_value);
5075 self
5076 }
5077
5078 /// Set any additional parameter of the query string used in the request.
5079 /// It should be used to set parameters which are not yet available through their own
5080 /// setters.
5081 ///
5082 /// Please note that this method must not be used to set any of the known parameters
5083 /// which have their own setter method. If done anyway, the request will fail.
5084 ///
5085 /// # Additional Parameters
5086 ///
5087 /// * *$.xgafv* (query-string) - V1 error format.
5088 /// * *access_token* (query-string) - OAuth access token.
5089 /// * *alt* (query-string) - Data format for response.
5090 /// * *callback* (query-string) - JSONP
5091 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5092 /// * *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.
5093 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5094 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5095 /// * *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.
5096 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5097 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5098 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5099 where
5100 T: AsRef<str>,
5101 {
5102 self._additional_params
5103 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5104 self
5105 }
5106
5107 /// Identifies the authorization scope for the method you are building.
5108 ///
5109 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5110 /// [`Scope::CloudPlatform`].
5111 ///
5112 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5113 /// tokens for more than one scope.
5114 ///
5115 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5116 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5117 /// sufficient, a read-write scope will do as well.
5118 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5119 where
5120 St: AsRef<str>,
5121 {
5122 self._scopes.insert(String::from(scope.as_ref()));
5123 self
5124 }
5125 /// Identifies the authorization scope(s) for the method you are building.
5126 ///
5127 /// See [`Self::add_scope()`] for details.
5128 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppAppAttestConfigPatchCall<'a, C>
5129 where
5130 I: IntoIterator<Item = St>,
5131 St: AsRef<str>,
5132 {
5133 self._scopes
5134 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5135 self
5136 }
5137
5138 /// Removes all scopes, and no default scope will be used either.
5139 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5140 /// for details).
5141 pub fn clear_scopes(mut self) -> ProjectAppAppAttestConfigPatchCall<'a, C> {
5142 self._scopes.clear();
5143 self
5144 }
5145}
5146
5147/// 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.
5148///
5149/// A builder for the *apps.debugTokens.create* method supported by a *project* resource.
5150/// It is not used directly, but through a [`ProjectMethods`] instance.
5151///
5152/// # Example
5153///
5154/// Instantiate a resource method builder
5155///
5156/// ```test_harness,no_run
5157/// # extern crate hyper;
5158/// # extern crate hyper_rustls;
5159/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5160/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDebugToken;
5161/// # async fn dox() {
5162/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5163///
5164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5165/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5166/// # secret,
5167/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5168/// # ).build().await.unwrap();
5169///
5170/// # let client = hyper_util::client::legacy::Client::builder(
5171/// # hyper_util::rt::TokioExecutor::new()
5172/// # )
5173/// # .build(
5174/// # hyper_rustls::HttpsConnectorBuilder::new()
5175/// # .with_native_roots()
5176/// # .unwrap()
5177/// # .https_or_http()
5178/// # .enable_http1()
5179/// # .build()
5180/// # );
5181/// # let mut hub = Firebaseappcheck::new(client, auth);
5182/// // As the method needs a request, you would usually fill it with the desired information
5183/// // into the respective structure. Some of the parts shown here might not be applicable !
5184/// // Values shown here are possibly random and not representative !
5185/// let mut req = GoogleFirebaseAppcheckV1betaDebugToken::default();
5186///
5187/// // You can configure optional parameters by calling the respective setters at will, and
5188/// // execute the final call using `doit()`.
5189/// // Values shown here are possibly random and not representative !
5190/// let result = hub.projects().apps_debug_tokens_create(req, "parent")
5191/// .doit().await;
5192/// # }
5193/// ```
5194pub struct ProjectAppDebugTokenCreateCall<'a, C>
5195where
5196 C: 'a,
5197{
5198 hub: &'a Firebaseappcheck<C>,
5199 _request: GoogleFirebaseAppcheckV1betaDebugToken,
5200 _parent: String,
5201 _delegate: Option<&'a mut dyn common::Delegate>,
5202 _additional_params: HashMap<String, String>,
5203 _scopes: BTreeSet<String>,
5204}
5205
5206impl<'a, C> common::CallBuilder for ProjectAppDebugTokenCreateCall<'a, C> {}
5207
5208impl<'a, C> ProjectAppDebugTokenCreateCall<'a, C>
5209where
5210 C: common::Connector,
5211{
5212 /// Perform the operation you have build so far.
5213 pub async fn doit(
5214 mut self,
5215 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
5216 use std::borrow::Cow;
5217 use std::io::{Read, Seek};
5218
5219 use common::{url::Params, ToParts};
5220 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5221
5222 let mut dd = common::DefaultDelegate;
5223 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5224 dlg.begin(common::MethodInfo {
5225 id: "firebaseappcheck.projects.apps.debugTokens.create",
5226 http_method: hyper::Method::POST,
5227 });
5228
5229 for &field in ["alt", "parent"].iter() {
5230 if self._additional_params.contains_key(field) {
5231 dlg.finished(false);
5232 return Err(common::Error::FieldClash(field));
5233 }
5234 }
5235
5236 let mut params = Params::with_capacity(4 + self._additional_params.len());
5237 params.push("parent", self._parent);
5238
5239 params.extend(self._additional_params.iter());
5240
5241 params.push("alt", "json");
5242 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/debugTokens";
5243 if self._scopes.is_empty() {
5244 self._scopes
5245 .insert(Scope::CloudPlatform.as_ref().to_string());
5246 }
5247
5248 #[allow(clippy::single_element_loop)]
5249 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5250 url = params.uri_replacement(url, param_name, find_this, true);
5251 }
5252 {
5253 let to_remove = ["parent"];
5254 params.remove_params(&to_remove);
5255 }
5256
5257 let url = params.parse_with_url(&url);
5258
5259 let mut json_mime_type = mime::APPLICATION_JSON;
5260 let mut request_value_reader = {
5261 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5262 common::remove_json_null_values(&mut value);
5263 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5264 serde_json::to_writer(&mut dst, &value).unwrap();
5265 dst
5266 };
5267 let request_size = request_value_reader
5268 .seek(std::io::SeekFrom::End(0))
5269 .unwrap();
5270 request_value_reader
5271 .seek(std::io::SeekFrom::Start(0))
5272 .unwrap();
5273
5274 loop {
5275 let token = match self
5276 .hub
5277 .auth
5278 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5279 .await
5280 {
5281 Ok(token) => token,
5282 Err(e) => match dlg.token(e) {
5283 Ok(token) => token,
5284 Err(e) => {
5285 dlg.finished(false);
5286 return Err(common::Error::MissingToken(e));
5287 }
5288 },
5289 };
5290 request_value_reader
5291 .seek(std::io::SeekFrom::Start(0))
5292 .unwrap();
5293 let mut req_result = {
5294 let client = &self.hub.client;
5295 dlg.pre_request();
5296 let mut req_builder = hyper::Request::builder()
5297 .method(hyper::Method::POST)
5298 .uri(url.as_str())
5299 .header(USER_AGENT, self.hub._user_agent.clone());
5300
5301 if let Some(token) = token.as_ref() {
5302 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5303 }
5304
5305 let request = req_builder
5306 .header(CONTENT_TYPE, json_mime_type.to_string())
5307 .header(CONTENT_LENGTH, request_size as u64)
5308 .body(common::to_body(
5309 request_value_reader.get_ref().clone().into(),
5310 ));
5311
5312 client.request(request.unwrap()).await
5313 };
5314
5315 match req_result {
5316 Err(err) => {
5317 if let common::Retry::After(d) = dlg.http_error(&err) {
5318 sleep(d).await;
5319 continue;
5320 }
5321 dlg.finished(false);
5322 return Err(common::Error::HttpError(err));
5323 }
5324 Ok(res) => {
5325 let (mut parts, body) = res.into_parts();
5326 let mut body = common::Body::new(body);
5327 if !parts.status.is_success() {
5328 let bytes = common::to_bytes(body).await.unwrap_or_default();
5329 let error = serde_json::from_str(&common::to_string(&bytes));
5330 let response = common::to_response(parts, bytes.into());
5331
5332 if let common::Retry::After(d) =
5333 dlg.http_failure(&response, error.as_ref().ok())
5334 {
5335 sleep(d).await;
5336 continue;
5337 }
5338
5339 dlg.finished(false);
5340
5341 return Err(match error {
5342 Ok(value) => common::Error::BadRequest(value),
5343 _ => common::Error::Failure(response),
5344 });
5345 }
5346 let response = {
5347 let bytes = common::to_bytes(body).await.unwrap_or_default();
5348 let encoded = common::to_string(&bytes);
5349 match serde_json::from_str(&encoded) {
5350 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5351 Err(error) => {
5352 dlg.response_json_decode_error(&encoded, &error);
5353 return Err(common::Error::JsonDecodeError(
5354 encoded.to_string(),
5355 error,
5356 ));
5357 }
5358 }
5359 };
5360
5361 dlg.finished(true);
5362 return Ok(response);
5363 }
5364 }
5365 }
5366 }
5367
5368 ///
5369 /// Sets the *request* property to the given value.
5370 ///
5371 /// Even though the property as already been set when instantiating this call,
5372 /// we provide this method for API completeness.
5373 pub fn request(
5374 mut self,
5375 new_value: GoogleFirebaseAppcheckV1betaDebugToken,
5376 ) -> ProjectAppDebugTokenCreateCall<'a, C> {
5377 self._request = new_value;
5378 self
5379 }
5380 /// 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} ```
5381 ///
5382 /// Sets the *parent* path property to the given value.
5383 ///
5384 /// Even though the property as already been set when instantiating this call,
5385 /// we provide this method for API completeness.
5386 pub fn parent(mut self, new_value: &str) -> ProjectAppDebugTokenCreateCall<'a, C> {
5387 self._parent = new_value.to_string();
5388 self
5389 }
5390 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5391 /// while executing the actual API request.
5392 ///
5393 /// ````text
5394 /// It should be used to handle progress information, and to implement a certain level of resilience.
5395 /// ````
5396 ///
5397 /// Sets the *delegate* property to the given value.
5398 pub fn delegate(
5399 mut self,
5400 new_value: &'a mut dyn common::Delegate,
5401 ) -> ProjectAppDebugTokenCreateCall<'a, C> {
5402 self._delegate = Some(new_value);
5403 self
5404 }
5405
5406 /// Set any additional parameter of the query string used in the request.
5407 /// It should be used to set parameters which are not yet available through their own
5408 /// setters.
5409 ///
5410 /// Please note that this method must not be used to set any of the known parameters
5411 /// which have their own setter method. If done anyway, the request will fail.
5412 ///
5413 /// # Additional Parameters
5414 ///
5415 /// * *$.xgafv* (query-string) - V1 error format.
5416 /// * *access_token* (query-string) - OAuth access token.
5417 /// * *alt* (query-string) - Data format for response.
5418 /// * *callback* (query-string) - JSONP
5419 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5420 /// * *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.
5421 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5422 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5423 /// * *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.
5424 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5425 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5426 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenCreateCall<'a, C>
5427 where
5428 T: AsRef<str>,
5429 {
5430 self._additional_params
5431 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5432 self
5433 }
5434
5435 /// Identifies the authorization scope for the method you are building.
5436 ///
5437 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5438 /// [`Scope::CloudPlatform`].
5439 ///
5440 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5441 /// tokens for more than one scope.
5442 ///
5443 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5444 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5445 /// sufficient, a read-write scope will do as well.
5446 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenCreateCall<'a, C>
5447 where
5448 St: AsRef<str>,
5449 {
5450 self._scopes.insert(String::from(scope.as_ref()));
5451 self
5452 }
5453 /// Identifies the authorization scope(s) for the method you are building.
5454 ///
5455 /// See [`Self::add_scope()`] for details.
5456 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenCreateCall<'a, C>
5457 where
5458 I: IntoIterator<Item = St>,
5459 St: AsRef<str>,
5460 {
5461 self._scopes
5462 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5463 self
5464 }
5465
5466 /// Removes all scopes, and no default scope will be used either.
5467 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5468 /// for details).
5469 pub fn clear_scopes(mut self) -> ProjectAppDebugTokenCreateCall<'a, C> {
5470 self._scopes.clear();
5471 self
5472 }
5473}
5474
5475/// 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.
5476///
5477/// A builder for the *apps.debugTokens.delete* method supported by a *project* resource.
5478/// It is not used directly, but through a [`ProjectMethods`] instance.
5479///
5480/// # Example
5481///
5482/// Instantiate a resource method builder
5483///
5484/// ```test_harness,no_run
5485/// # extern crate hyper;
5486/// # extern crate hyper_rustls;
5487/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5488/// # async fn dox() {
5489/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5490///
5491/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5492/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5493/// # secret,
5494/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5495/// # ).build().await.unwrap();
5496///
5497/// # let client = hyper_util::client::legacy::Client::builder(
5498/// # hyper_util::rt::TokioExecutor::new()
5499/// # )
5500/// # .build(
5501/// # hyper_rustls::HttpsConnectorBuilder::new()
5502/// # .with_native_roots()
5503/// # .unwrap()
5504/// # .https_or_http()
5505/// # .enable_http1()
5506/// # .build()
5507/// # );
5508/// # let mut hub = Firebaseappcheck::new(client, auth);
5509/// // You can configure optional parameters by calling the respective setters at will, and
5510/// // execute the final call using `doit()`.
5511/// // Values shown here are possibly random and not representative !
5512/// let result = hub.projects().apps_debug_tokens_delete("name")
5513/// .doit().await;
5514/// # }
5515/// ```
5516pub struct ProjectAppDebugTokenDeleteCall<'a, C>
5517where
5518 C: 'a,
5519{
5520 hub: &'a Firebaseappcheck<C>,
5521 _name: String,
5522 _delegate: Option<&'a mut dyn common::Delegate>,
5523 _additional_params: HashMap<String, String>,
5524 _scopes: BTreeSet<String>,
5525}
5526
5527impl<'a, C> common::CallBuilder for ProjectAppDebugTokenDeleteCall<'a, C> {}
5528
5529impl<'a, C> ProjectAppDebugTokenDeleteCall<'a, C>
5530where
5531 C: common::Connector,
5532{
5533 /// Perform the operation you have build so far.
5534 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
5535 use std::borrow::Cow;
5536 use std::io::{Read, Seek};
5537
5538 use common::{url::Params, ToParts};
5539 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5540
5541 let mut dd = common::DefaultDelegate;
5542 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5543 dlg.begin(common::MethodInfo {
5544 id: "firebaseappcheck.projects.apps.debugTokens.delete",
5545 http_method: hyper::Method::DELETE,
5546 });
5547
5548 for &field in ["alt", "name"].iter() {
5549 if self._additional_params.contains_key(field) {
5550 dlg.finished(false);
5551 return Err(common::Error::FieldClash(field));
5552 }
5553 }
5554
5555 let mut params = Params::with_capacity(3 + self._additional_params.len());
5556 params.push("name", self._name);
5557
5558 params.extend(self._additional_params.iter());
5559
5560 params.push("alt", "json");
5561 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
5562 if self._scopes.is_empty() {
5563 self._scopes
5564 .insert(Scope::CloudPlatform.as_ref().to_string());
5565 }
5566
5567 #[allow(clippy::single_element_loop)]
5568 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5569 url = params.uri_replacement(url, param_name, find_this, true);
5570 }
5571 {
5572 let to_remove = ["name"];
5573 params.remove_params(&to_remove);
5574 }
5575
5576 let url = params.parse_with_url(&url);
5577
5578 loop {
5579 let token = match self
5580 .hub
5581 .auth
5582 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5583 .await
5584 {
5585 Ok(token) => token,
5586 Err(e) => match dlg.token(e) {
5587 Ok(token) => token,
5588 Err(e) => {
5589 dlg.finished(false);
5590 return Err(common::Error::MissingToken(e));
5591 }
5592 },
5593 };
5594 let mut req_result = {
5595 let client = &self.hub.client;
5596 dlg.pre_request();
5597 let mut req_builder = hyper::Request::builder()
5598 .method(hyper::Method::DELETE)
5599 .uri(url.as_str())
5600 .header(USER_AGENT, self.hub._user_agent.clone());
5601
5602 if let Some(token) = token.as_ref() {
5603 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5604 }
5605
5606 let request = req_builder
5607 .header(CONTENT_LENGTH, 0_u64)
5608 .body(common::to_body::<String>(None));
5609
5610 client.request(request.unwrap()).await
5611 };
5612
5613 match req_result {
5614 Err(err) => {
5615 if let common::Retry::After(d) = dlg.http_error(&err) {
5616 sleep(d).await;
5617 continue;
5618 }
5619 dlg.finished(false);
5620 return Err(common::Error::HttpError(err));
5621 }
5622 Ok(res) => {
5623 let (mut parts, body) = res.into_parts();
5624 let mut body = common::Body::new(body);
5625 if !parts.status.is_success() {
5626 let bytes = common::to_bytes(body).await.unwrap_or_default();
5627 let error = serde_json::from_str(&common::to_string(&bytes));
5628 let response = common::to_response(parts, bytes.into());
5629
5630 if let common::Retry::After(d) =
5631 dlg.http_failure(&response, error.as_ref().ok())
5632 {
5633 sleep(d).await;
5634 continue;
5635 }
5636
5637 dlg.finished(false);
5638
5639 return Err(match error {
5640 Ok(value) => common::Error::BadRequest(value),
5641 _ => common::Error::Failure(response),
5642 });
5643 }
5644 let response = {
5645 let bytes = common::to_bytes(body).await.unwrap_or_default();
5646 let encoded = common::to_string(&bytes);
5647 match serde_json::from_str(&encoded) {
5648 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5649 Err(error) => {
5650 dlg.response_json_decode_error(&encoded, &error);
5651 return Err(common::Error::JsonDecodeError(
5652 encoded.to_string(),
5653 error,
5654 ));
5655 }
5656 }
5657 };
5658
5659 dlg.finished(true);
5660 return Ok(response);
5661 }
5662 }
5663 }
5664 }
5665
5666 /// Required. The relative resource name of the DebugToken to delete, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
5667 ///
5668 /// Sets the *name* path property to the given value.
5669 ///
5670 /// Even though the property as already been set when instantiating this call,
5671 /// we provide this method for API completeness.
5672 pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5673 self._name = new_value.to_string();
5674 self
5675 }
5676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5677 /// while executing the actual API request.
5678 ///
5679 /// ````text
5680 /// It should be used to handle progress information, and to implement a certain level of resilience.
5681 /// ````
5682 ///
5683 /// Sets the *delegate* property to the given value.
5684 pub fn delegate(
5685 mut self,
5686 new_value: &'a mut dyn common::Delegate,
5687 ) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5688 self._delegate = Some(new_value);
5689 self
5690 }
5691
5692 /// Set any additional parameter of the query string used in the request.
5693 /// It should be used to set parameters which are not yet available through their own
5694 /// setters.
5695 ///
5696 /// Please note that this method must not be used to set any of the known parameters
5697 /// which have their own setter method. If done anyway, the request will fail.
5698 ///
5699 /// # Additional Parameters
5700 ///
5701 /// * *$.xgafv* (query-string) - V1 error format.
5702 /// * *access_token* (query-string) - OAuth access token.
5703 /// * *alt* (query-string) - Data format for response.
5704 /// * *callback* (query-string) - JSONP
5705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5706 /// * *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.
5707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5709 /// * *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.
5710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5712 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenDeleteCall<'a, C>
5713 where
5714 T: AsRef<str>,
5715 {
5716 self._additional_params
5717 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5718 self
5719 }
5720
5721 /// Identifies the authorization scope for the method you are building.
5722 ///
5723 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5724 /// [`Scope::CloudPlatform`].
5725 ///
5726 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5727 /// tokens for more than one scope.
5728 ///
5729 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5730 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5731 /// sufficient, a read-write scope will do as well.
5732 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenDeleteCall<'a, C>
5733 where
5734 St: AsRef<str>,
5735 {
5736 self._scopes.insert(String::from(scope.as_ref()));
5737 self
5738 }
5739 /// Identifies the authorization scope(s) for the method you are building.
5740 ///
5741 /// See [`Self::add_scope()`] for details.
5742 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenDeleteCall<'a, C>
5743 where
5744 I: IntoIterator<Item = St>,
5745 St: AsRef<str>,
5746 {
5747 self._scopes
5748 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5749 self
5750 }
5751
5752 /// Removes all scopes, and no default scope will be used either.
5753 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5754 /// for details).
5755 pub fn clear_scopes(mut self) -> ProjectAppDebugTokenDeleteCall<'a, C> {
5756 self._scopes.clear();
5757 self
5758 }
5759}
5760
5761/// Gets the specified DebugToken. For security reasons, the `token` field is never populated in the response.
5762///
5763/// A builder for the *apps.debugTokens.get* method supported by a *project* resource.
5764/// It is not used directly, but through a [`ProjectMethods`] instance.
5765///
5766/// # Example
5767///
5768/// Instantiate a resource method builder
5769///
5770/// ```test_harness,no_run
5771/// # extern crate hyper;
5772/// # extern crate hyper_rustls;
5773/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
5774/// # async fn dox() {
5775/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5776///
5777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5779/// # secret,
5780/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5781/// # ).build().await.unwrap();
5782///
5783/// # let client = hyper_util::client::legacy::Client::builder(
5784/// # hyper_util::rt::TokioExecutor::new()
5785/// # )
5786/// # .build(
5787/// # hyper_rustls::HttpsConnectorBuilder::new()
5788/// # .with_native_roots()
5789/// # .unwrap()
5790/// # .https_or_http()
5791/// # .enable_http1()
5792/// # .build()
5793/// # );
5794/// # let mut hub = Firebaseappcheck::new(client, auth);
5795/// // You can configure optional parameters by calling the respective setters at will, and
5796/// // execute the final call using `doit()`.
5797/// // Values shown here are possibly random and not representative !
5798/// let result = hub.projects().apps_debug_tokens_get("name")
5799/// .doit().await;
5800/// # }
5801/// ```
5802pub struct ProjectAppDebugTokenGetCall<'a, C>
5803where
5804 C: 'a,
5805{
5806 hub: &'a Firebaseappcheck<C>,
5807 _name: String,
5808 _delegate: Option<&'a mut dyn common::Delegate>,
5809 _additional_params: HashMap<String, String>,
5810 _scopes: BTreeSet<String>,
5811}
5812
5813impl<'a, C> common::CallBuilder for ProjectAppDebugTokenGetCall<'a, C> {}
5814
5815impl<'a, C> ProjectAppDebugTokenGetCall<'a, C>
5816where
5817 C: common::Connector,
5818{
5819 /// Perform the operation you have build so far.
5820 pub async fn doit(
5821 mut self,
5822 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
5823 use std::borrow::Cow;
5824 use std::io::{Read, Seek};
5825
5826 use common::{url::Params, ToParts};
5827 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5828
5829 let mut dd = common::DefaultDelegate;
5830 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5831 dlg.begin(common::MethodInfo {
5832 id: "firebaseappcheck.projects.apps.debugTokens.get",
5833 http_method: hyper::Method::GET,
5834 });
5835
5836 for &field in ["alt", "name"].iter() {
5837 if self._additional_params.contains_key(field) {
5838 dlg.finished(false);
5839 return Err(common::Error::FieldClash(field));
5840 }
5841 }
5842
5843 let mut params = Params::with_capacity(3 + self._additional_params.len());
5844 params.push("name", self._name);
5845
5846 params.extend(self._additional_params.iter());
5847
5848 params.push("alt", "json");
5849 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
5850 if self._scopes.is_empty() {
5851 self._scopes
5852 .insert(Scope::CloudPlatform.as_ref().to_string());
5853 }
5854
5855 #[allow(clippy::single_element_loop)]
5856 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5857 url = params.uri_replacement(url, param_name, find_this, true);
5858 }
5859 {
5860 let to_remove = ["name"];
5861 params.remove_params(&to_remove);
5862 }
5863
5864 let url = params.parse_with_url(&url);
5865
5866 loop {
5867 let token = match self
5868 .hub
5869 .auth
5870 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5871 .await
5872 {
5873 Ok(token) => token,
5874 Err(e) => match dlg.token(e) {
5875 Ok(token) => token,
5876 Err(e) => {
5877 dlg.finished(false);
5878 return Err(common::Error::MissingToken(e));
5879 }
5880 },
5881 };
5882 let mut req_result = {
5883 let client = &self.hub.client;
5884 dlg.pre_request();
5885 let mut req_builder = hyper::Request::builder()
5886 .method(hyper::Method::GET)
5887 .uri(url.as_str())
5888 .header(USER_AGENT, self.hub._user_agent.clone());
5889
5890 if let Some(token) = token.as_ref() {
5891 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5892 }
5893
5894 let request = req_builder
5895 .header(CONTENT_LENGTH, 0_u64)
5896 .body(common::to_body::<String>(None));
5897
5898 client.request(request.unwrap()).await
5899 };
5900
5901 match req_result {
5902 Err(err) => {
5903 if let common::Retry::After(d) = dlg.http_error(&err) {
5904 sleep(d).await;
5905 continue;
5906 }
5907 dlg.finished(false);
5908 return Err(common::Error::HttpError(err));
5909 }
5910 Ok(res) => {
5911 let (mut parts, body) = res.into_parts();
5912 let mut body = common::Body::new(body);
5913 if !parts.status.is_success() {
5914 let bytes = common::to_bytes(body).await.unwrap_or_default();
5915 let error = serde_json::from_str(&common::to_string(&bytes));
5916 let response = common::to_response(parts, bytes.into());
5917
5918 if let common::Retry::After(d) =
5919 dlg.http_failure(&response, error.as_ref().ok())
5920 {
5921 sleep(d).await;
5922 continue;
5923 }
5924
5925 dlg.finished(false);
5926
5927 return Err(match error {
5928 Ok(value) => common::Error::BadRequest(value),
5929 _ => common::Error::Failure(response),
5930 });
5931 }
5932 let response = {
5933 let bytes = common::to_bytes(body).await.unwrap_or_default();
5934 let encoded = common::to_string(&bytes);
5935 match serde_json::from_str(&encoded) {
5936 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5937 Err(error) => {
5938 dlg.response_json_decode_error(&encoded, &error);
5939 return Err(common::Error::JsonDecodeError(
5940 encoded.to_string(),
5941 error,
5942 ));
5943 }
5944 }
5945 };
5946
5947 dlg.finished(true);
5948 return Ok(response);
5949 }
5950 }
5951 }
5952 }
5953
5954 /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
5955 ///
5956 /// Sets the *name* path property to the given value.
5957 ///
5958 /// Even though the property as already been set when instantiating this call,
5959 /// we provide this method for API completeness.
5960 pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenGetCall<'a, C> {
5961 self._name = new_value.to_string();
5962 self
5963 }
5964 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5965 /// while executing the actual API request.
5966 ///
5967 /// ````text
5968 /// It should be used to handle progress information, and to implement a certain level of resilience.
5969 /// ````
5970 ///
5971 /// Sets the *delegate* property to the given value.
5972 pub fn delegate(
5973 mut self,
5974 new_value: &'a mut dyn common::Delegate,
5975 ) -> ProjectAppDebugTokenGetCall<'a, C> {
5976 self._delegate = Some(new_value);
5977 self
5978 }
5979
5980 /// Set any additional parameter of the query string used in the request.
5981 /// It should be used to set parameters which are not yet available through their own
5982 /// setters.
5983 ///
5984 /// Please note that this method must not be used to set any of the known parameters
5985 /// which have their own setter method. If done anyway, the request will fail.
5986 ///
5987 /// # Additional Parameters
5988 ///
5989 /// * *$.xgafv* (query-string) - V1 error format.
5990 /// * *access_token* (query-string) - OAuth access token.
5991 /// * *alt* (query-string) - Data format for response.
5992 /// * *callback* (query-string) - JSONP
5993 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5994 /// * *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.
5995 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5996 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5997 /// * *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.
5998 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5999 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6000 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenGetCall<'a, C>
6001 where
6002 T: AsRef<str>,
6003 {
6004 self._additional_params
6005 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6006 self
6007 }
6008
6009 /// Identifies the authorization scope for the method you are building.
6010 ///
6011 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6012 /// [`Scope::CloudPlatform`].
6013 ///
6014 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6015 /// tokens for more than one scope.
6016 ///
6017 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6018 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6019 /// sufficient, a read-write scope will do as well.
6020 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenGetCall<'a, C>
6021 where
6022 St: AsRef<str>,
6023 {
6024 self._scopes.insert(String::from(scope.as_ref()));
6025 self
6026 }
6027 /// Identifies the authorization scope(s) for the method you are building.
6028 ///
6029 /// See [`Self::add_scope()`] for details.
6030 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenGetCall<'a, C>
6031 where
6032 I: IntoIterator<Item = St>,
6033 St: AsRef<str>,
6034 {
6035 self._scopes
6036 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6037 self
6038 }
6039
6040 /// Removes all scopes, and no default scope will be used either.
6041 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6042 /// for details).
6043 pub fn clear_scopes(mut self) -> ProjectAppDebugTokenGetCall<'a, C> {
6044 self._scopes.clear();
6045 self
6046 }
6047}
6048
6049/// Lists all DebugTokens for the specified app. For security reasons, the `token` field is never populated in the response.
6050///
6051/// A builder for the *apps.debugTokens.list* method supported by a *project* resource.
6052/// It is not used directly, but through a [`ProjectMethods`] instance.
6053///
6054/// # Example
6055///
6056/// Instantiate a resource method builder
6057///
6058/// ```test_harness,no_run
6059/// # extern crate hyper;
6060/// # extern crate hyper_rustls;
6061/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6062/// # async fn dox() {
6063/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6064///
6065/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6067/// # secret,
6068/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6069/// # ).build().await.unwrap();
6070///
6071/// # let client = hyper_util::client::legacy::Client::builder(
6072/// # hyper_util::rt::TokioExecutor::new()
6073/// # )
6074/// # .build(
6075/// # hyper_rustls::HttpsConnectorBuilder::new()
6076/// # .with_native_roots()
6077/// # .unwrap()
6078/// # .https_or_http()
6079/// # .enable_http1()
6080/// # .build()
6081/// # );
6082/// # let mut hub = Firebaseappcheck::new(client, auth);
6083/// // You can configure optional parameters by calling the respective setters at will, and
6084/// // execute the final call using `doit()`.
6085/// // Values shown here are possibly random and not representative !
6086/// let result = hub.projects().apps_debug_tokens_list("parent")
6087/// .page_token("eos")
6088/// .page_size(-4)
6089/// .doit().await;
6090/// # }
6091/// ```
6092pub struct ProjectAppDebugTokenListCall<'a, C>
6093where
6094 C: 'a,
6095{
6096 hub: &'a Firebaseappcheck<C>,
6097 _parent: String,
6098 _page_token: Option<String>,
6099 _page_size: Option<i32>,
6100 _delegate: Option<&'a mut dyn common::Delegate>,
6101 _additional_params: HashMap<String, String>,
6102 _scopes: BTreeSet<String>,
6103}
6104
6105impl<'a, C> common::CallBuilder for ProjectAppDebugTokenListCall<'a, C> {}
6106
6107impl<'a, C> ProjectAppDebugTokenListCall<'a, C>
6108where
6109 C: common::Connector,
6110{
6111 /// Perform the operation you have build so far.
6112 pub async fn doit(
6113 mut self,
6114 ) -> common::Result<(
6115 common::Response,
6116 GoogleFirebaseAppcheckV1betaListDebugTokensResponse,
6117 )> {
6118 use std::borrow::Cow;
6119 use std::io::{Read, Seek};
6120
6121 use common::{url::Params, ToParts};
6122 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6123
6124 let mut dd = common::DefaultDelegate;
6125 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6126 dlg.begin(common::MethodInfo {
6127 id: "firebaseappcheck.projects.apps.debugTokens.list",
6128 http_method: hyper::Method::GET,
6129 });
6130
6131 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6132 if self._additional_params.contains_key(field) {
6133 dlg.finished(false);
6134 return Err(common::Error::FieldClash(field));
6135 }
6136 }
6137
6138 let mut params = Params::with_capacity(5 + self._additional_params.len());
6139 params.push("parent", self._parent);
6140 if let Some(value) = self._page_token.as_ref() {
6141 params.push("pageToken", value);
6142 }
6143 if let Some(value) = self._page_size.as_ref() {
6144 params.push("pageSize", value.to_string());
6145 }
6146
6147 params.extend(self._additional_params.iter());
6148
6149 params.push("alt", "json");
6150 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/debugTokens";
6151 if self._scopes.is_empty() {
6152 self._scopes
6153 .insert(Scope::CloudPlatform.as_ref().to_string());
6154 }
6155
6156 #[allow(clippy::single_element_loop)]
6157 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6158 url = params.uri_replacement(url, param_name, find_this, true);
6159 }
6160 {
6161 let to_remove = ["parent"];
6162 params.remove_params(&to_remove);
6163 }
6164
6165 let url = params.parse_with_url(&url);
6166
6167 loop {
6168 let token = match self
6169 .hub
6170 .auth
6171 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6172 .await
6173 {
6174 Ok(token) => token,
6175 Err(e) => match dlg.token(e) {
6176 Ok(token) => token,
6177 Err(e) => {
6178 dlg.finished(false);
6179 return Err(common::Error::MissingToken(e));
6180 }
6181 },
6182 };
6183 let mut req_result = {
6184 let client = &self.hub.client;
6185 dlg.pre_request();
6186 let mut req_builder = hyper::Request::builder()
6187 .method(hyper::Method::GET)
6188 .uri(url.as_str())
6189 .header(USER_AGENT, self.hub._user_agent.clone());
6190
6191 if let Some(token) = token.as_ref() {
6192 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6193 }
6194
6195 let request = req_builder
6196 .header(CONTENT_LENGTH, 0_u64)
6197 .body(common::to_body::<String>(None));
6198
6199 client.request(request.unwrap()).await
6200 };
6201
6202 match req_result {
6203 Err(err) => {
6204 if let common::Retry::After(d) = dlg.http_error(&err) {
6205 sleep(d).await;
6206 continue;
6207 }
6208 dlg.finished(false);
6209 return Err(common::Error::HttpError(err));
6210 }
6211 Ok(res) => {
6212 let (mut parts, body) = res.into_parts();
6213 let mut body = common::Body::new(body);
6214 if !parts.status.is_success() {
6215 let bytes = common::to_bytes(body).await.unwrap_or_default();
6216 let error = serde_json::from_str(&common::to_string(&bytes));
6217 let response = common::to_response(parts, bytes.into());
6218
6219 if let common::Retry::After(d) =
6220 dlg.http_failure(&response, error.as_ref().ok())
6221 {
6222 sleep(d).await;
6223 continue;
6224 }
6225
6226 dlg.finished(false);
6227
6228 return Err(match error {
6229 Ok(value) => common::Error::BadRequest(value),
6230 _ => common::Error::Failure(response),
6231 });
6232 }
6233 let response = {
6234 let bytes = common::to_bytes(body).await.unwrap_or_default();
6235 let encoded = common::to_string(&bytes);
6236 match serde_json::from_str(&encoded) {
6237 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6238 Err(error) => {
6239 dlg.response_json_decode_error(&encoded, &error);
6240 return Err(common::Error::JsonDecodeError(
6241 encoded.to_string(),
6242 error,
6243 ));
6244 }
6245 }
6246 };
6247
6248 dlg.finished(true);
6249 return Ok(response);
6250 }
6251 }
6252 }
6253 }
6254
6255 /// 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} ```
6256 ///
6257 /// Sets the *parent* path property to the given value.
6258 ///
6259 /// Even though the property as already been set when instantiating this call,
6260 /// we provide this method for API completeness.
6261 pub fn parent(mut self, new_value: &str) -> ProjectAppDebugTokenListCall<'a, C> {
6262 self._parent = new_value.to_string();
6263 self
6264 }
6265 /// 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.
6266 ///
6267 /// Sets the *page token* query property to the given value.
6268 pub fn page_token(mut self, new_value: &str) -> ProjectAppDebugTokenListCall<'a, C> {
6269 self._page_token = Some(new_value.to_string());
6270 self
6271 }
6272 /// 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.
6273 ///
6274 /// Sets the *page size* query property to the given value.
6275 pub fn page_size(mut self, new_value: i32) -> ProjectAppDebugTokenListCall<'a, C> {
6276 self._page_size = Some(new_value);
6277 self
6278 }
6279 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6280 /// while executing the actual API request.
6281 ///
6282 /// ````text
6283 /// It should be used to handle progress information, and to implement a certain level of resilience.
6284 /// ````
6285 ///
6286 /// Sets the *delegate* property to the given value.
6287 pub fn delegate(
6288 mut self,
6289 new_value: &'a mut dyn common::Delegate,
6290 ) -> ProjectAppDebugTokenListCall<'a, C> {
6291 self._delegate = Some(new_value);
6292 self
6293 }
6294
6295 /// Set any additional parameter of the query string used in the request.
6296 /// It should be used to set parameters which are not yet available through their own
6297 /// setters.
6298 ///
6299 /// Please note that this method must not be used to set any of the known parameters
6300 /// which have their own setter method. If done anyway, the request will fail.
6301 ///
6302 /// # Additional Parameters
6303 ///
6304 /// * *$.xgafv* (query-string) - V1 error format.
6305 /// * *access_token* (query-string) - OAuth access token.
6306 /// * *alt* (query-string) - Data format for response.
6307 /// * *callback* (query-string) - JSONP
6308 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6309 /// * *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.
6310 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6311 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6312 /// * *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.
6313 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6314 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6315 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenListCall<'a, C>
6316 where
6317 T: AsRef<str>,
6318 {
6319 self._additional_params
6320 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6321 self
6322 }
6323
6324 /// Identifies the authorization scope for the method you are building.
6325 ///
6326 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6327 /// [`Scope::CloudPlatform`].
6328 ///
6329 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6330 /// tokens for more than one scope.
6331 ///
6332 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6333 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6334 /// sufficient, a read-write scope will do as well.
6335 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenListCall<'a, C>
6336 where
6337 St: AsRef<str>,
6338 {
6339 self._scopes.insert(String::from(scope.as_ref()));
6340 self
6341 }
6342 /// Identifies the authorization scope(s) for the method you are building.
6343 ///
6344 /// See [`Self::add_scope()`] for details.
6345 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenListCall<'a, C>
6346 where
6347 I: IntoIterator<Item = St>,
6348 St: AsRef<str>,
6349 {
6350 self._scopes
6351 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6352 self
6353 }
6354
6355 /// Removes all scopes, and no default scope will be used either.
6356 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6357 /// for details).
6358 pub fn clear_scopes(mut self) -> ProjectAppDebugTokenListCall<'a, C> {
6359 self._scopes.clear();
6360 self
6361 }
6362}
6363
6364/// 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.
6365///
6366/// A builder for the *apps.debugTokens.patch* method supported by a *project* resource.
6367/// It is not used directly, but through a [`ProjectMethods`] instance.
6368///
6369/// # Example
6370///
6371/// Instantiate a resource method builder
6372///
6373/// ```test_harness,no_run
6374/// # extern crate hyper;
6375/// # extern crate hyper_rustls;
6376/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6377/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDebugToken;
6378/// # async fn dox() {
6379/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6380///
6381/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6382/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6383/// # secret,
6384/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6385/// # ).build().await.unwrap();
6386///
6387/// # let client = hyper_util::client::legacy::Client::builder(
6388/// # hyper_util::rt::TokioExecutor::new()
6389/// # )
6390/// # .build(
6391/// # hyper_rustls::HttpsConnectorBuilder::new()
6392/// # .with_native_roots()
6393/// # .unwrap()
6394/// # .https_or_http()
6395/// # .enable_http1()
6396/// # .build()
6397/// # );
6398/// # let mut hub = Firebaseappcheck::new(client, auth);
6399/// // As the method needs a request, you would usually fill it with the desired information
6400/// // into the respective structure. Some of the parts shown here might not be applicable !
6401/// // Values shown here are possibly random and not representative !
6402/// let mut req = GoogleFirebaseAppcheckV1betaDebugToken::default();
6403///
6404/// // You can configure optional parameters by calling the respective setters at will, and
6405/// // execute the final call using `doit()`.
6406/// // Values shown here are possibly random and not representative !
6407/// let result = hub.projects().apps_debug_tokens_patch(req, "name")
6408/// .update_mask(FieldMask::new::<&str>(&[]))
6409/// .doit().await;
6410/// # }
6411/// ```
6412pub struct ProjectAppDebugTokenPatchCall<'a, C>
6413where
6414 C: 'a,
6415{
6416 hub: &'a Firebaseappcheck<C>,
6417 _request: GoogleFirebaseAppcheckV1betaDebugToken,
6418 _name: String,
6419 _update_mask: Option<common::FieldMask>,
6420 _delegate: Option<&'a mut dyn common::Delegate>,
6421 _additional_params: HashMap<String, String>,
6422 _scopes: BTreeSet<String>,
6423}
6424
6425impl<'a, C> common::CallBuilder for ProjectAppDebugTokenPatchCall<'a, C> {}
6426
6427impl<'a, C> ProjectAppDebugTokenPatchCall<'a, C>
6428where
6429 C: common::Connector,
6430{
6431 /// Perform the operation you have build so far.
6432 pub async fn doit(
6433 mut self,
6434 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaDebugToken)> {
6435 use std::borrow::Cow;
6436 use std::io::{Read, Seek};
6437
6438 use common::{url::Params, ToParts};
6439 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6440
6441 let mut dd = common::DefaultDelegate;
6442 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6443 dlg.begin(common::MethodInfo {
6444 id: "firebaseappcheck.projects.apps.debugTokens.patch",
6445 http_method: hyper::Method::PATCH,
6446 });
6447
6448 for &field in ["alt", "name", "updateMask"].iter() {
6449 if self._additional_params.contains_key(field) {
6450 dlg.finished(false);
6451 return Err(common::Error::FieldClash(field));
6452 }
6453 }
6454
6455 let mut params = Params::with_capacity(5 + self._additional_params.len());
6456 params.push("name", self._name);
6457 if let Some(value) = self._update_mask.as_ref() {
6458 params.push("updateMask", value.to_string());
6459 }
6460
6461 params.extend(self._additional_params.iter());
6462
6463 params.push("alt", "json");
6464 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
6465 if self._scopes.is_empty() {
6466 self._scopes
6467 .insert(Scope::CloudPlatform.as_ref().to_string());
6468 }
6469
6470 #[allow(clippy::single_element_loop)]
6471 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6472 url = params.uri_replacement(url, param_name, find_this, true);
6473 }
6474 {
6475 let to_remove = ["name"];
6476 params.remove_params(&to_remove);
6477 }
6478
6479 let url = params.parse_with_url(&url);
6480
6481 let mut json_mime_type = mime::APPLICATION_JSON;
6482 let mut request_value_reader = {
6483 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6484 common::remove_json_null_values(&mut value);
6485 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6486 serde_json::to_writer(&mut dst, &value).unwrap();
6487 dst
6488 };
6489 let request_size = request_value_reader
6490 .seek(std::io::SeekFrom::End(0))
6491 .unwrap();
6492 request_value_reader
6493 .seek(std::io::SeekFrom::Start(0))
6494 .unwrap();
6495
6496 loop {
6497 let token = match self
6498 .hub
6499 .auth
6500 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6501 .await
6502 {
6503 Ok(token) => token,
6504 Err(e) => match dlg.token(e) {
6505 Ok(token) => token,
6506 Err(e) => {
6507 dlg.finished(false);
6508 return Err(common::Error::MissingToken(e));
6509 }
6510 },
6511 };
6512 request_value_reader
6513 .seek(std::io::SeekFrom::Start(0))
6514 .unwrap();
6515 let mut req_result = {
6516 let client = &self.hub.client;
6517 dlg.pre_request();
6518 let mut req_builder = hyper::Request::builder()
6519 .method(hyper::Method::PATCH)
6520 .uri(url.as_str())
6521 .header(USER_AGENT, self.hub._user_agent.clone());
6522
6523 if let Some(token) = token.as_ref() {
6524 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6525 }
6526
6527 let request = req_builder
6528 .header(CONTENT_TYPE, json_mime_type.to_string())
6529 .header(CONTENT_LENGTH, request_size as u64)
6530 .body(common::to_body(
6531 request_value_reader.get_ref().clone().into(),
6532 ));
6533
6534 client.request(request.unwrap()).await
6535 };
6536
6537 match req_result {
6538 Err(err) => {
6539 if let common::Retry::After(d) = dlg.http_error(&err) {
6540 sleep(d).await;
6541 continue;
6542 }
6543 dlg.finished(false);
6544 return Err(common::Error::HttpError(err));
6545 }
6546 Ok(res) => {
6547 let (mut parts, body) = res.into_parts();
6548 let mut body = common::Body::new(body);
6549 if !parts.status.is_success() {
6550 let bytes = common::to_bytes(body).await.unwrap_or_default();
6551 let error = serde_json::from_str(&common::to_string(&bytes));
6552 let response = common::to_response(parts, bytes.into());
6553
6554 if let common::Retry::After(d) =
6555 dlg.http_failure(&response, error.as_ref().ok())
6556 {
6557 sleep(d).await;
6558 continue;
6559 }
6560
6561 dlg.finished(false);
6562
6563 return Err(match error {
6564 Ok(value) => common::Error::BadRequest(value),
6565 _ => common::Error::Failure(response),
6566 });
6567 }
6568 let response = {
6569 let bytes = common::to_bytes(body).await.unwrap_or_default();
6570 let encoded = common::to_string(&bytes);
6571 match serde_json::from_str(&encoded) {
6572 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6573 Err(error) => {
6574 dlg.response_json_decode_error(&encoded, &error);
6575 return Err(common::Error::JsonDecodeError(
6576 encoded.to_string(),
6577 error,
6578 ));
6579 }
6580 }
6581 };
6582
6583 dlg.finished(true);
6584 return Ok(response);
6585 }
6586 }
6587 }
6588 }
6589
6590 ///
6591 /// Sets the *request* property to the given value.
6592 ///
6593 /// Even though the property as already been set when instantiating this call,
6594 /// we provide this method for API completeness.
6595 pub fn request(
6596 mut self,
6597 new_value: GoogleFirebaseAppcheckV1betaDebugToken,
6598 ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6599 self._request = new_value;
6600 self
6601 }
6602 /// Required. The relative resource name of the debug token, in the format: ``` projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
6603 ///
6604 /// Sets the *name* path property to the given value.
6605 ///
6606 /// Even though the property as already been set when instantiating this call,
6607 /// we provide this method for API completeness.
6608 pub fn name(mut self, new_value: &str) -> ProjectAppDebugTokenPatchCall<'a, C> {
6609 self._name = new_value.to_string();
6610 self
6611 }
6612 /// Required. A comma-separated list of names of fields in the DebugToken to update. Example: `display_name`.
6613 ///
6614 /// Sets the *update mask* query property to the given value.
6615 pub fn update_mask(
6616 mut self,
6617 new_value: common::FieldMask,
6618 ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6619 self._update_mask = Some(new_value);
6620 self
6621 }
6622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6623 /// while executing the actual API request.
6624 ///
6625 /// ````text
6626 /// It should be used to handle progress information, and to implement a certain level of resilience.
6627 /// ````
6628 ///
6629 /// Sets the *delegate* property to the given value.
6630 pub fn delegate(
6631 mut self,
6632 new_value: &'a mut dyn common::Delegate,
6633 ) -> ProjectAppDebugTokenPatchCall<'a, C> {
6634 self._delegate = Some(new_value);
6635 self
6636 }
6637
6638 /// Set any additional parameter of the query string used in the request.
6639 /// It should be used to set parameters which are not yet available through their own
6640 /// setters.
6641 ///
6642 /// Please note that this method must not be used to set any of the known parameters
6643 /// which have their own setter method. If done anyway, the request will fail.
6644 ///
6645 /// # Additional Parameters
6646 ///
6647 /// * *$.xgafv* (query-string) - V1 error format.
6648 /// * *access_token* (query-string) - OAuth access token.
6649 /// * *alt* (query-string) - Data format for response.
6650 /// * *callback* (query-string) - JSONP
6651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6652 /// * *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.
6653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6655 /// * *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.
6656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6658 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDebugTokenPatchCall<'a, C>
6659 where
6660 T: AsRef<str>,
6661 {
6662 self._additional_params
6663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6664 self
6665 }
6666
6667 /// Identifies the authorization scope for the method you are building.
6668 ///
6669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6670 /// [`Scope::CloudPlatform`].
6671 ///
6672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6673 /// tokens for more than one scope.
6674 ///
6675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6677 /// sufficient, a read-write scope will do as well.
6678 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDebugTokenPatchCall<'a, C>
6679 where
6680 St: AsRef<str>,
6681 {
6682 self._scopes.insert(String::from(scope.as_ref()));
6683 self
6684 }
6685 /// Identifies the authorization scope(s) for the method you are building.
6686 ///
6687 /// See [`Self::add_scope()`] for details.
6688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDebugTokenPatchCall<'a, C>
6689 where
6690 I: IntoIterator<Item = St>,
6691 St: AsRef<str>,
6692 {
6693 self._scopes
6694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6695 self
6696 }
6697
6698 /// Removes all scopes, and no default scope will be used either.
6699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6700 /// for details).
6701 pub fn clear_scopes(mut self) -> ProjectAppDebugTokenPatchCall<'a, C> {
6702 self._scopes.clear();
6703 self
6704 }
6705}
6706
6707/// Atomically gets the DeviceCheckConfigs for the specified list of apps. For security reasons, the `private_key` field is never populated in the response.
6708///
6709/// A builder for the *apps.deviceCheckConfig.batchGet* method supported by a *project* resource.
6710/// It is not used directly, but through a [`ProjectMethods`] instance.
6711///
6712/// # Example
6713///
6714/// Instantiate a resource method builder
6715///
6716/// ```test_harness,no_run
6717/// # extern crate hyper;
6718/// # extern crate hyper_rustls;
6719/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
6720/// # async fn dox() {
6721/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6722///
6723/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6724/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6725/// # secret,
6726/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6727/// # ).build().await.unwrap();
6728///
6729/// # let client = hyper_util::client::legacy::Client::builder(
6730/// # hyper_util::rt::TokioExecutor::new()
6731/// # )
6732/// # .build(
6733/// # hyper_rustls::HttpsConnectorBuilder::new()
6734/// # .with_native_roots()
6735/// # .unwrap()
6736/// # .https_or_http()
6737/// # .enable_http1()
6738/// # .build()
6739/// # );
6740/// # let mut hub = Firebaseappcheck::new(client, auth);
6741/// // You can configure optional parameters by calling the respective setters at will, and
6742/// // execute the final call using `doit()`.
6743/// // Values shown here are possibly random and not representative !
6744/// let result = hub.projects().apps_device_check_config_batch_get("parent")
6745/// .add_names("invidunt")
6746/// .doit().await;
6747/// # }
6748/// ```
6749pub struct ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
6750where
6751 C: 'a,
6752{
6753 hub: &'a Firebaseappcheck<C>,
6754 _parent: String,
6755 _names: Vec<String>,
6756 _delegate: Option<&'a mut dyn common::Delegate>,
6757 _additional_params: HashMap<String, String>,
6758 _scopes: BTreeSet<String>,
6759}
6760
6761impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {}
6762
6763impl<'a, C> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
6764where
6765 C: common::Connector,
6766{
6767 /// Perform the operation you have build so far.
6768 pub async fn doit(
6769 mut self,
6770 ) -> common::Result<(
6771 common::Response,
6772 GoogleFirebaseAppcheckV1betaBatchGetDeviceCheckConfigsResponse,
6773 )> {
6774 use std::borrow::Cow;
6775 use std::io::{Read, Seek};
6776
6777 use common::{url::Params, ToParts};
6778 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6779
6780 let mut dd = common::DefaultDelegate;
6781 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6782 dlg.begin(common::MethodInfo {
6783 id: "firebaseappcheck.projects.apps.deviceCheckConfig.batchGet",
6784 http_method: hyper::Method::GET,
6785 });
6786
6787 for &field in ["alt", "parent", "names"].iter() {
6788 if self._additional_params.contains_key(field) {
6789 dlg.finished(false);
6790 return Err(common::Error::FieldClash(field));
6791 }
6792 }
6793
6794 let mut params = Params::with_capacity(4 + self._additional_params.len());
6795 params.push("parent", self._parent);
6796 if !self._names.is_empty() {
6797 for f in self._names.iter() {
6798 params.push("names", f);
6799 }
6800 }
6801
6802 params.extend(self._additional_params.iter());
6803
6804 params.push("alt", "json");
6805 let mut url =
6806 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/deviceCheckConfig:batchGet";
6807 if self._scopes.is_empty() {
6808 self._scopes
6809 .insert(Scope::CloudPlatform.as_ref().to_string());
6810 }
6811
6812 #[allow(clippy::single_element_loop)]
6813 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6814 url = params.uri_replacement(url, param_name, find_this, true);
6815 }
6816 {
6817 let to_remove = ["parent"];
6818 params.remove_params(&to_remove);
6819 }
6820
6821 let url = params.parse_with_url(&url);
6822
6823 loop {
6824 let token = match self
6825 .hub
6826 .auth
6827 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6828 .await
6829 {
6830 Ok(token) => token,
6831 Err(e) => match dlg.token(e) {
6832 Ok(token) => token,
6833 Err(e) => {
6834 dlg.finished(false);
6835 return Err(common::Error::MissingToken(e));
6836 }
6837 },
6838 };
6839 let mut req_result = {
6840 let client = &self.hub.client;
6841 dlg.pre_request();
6842 let mut req_builder = hyper::Request::builder()
6843 .method(hyper::Method::GET)
6844 .uri(url.as_str())
6845 .header(USER_AGENT, self.hub._user_agent.clone());
6846
6847 if let Some(token) = token.as_ref() {
6848 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6849 }
6850
6851 let request = req_builder
6852 .header(CONTENT_LENGTH, 0_u64)
6853 .body(common::to_body::<String>(None));
6854
6855 client.request(request.unwrap()).await
6856 };
6857
6858 match req_result {
6859 Err(err) => {
6860 if let common::Retry::After(d) = dlg.http_error(&err) {
6861 sleep(d).await;
6862 continue;
6863 }
6864 dlg.finished(false);
6865 return Err(common::Error::HttpError(err));
6866 }
6867 Ok(res) => {
6868 let (mut parts, body) = res.into_parts();
6869 let mut body = common::Body::new(body);
6870 if !parts.status.is_success() {
6871 let bytes = common::to_bytes(body).await.unwrap_or_default();
6872 let error = serde_json::from_str(&common::to_string(&bytes));
6873 let response = common::to_response(parts, bytes.into());
6874
6875 if let common::Retry::After(d) =
6876 dlg.http_failure(&response, error.as_ref().ok())
6877 {
6878 sleep(d).await;
6879 continue;
6880 }
6881
6882 dlg.finished(false);
6883
6884 return Err(match error {
6885 Ok(value) => common::Error::BadRequest(value),
6886 _ => common::Error::Failure(response),
6887 });
6888 }
6889 let response = {
6890 let bytes = common::to_bytes(body).await.unwrap_or_default();
6891 let encoded = common::to_string(&bytes);
6892 match serde_json::from_str(&encoded) {
6893 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6894 Err(error) => {
6895 dlg.response_json_decode_error(&encoded, &error);
6896 return Err(common::Error::JsonDecodeError(
6897 encoded.to_string(),
6898 error,
6899 ));
6900 }
6901 }
6902 };
6903
6904 dlg.finished(true);
6905 return Ok(response);
6906 }
6907 }
6908 }
6909 }
6910
6911 /// 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.
6912 ///
6913 /// Sets the *parent* path property to the given value.
6914 ///
6915 /// Even though the property as already been set when instantiating this call,
6916 /// we provide this method for API completeness.
6917 pub fn parent(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
6918 self._parent = new_value.to_string();
6919 self
6920 }
6921 /// 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.
6922 ///
6923 /// Append the given value to the *names* query property.
6924 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6925 pub fn add_names(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
6926 self._names.push(new_value.to_string());
6927 self
6928 }
6929 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6930 /// while executing the actual API request.
6931 ///
6932 /// ````text
6933 /// It should be used to handle progress information, and to implement a certain level of resilience.
6934 /// ````
6935 ///
6936 /// Sets the *delegate* property to the given value.
6937 pub fn delegate(
6938 mut self,
6939 new_value: &'a mut dyn common::Delegate,
6940 ) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
6941 self._delegate = Some(new_value);
6942 self
6943 }
6944
6945 /// Set any additional parameter of the query string used in the request.
6946 /// It should be used to set parameters which are not yet available through their own
6947 /// setters.
6948 ///
6949 /// Please note that this method must not be used to set any of the known parameters
6950 /// which have their own setter method. If done anyway, the request will fail.
6951 ///
6952 /// # Additional Parameters
6953 ///
6954 /// * *$.xgafv* (query-string) - V1 error format.
6955 /// * *access_token* (query-string) - OAuth access token.
6956 /// * *alt* (query-string) - Data format for response.
6957 /// * *callback* (query-string) - JSONP
6958 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6959 /// * *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.
6960 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6961 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6962 /// * *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.
6963 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6964 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6965 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
6966 where
6967 T: AsRef<str>,
6968 {
6969 self._additional_params
6970 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6971 self
6972 }
6973
6974 /// Identifies the authorization scope for the method you are building.
6975 ///
6976 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6977 /// [`Scope::CloudPlatform`].
6978 ///
6979 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6980 /// tokens for more than one scope.
6981 ///
6982 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6983 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6984 /// sufficient, a read-write scope will do as well.
6985 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
6986 where
6987 St: AsRef<str>,
6988 {
6989 self._scopes.insert(String::from(scope.as_ref()));
6990 self
6991 }
6992 /// Identifies the authorization scope(s) for the method you are building.
6993 ///
6994 /// See [`Self::add_scope()`] for details.
6995 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C>
6996 where
6997 I: IntoIterator<Item = St>,
6998 St: AsRef<str>,
6999 {
7000 self._scopes
7001 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7002 self
7003 }
7004
7005 /// Removes all scopes, and no default scope will be used either.
7006 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7007 /// for details).
7008 pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigBatchGetCall<'a, C> {
7009 self._scopes.clear();
7010 self
7011 }
7012}
7013
7014/// Gets the DeviceCheckConfig for the specified app. For security reasons, the `private_key` field is never populated in the response.
7015///
7016/// A builder for the *apps.deviceCheckConfig.get* method supported by a *project* resource.
7017/// It is not used directly, but through a [`ProjectMethods`] instance.
7018///
7019/// # Example
7020///
7021/// Instantiate a resource method builder
7022///
7023/// ```test_harness,no_run
7024/// # extern crate hyper;
7025/// # extern crate hyper_rustls;
7026/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7027/// # async fn dox() {
7028/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7029///
7030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7032/// # secret,
7033/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7034/// # ).build().await.unwrap();
7035///
7036/// # let client = hyper_util::client::legacy::Client::builder(
7037/// # hyper_util::rt::TokioExecutor::new()
7038/// # )
7039/// # .build(
7040/// # hyper_rustls::HttpsConnectorBuilder::new()
7041/// # .with_native_roots()
7042/// # .unwrap()
7043/// # .https_or_http()
7044/// # .enable_http1()
7045/// # .build()
7046/// # );
7047/// # let mut hub = Firebaseappcheck::new(client, auth);
7048/// // You can configure optional parameters by calling the respective setters at will, and
7049/// // execute the final call using `doit()`.
7050/// // Values shown here are possibly random and not representative !
7051/// let result = hub.projects().apps_device_check_config_get("name")
7052/// .doit().await;
7053/// # }
7054/// ```
7055pub struct ProjectAppDeviceCheckConfigGetCall<'a, C>
7056where
7057 C: 'a,
7058{
7059 hub: &'a Firebaseappcheck<C>,
7060 _name: String,
7061 _delegate: Option<&'a mut dyn common::Delegate>,
7062 _additional_params: HashMap<String, String>,
7063 _scopes: BTreeSet<String>,
7064}
7065
7066impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigGetCall<'a, C> {}
7067
7068impl<'a, C> ProjectAppDeviceCheckConfigGetCall<'a, C>
7069where
7070 C: common::Connector,
7071{
7072 /// Perform the operation you have build so far.
7073 pub async fn doit(
7074 mut self,
7075 ) -> common::Result<(
7076 common::Response,
7077 GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7078 )> {
7079 use std::borrow::Cow;
7080 use std::io::{Read, Seek};
7081
7082 use common::{url::Params, ToParts};
7083 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7084
7085 let mut dd = common::DefaultDelegate;
7086 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7087 dlg.begin(common::MethodInfo {
7088 id: "firebaseappcheck.projects.apps.deviceCheckConfig.get",
7089 http_method: hyper::Method::GET,
7090 });
7091
7092 for &field in ["alt", "name"].iter() {
7093 if self._additional_params.contains_key(field) {
7094 dlg.finished(false);
7095 return Err(common::Error::FieldClash(field));
7096 }
7097 }
7098
7099 let mut params = Params::with_capacity(3 + self._additional_params.len());
7100 params.push("name", self._name);
7101
7102 params.extend(self._additional_params.iter());
7103
7104 params.push("alt", "json");
7105 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7106 if self._scopes.is_empty() {
7107 self._scopes
7108 .insert(Scope::CloudPlatform.as_ref().to_string());
7109 }
7110
7111 #[allow(clippy::single_element_loop)]
7112 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7113 url = params.uri_replacement(url, param_name, find_this, true);
7114 }
7115 {
7116 let to_remove = ["name"];
7117 params.remove_params(&to_remove);
7118 }
7119
7120 let url = params.parse_with_url(&url);
7121
7122 loop {
7123 let token = match self
7124 .hub
7125 .auth
7126 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7127 .await
7128 {
7129 Ok(token) => token,
7130 Err(e) => match dlg.token(e) {
7131 Ok(token) => token,
7132 Err(e) => {
7133 dlg.finished(false);
7134 return Err(common::Error::MissingToken(e));
7135 }
7136 },
7137 };
7138 let mut req_result = {
7139 let client = &self.hub.client;
7140 dlg.pre_request();
7141 let mut req_builder = hyper::Request::builder()
7142 .method(hyper::Method::GET)
7143 .uri(url.as_str())
7144 .header(USER_AGENT, self.hub._user_agent.clone());
7145
7146 if let Some(token) = token.as_ref() {
7147 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7148 }
7149
7150 let request = req_builder
7151 .header(CONTENT_LENGTH, 0_u64)
7152 .body(common::to_body::<String>(None));
7153
7154 client.request(request.unwrap()).await
7155 };
7156
7157 match req_result {
7158 Err(err) => {
7159 if let common::Retry::After(d) = dlg.http_error(&err) {
7160 sleep(d).await;
7161 continue;
7162 }
7163 dlg.finished(false);
7164 return Err(common::Error::HttpError(err));
7165 }
7166 Ok(res) => {
7167 let (mut parts, body) = res.into_parts();
7168 let mut body = common::Body::new(body);
7169 if !parts.status.is_success() {
7170 let bytes = common::to_bytes(body).await.unwrap_or_default();
7171 let error = serde_json::from_str(&common::to_string(&bytes));
7172 let response = common::to_response(parts, bytes.into());
7173
7174 if let common::Retry::After(d) =
7175 dlg.http_failure(&response, error.as_ref().ok())
7176 {
7177 sleep(d).await;
7178 continue;
7179 }
7180
7181 dlg.finished(false);
7182
7183 return Err(match error {
7184 Ok(value) => common::Error::BadRequest(value),
7185 _ => common::Error::Failure(response),
7186 });
7187 }
7188 let response = {
7189 let bytes = common::to_bytes(body).await.unwrap_or_default();
7190 let encoded = common::to_string(&bytes);
7191 match serde_json::from_str(&encoded) {
7192 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7193 Err(error) => {
7194 dlg.response_json_decode_error(&encoded, &error);
7195 return Err(common::Error::JsonDecodeError(
7196 encoded.to_string(),
7197 error,
7198 ));
7199 }
7200 }
7201 };
7202
7203 dlg.finished(true);
7204 return Ok(response);
7205 }
7206 }
7207 }
7208 }
7209
7210 /// Required. The relative resource name of the DeviceCheckConfig, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
7211 ///
7212 /// Sets the *name* path property to the given value.
7213 ///
7214 /// Even though the property as already been set when instantiating this call,
7215 /// we provide this method for API completeness.
7216 pub fn name(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7217 self._name = new_value.to_string();
7218 self
7219 }
7220 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7221 /// while executing the actual API request.
7222 ///
7223 /// ````text
7224 /// It should be used to handle progress information, and to implement a certain level of resilience.
7225 /// ````
7226 ///
7227 /// Sets the *delegate* property to the given value.
7228 pub fn delegate(
7229 mut self,
7230 new_value: &'a mut dyn common::Delegate,
7231 ) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7232 self._delegate = Some(new_value);
7233 self
7234 }
7235
7236 /// Set any additional parameter of the query string used in the request.
7237 /// It should be used to set parameters which are not yet available through their own
7238 /// setters.
7239 ///
7240 /// Please note that this method must not be used to set any of the known parameters
7241 /// which have their own setter method. If done anyway, the request will fail.
7242 ///
7243 /// # Additional Parameters
7244 ///
7245 /// * *$.xgafv* (query-string) - V1 error format.
7246 /// * *access_token* (query-string) - OAuth access token.
7247 /// * *alt* (query-string) - Data format for response.
7248 /// * *callback* (query-string) - JSONP
7249 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7250 /// * *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.
7251 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7252 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7253 /// * *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.
7254 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7255 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7256 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7257 where
7258 T: AsRef<str>,
7259 {
7260 self._additional_params
7261 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7262 self
7263 }
7264
7265 /// Identifies the authorization scope for the method you are building.
7266 ///
7267 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7268 /// [`Scope::CloudPlatform`].
7269 ///
7270 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7271 /// tokens for more than one scope.
7272 ///
7273 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7274 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7275 /// sufficient, a read-write scope will do as well.
7276 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7277 where
7278 St: AsRef<str>,
7279 {
7280 self._scopes.insert(String::from(scope.as_ref()));
7281 self
7282 }
7283 /// Identifies the authorization scope(s) for the method you are building.
7284 ///
7285 /// See [`Self::add_scope()`] for details.
7286 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigGetCall<'a, C>
7287 where
7288 I: IntoIterator<Item = St>,
7289 St: AsRef<str>,
7290 {
7291 self._scopes
7292 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7293 self
7294 }
7295
7296 /// Removes all scopes, and no default scope will be used either.
7297 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7298 /// for details).
7299 pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigGetCall<'a, C> {
7300 self._scopes.clear();
7301 self
7302 }
7303}
7304
7305/// 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.
7306///
7307/// A builder for the *apps.deviceCheckConfig.patch* method supported by a *project* resource.
7308/// It is not used directly, but through a [`ProjectMethods`] instance.
7309///
7310/// # Example
7311///
7312/// Instantiate a resource method builder
7313///
7314/// ```test_harness,no_run
7315/// # extern crate hyper;
7316/// # extern crate hyper_rustls;
7317/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7318/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaDeviceCheckConfig;
7319/// # async fn dox() {
7320/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7321///
7322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7324/// # secret,
7325/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7326/// # ).build().await.unwrap();
7327///
7328/// # let client = hyper_util::client::legacy::Client::builder(
7329/// # hyper_util::rt::TokioExecutor::new()
7330/// # )
7331/// # .build(
7332/// # hyper_rustls::HttpsConnectorBuilder::new()
7333/// # .with_native_roots()
7334/// # .unwrap()
7335/// # .https_or_http()
7336/// # .enable_http1()
7337/// # .build()
7338/// # );
7339/// # let mut hub = Firebaseappcheck::new(client, auth);
7340/// // As the method needs a request, you would usually fill it with the desired information
7341/// // into the respective structure. Some of the parts shown here might not be applicable !
7342/// // Values shown here are possibly random and not representative !
7343/// let mut req = GoogleFirebaseAppcheckV1betaDeviceCheckConfig::default();
7344///
7345/// // You can configure optional parameters by calling the respective setters at will, and
7346/// // execute the final call using `doit()`.
7347/// // Values shown here are possibly random and not representative !
7348/// let result = hub.projects().apps_device_check_config_patch(req, "name")
7349/// .update_mask(FieldMask::new::<&str>(&[]))
7350/// .doit().await;
7351/// # }
7352/// ```
7353pub struct ProjectAppDeviceCheckConfigPatchCall<'a, C>
7354where
7355 C: 'a,
7356{
7357 hub: &'a Firebaseappcheck<C>,
7358 _request: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7359 _name: String,
7360 _update_mask: Option<common::FieldMask>,
7361 _delegate: Option<&'a mut dyn common::Delegate>,
7362 _additional_params: HashMap<String, String>,
7363 _scopes: BTreeSet<String>,
7364}
7365
7366impl<'a, C> common::CallBuilder for ProjectAppDeviceCheckConfigPatchCall<'a, C> {}
7367
7368impl<'a, C> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7369where
7370 C: common::Connector,
7371{
7372 /// Perform the operation you have build so far.
7373 pub async fn doit(
7374 mut self,
7375 ) -> common::Result<(
7376 common::Response,
7377 GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7378 )> {
7379 use std::borrow::Cow;
7380 use std::io::{Read, Seek};
7381
7382 use common::{url::Params, ToParts};
7383 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7384
7385 let mut dd = common::DefaultDelegate;
7386 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7387 dlg.begin(common::MethodInfo {
7388 id: "firebaseappcheck.projects.apps.deviceCheckConfig.patch",
7389 http_method: hyper::Method::PATCH,
7390 });
7391
7392 for &field in ["alt", "name", "updateMask"].iter() {
7393 if self._additional_params.contains_key(field) {
7394 dlg.finished(false);
7395 return Err(common::Error::FieldClash(field));
7396 }
7397 }
7398
7399 let mut params = Params::with_capacity(5 + self._additional_params.len());
7400 params.push("name", self._name);
7401 if let Some(value) = self._update_mask.as_ref() {
7402 params.push("updateMask", value.to_string());
7403 }
7404
7405 params.extend(self._additional_params.iter());
7406
7407 params.push("alt", "json");
7408 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7409 if self._scopes.is_empty() {
7410 self._scopes
7411 .insert(Scope::CloudPlatform.as_ref().to_string());
7412 }
7413
7414 #[allow(clippy::single_element_loop)]
7415 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7416 url = params.uri_replacement(url, param_name, find_this, true);
7417 }
7418 {
7419 let to_remove = ["name"];
7420 params.remove_params(&to_remove);
7421 }
7422
7423 let url = params.parse_with_url(&url);
7424
7425 let mut json_mime_type = mime::APPLICATION_JSON;
7426 let mut request_value_reader = {
7427 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7428 common::remove_json_null_values(&mut value);
7429 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7430 serde_json::to_writer(&mut dst, &value).unwrap();
7431 dst
7432 };
7433 let request_size = request_value_reader
7434 .seek(std::io::SeekFrom::End(0))
7435 .unwrap();
7436 request_value_reader
7437 .seek(std::io::SeekFrom::Start(0))
7438 .unwrap();
7439
7440 loop {
7441 let token = match self
7442 .hub
7443 .auth
7444 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7445 .await
7446 {
7447 Ok(token) => token,
7448 Err(e) => match dlg.token(e) {
7449 Ok(token) => token,
7450 Err(e) => {
7451 dlg.finished(false);
7452 return Err(common::Error::MissingToken(e));
7453 }
7454 },
7455 };
7456 request_value_reader
7457 .seek(std::io::SeekFrom::Start(0))
7458 .unwrap();
7459 let mut req_result = {
7460 let client = &self.hub.client;
7461 dlg.pre_request();
7462 let mut req_builder = hyper::Request::builder()
7463 .method(hyper::Method::PATCH)
7464 .uri(url.as_str())
7465 .header(USER_AGENT, self.hub._user_agent.clone());
7466
7467 if let Some(token) = token.as_ref() {
7468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7469 }
7470
7471 let request = req_builder
7472 .header(CONTENT_TYPE, json_mime_type.to_string())
7473 .header(CONTENT_LENGTH, request_size as u64)
7474 .body(common::to_body(
7475 request_value_reader.get_ref().clone().into(),
7476 ));
7477
7478 client.request(request.unwrap()).await
7479 };
7480
7481 match req_result {
7482 Err(err) => {
7483 if let common::Retry::After(d) = dlg.http_error(&err) {
7484 sleep(d).await;
7485 continue;
7486 }
7487 dlg.finished(false);
7488 return Err(common::Error::HttpError(err));
7489 }
7490 Ok(res) => {
7491 let (mut parts, body) = res.into_parts();
7492 let mut body = common::Body::new(body);
7493 if !parts.status.is_success() {
7494 let bytes = common::to_bytes(body).await.unwrap_or_default();
7495 let error = serde_json::from_str(&common::to_string(&bytes));
7496 let response = common::to_response(parts, bytes.into());
7497
7498 if let common::Retry::After(d) =
7499 dlg.http_failure(&response, error.as_ref().ok())
7500 {
7501 sleep(d).await;
7502 continue;
7503 }
7504
7505 dlg.finished(false);
7506
7507 return Err(match error {
7508 Ok(value) => common::Error::BadRequest(value),
7509 _ => common::Error::Failure(response),
7510 });
7511 }
7512 let response = {
7513 let bytes = common::to_bytes(body).await.unwrap_or_default();
7514 let encoded = common::to_string(&bytes);
7515 match serde_json::from_str(&encoded) {
7516 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7517 Err(error) => {
7518 dlg.response_json_decode_error(&encoded, &error);
7519 return Err(common::Error::JsonDecodeError(
7520 encoded.to_string(),
7521 error,
7522 ));
7523 }
7524 }
7525 };
7526
7527 dlg.finished(true);
7528 return Ok(response);
7529 }
7530 }
7531 }
7532 }
7533
7534 ///
7535 /// Sets the *request* property to the given value.
7536 ///
7537 /// Even though the property as already been set when instantiating this call,
7538 /// we provide this method for API completeness.
7539 pub fn request(
7540 mut self,
7541 new_value: GoogleFirebaseAppcheckV1betaDeviceCheckConfig,
7542 ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7543 self._request = new_value;
7544 self
7545 }
7546 /// Required. The relative resource name of the DeviceCheck configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/deviceCheckConfig ```
7547 ///
7548 /// Sets the *name* path property to the given value.
7549 ///
7550 /// Even though the property as already been set when instantiating this call,
7551 /// we provide this method for API completeness.
7552 pub fn name(mut self, new_value: &str) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7553 self._name = new_value.to_string();
7554 self
7555 }
7556 /// Required. A comma-separated list of names of fields in the DeviceCheckConfig to update. Example: `key_id,private_key`.
7557 ///
7558 /// Sets the *update mask* query property to the given value.
7559 pub fn update_mask(
7560 mut self,
7561 new_value: common::FieldMask,
7562 ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7563 self._update_mask = Some(new_value);
7564 self
7565 }
7566 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7567 /// while executing the actual API request.
7568 ///
7569 /// ````text
7570 /// It should be used to handle progress information, and to implement a certain level of resilience.
7571 /// ````
7572 ///
7573 /// Sets the *delegate* property to the given value.
7574 pub fn delegate(
7575 mut self,
7576 new_value: &'a mut dyn common::Delegate,
7577 ) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7578 self._delegate = Some(new_value);
7579 self
7580 }
7581
7582 /// Set any additional parameter of the query string used in the request.
7583 /// It should be used to set parameters which are not yet available through their own
7584 /// setters.
7585 ///
7586 /// Please note that this method must not be used to set any of the known parameters
7587 /// which have their own setter method. If done anyway, the request will fail.
7588 ///
7589 /// # Additional Parameters
7590 ///
7591 /// * *$.xgafv* (query-string) - V1 error format.
7592 /// * *access_token* (query-string) - OAuth access token.
7593 /// * *alt* (query-string) - Data format for response.
7594 /// * *callback* (query-string) - JSONP
7595 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7596 /// * *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.
7597 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7598 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7599 /// * *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.
7600 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7601 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7602 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7603 where
7604 T: AsRef<str>,
7605 {
7606 self._additional_params
7607 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7608 self
7609 }
7610
7611 /// Identifies the authorization scope for the method you are building.
7612 ///
7613 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7614 /// [`Scope::CloudPlatform`].
7615 ///
7616 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7617 /// tokens for more than one scope.
7618 ///
7619 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7620 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7621 /// sufficient, a read-write scope will do as well.
7622 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7623 where
7624 St: AsRef<str>,
7625 {
7626 self._scopes.insert(String::from(scope.as_ref()));
7627 self
7628 }
7629 /// Identifies the authorization scope(s) for the method you are building.
7630 ///
7631 /// See [`Self::add_scope()`] for details.
7632 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppDeviceCheckConfigPatchCall<'a, C>
7633 where
7634 I: IntoIterator<Item = St>,
7635 St: AsRef<str>,
7636 {
7637 self._scopes
7638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7639 self
7640 }
7641
7642 /// Removes all scopes, and no default scope will be used either.
7643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7644 /// for details).
7645 pub fn clear_scopes(mut self) -> ProjectAppDeviceCheckConfigPatchCall<'a, C> {
7646 self._scopes.clear();
7647 self
7648 }
7649}
7650
7651/// Atomically gets the PlayIntegrityConfigs for the specified list of apps.
7652///
7653/// A builder for the *apps.playIntegrityConfig.batchGet* method supported by a *project* resource.
7654/// It is not used directly, but through a [`ProjectMethods`] instance.
7655///
7656/// # Example
7657///
7658/// Instantiate a resource method builder
7659///
7660/// ```test_harness,no_run
7661/// # extern crate hyper;
7662/// # extern crate hyper_rustls;
7663/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7664/// # async fn dox() {
7665/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7666///
7667/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7668/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7669/// # secret,
7670/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7671/// # ).build().await.unwrap();
7672///
7673/// # let client = hyper_util::client::legacy::Client::builder(
7674/// # hyper_util::rt::TokioExecutor::new()
7675/// # )
7676/// # .build(
7677/// # hyper_rustls::HttpsConnectorBuilder::new()
7678/// # .with_native_roots()
7679/// # .unwrap()
7680/// # .https_or_http()
7681/// # .enable_http1()
7682/// # .build()
7683/// # );
7684/// # let mut hub = Firebaseappcheck::new(client, auth);
7685/// // You can configure optional parameters by calling the respective setters at will, and
7686/// // execute the final call using `doit()`.
7687/// // Values shown here are possibly random and not representative !
7688/// let result = hub.projects().apps_play_integrity_config_batch_get("parent")
7689/// .add_names("sed")
7690/// .doit().await;
7691/// # }
7692/// ```
7693pub struct ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
7694where
7695 C: 'a,
7696{
7697 hub: &'a Firebaseappcheck<C>,
7698 _parent: String,
7699 _names: Vec<String>,
7700 _delegate: Option<&'a mut dyn common::Delegate>,
7701 _additional_params: HashMap<String, String>,
7702 _scopes: BTreeSet<String>,
7703}
7704
7705impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {}
7706
7707impl<'a, C> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
7708where
7709 C: common::Connector,
7710{
7711 /// Perform the operation you have build so far.
7712 pub async fn doit(
7713 mut self,
7714 ) -> common::Result<(
7715 common::Response,
7716 GoogleFirebaseAppcheckV1betaBatchGetPlayIntegrityConfigsResponse,
7717 )> {
7718 use std::borrow::Cow;
7719 use std::io::{Read, Seek};
7720
7721 use common::{url::Params, ToParts};
7722 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7723
7724 let mut dd = common::DefaultDelegate;
7725 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7726 dlg.begin(common::MethodInfo {
7727 id: "firebaseappcheck.projects.apps.playIntegrityConfig.batchGet",
7728 http_method: hyper::Method::GET,
7729 });
7730
7731 for &field in ["alt", "parent", "names"].iter() {
7732 if self._additional_params.contains_key(field) {
7733 dlg.finished(false);
7734 return Err(common::Error::FieldClash(field));
7735 }
7736 }
7737
7738 let mut params = Params::with_capacity(4 + self._additional_params.len());
7739 params.push("parent", self._parent);
7740 if !self._names.is_empty() {
7741 for f in self._names.iter() {
7742 params.push("names", f);
7743 }
7744 }
7745
7746 params.extend(self._additional_params.iter());
7747
7748 params.push("alt", "json");
7749 let mut url =
7750 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/playIntegrityConfig:batchGet";
7751 if self._scopes.is_empty() {
7752 self._scopes
7753 .insert(Scope::CloudPlatform.as_ref().to_string());
7754 }
7755
7756 #[allow(clippy::single_element_loop)]
7757 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7758 url = params.uri_replacement(url, param_name, find_this, true);
7759 }
7760 {
7761 let to_remove = ["parent"];
7762 params.remove_params(&to_remove);
7763 }
7764
7765 let url = params.parse_with_url(&url);
7766
7767 loop {
7768 let token = match self
7769 .hub
7770 .auth
7771 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7772 .await
7773 {
7774 Ok(token) => token,
7775 Err(e) => match dlg.token(e) {
7776 Ok(token) => token,
7777 Err(e) => {
7778 dlg.finished(false);
7779 return Err(common::Error::MissingToken(e));
7780 }
7781 },
7782 };
7783 let mut req_result = {
7784 let client = &self.hub.client;
7785 dlg.pre_request();
7786 let mut req_builder = hyper::Request::builder()
7787 .method(hyper::Method::GET)
7788 .uri(url.as_str())
7789 .header(USER_AGENT, self.hub._user_agent.clone());
7790
7791 if let Some(token) = token.as_ref() {
7792 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7793 }
7794
7795 let request = req_builder
7796 .header(CONTENT_LENGTH, 0_u64)
7797 .body(common::to_body::<String>(None));
7798
7799 client.request(request.unwrap()).await
7800 };
7801
7802 match req_result {
7803 Err(err) => {
7804 if let common::Retry::After(d) = dlg.http_error(&err) {
7805 sleep(d).await;
7806 continue;
7807 }
7808 dlg.finished(false);
7809 return Err(common::Error::HttpError(err));
7810 }
7811 Ok(res) => {
7812 let (mut parts, body) = res.into_parts();
7813 let mut body = common::Body::new(body);
7814 if !parts.status.is_success() {
7815 let bytes = common::to_bytes(body).await.unwrap_or_default();
7816 let error = serde_json::from_str(&common::to_string(&bytes));
7817 let response = common::to_response(parts, bytes.into());
7818
7819 if let common::Retry::After(d) =
7820 dlg.http_failure(&response, error.as_ref().ok())
7821 {
7822 sleep(d).await;
7823 continue;
7824 }
7825
7826 dlg.finished(false);
7827
7828 return Err(match error {
7829 Ok(value) => common::Error::BadRequest(value),
7830 _ => common::Error::Failure(response),
7831 });
7832 }
7833 let response = {
7834 let bytes = common::to_bytes(body).await.unwrap_or_default();
7835 let encoded = common::to_string(&bytes);
7836 match serde_json::from_str(&encoded) {
7837 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7838 Err(error) => {
7839 dlg.response_json_decode_error(&encoded, &error);
7840 return Err(common::Error::JsonDecodeError(
7841 encoded.to_string(),
7842 error,
7843 ));
7844 }
7845 }
7846 };
7847
7848 dlg.finished(true);
7849 return Ok(response);
7850 }
7851 }
7852 }
7853 }
7854
7855 /// 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.
7856 ///
7857 /// Sets the *parent* path property to the given value.
7858 ///
7859 /// Even though the property as already been set when instantiating this call,
7860 /// we provide this method for API completeness.
7861 pub fn parent(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
7862 self._parent = new_value.to_string();
7863 self
7864 }
7865 /// 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.
7866 ///
7867 /// Append the given value to the *names* query property.
7868 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7869 pub fn add_names(
7870 mut self,
7871 new_value: &str,
7872 ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
7873 self._names.push(new_value.to_string());
7874 self
7875 }
7876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7877 /// while executing the actual API request.
7878 ///
7879 /// ````text
7880 /// It should be used to handle progress information, and to implement a certain level of resilience.
7881 /// ````
7882 ///
7883 /// Sets the *delegate* property to the given value.
7884 pub fn delegate(
7885 mut self,
7886 new_value: &'a mut dyn common::Delegate,
7887 ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
7888 self._delegate = Some(new_value);
7889 self
7890 }
7891
7892 /// Set any additional parameter of the query string used in the request.
7893 /// It should be used to set parameters which are not yet available through their own
7894 /// setters.
7895 ///
7896 /// Please note that this method must not be used to set any of the known parameters
7897 /// which have their own setter method. If done anyway, the request will fail.
7898 ///
7899 /// # Additional Parameters
7900 ///
7901 /// * *$.xgafv* (query-string) - V1 error format.
7902 /// * *access_token* (query-string) - OAuth access token.
7903 /// * *alt* (query-string) - Data format for response.
7904 /// * *callback* (query-string) - JSONP
7905 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7906 /// * *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.
7907 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7908 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7909 /// * *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.
7910 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7911 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7912 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
7913 where
7914 T: AsRef<str>,
7915 {
7916 self._additional_params
7917 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7918 self
7919 }
7920
7921 /// Identifies the authorization scope for the method you are building.
7922 ///
7923 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7924 /// [`Scope::CloudPlatform`].
7925 ///
7926 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7927 /// tokens for more than one scope.
7928 ///
7929 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7930 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7931 /// sufficient, a read-write scope will do as well.
7932 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
7933 where
7934 St: AsRef<str>,
7935 {
7936 self._scopes.insert(String::from(scope.as_ref()));
7937 self
7938 }
7939 /// Identifies the authorization scope(s) for the method you are building.
7940 ///
7941 /// See [`Self::add_scope()`] for details.
7942 pub fn add_scopes<I, St>(
7943 mut self,
7944 scopes: I,
7945 ) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C>
7946 where
7947 I: IntoIterator<Item = St>,
7948 St: AsRef<str>,
7949 {
7950 self._scopes
7951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7952 self
7953 }
7954
7955 /// Removes all scopes, and no default scope will be used either.
7956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7957 /// for details).
7958 pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigBatchGetCall<'a, C> {
7959 self._scopes.clear();
7960 self
7961 }
7962}
7963
7964/// Gets the PlayIntegrityConfig for the specified app.
7965///
7966/// A builder for the *apps.playIntegrityConfig.get* method supported by a *project* resource.
7967/// It is not used directly, but through a [`ProjectMethods`] instance.
7968///
7969/// # Example
7970///
7971/// Instantiate a resource method builder
7972///
7973/// ```test_harness,no_run
7974/// # extern crate hyper;
7975/// # extern crate hyper_rustls;
7976/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
7977/// # async fn dox() {
7978/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7979///
7980/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7982/// # secret,
7983/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7984/// # ).build().await.unwrap();
7985///
7986/// # let client = hyper_util::client::legacy::Client::builder(
7987/// # hyper_util::rt::TokioExecutor::new()
7988/// # )
7989/// # .build(
7990/// # hyper_rustls::HttpsConnectorBuilder::new()
7991/// # .with_native_roots()
7992/// # .unwrap()
7993/// # .https_or_http()
7994/// # .enable_http1()
7995/// # .build()
7996/// # );
7997/// # let mut hub = Firebaseappcheck::new(client, auth);
7998/// // You can configure optional parameters by calling the respective setters at will, and
7999/// // execute the final call using `doit()`.
8000/// // Values shown here are possibly random and not representative !
8001/// let result = hub.projects().apps_play_integrity_config_get("name")
8002/// .doit().await;
8003/// # }
8004/// ```
8005pub struct ProjectAppPlayIntegrityConfigGetCall<'a, C>
8006where
8007 C: 'a,
8008{
8009 hub: &'a Firebaseappcheck<C>,
8010 _name: String,
8011 _delegate: Option<&'a mut dyn common::Delegate>,
8012 _additional_params: HashMap<String, String>,
8013 _scopes: BTreeSet<String>,
8014}
8015
8016impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigGetCall<'a, C> {}
8017
8018impl<'a, C> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8019where
8020 C: common::Connector,
8021{
8022 /// Perform the operation you have build so far.
8023 pub async fn doit(
8024 mut self,
8025 ) -> common::Result<(
8026 common::Response,
8027 GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8028 )> {
8029 use std::borrow::Cow;
8030 use std::io::{Read, Seek};
8031
8032 use common::{url::Params, ToParts};
8033 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8034
8035 let mut dd = common::DefaultDelegate;
8036 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8037 dlg.begin(common::MethodInfo {
8038 id: "firebaseappcheck.projects.apps.playIntegrityConfig.get",
8039 http_method: hyper::Method::GET,
8040 });
8041
8042 for &field in ["alt", "name"].iter() {
8043 if self._additional_params.contains_key(field) {
8044 dlg.finished(false);
8045 return Err(common::Error::FieldClash(field));
8046 }
8047 }
8048
8049 let mut params = Params::with_capacity(3 + self._additional_params.len());
8050 params.push("name", self._name);
8051
8052 params.extend(self._additional_params.iter());
8053
8054 params.push("alt", "json");
8055 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
8056 if self._scopes.is_empty() {
8057 self._scopes
8058 .insert(Scope::CloudPlatform.as_ref().to_string());
8059 }
8060
8061 #[allow(clippy::single_element_loop)]
8062 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8063 url = params.uri_replacement(url, param_name, find_this, true);
8064 }
8065 {
8066 let to_remove = ["name"];
8067 params.remove_params(&to_remove);
8068 }
8069
8070 let url = params.parse_with_url(&url);
8071
8072 loop {
8073 let token = match self
8074 .hub
8075 .auth
8076 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8077 .await
8078 {
8079 Ok(token) => token,
8080 Err(e) => match dlg.token(e) {
8081 Ok(token) => token,
8082 Err(e) => {
8083 dlg.finished(false);
8084 return Err(common::Error::MissingToken(e));
8085 }
8086 },
8087 };
8088 let mut req_result = {
8089 let client = &self.hub.client;
8090 dlg.pre_request();
8091 let mut req_builder = hyper::Request::builder()
8092 .method(hyper::Method::GET)
8093 .uri(url.as_str())
8094 .header(USER_AGENT, self.hub._user_agent.clone());
8095
8096 if let Some(token) = token.as_ref() {
8097 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8098 }
8099
8100 let request = req_builder
8101 .header(CONTENT_LENGTH, 0_u64)
8102 .body(common::to_body::<String>(None));
8103
8104 client.request(request.unwrap()).await
8105 };
8106
8107 match req_result {
8108 Err(err) => {
8109 if let common::Retry::After(d) = dlg.http_error(&err) {
8110 sleep(d).await;
8111 continue;
8112 }
8113 dlg.finished(false);
8114 return Err(common::Error::HttpError(err));
8115 }
8116 Ok(res) => {
8117 let (mut parts, body) = res.into_parts();
8118 let mut body = common::Body::new(body);
8119 if !parts.status.is_success() {
8120 let bytes = common::to_bytes(body).await.unwrap_or_default();
8121 let error = serde_json::from_str(&common::to_string(&bytes));
8122 let response = common::to_response(parts, bytes.into());
8123
8124 if let common::Retry::After(d) =
8125 dlg.http_failure(&response, error.as_ref().ok())
8126 {
8127 sleep(d).await;
8128 continue;
8129 }
8130
8131 dlg.finished(false);
8132
8133 return Err(match error {
8134 Ok(value) => common::Error::BadRequest(value),
8135 _ => common::Error::Failure(response),
8136 });
8137 }
8138 let response = {
8139 let bytes = common::to_bytes(body).await.unwrap_or_default();
8140 let encoded = common::to_string(&bytes);
8141 match serde_json::from_str(&encoded) {
8142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8143 Err(error) => {
8144 dlg.response_json_decode_error(&encoded, &error);
8145 return Err(common::Error::JsonDecodeError(
8146 encoded.to_string(),
8147 error,
8148 ));
8149 }
8150 }
8151 };
8152
8153 dlg.finished(true);
8154 return Ok(response);
8155 }
8156 }
8157 }
8158 }
8159
8160 /// Required. The relative resource name of the PlayIntegrityConfig, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
8161 ///
8162 /// Sets the *name* path property to the given value.
8163 ///
8164 /// Even though the property as already been set when instantiating this call,
8165 /// we provide this method for API completeness.
8166 pub fn name(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8167 self._name = new_value.to_string();
8168 self
8169 }
8170 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8171 /// while executing the actual API request.
8172 ///
8173 /// ````text
8174 /// It should be used to handle progress information, and to implement a certain level of resilience.
8175 /// ````
8176 ///
8177 /// Sets the *delegate* property to the given value.
8178 pub fn delegate(
8179 mut self,
8180 new_value: &'a mut dyn common::Delegate,
8181 ) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8182 self._delegate = Some(new_value);
8183 self
8184 }
8185
8186 /// Set any additional parameter of the query string used in the request.
8187 /// It should be used to set parameters which are not yet available through their own
8188 /// setters.
8189 ///
8190 /// Please note that this method must not be used to set any of the known parameters
8191 /// which have their own setter method. If done anyway, the request will fail.
8192 ///
8193 /// # Additional Parameters
8194 ///
8195 /// * *$.xgafv* (query-string) - V1 error format.
8196 /// * *access_token* (query-string) - OAuth access token.
8197 /// * *alt* (query-string) - Data format for response.
8198 /// * *callback* (query-string) - JSONP
8199 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8200 /// * *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.
8201 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8202 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8203 /// * *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.
8204 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8205 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8206 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8207 where
8208 T: AsRef<str>,
8209 {
8210 self._additional_params
8211 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8212 self
8213 }
8214
8215 /// Identifies the authorization scope for the method you are building.
8216 ///
8217 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8218 /// [`Scope::CloudPlatform`].
8219 ///
8220 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8221 /// tokens for more than one scope.
8222 ///
8223 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8224 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8225 /// sufficient, a read-write scope will do as well.
8226 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8227 where
8228 St: AsRef<str>,
8229 {
8230 self._scopes.insert(String::from(scope.as_ref()));
8231 self
8232 }
8233 /// Identifies the authorization scope(s) for the method you are building.
8234 ///
8235 /// See [`Self::add_scope()`] for details.
8236 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppPlayIntegrityConfigGetCall<'a, C>
8237 where
8238 I: IntoIterator<Item = St>,
8239 St: AsRef<str>,
8240 {
8241 self._scopes
8242 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8243 self
8244 }
8245
8246 /// Removes all scopes, and no default scope will be used either.
8247 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8248 /// for details).
8249 pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigGetCall<'a, C> {
8250 self._scopes.clear();
8251 self
8252 }
8253}
8254
8255/// 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.
8256///
8257/// A builder for the *apps.playIntegrityConfig.patch* method supported by a *project* resource.
8258/// It is not used directly, but through a [`ProjectMethods`] instance.
8259///
8260/// # Example
8261///
8262/// Instantiate a resource method builder
8263///
8264/// ```test_harness,no_run
8265/// # extern crate hyper;
8266/// # extern crate hyper_rustls;
8267/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8268/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaPlayIntegrityConfig;
8269/// # async fn dox() {
8270/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8271///
8272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8274/// # secret,
8275/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8276/// # ).build().await.unwrap();
8277///
8278/// # let client = hyper_util::client::legacy::Client::builder(
8279/// # hyper_util::rt::TokioExecutor::new()
8280/// # )
8281/// # .build(
8282/// # hyper_rustls::HttpsConnectorBuilder::new()
8283/// # .with_native_roots()
8284/// # .unwrap()
8285/// # .https_or_http()
8286/// # .enable_http1()
8287/// # .build()
8288/// # );
8289/// # let mut hub = Firebaseappcheck::new(client, auth);
8290/// // As the method needs a request, you would usually fill it with the desired information
8291/// // into the respective structure. Some of the parts shown here might not be applicable !
8292/// // Values shown here are possibly random and not representative !
8293/// let mut req = GoogleFirebaseAppcheckV1betaPlayIntegrityConfig::default();
8294///
8295/// // You can configure optional parameters by calling the respective setters at will, and
8296/// // execute the final call using `doit()`.
8297/// // Values shown here are possibly random and not representative !
8298/// let result = hub.projects().apps_play_integrity_config_patch(req, "name")
8299/// .update_mask(FieldMask::new::<&str>(&[]))
8300/// .doit().await;
8301/// # }
8302/// ```
8303pub struct ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8304where
8305 C: 'a,
8306{
8307 hub: &'a Firebaseappcheck<C>,
8308 _request: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8309 _name: String,
8310 _update_mask: Option<common::FieldMask>,
8311 _delegate: Option<&'a mut dyn common::Delegate>,
8312 _additional_params: HashMap<String, String>,
8313 _scopes: BTreeSet<String>,
8314}
8315
8316impl<'a, C> common::CallBuilder for ProjectAppPlayIntegrityConfigPatchCall<'a, C> {}
8317
8318impl<'a, C> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8319where
8320 C: common::Connector,
8321{
8322 /// Perform the operation you have build so far.
8323 pub async fn doit(
8324 mut self,
8325 ) -> common::Result<(
8326 common::Response,
8327 GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8328 )> {
8329 use std::borrow::Cow;
8330 use std::io::{Read, Seek};
8331
8332 use common::{url::Params, ToParts};
8333 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8334
8335 let mut dd = common::DefaultDelegate;
8336 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8337 dlg.begin(common::MethodInfo {
8338 id: "firebaseappcheck.projects.apps.playIntegrityConfig.patch",
8339 http_method: hyper::Method::PATCH,
8340 });
8341
8342 for &field in ["alt", "name", "updateMask"].iter() {
8343 if self._additional_params.contains_key(field) {
8344 dlg.finished(false);
8345 return Err(common::Error::FieldClash(field));
8346 }
8347 }
8348
8349 let mut params = Params::with_capacity(5 + self._additional_params.len());
8350 params.push("name", self._name);
8351 if let Some(value) = self._update_mask.as_ref() {
8352 params.push("updateMask", value.to_string());
8353 }
8354
8355 params.extend(self._additional_params.iter());
8356
8357 params.push("alt", "json");
8358 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
8359 if self._scopes.is_empty() {
8360 self._scopes
8361 .insert(Scope::CloudPlatform.as_ref().to_string());
8362 }
8363
8364 #[allow(clippy::single_element_loop)]
8365 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8366 url = params.uri_replacement(url, param_name, find_this, true);
8367 }
8368 {
8369 let to_remove = ["name"];
8370 params.remove_params(&to_remove);
8371 }
8372
8373 let url = params.parse_with_url(&url);
8374
8375 let mut json_mime_type = mime::APPLICATION_JSON;
8376 let mut request_value_reader = {
8377 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8378 common::remove_json_null_values(&mut value);
8379 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8380 serde_json::to_writer(&mut dst, &value).unwrap();
8381 dst
8382 };
8383 let request_size = request_value_reader
8384 .seek(std::io::SeekFrom::End(0))
8385 .unwrap();
8386 request_value_reader
8387 .seek(std::io::SeekFrom::Start(0))
8388 .unwrap();
8389
8390 loop {
8391 let token = match self
8392 .hub
8393 .auth
8394 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8395 .await
8396 {
8397 Ok(token) => token,
8398 Err(e) => match dlg.token(e) {
8399 Ok(token) => token,
8400 Err(e) => {
8401 dlg.finished(false);
8402 return Err(common::Error::MissingToken(e));
8403 }
8404 },
8405 };
8406 request_value_reader
8407 .seek(std::io::SeekFrom::Start(0))
8408 .unwrap();
8409 let mut req_result = {
8410 let client = &self.hub.client;
8411 dlg.pre_request();
8412 let mut req_builder = hyper::Request::builder()
8413 .method(hyper::Method::PATCH)
8414 .uri(url.as_str())
8415 .header(USER_AGENT, self.hub._user_agent.clone());
8416
8417 if let Some(token) = token.as_ref() {
8418 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8419 }
8420
8421 let request = req_builder
8422 .header(CONTENT_TYPE, json_mime_type.to_string())
8423 .header(CONTENT_LENGTH, request_size as u64)
8424 .body(common::to_body(
8425 request_value_reader.get_ref().clone().into(),
8426 ));
8427
8428 client.request(request.unwrap()).await
8429 };
8430
8431 match req_result {
8432 Err(err) => {
8433 if let common::Retry::After(d) = dlg.http_error(&err) {
8434 sleep(d).await;
8435 continue;
8436 }
8437 dlg.finished(false);
8438 return Err(common::Error::HttpError(err));
8439 }
8440 Ok(res) => {
8441 let (mut parts, body) = res.into_parts();
8442 let mut body = common::Body::new(body);
8443 if !parts.status.is_success() {
8444 let bytes = common::to_bytes(body).await.unwrap_or_default();
8445 let error = serde_json::from_str(&common::to_string(&bytes));
8446 let response = common::to_response(parts, bytes.into());
8447
8448 if let common::Retry::After(d) =
8449 dlg.http_failure(&response, error.as_ref().ok())
8450 {
8451 sleep(d).await;
8452 continue;
8453 }
8454
8455 dlg.finished(false);
8456
8457 return Err(match error {
8458 Ok(value) => common::Error::BadRequest(value),
8459 _ => common::Error::Failure(response),
8460 });
8461 }
8462 let response = {
8463 let bytes = common::to_bytes(body).await.unwrap_or_default();
8464 let encoded = common::to_string(&bytes);
8465 match serde_json::from_str(&encoded) {
8466 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8467 Err(error) => {
8468 dlg.response_json_decode_error(&encoded, &error);
8469 return Err(common::Error::JsonDecodeError(
8470 encoded.to_string(),
8471 error,
8472 ));
8473 }
8474 }
8475 };
8476
8477 dlg.finished(true);
8478 return Ok(response);
8479 }
8480 }
8481 }
8482 }
8483
8484 ///
8485 /// Sets the *request* property to the given value.
8486 ///
8487 /// Even though the property as already been set when instantiating this call,
8488 /// we provide this method for API completeness.
8489 pub fn request(
8490 mut self,
8491 new_value: GoogleFirebaseAppcheckV1betaPlayIntegrityConfig,
8492 ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8493 self._request = new_value;
8494 self
8495 }
8496 /// Required. The relative resource name of the Play Integrity configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/playIntegrityConfig ```
8497 ///
8498 /// Sets the *name* path property to the given value.
8499 ///
8500 /// Even though the property as already been set when instantiating this call,
8501 /// we provide this method for API completeness.
8502 pub fn name(mut self, new_value: &str) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8503 self._name = new_value.to_string();
8504 self
8505 }
8506 /// Required. A comma-separated list of names of fields in the PlayIntegrityConfig to update. Example: `token_ttl`.
8507 ///
8508 /// Sets the *update mask* query property to the given value.
8509 pub fn update_mask(
8510 mut self,
8511 new_value: common::FieldMask,
8512 ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8513 self._update_mask = Some(new_value);
8514 self
8515 }
8516 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8517 /// while executing the actual API request.
8518 ///
8519 /// ````text
8520 /// It should be used to handle progress information, and to implement a certain level of resilience.
8521 /// ````
8522 ///
8523 /// Sets the *delegate* property to the given value.
8524 pub fn delegate(
8525 mut self,
8526 new_value: &'a mut dyn common::Delegate,
8527 ) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8528 self._delegate = Some(new_value);
8529 self
8530 }
8531
8532 /// Set any additional parameter of the query string used in the request.
8533 /// It should be used to set parameters which are not yet available through their own
8534 /// setters.
8535 ///
8536 /// Please note that this method must not be used to set any of the known parameters
8537 /// which have their own setter method. If done anyway, the request will fail.
8538 ///
8539 /// # Additional Parameters
8540 ///
8541 /// * *$.xgafv* (query-string) - V1 error format.
8542 /// * *access_token* (query-string) - OAuth access token.
8543 /// * *alt* (query-string) - Data format for response.
8544 /// * *callback* (query-string) - JSONP
8545 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8546 /// * *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.
8547 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8548 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8549 /// * *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.
8550 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8551 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8552 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8553 where
8554 T: AsRef<str>,
8555 {
8556 self._additional_params
8557 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8558 self
8559 }
8560
8561 /// Identifies the authorization scope for the method you are building.
8562 ///
8563 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8564 /// [`Scope::CloudPlatform`].
8565 ///
8566 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8567 /// tokens for more than one scope.
8568 ///
8569 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8570 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8571 /// sufficient, a read-write scope will do as well.
8572 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8573 where
8574 St: AsRef<str>,
8575 {
8576 self._scopes.insert(String::from(scope.as_ref()));
8577 self
8578 }
8579 /// Identifies the authorization scope(s) for the method you are building.
8580 ///
8581 /// See [`Self::add_scope()`] for details.
8582 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C>
8583 where
8584 I: IntoIterator<Item = St>,
8585 St: AsRef<str>,
8586 {
8587 self._scopes
8588 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8589 self
8590 }
8591
8592 /// Removes all scopes, and no default scope will be used either.
8593 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8594 /// for details).
8595 pub fn clear_scopes(mut self) -> ProjectAppPlayIntegrityConfigPatchCall<'a, C> {
8596 self._scopes.clear();
8597 self
8598 }
8599}
8600
8601/// Atomically gets the RecaptchaConfigs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
8602///
8603/// A builder for the *apps.recaptchaConfig.batchGet* method supported by a *project* resource.
8604/// It is not used directly, but through a [`ProjectMethods`] instance.
8605///
8606/// # Example
8607///
8608/// Instantiate a resource method builder
8609///
8610/// ```test_harness,no_run
8611/// # extern crate hyper;
8612/// # extern crate hyper_rustls;
8613/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8614/// # async fn dox() {
8615/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8616///
8617/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8618/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8619/// # secret,
8620/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8621/// # ).build().await.unwrap();
8622///
8623/// # let client = hyper_util::client::legacy::Client::builder(
8624/// # hyper_util::rt::TokioExecutor::new()
8625/// # )
8626/// # .build(
8627/// # hyper_rustls::HttpsConnectorBuilder::new()
8628/// # .with_native_roots()
8629/// # .unwrap()
8630/// # .https_or_http()
8631/// # .enable_http1()
8632/// # .build()
8633/// # );
8634/// # let mut hub = Firebaseappcheck::new(client, auth);
8635/// // You can configure optional parameters by calling the respective setters at will, and
8636/// // execute the final call using `doit()`.
8637/// // Values shown here are possibly random and not representative !
8638/// let result = hub.projects().apps_recaptcha_config_batch_get("parent")
8639/// .add_names("est")
8640/// .doit().await;
8641/// # }
8642/// ```
8643pub struct ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8644where
8645 C: 'a,
8646{
8647 hub: &'a Firebaseappcheck<C>,
8648 _parent: String,
8649 _names: Vec<String>,
8650 _delegate: Option<&'a mut dyn common::Delegate>,
8651 _additional_params: HashMap<String, String>,
8652 _scopes: BTreeSet<String>,
8653}
8654
8655impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigBatchGetCall<'a, C> {}
8656
8657impl<'a, C> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8658where
8659 C: common::Connector,
8660{
8661 /// Perform the operation you have build so far.
8662 pub async fn doit(
8663 mut self,
8664 ) -> common::Result<(
8665 common::Response,
8666 GoogleFirebaseAppcheckV1betaBatchGetRecaptchaConfigsResponse,
8667 )> {
8668 use std::borrow::Cow;
8669 use std::io::{Read, Seek};
8670
8671 use common::{url::Params, ToParts};
8672 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8673
8674 let mut dd = common::DefaultDelegate;
8675 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8676 dlg.begin(common::MethodInfo {
8677 id: "firebaseappcheck.projects.apps.recaptchaConfig.batchGet",
8678 http_method: hyper::Method::GET,
8679 });
8680
8681 for &field in ["alt", "parent", "names"].iter() {
8682 if self._additional_params.contains_key(field) {
8683 dlg.finished(false);
8684 return Err(common::Error::FieldClash(field));
8685 }
8686 }
8687
8688 let mut params = Params::with_capacity(4 + self._additional_params.len());
8689 params.push("parent", self._parent);
8690 if !self._names.is_empty() {
8691 for f in self._names.iter() {
8692 params.push("names", f);
8693 }
8694 }
8695
8696 params.extend(self._additional_params.iter());
8697
8698 params.push("alt", "json");
8699 let mut url =
8700 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/recaptchaConfig:batchGet";
8701 if self._scopes.is_empty() {
8702 self._scopes
8703 .insert(Scope::CloudPlatform.as_ref().to_string());
8704 }
8705
8706 #[allow(clippy::single_element_loop)]
8707 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8708 url = params.uri_replacement(url, param_name, find_this, true);
8709 }
8710 {
8711 let to_remove = ["parent"];
8712 params.remove_params(&to_remove);
8713 }
8714
8715 let url = params.parse_with_url(&url);
8716
8717 loop {
8718 let token = match self
8719 .hub
8720 .auth
8721 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8722 .await
8723 {
8724 Ok(token) => token,
8725 Err(e) => match dlg.token(e) {
8726 Ok(token) => token,
8727 Err(e) => {
8728 dlg.finished(false);
8729 return Err(common::Error::MissingToken(e));
8730 }
8731 },
8732 };
8733 let mut req_result = {
8734 let client = &self.hub.client;
8735 dlg.pre_request();
8736 let mut req_builder = hyper::Request::builder()
8737 .method(hyper::Method::GET)
8738 .uri(url.as_str())
8739 .header(USER_AGENT, self.hub._user_agent.clone());
8740
8741 if let Some(token) = token.as_ref() {
8742 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8743 }
8744
8745 let request = req_builder
8746 .header(CONTENT_LENGTH, 0_u64)
8747 .body(common::to_body::<String>(None));
8748
8749 client.request(request.unwrap()).await
8750 };
8751
8752 match req_result {
8753 Err(err) => {
8754 if let common::Retry::After(d) = dlg.http_error(&err) {
8755 sleep(d).await;
8756 continue;
8757 }
8758 dlg.finished(false);
8759 return Err(common::Error::HttpError(err));
8760 }
8761 Ok(res) => {
8762 let (mut parts, body) = res.into_parts();
8763 let mut body = common::Body::new(body);
8764 if !parts.status.is_success() {
8765 let bytes = common::to_bytes(body).await.unwrap_or_default();
8766 let error = serde_json::from_str(&common::to_string(&bytes));
8767 let response = common::to_response(parts, bytes.into());
8768
8769 if let common::Retry::After(d) =
8770 dlg.http_failure(&response, error.as_ref().ok())
8771 {
8772 sleep(d).await;
8773 continue;
8774 }
8775
8776 dlg.finished(false);
8777
8778 return Err(match error {
8779 Ok(value) => common::Error::BadRequest(value),
8780 _ => common::Error::Failure(response),
8781 });
8782 }
8783 let response = {
8784 let bytes = common::to_bytes(body).await.unwrap_or_default();
8785 let encoded = common::to_string(&bytes);
8786 match serde_json::from_str(&encoded) {
8787 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8788 Err(error) => {
8789 dlg.response_json_decode_error(&encoded, &error);
8790 return Err(common::Error::JsonDecodeError(
8791 encoded.to_string(),
8792 error,
8793 ));
8794 }
8795 }
8796 };
8797
8798 dlg.finished(true);
8799 return Ok(response);
8800 }
8801 }
8802 }
8803 }
8804
8805 /// 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.
8806 ///
8807 /// Sets the *parent* path property to the given value.
8808 ///
8809 /// Even though the property as already been set when instantiating this call,
8810 /// we provide this method for API completeness.
8811 pub fn parent(mut self, new_value: &str) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
8812 self._parent = new_value.to_string();
8813 self
8814 }
8815 /// 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.
8816 ///
8817 /// Append the given value to the *names* query property.
8818 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8819 pub fn add_names(mut self, new_value: &str) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
8820 self._names.push(new_value.to_string());
8821 self
8822 }
8823 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8824 /// while executing the actual API request.
8825 ///
8826 /// ````text
8827 /// It should be used to handle progress information, and to implement a certain level of resilience.
8828 /// ````
8829 ///
8830 /// Sets the *delegate* property to the given value.
8831 pub fn delegate(
8832 mut self,
8833 new_value: &'a mut dyn common::Delegate,
8834 ) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
8835 self._delegate = Some(new_value);
8836 self
8837 }
8838
8839 /// Set any additional parameter of the query string used in the request.
8840 /// It should be used to set parameters which are not yet available through their own
8841 /// setters.
8842 ///
8843 /// Please note that this method must not be used to set any of the known parameters
8844 /// which have their own setter method. If done anyway, the request will fail.
8845 ///
8846 /// # Additional Parameters
8847 ///
8848 /// * *$.xgafv* (query-string) - V1 error format.
8849 /// * *access_token* (query-string) - OAuth access token.
8850 /// * *alt* (query-string) - Data format for response.
8851 /// * *callback* (query-string) - JSONP
8852 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8853 /// * *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.
8854 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8855 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8856 /// * *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.
8857 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8858 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8859 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8860 where
8861 T: AsRef<str>,
8862 {
8863 self._additional_params
8864 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8865 self
8866 }
8867
8868 /// Identifies the authorization scope for the method you are building.
8869 ///
8870 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8871 /// [`Scope::CloudPlatform`].
8872 ///
8873 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8874 /// tokens for more than one scope.
8875 ///
8876 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8877 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8878 /// sufficient, a read-write scope will do as well.
8879 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8880 where
8881 St: AsRef<str>,
8882 {
8883 self._scopes.insert(String::from(scope.as_ref()));
8884 self
8885 }
8886 /// Identifies the authorization scope(s) for the method you are building.
8887 ///
8888 /// See [`Self::add_scope()`] for details.
8889 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C>
8890 where
8891 I: IntoIterator<Item = St>,
8892 St: AsRef<str>,
8893 {
8894 self._scopes
8895 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8896 self
8897 }
8898
8899 /// Removes all scopes, and no default scope will be used either.
8900 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8901 /// for details).
8902 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigBatchGetCall<'a, C> {
8903 self._scopes.clear();
8904 self
8905 }
8906}
8907
8908/// Gets the RecaptchaConfig for the specified app. For security reasons, the `site_secret` field is never populated in the response.
8909///
8910/// A builder for the *apps.recaptchaConfig.get* method supported by a *project* resource.
8911/// It is not used directly, but through a [`ProjectMethods`] instance.
8912///
8913/// # Example
8914///
8915/// Instantiate a resource method builder
8916///
8917/// ```test_harness,no_run
8918/// # extern crate hyper;
8919/// # extern crate hyper_rustls;
8920/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
8921/// # async fn dox() {
8922/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8923///
8924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8926/// # secret,
8927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8928/// # ).build().await.unwrap();
8929///
8930/// # let client = hyper_util::client::legacy::Client::builder(
8931/// # hyper_util::rt::TokioExecutor::new()
8932/// # )
8933/// # .build(
8934/// # hyper_rustls::HttpsConnectorBuilder::new()
8935/// # .with_native_roots()
8936/// # .unwrap()
8937/// # .https_or_http()
8938/// # .enable_http1()
8939/// # .build()
8940/// # );
8941/// # let mut hub = Firebaseappcheck::new(client, auth);
8942/// // You can configure optional parameters by calling the respective setters at will, and
8943/// // execute the final call using `doit()`.
8944/// // Values shown here are possibly random and not representative !
8945/// let result = hub.projects().apps_recaptcha_config_get("name")
8946/// .doit().await;
8947/// # }
8948/// ```
8949pub struct ProjectAppRecaptchaConfigGetCall<'a, C>
8950where
8951 C: 'a,
8952{
8953 hub: &'a Firebaseappcheck<C>,
8954 _name: String,
8955 _delegate: Option<&'a mut dyn common::Delegate>,
8956 _additional_params: HashMap<String, String>,
8957 _scopes: BTreeSet<String>,
8958}
8959
8960impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigGetCall<'a, C> {}
8961
8962impl<'a, C> ProjectAppRecaptchaConfigGetCall<'a, C>
8963where
8964 C: common::Connector,
8965{
8966 /// Perform the operation you have build so far.
8967 pub async fn doit(
8968 mut self,
8969 ) -> common::Result<(
8970 common::Response,
8971 GoogleFirebaseAppcheckV1betaRecaptchaConfig,
8972 )> {
8973 use std::borrow::Cow;
8974 use std::io::{Read, Seek};
8975
8976 use common::{url::Params, ToParts};
8977 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8978
8979 let mut dd = common::DefaultDelegate;
8980 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8981 dlg.begin(common::MethodInfo {
8982 id: "firebaseappcheck.projects.apps.recaptchaConfig.get",
8983 http_method: hyper::Method::GET,
8984 });
8985
8986 for &field in ["alt", "name"].iter() {
8987 if self._additional_params.contains_key(field) {
8988 dlg.finished(false);
8989 return Err(common::Error::FieldClash(field));
8990 }
8991 }
8992
8993 let mut params = Params::with_capacity(3 + self._additional_params.len());
8994 params.push("name", self._name);
8995
8996 params.extend(self._additional_params.iter());
8997
8998 params.push("alt", "json");
8999 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
9000 if self._scopes.is_empty() {
9001 self._scopes
9002 .insert(Scope::CloudPlatform.as_ref().to_string());
9003 }
9004
9005 #[allow(clippy::single_element_loop)]
9006 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9007 url = params.uri_replacement(url, param_name, find_this, true);
9008 }
9009 {
9010 let to_remove = ["name"];
9011 params.remove_params(&to_remove);
9012 }
9013
9014 let url = params.parse_with_url(&url);
9015
9016 loop {
9017 let token = match self
9018 .hub
9019 .auth
9020 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9021 .await
9022 {
9023 Ok(token) => token,
9024 Err(e) => match dlg.token(e) {
9025 Ok(token) => token,
9026 Err(e) => {
9027 dlg.finished(false);
9028 return Err(common::Error::MissingToken(e));
9029 }
9030 },
9031 };
9032 let mut req_result = {
9033 let client = &self.hub.client;
9034 dlg.pre_request();
9035 let mut req_builder = hyper::Request::builder()
9036 .method(hyper::Method::GET)
9037 .uri(url.as_str())
9038 .header(USER_AGENT, self.hub._user_agent.clone());
9039
9040 if let Some(token) = token.as_ref() {
9041 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9042 }
9043
9044 let request = req_builder
9045 .header(CONTENT_LENGTH, 0_u64)
9046 .body(common::to_body::<String>(None));
9047
9048 client.request(request.unwrap()).await
9049 };
9050
9051 match req_result {
9052 Err(err) => {
9053 if let common::Retry::After(d) = dlg.http_error(&err) {
9054 sleep(d).await;
9055 continue;
9056 }
9057 dlg.finished(false);
9058 return Err(common::Error::HttpError(err));
9059 }
9060 Ok(res) => {
9061 let (mut parts, body) = res.into_parts();
9062 let mut body = common::Body::new(body);
9063 if !parts.status.is_success() {
9064 let bytes = common::to_bytes(body).await.unwrap_or_default();
9065 let error = serde_json::from_str(&common::to_string(&bytes));
9066 let response = common::to_response(parts, bytes.into());
9067
9068 if let common::Retry::After(d) =
9069 dlg.http_failure(&response, error.as_ref().ok())
9070 {
9071 sleep(d).await;
9072 continue;
9073 }
9074
9075 dlg.finished(false);
9076
9077 return Err(match error {
9078 Ok(value) => common::Error::BadRequest(value),
9079 _ => common::Error::Failure(response),
9080 });
9081 }
9082 let response = {
9083 let bytes = common::to_bytes(body).await.unwrap_or_default();
9084 let encoded = common::to_string(&bytes);
9085 match serde_json::from_str(&encoded) {
9086 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9087 Err(error) => {
9088 dlg.response_json_decode_error(&encoded, &error);
9089 return Err(common::Error::JsonDecodeError(
9090 encoded.to_string(),
9091 error,
9092 ));
9093 }
9094 }
9095 };
9096
9097 dlg.finished(true);
9098 return Ok(response);
9099 }
9100 }
9101 }
9102 }
9103
9104 /// Required. The relative resource name of the RecaptchaConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
9105 ///
9106 /// Sets the *name* path property to the given value.
9107 ///
9108 /// Even though the property as already been set when instantiating this call,
9109 /// we provide this method for API completeness.
9110 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9111 self._name = new_value.to_string();
9112 self
9113 }
9114 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9115 /// while executing the actual API request.
9116 ///
9117 /// ````text
9118 /// It should be used to handle progress information, and to implement a certain level of resilience.
9119 /// ````
9120 ///
9121 /// Sets the *delegate* property to the given value.
9122 pub fn delegate(
9123 mut self,
9124 new_value: &'a mut dyn common::Delegate,
9125 ) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9126 self._delegate = Some(new_value);
9127 self
9128 }
9129
9130 /// Set any additional parameter of the query string used in the request.
9131 /// It should be used to set parameters which are not yet available through their own
9132 /// setters.
9133 ///
9134 /// Please note that this method must not be used to set any of the known parameters
9135 /// which have their own setter method. If done anyway, the request will fail.
9136 ///
9137 /// # Additional Parameters
9138 ///
9139 /// * *$.xgafv* (query-string) - V1 error format.
9140 /// * *access_token* (query-string) - OAuth access token.
9141 /// * *alt* (query-string) - Data format for response.
9142 /// * *callback* (query-string) - JSONP
9143 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9144 /// * *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.
9145 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9146 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9147 /// * *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.
9148 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9149 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9150 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9151 where
9152 T: AsRef<str>,
9153 {
9154 self._additional_params
9155 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9156 self
9157 }
9158
9159 /// Identifies the authorization scope for the method you are building.
9160 ///
9161 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9162 /// [`Scope::CloudPlatform`].
9163 ///
9164 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9165 /// tokens for more than one scope.
9166 ///
9167 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9168 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9169 /// sufficient, a read-write scope will do as well.
9170 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9171 where
9172 St: AsRef<str>,
9173 {
9174 self._scopes.insert(String::from(scope.as_ref()));
9175 self
9176 }
9177 /// Identifies the authorization scope(s) for the method you are building.
9178 ///
9179 /// See [`Self::add_scope()`] for details.
9180 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigGetCall<'a, C>
9181 where
9182 I: IntoIterator<Item = St>,
9183 St: AsRef<str>,
9184 {
9185 self._scopes
9186 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9187 self
9188 }
9189
9190 /// Removes all scopes, and no default scope will be used either.
9191 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9192 /// for details).
9193 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigGetCall<'a, C> {
9194 self._scopes.clear();
9195 self
9196 }
9197}
9198
9199/// 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.
9200///
9201/// A builder for the *apps.recaptchaConfig.patch* method supported by a *project* resource.
9202/// It is not used directly, but through a [`ProjectMethods`] instance.
9203///
9204/// # Example
9205///
9206/// Instantiate a resource method builder
9207///
9208/// ```test_harness,no_run
9209/// # extern crate hyper;
9210/// # extern crate hyper_rustls;
9211/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9212/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaConfig;
9213/// # async fn dox() {
9214/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9215///
9216/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9217/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9218/// # secret,
9219/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9220/// # ).build().await.unwrap();
9221///
9222/// # let client = hyper_util::client::legacy::Client::builder(
9223/// # hyper_util::rt::TokioExecutor::new()
9224/// # )
9225/// # .build(
9226/// # hyper_rustls::HttpsConnectorBuilder::new()
9227/// # .with_native_roots()
9228/// # .unwrap()
9229/// # .https_or_http()
9230/// # .enable_http1()
9231/// # .build()
9232/// # );
9233/// # let mut hub = Firebaseappcheck::new(client, auth);
9234/// // As the method needs a request, you would usually fill it with the desired information
9235/// // into the respective structure. Some of the parts shown here might not be applicable !
9236/// // Values shown here are possibly random and not representative !
9237/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaConfig::default();
9238///
9239/// // You can configure optional parameters by calling the respective setters at will, and
9240/// // execute the final call using `doit()`.
9241/// // Values shown here are possibly random and not representative !
9242/// let result = hub.projects().apps_recaptcha_config_patch(req, "name")
9243/// .update_mask(FieldMask::new::<&str>(&[]))
9244/// .doit().await;
9245/// # }
9246/// ```
9247pub struct ProjectAppRecaptchaConfigPatchCall<'a, C>
9248where
9249 C: 'a,
9250{
9251 hub: &'a Firebaseappcheck<C>,
9252 _request: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9253 _name: String,
9254 _update_mask: Option<common::FieldMask>,
9255 _delegate: Option<&'a mut dyn common::Delegate>,
9256 _additional_params: HashMap<String, String>,
9257 _scopes: BTreeSet<String>,
9258}
9259
9260impl<'a, C> common::CallBuilder for ProjectAppRecaptchaConfigPatchCall<'a, C> {}
9261
9262impl<'a, C> ProjectAppRecaptchaConfigPatchCall<'a, C>
9263where
9264 C: common::Connector,
9265{
9266 /// Perform the operation you have build so far.
9267 pub async fn doit(
9268 mut self,
9269 ) -> common::Result<(
9270 common::Response,
9271 GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9272 )> {
9273 use std::borrow::Cow;
9274 use std::io::{Read, Seek};
9275
9276 use common::{url::Params, ToParts};
9277 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9278
9279 let mut dd = common::DefaultDelegate;
9280 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9281 dlg.begin(common::MethodInfo {
9282 id: "firebaseappcheck.projects.apps.recaptchaConfig.patch",
9283 http_method: hyper::Method::PATCH,
9284 });
9285
9286 for &field in ["alt", "name", "updateMask"].iter() {
9287 if self._additional_params.contains_key(field) {
9288 dlg.finished(false);
9289 return Err(common::Error::FieldClash(field));
9290 }
9291 }
9292
9293 let mut params = Params::with_capacity(5 + self._additional_params.len());
9294 params.push("name", self._name);
9295 if let Some(value) = self._update_mask.as_ref() {
9296 params.push("updateMask", value.to_string());
9297 }
9298
9299 params.extend(self._additional_params.iter());
9300
9301 params.push("alt", "json");
9302 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
9303 if self._scopes.is_empty() {
9304 self._scopes
9305 .insert(Scope::CloudPlatform.as_ref().to_string());
9306 }
9307
9308 #[allow(clippy::single_element_loop)]
9309 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9310 url = params.uri_replacement(url, param_name, find_this, true);
9311 }
9312 {
9313 let to_remove = ["name"];
9314 params.remove_params(&to_remove);
9315 }
9316
9317 let url = params.parse_with_url(&url);
9318
9319 let mut json_mime_type = mime::APPLICATION_JSON;
9320 let mut request_value_reader = {
9321 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9322 common::remove_json_null_values(&mut value);
9323 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9324 serde_json::to_writer(&mut dst, &value).unwrap();
9325 dst
9326 };
9327 let request_size = request_value_reader
9328 .seek(std::io::SeekFrom::End(0))
9329 .unwrap();
9330 request_value_reader
9331 .seek(std::io::SeekFrom::Start(0))
9332 .unwrap();
9333
9334 loop {
9335 let token = match self
9336 .hub
9337 .auth
9338 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9339 .await
9340 {
9341 Ok(token) => token,
9342 Err(e) => match dlg.token(e) {
9343 Ok(token) => token,
9344 Err(e) => {
9345 dlg.finished(false);
9346 return Err(common::Error::MissingToken(e));
9347 }
9348 },
9349 };
9350 request_value_reader
9351 .seek(std::io::SeekFrom::Start(0))
9352 .unwrap();
9353 let mut req_result = {
9354 let client = &self.hub.client;
9355 dlg.pre_request();
9356 let mut req_builder = hyper::Request::builder()
9357 .method(hyper::Method::PATCH)
9358 .uri(url.as_str())
9359 .header(USER_AGENT, self.hub._user_agent.clone());
9360
9361 if let Some(token) = token.as_ref() {
9362 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9363 }
9364
9365 let request = req_builder
9366 .header(CONTENT_TYPE, json_mime_type.to_string())
9367 .header(CONTENT_LENGTH, request_size as u64)
9368 .body(common::to_body(
9369 request_value_reader.get_ref().clone().into(),
9370 ));
9371
9372 client.request(request.unwrap()).await
9373 };
9374
9375 match req_result {
9376 Err(err) => {
9377 if let common::Retry::After(d) = dlg.http_error(&err) {
9378 sleep(d).await;
9379 continue;
9380 }
9381 dlg.finished(false);
9382 return Err(common::Error::HttpError(err));
9383 }
9384 Ok(res) => {
9385 let (mut parts, body) = res.into_parts();
9386 let mut body = common::Body::new(body);
9387 if !parts.status.is_success() {
9388 let bytes = common::to_bytes(body).await.unwrap_or_default();
9389 let error = serde_json::from_str(&common::to_string(&bytes));
9390 let response = common::to_response(parts, bytes.into());
9391
9392 if let common::Retry::After(d) =
9393 dlg.http_failure(&response, error.as_ref().ok())
9394 {
9395 sleep(d).await;
9396 continue;
9397 }
9398
9399 dlg.finished(false);
9400
9401 return Err(match error {
9402 Ok(value) => common::Error::BadRequest(value),
9403 _ => common::Error::Failure(response),
9404 });
9405 }
9406 let response = {
9407 let bytes = common::to_bytes(body).await.unwrap_or_default();
9408 let encoded = common::to_string(&bytes);
9409 match serde_json::from_str(&encoded) {
9410 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9411 Err(error) => {
9412 dlg.response_json_decode_error(&encoded, &error);
9413 return Err(common::Error::JsonDecodeError(
9414 encoded.to_string(),
9415 error,
9416 ));
9417 }
9418 }
9419 };
9420
9421 dlg.finished(true);
9422 return Ok(response);
9423 }
9424 }
9425 }
9426 }
9427
9428 ///
9429 /// Sets the *request* property to the given value.
9430 ///
9431 /// Even though the property as already been set when instantiating this call,
9432 /// we provide this method for API completeness.
9433 pub fn request(
9434 mut self,
9435 new_value: GoogleFirebaseAppcheckV1betaRecaptchaConfig,
9436 ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9437 self._request = new_value;
9438 self
9439 }
9440 /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaConfig ```
9441 ///
9442 /// Sets the *name* path property to the given value.
9443 ///
9444 /// Even though the property as already been set when instantiating this call,
9445 /// we provide this method for API completeness.
9446 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9447 self._name = new_value.to_string();
9448 self
9449 }
9450 /// Required. A comma-separated list of names of fields in the RecaptchaConfig to update. Example: `site_secret`.
9451 ///
9452 /// Sets the *update mask* query property to the given value.
9453 pub fn update_mask(
9454 mut self,
9455 new_value: common::FieldMask,
9456 ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9457 self._update_mask = Some(new_value);
9458 self
9459 }
9460 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9461 /// while executing the actual API request.
9462 ///
9463 /// ````text
9464 /// It should be used to handle progress information, and to implement a certain level of resilience.
9465 /// ````
9466 ///
9467 /// Sets the *delegate* property to the given value.
9468 pub fn delegate(
9469 mut self,
9470 new_value: &'a mut dyn common::Delegate,
9471 ) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9472 self._delegate = Some(new_value);
9473 self
9474 }
9475
9476 /// Set any additional parameter of the query string used in the request.
9477 /// It should be used to set parameters which are not yet available through their own
9478 /// setters.
9479 ///
9480 /// Please note that this method must not be used to set any of the known parameters
9481 /// which have their own setter method. If done anyway, the request will fail.
9482 ///
9483 /// # Additional Parameters
9484 ///
9485 /// * *$.xgafv* (query-string) - V1 error format.
9486 /// * *access_token* (query-string) - OAuth access token.
9487 /// * *alt* (query-string) - Data format for response.
9488 /// * *callback* (query-string) - JSONP
9489 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9490 /// * *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.
9491 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9492 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9493 /// * *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.
9494 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9495 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9496 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9497 where
9498 T: AsRef<str>,
9499 {
9500 self._additional_params
9501 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9502 self
9503 }
9504
9505 /// Identifies the authorization scope for the method you are building.
9506 ///
9507 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9508 /// [`Scope::CloudPlatform`].
9509 ///
9510 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9511 /// tokens for more than one scope.
9512 ///
9513 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9514 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9515 /// sufficient, a read-write scope will do as well.
9516 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9517 where
9518 St: AsRef<str>,
9519 {
9520 self._scopes.insert(String::from(scope.as_ref()));
9521 self
9522 }
9523 /// Identifies the authorization scope(s) for the method you are building.
9524 ///
9525 /// See [`Self::add_scope()`] for details.
9526 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaConfigPatchCall<'a, C>
9527 where
9528 I: IntoIterator<Item = St>,
9529 St: AsRef<str>,
9530 {
9531 self._scopes
9532 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9533 self
9534 }
9535
9536 /// Removes all scopes, and no default scope will be used either.
9537 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9538 /// for details).
9539 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaConfigPatchCall<'a, C> {
9540 self._scopes.clear();
9541 self
9542 }
9543}
9544
9545/// Atomically gets the RecaptchaEnterpriseConfigs for the specified list of apps.
9546///
9547/// A builder for the *apps.recaptchaEnterpriseConfig.batchGet* method supported by a *project* resource.
9548/// It is not used directly, but through a [`ProjectMethods`] instance.
9549///
9550/// # Example
9551///
9552/// Instantiate a resource method builder
9553///
9554/// ```test_harness,no_run
9555/// # extern crate hyper;
9556/// # extern crate hyper_rustls;
9557/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9558/// # async fn dox() {
9559/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9560///
9561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9563/// # secret,
9564/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9565/// # ).build().await.unwrap();
9566///
9567/// # let client = hyper_util::client::legacy::Client::builder(
9568/// # hyper_util::rt::TokioExecutor::new()
9569/// # )
9570/// # .build(
9571/// # hyper_rustls::HttpsConnectorBuilder::new()
9572/// # .with_native_roots()
9573/// # .unwrap()
9574/// # .https_or_http()
9575/// # .enable_http1()
9576/// # .build()
9577/// # );
9578/// # let mut hub = Firebaseappcheck::new(client, auth);
9579/// // You can configure optional parameters by calling the respective setters at will, and
9580/// // execute the final call using `doit()`.
9581/// // Values shown here are possibly random and not representative !
9582/// let result = hub.projects().apps_recaptcha_enterprise_config_batch_get("parent")
9583/// .add_names("gubergren")
9584/// .doit().await;
9585/// # }
9586/// ```
9587pub struct ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9588where
9589 C: 'a,
9590{
9591 hub: &'a Firebaseappcheck<C>,
9592 _parent: String,
9593 _names: Vec<String>,
9594 _delegate: Option<&'a mut dyn common::Delegate>,
9595 _additional_params: HashMap<String, String>,
9596 _scopes: BTreeSet<String>,
9597}
9598
9599impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {}
9600
9601impl<'a, C> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9602where
9603 C: common::Connector,
9604{
9605 /// Perform the operation you have build so far.
9606 pub async fn doit(
9607 mut self,
9608 ) -> common::Result<(
9609 common::Response,
9610 GoogleFirebaseAppcheckV1betaBatchGetRecaptchaEnterpriseConfigsResponse,
9611 )> {
9612 use std::borrow::Cow;
9613 use std::io::{Read, Seek};
9614
9615 use common::{url::Params, ToParts};
9616 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9617
9618 let mut dd = common::DefaultDelegate;
9619 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9620 dlg.begin(common::MethodInfo {
9621 id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.batchGet",
9622 http_method: hyper::Method::GET,
9623 });
9624
9625 for &field in ["alt", "parent", "names"].iter() {
9626 if self._additional_params.contains_key(field) {
9627 dlg.finished(false);
9628 return Err(common::Error::FieldClash(field));
9629 }
9630 }
9631
9632 let mut params = Params::with_capacity(4 + self._additional_params.len());
9633 params.push("parent", self._parent);
9634 if !self._names.is_empty() {
9635 for f in self._names.iter() {
9636 params.push("names", f);
9637 }
9638 }
9639
9640 params.extend(self._additional_params.iter());
9641
9642 params.push("alt", "json");
9643 let mut url = self.hub._base_url.clone()
9644 + "v1beta/{+parent}/apps/-/recaptchaEnterpriseConfig:batchGet";
9645 if self._scopes.is_empty() {
9646 self._scopes
9647 .insert(Scope::CloudPlatform.as_ref().to_string());
9648 }
9649
9650 #[allow(clippy::single_element_loop)]
9651 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9652 url = params.uri_replacement(url, param_name, find_this, true);
9653 }
9654 {
9655 let to_remove = ["parent"];
9656 params.remove_params(&to_remove);
9657 }
9658
9659 let url = params.parse_with_url(&url);
9660
9661 loop {
9662 let token = match self
9663 .hub
9664 .auth
9665 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9666 .await
9667 {
9668 Ok(token) => token,
9669 Err(e) => match dlg.token(e) {
9670 Ok(token) => token,
9671 Err(e) => {
9672 dlg.finished(false);
9673 return Err(common::Error::MissingToken(e));
9674 }
9675 },
9676 };
9677 let mut req_result = {
9678 let client = &self.hub.client;
9679 dlg.pre_request();
9680 let mut req_builder = hyper::Request::builder()
9681 .method(hyper::Method::GET)
9682 .uri(url.as_str())
9683 .header(USER_AGENT, self.hub._user_agent.clone());
9684
9685 if let Some(token) = token.as_ref() {
9686 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9687 }
9688
9689 let request = req_builder
9690 .header(CONTENT_LENGTH, 0_u64)
9691 .body(common::to_body::<String>(None));
9692
9693 client.request(request.unwrap()).await
9694 };
9695
9696 match req_result {
9697 Err(err) => {
9698 if let common::Retry::After(d) = dlg.http_error(&err) {
9699 sleep(d).await;
9700 continue;
9701 }
9702 dlg.finished(false);
9703 return Err(common::Error::HttpError(err));
9704 }
9705 Ok(res) => {
9706 let (mut parts, body) = res.into_parts();
9707 let mut body = common::Body::new(body);
9708 if !parts.status.is_success() {
9709 let bytes = common::to_bytes(body).await.unwrap_or_default();
9710 let error = serde_json::from_str(&common::to_string(&bytes));
9711 let response = common::to_response(parts, bytes.into());
9712
9713 if let common::Retry::After(d) =
9714 dlg.http_failure(&response, error.as_ref().ok())
9715 {
9716 sleep(d).await;
9717 continue;
9718 }
9719
9720 dlg.finished(false);
9721
9722 return Err(match error {
9723 Ok(value) => common::Error::BadRequest(value),
9724 _ => common::Error::Failure(response),
9725 });
9726 }
9727 let response = {
9728 let bytes = common::to_bytes(body).await.unwrap_or_default();
9729 let encoded = common::to_string(&bytes);
9730 match serde_json::from_str(&encoded) {
9731 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9732 Err(error) => {
9733 dlg.response_json_decode_error(&encoded, &error);
9734 return Err(common::Error::JsonDecodeError(
9735 encoded.to_string(),
9736 error,
9737 ));
9738 }
9739 }
9740 };
9741
9742 dlg.finished(true);
9743 return Ok(response);
9744 }
9745 }
9746 }
9747 }
9748
9749 /// 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.
9750 ///
9751 /// Sets the *parent* path property to the given value.
9752 ///
9753 /// Even though the property as already been set when instantiating this call,
9754 /// we provide this method for API completeness.
9755 pub fn parent(
9756 mut self,
9757 new_value: &str,
9758 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
9759 self._parent = new_value.to_string();
9760 self
9761 }
9762 /// 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.
9763 ///
9764 /// Append the given value to the *names* query property.
9765 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9766 pub fn add_names(
9767 mut self,
9768 new_value: &str,
9769 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
9770 self._names.push(new_value.to_string());
9771 self
9772 }
9773 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9774 /// while executing the actual API request.
9775 ///
9776 /// ````text
9777 /// It should be used to handle progress information, and to implement a certain level of resilience.
9778 /// ````
9779 ///
9780 /// Sets the *delegate* property to the given value.
9781 pub fn delegate(
9782 mut self,
9783 new_value: &'a mut dyn common::Delegate,
9784 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
9785 self._delegate = Some(new_value);
9786 self
9787 }
9788
9789 /// Set any additional parameter of the query string used in the request.
9790 /// It should be used to set parameters which are not yet available through their own
9791 /// setters.
9792 ///
9793 /// Please note that this method must not be used to set any of the known parameters
9794 /// which have their own setter method. If done anyway, the request will fail.
9795 ///
9796 /// # Additional Parameters
9797 ///
9798 /// * *$.xgafv* (query-string) - V1 error format.
9799 /// * *access_token* (query-string) - OAuth access token.
9800 /// * *alt* (query-string) - Data format for response.
9801 /// * *callback* (query-string) - JSONP
9802 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9803 /// * *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.
9804 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9805 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9806 /// * *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.
9807 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9808 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9809 pub fn param<T>(
9810 mut self,
9811 name: T,
9812 value: T,
9813 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9814 where
9815 T: AsRef<str>,
9816 {
9817 self._additional_params
9818 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9819 self
9820 }
9821
9822 /// Identifies the authorization scope for the method you are building.
9823 ///
9824 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9825 /// [`Scope::CloudPlatform`].
9826 ///
9827 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9828 /// tokens for more than one scope.
9829 ///
9830 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9831 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9832 /// sufficient, a read-write scope will do as well.
9833 pub fn add_scope<St>(
9834 mut self,
9835 scope: St,
9836 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9837 where
9838 St: AsRef<str>,
9839 {
9840 self._scopes.insert(String::from(scope.as_ref()));
9841 self
9842 }
9843 /// Identifies the authorization scope(s) for the method you are building.
9844 ///
9845 /// See [`Self::add_scope()`] for details.
9846 pub fn add_scopes<I, St>(
9847 mut self,
9848 scopes: I,
9849 ) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C>
9850 where
9851 I: IntoIterator<Item = St>,
9852 St: AsRef<str>,
9853 {
9854 self._scopes
9855 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9856 self
9857 }
9858
9859 /// Removes all scopes, and no default scope will be used either.
9860 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9861 /// for details).
9862 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigBatchGetCall<'a, C> {
9863 self._scopes.clear();
9864 self
9865 }
9866}
9867
9868/// Gets the RecaptchaEnterpriseConfig for the specified app.
9869///
9870/// A builder for the *apps.recaptchaEnterpriseConfig.get* method supported by a *project* resource.
9871/// It is not used directly, but through a [`ProjectMethods`] instance.
9872///
9873/// # Example
9874///
9875/// Instantiate a resource method builder
9876///
9877/// ```test_harness,no_run
9878/// # extern crate hyper;
9879/// # extern crate hyper_rustls;
9880/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
9881/// # async fn dox() {
9882/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9883///
9884/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9885/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9886/// # secret,
9887/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9888/// # ).build().await.unwrap();
9889///
9890/// # let client = hyper_util::client::legacy::Client::builder(
9891/// # hyper_util::rt::TokioExecutor::new()
9892/// # )
9893/// # .build(
9894/// # hyper_rustls::HttpsConnectorBuilder::new()
9895/// # .with_native_roots()
9896/// # .unwrap()
9897/// # .https_or_http()
9898/// # .enable_http1()
9899/// # .build()
9900/// # );
9901/// # let mut hub = Firebaseappcheck::new(client, auth);
9902/// // You can configure optional parameters by calling the respective setters at will, and
9903/// // execute the final call using `doit()`.
9904/// // Values shown here are possibly random and not representative !
9905/// let result = hub.projects().apps_recaptcha_enterprise_config_get("name")
9906/// .doit().await;
9907/// # }
9908/// ```
9909pub struct ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
9910where
9911 C: 'a,
9912{
9913 hub: &'a Firebaseappcheck<C>,
9914 _name: String,
9915 _delegate: Option<&'a mut dyn common::Delegate>,
9916 _additional_params: HashMap<String, String>,
9917 _scopes: BTreeSet<String>,
9918}
9919
9920impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {}
9921
9922impl<'a, C> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
9923where
9924 C: common::Connector,
9925{
9926 /// Perform the operation you have build so far.
9927 pub async fn doit(
9928 mut self,
9929 ) -> common::Result<(
9930 common::Response,
9931 GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
9932 )> {
9933 use std::borrow::Cow;
9934 use std::io::{Read, Seek};
9935
9936 use common::{url::Params, ToParts};
9937 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9938
9939 let mut dd = common::DefaultDelegate;
9940 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9941 dlg.begin(common::MethodInfo {
9942 id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.get",
9943 http_method: hyper::Method::GET,
9944 });
9945
9946 for &field in ["alt", "name"].iter() {
9947 if self._additional_params.contains_key(field) {
9948 dlg.finished(false);
9949 return Err(common::Error::FieldClash(field));
9950 }
9951 }
9952
9953 let mut params = Params::with_capacity(3 + self._additional_params.len());
9954 params.push("name", self._name);
9955
9956 params.extend(self._additional_params.iter());
9957
9958 params.push("alt", "json");
9959 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
9960 if self._scopes.is_empty() {
9961 self._scopes
9962 .insert(Scope::CloudPlatform.as_ref().to_string());
9963 }
9964
9965 #[allow(clippy::single_element_loop)]
9966 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9967 url = params.uri_replacement(url, param_name, find_this, true);
9968 }
9969 {
9970 let to_remove = ["name"];
9971 params.remove_params(&to_remove);
9972 }
9973
9974 let url = params.parse_with_url(&url);
9975
9976 loop {
9977 let token = match self
9978 .hub
9979 .auth
9980 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9981 .await
9982 {
9983 Ok(token) => token,
9984 Err(e) => match dlg.token(e) {
9985 Ok(token) => token,
9986 Err(e) => {
9987 dlg.finished(false);
9988 return Err(common::Error::MissingToken(e));
9989 }
9990 },
9991 };
9992 let mut req_result = {
9993 let client = &self.hub.client;
9994 dlg.pre_request();
9995 let mut req_builder = hyper::Request::builder()
9996 .method(hyper::Method::GET)
9997 .uri(url.as_str())
9998 .header(USER_AGENT, self.hub._user_agent.clone());
9999
10000 if let Some(token) = token.as_ref() {
10001 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10002 }
10003
10004 let request = req_builder
10005 .header(CONTENT_LENGTH, 0_u64)
10006 .body(common::to_body::<String>(None));
10007
10008 client.request(request.unwrap()).await
10009 };
10010
10011 match req_result {
10012 Err(err) => {
10013 if let common::Retry::After(d) = dlg.http_error(&err) {
10014 sleep(d).await;
10015 continue;
10016 }
10017 dlg.finished(false);
10018 return Err(common::Error::HttpError(err));
10019 }
10020 Ok(res) => {
10021 let (mut parts, body) = res.into_parts();
10022 let mut body = common::Body::new(body);
10023 if !parts.status.is_success() {
10024 let bytes = common::to_bytes(body).await.unwrap_or_default();
10025 let error = serde_json::from_str(&common::to_string(&bytes));
10026 let response = common::to_response(parts, bytes.into());
10027
10028 if let common::Retry::After(d) =
10029 dlg.http_failure(&response, error.as_ref().ok())
10030 {
10031 sleep(d).await;
10032 continue;
10033 }
10034
10035 dlg.finished(false);
10036
10037 return Err(match error {
10038 Ok(value) => common::Error::BadRequest(value),
10039 _ => common::Error::Failure(response),
10040 });
10041 }
10042 let response = {
10043 let bytes = common::to_bytes(body).await.unwrap_or_default();
10044 let encoded = common::to_string(&bytes);
10045 match serde_json::from_str(&encoded) {
10046 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10047 Err(error) => {
10048 dlg.response_json_decode_error(&encoded, &error);
10049 return Err(common::Error::JsonDecodeError(
10050 encoded.to_string(),
10051 error,
10052 ));
10053 }
10054 }
10055 };
10056
10057 dlg.finished(true);
10058 return Ok(response);
10059 }
10060 }
10061 }
10062 }
10063
10064 /// Required. The relative resource name of the RecaptchaEnterpriseConfig, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
10065 ///
10066 /// Sets the *name* path property to the given value.
10067 ///
10068 /// Even though the property as already been set when instantiating this call,
10069 /// we provide this method for API completeness.
10070 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10071 self._name = new_value.to_string();
10072 self
10073 }
10074 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10075 /// while executing the actual API request.
10076 ///
10077 /// ````text
10078 /// It should be used to handle progress information, and to implement a certain level of resilience.
10079 /// ````
10080 ///
10081 /// Sets the *delegate* property to the given value.
10082 pub fn delegate(
10083 mut self,
10084 new_value: &'a mut dyn common::Delegate,
10085 ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10086 self._delegate = Some(new_value);
10087 self
10088 }
10089
10090 /// Set any additional parameter of the query string used in the request.
10091 /// It should be used to set parameters which are not yet available through their own
10092 /// setters.
10093 ///
10094 /// Please note that this method must not be used to set any of the known parameters
10095 /// which have their own setter method. If done anyway, the request will fail.
10096 ///
10097 /// # Additional Parameters
10098 ///
10099 /// * *$.xgafv* (query-string) - V1 error format.
10100 /// * *access_token* (query-string) - OAuth access token.
10101 /// * *alt* (query-string) - Data format for response.
10102 /// * *callback* (query-string) - JSONP
10103 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10104 /// * *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.
10105 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10106 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10107 /// * *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.
10108 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10109 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10110 pub fn param<T>(
10111 mut self,
10112 name: T,
10113 value: T,
10114 ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10115 where
10116 T: AsRef<str>,
10117 {
10118 self._additional_params
10119 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10120 self
10121 }
10122
10123 /// Identifies the authorization scope for the method you are building.
10124 ///
10125 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10126 /// [`Scope::CloudPlatform`].
10127 ///
10128 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10129 /// tokens for more than one scope.
10130 ///
10131 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10132 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10133 /// sufficient, a read-write scope will do as well.
10134 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10135 where
10136 St: AsRef<str>,
10137 {
10138 self._scopes.insert(String::from(scope.as_ref()));
10139 self
10140 }
10141 /// Identifies the authorization scope(s) for the method you are building.
10142 ///
10143 /// See [`Self::add_scope()`] for details.
10144 pub fn add_scopes<I, St>(
10145 mut self,
10146 scopes: I,
10147 ) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C>
10148 where
10149 I: IntoIterator<Item = St>,
10150 St: AsRef<str>,
10151 {
10152 self._scopes
10153 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10154 self
10155 }
10156
10157 /// Removes all scopes, and no default scope will be used either.
10158 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10159 /// for details).
10160 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigGetCall<'a, C> {
10161 self._scopes.clear();
10162 self
10163 }
10164}
10165
10166/// 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.
10167///
10168/// A builder for the *apps.recaptchaEnterpriseConfig.patch* method supported by a *project* resource.
10169/// It is not used directly, but through a [`ProjectMethods`] instance.
10170///
10171/// # Example
10172///
10173/// Instantiate a resource method builder
10174///
10175/// ```test_harness,no_run
10176/// # extern crate hyper;
10177/// # extern crate hyper_rustls;
10178/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10179/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig;
10180/// # async fn dox() {
10181/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10182///
10183/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10184/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10185/// # secret,
10186/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10187/// # ).build().await.unwrap();
10188///
10189/// # let client = hyper_util::client::legacy::Client::builder(
10190/// # hyper_util::rt::TokioExecutor::new()
10191/// # )
10192/// # .build(
10193/// # hyper_rustls::HttpsConnectorBuilder::new()
10194/// # .with_native_roots()
10195/// # .unwrap()
10196/// # .https_or_http()
10197/// # .enable_http1()
10198/// # .build()
10199/// # );
10200/// # let mut hub = Firebaseappcheck::new(client, auth);
10201/// // As the method needs a request, you would usually fill it with the desired information
10202/// // into the respective structure. Some of the parts shown here might not be applicable !
10203/// // Values shown here are possibly random and not representative !
10204/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig::default();
10205///
10206/// // You can configure optional parameters by calling the respective setters at will, and
10207/// // execute the final call using `doit()`.
10208/// // Values shown here are possibly random and not representative !
10209/// let result = hub.projects().apps_recaptcha_enterprise_config_patch(req, "name")
10210/// .update_mask(FieldMask::new::<&str>(&[]))
10211/// .doit().await;
10212/// # }
10213/// ```
10214pub struct ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10215where
10216 C: 'a,
10217{
10218 hub: &'a Firebaseappcheck<C>,
10219 _request: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10220 _name: String,
10221 _update_mask: Option<common::FieldMask>,
10222 _delegate: Option<&'a mut dyn common::Delegate>,
10223 _additional_params: HashMap<String, String>,
10224 _scopes: BTreeSet<String>,
10225}
10226
10227impl<'a, C> common::CallBuilder for ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {}
10228
10229impl<'a, C> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10230where
10231 C: common::Connector,
10232{
10233 /// Perform the operation you have build so far.
10234 pub async fn doit(
10235 mut self,
10236 ) -> common::Result<(
10237 common::Response,
10238 GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10239 )> {
10240 use std::borrow::Cow;
10241 use std::io::{Read, Seek};
10242
10243 use common::{url::Params, ToParts};
10244 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10245
10246 let mut dd = common::DefaultDelegate;
10247 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10248 dlg.begin(common::MethodInfo {
10249 id: "firebaseappcheck.projects.apps.recaptchaEnterpriseConfig.patch",
10250 http_method: hyper::Method::PATCH,
10251 });
10252
10253 for &field in ["alt", "name", "updateMask"].iter() {
10254 if self._additional_params.contains_key(field) {
10255 dlg.finished(false);
10256 return Err(common::Error::FieldClash(field));
10257 }
10258 }
10259
10260 let mut params = Params::with_capacity(5 + self._additional_params.len());
10261 params.push("name", self._name);
10262 if let Some(value) = self._update_mask.as_ref() {
10263 params.push("updateMask", value.to_string());
10264 }
10265
10266 params.extend(self._additional_params.iter());
10267
10268 params.push("alt", "json");
10269 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
10270 if self._scopes.is_empty() {
10271 self._scopes
10272 .insert(Scope::CloudPlatform.as_ref().to_string());
10273 }
10274
10275 #[allow(clippy::single_element_loop)]
10276 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10277 url = params.uri_replacement(url, param_name, find_this, true);
10278 }
10279 {
10280 let to_remove = ["name"];
10281 params.remove_params(&to_remove);
10282 }
10283
10284 let url = params.parse_with_url(&url);
10285
10286 let mut json_mime_type = mime::APPLICATION_JSON;
10287 let mut request_value_reader = {
10288 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10289 common::remove_json_null_values(&mut value);
10290 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10291 serde_json::to_writer(&mut dst, &value).unwrap();
10292 dst
10293 };
10294 let request_size = request_value_reader
10295 .seek(std::io::SeekFrom::End(0))
10296 .unwrap();
10297 request_value_reader
10298 .seek(std::io::SeekFrom::Start(0))
10299 .unwrap();
10300
10301 loop {
10302 let token = match self
10303 .hub
10304 .auth
10305 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10306 .await
10307 {
10308 Ok(token) => token,
10309 Err(e) => match dlg.token(e) {
10310 Ok(token) => token,
10311 Err(e) => {
10312 dlg.finished(false);
10313 return Err(common::Error::MissingToken(e));
10314 }
10315 },
10316 };
10317 request_value_reader
10318 .seek(std::io::SeekFrom::Start(0))
10319 .unwrap();
10320 let mut req_result = {
10321 let client = &self.hub.client;
10322 dlg.pre_request();
10323 let mut req_builder = hyper::Request::builder()
10324 .method(hyper::Method::PATCH)
10325 .uri(url.as_str())
10326 .header(USER_AGENT, self.hub._user_agent.clone());
10327
10328 if let Some(token) = token.as_ref() {
10329 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10330 }
10331
10332 let request = req_builder
10333 .header(CONTENT_TYPE, json_mime_type.to_string())
10334 .header(CONTENT_LENGTH, request_size as u64)
10335 .body(common::to_body(
10336 request_value_reader.get_ref().clone().into(),
10337 ));
10338
10339 client.request(request.unwrap()).await
10340 };
10341
10342 match req_result {
10343 Err(err) => {
10344 if let common::Retry::After(d) = dlg.http_error(&err) {
10345 sleep(d).await;
10346 continue;
10347 }
10348 dlg.finished(false);
10349 return Err(common::Error::HttpError(err));
10350 }
10351 Ok(res) => {
10352 let (mut parts, body) = res.into_parts();
10353 let mut body = common::Body::new(body);
10354 if !parts.status.is_success() {
10355 let bytes = common::to_bytes(body).await.unwrap_or_default();
10356 let error = serde_json::from_str(&common::to_string(&bytes));
10357 let response = common::to_response(parts, bytes.into());
10358
10359 if let common::Retry::After(d) =
10360 dlg.http_failure(&response, error.as_ref().ok())
10361 {
10362 sleep(d).await;
10363 continue;
10364 }
10365
10366 dlg.finished(false);
10367
10368 return Err(match error {
10369 Ok(value) => common::Error::BadRequest(value),
10370 _ => common::Error::Failure(response),
10371 });
10372 }
10373 let response = {
10374 let bytes = common::to_bytes(body).await.unwrap_or_default();
10375 let encoded = common::to_string(&bytes);
10376 match serde_json::from_str(&encoded) {
10377 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10378 Err(error) => {
10379 dlg.response_json_decode_error(&encoded, &error);
10380 return Err(common::Error::JsonDecodeError(
10381 encoded.to_string(),
10382 error,
10383 ));
10384 }
10385 }
10386 };
10387
10388 dlg.finished(true);
10389 return Ok(response);
10390 }
10391 }
10392 }
10393 }
10394
10395 ///
10396 /// Sets the *request* property to the given value.
10397 ///
10398 /// Even though the property as already been set when instantiating this call,
10399 /// we provide this method for API completeness.
10400 pub fn request(
10401 mut self,
10402 new_value: GoogleFirebaseAppcheckV1betaRecaptchaEnterpriseConfig,
10403 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10404 self._request = new_value;
10405 self
10406 }
10407 /// Required. The relative resource name of the reCAPTCHA Enterprise configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaEnterpriseConfig ```
10408 ///
10409 /// Sets the *name* path property to the given value.
10410 ///
10411 /// Even though the property as already been set when instantiating this call,
10412 /// we provide this method for API completeness.
10413 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10414 self._name = new_value.to_string();
10415 self
10416 }
10417 /// Required. A comma-separated list of names of fields in the RecaptchaEnterpriseConfig to update. Example: `site_key`.
10418 ///
10419 /// Sets the *update mask* query property to the given value.
10420 pub fn update_mask(
10421 mut self,
10422 new_value: common::FieldMask,
10423 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10424 self._update_mask = Some(new_value);
10425 self
10426 }
10427 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10428 /// while executing the actual API request.
10429 ///
10430 /// ````text
10431 /// It should be used to handle progress information, and to implement a certain level of resilience.
10432 /// ````
10433 ///
10434 /// Sets the *delegate* property to the given value.
10435 pub fn delegate(
10436 mut self,
10437 new_value: &'a mut dyn common::Delegate,
10438 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10439 self._delegate = Some(new_value);
10440 self
10441 }
10442
10443 /// Set any additional parameter of the query string used in the request.
10444 /// It should be used to set parameters which are not yet available through their own
10445 /// setters.
10446 ///
10447 /// Please note that this method must not be used to set any of the known parameters
10448 /// which have their own setter method. If done anyway, the request will fail.
10449 ///
10450 /// # Additional Parameters
10451 ///
10452 /// * *$.xgafv* (query-string) - V1 error format.
10453 /// * *access_token* (query-string) - OAuth access token.
10454 /// * *alt* (query-string) - Data format for response.
10455 /// * *callback* (query-string) - JSONP
10456 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10457 /// * *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.
10458 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10459 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10460 /// * *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.
10461 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10462 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10463 pub fn param<T>(
10464 mut self,
10465 name: T,
10466 value: T,
10467 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10468 where
10469 T: AsRef<str>,
10470 {
10471 self._additional_params
10472 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10473 self
10474 }
10475
10476 /// Identifies the authorization scope for the method you are building.
10477 ///
10478 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10479 /// [`Scope::CloudPlatform`].
10480 ///
10481 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10482 /// tokens for more than one scope.
10483 ///
10484 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10485 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10486 /// sufficient, a read-write scope will do as well.
10487 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10488 where
10489 St: AsRef<str>,
10490 {
10491 self._scopes.insert(String::from(scope.as_ref()));
10492 self
10493 }
10494 /// Identifies the authorization scope(s) for the method you are building.
10495 ///
10496 /// See [`Self::add_scope()`] for details.
10497 pub fn add_scopes<I, St>(
10498 mut self,
10499 scopes: I,
10500 ) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C>
10501 where
10502 I: IntoIterator<Item = St>,
10503 St: AsRef<str>,
10504 {
10505 self._scopes
10506 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10507 self
10508 }
10509
10510 /// Removes all scopes, and no default scope will be used either.
10511 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10512 /// for details).
10513 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaEnterpriseConfigPatchCall<'a, C> {
10514 self._scopes.clear();
10515 self
10516 }
10517}
10518
10519/// Atomically gets the RecaptchaV3Configs for the specified list of apps. For security reasons, the `site_secret` field is never populated in the response.
10520///
10521/// A builder for the *apps.recaptchaV3Config.batchGet* method supported by a *project* resource.
10522/// It is not used directly, but through a [`ProjectMethods`] instance.
10523///
10524/// # Example
10525///
10526/// Instantiate a resource method builder
10527///
10528/// ```test_harness,no_run
10529/// # extern crate hyper;
10530/// # extern crate hyper_rustls;
10531/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10532/// # async fn dox() {
10533/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10534///
10535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10537/// # secret,
10538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10539/// # ).build().await.unwrap();
10540///
10541/// # let client = hyper_util::client::legacy::Client::builder(
10542/// # hyper_util::rt::TokioExecutor::new()
10543/// # )
10544/// # .build(
10545/// # hyper_rustls::HttpsConnectorBuilder::new()
10546/// # .with_native_roots()
10547/// # .unwrap()
10548/// # .https_or_http()
10549/// # .enable_http1()
10550/// # .build()
10551/// # );
10552/// # let mut hub = Firebaseappcheck::new(client, auth);
10553/// // You can configure optional parameters by calling the respective setters at will, and
10554/// // execute the final call using `doit()`.
10555/// // Values shown here are possibly random and not representative !
10556/// let result = hub.projects().apps_recaptcha_v3_config_batch_get("parent")
10557/// .add_names("eos")
10558/// .doit().await;
10559/// # }
10560/// ```
10561pub struct ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10562where
10563 C: 'a,
10564{
10565 hub: &'a Firebaseappcheck<C>,
10566 _parent: String,
10567 _names: Vec<String>,
10568 _delegate: Option<&'a mut dyn common::Delegate>,
10569 _additional_params: HashMap<String, String>,
10570 _scopes: BTreeSet<String>,
10571}
10572
10573impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {}
10574
10575impl<'a, C> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10576where
10577 C: common::Connector,
10578{
10579 /// Perform the operation you have build so far.
10580 pub async fn doit(
10581 mut self,
10582 ) -> common::Result<(
10583 common::Response,
10584 GoogleFirebaseAppcheckV1betaBatchGetRecaptchaV3ConfigsResponse,
10585 )> {
10586 use std::borrow::Cow;
10587 use std::io::{Read, Seek};
10588
10589 use common::{url::Params, ToParts};
10590 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10591
10592 let mut dd = common::DefaultDelegate;
10593 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10594 dlg.begin(common::MethodInfo {
10595 id: "firebaseappcheck.projects.apps.recaptchaV3Config.batchGet",
10596 http_method: hyper::Method::GET,
10597 });
10598
10599 for &field in ["alt", "parent", "names"].iter() {
10600 if self._additional_params.contains_key(field) {
10601 dlg.finished(false);
10602 return Err(common::Error::FieldClash(field));
10603 }
10604 }
10605
10606 let mut params = Params::with_capacity(4 + self._additional_params.len());
10607 params.push("parent", self._parent);
10608 if !self._names.is_empty() {
10609 for f in self._names.iter() {
10610 params.push("names", f);
10611 }
10612 }
10613
10614 params.extend(self._additional_params.iter());
10615
10616 params.push("alt", "json");
10617 let mut url =
10618 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/recaptchaV3Config:batchGet";
10619 if self._scopes.is_empty() {
10620 self._scopes
10621 .insert(Scope::CloudPlatform.as_ref().to_string());
10622 }
10623
10624 #[allow(clippy::single_element_loop)]
10625 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10626 url = params.uri_replacement(url, param_name, find_this, true);
10627 }
10628 {
10629 let to_remove = ["parent"];
10630 params.remove_params(&to_remove);
10631 }
10632
10633 let url = params.parse_with_url(&url);
10634
10635 loop {
10636 let token = match self
10637 .hub
10638 .auth
10639 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10640 .await
10641 {
10642 Ok(token) => token,
10643 Err(e) => match dlg.token(e) {
10644 Ok(token) => token,
10645 Err(e) => {
10646 dlg.finished(false);
10647 return Err(common::Error::MissingToken(e));
10648 }
10649 },
10650 };
10651 let mut req_result = {
10652 let client = &self.hub.client;
10653 dlg.pre_request();
10654 let mut req_builder = hyper::Request::builder()
10655 .method(hyper::Method::GET)
10656 .uri(url.as_str())
10657 .header(USER_AGENT, self.hub._user_agent.clone());
10658
10659 if let Some(token) = token.as_ref() {
10660 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10661 }
10662
10663 let request = req_builder
10664 .header(CONTENT_LENGTH, 0_u64)
10665 .body(common::to_body::<String>(None));
10666
10667 client.request(request.unwrap()).await
10668 };
10669
10670 match req_result {
10671 Err(err) => {
10672 if let common::Retry::After(d) = dlg.http_error(&err) {
10673 sleep(d).await;
10674 continue;
10675 }
10676 dlg.finished(false);
10677 return Err(common::Error::HttpError(err));
10678 }
10679 Ok(res) => {
10680 let (mut parts, body) = res.into_parts();
10681 let mut body = common::Body::new(body);
10682 if !parts.status.is_success() {
10683 let bytes = common::to_bytes(body).await.unwrap_or_default();
10684 let error = serde_json::from_str(&common::to_string(&bytes));
10685 let response = common::to_response(parts, bytes.into());
10686
10687 if let common::Retry::After(d) =
10688 dlg.http_failure(&response, error.as_ref().ok())
10689 {
10690 sleep(d).await;
10691 continue;
10692 }
10693
10694 dlg.finished(false);
10695
10696 return Err(match error {
10697 Ok(value) => common::Error::BadRequest(value),
10698 _ => common::Error::Failure(response),
10699 });
10700 }
10701 let response = {
10702 let bytes = common::to_bytes(body).await.unwrap_or_default();
10703 let encoded = common::to_string(&bytes);
10704 match serde_json::from_str(&encoded) {
10705 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10706 Err(error) => {
10707 dlg.response_json_decode_error(&encoded, &error);
10708 return Err(common::Error::JsonDecodeError(
10709 encoded.to_string(),
10710 error,
10711 ));
10712 }
10713 }
10714 };
10715
10716 dlg.finished(true);
10717 return Ok(response);
10718 }
10719 }
10720 }
10721 }
10722
10723 /// 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.
10724 ///
10725 /// Sets the *parent* path property to the given value.
10726 ///
10727 /// Even though the property as already been set when instantiating this call,
10728 /// we provide this method for API completeness.
10729 pub fn parent(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
10730 self._parent = new_value.to_string();
10731 self
10732 }
10733 /// 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.
10734 ///
10735 /// Append the given value to the *names* query property.
10736 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10737 pub fn add_names(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
10738 self._names.push(new_value.to_string());
10739 self
10740 }
10741 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10742 /// while executing the actual API request.
10743 ///
10744 /// ````text
10745 /// It should be used to handle progress information, and to implement a certain level of resilience.
10746 /// ````
10747 ///
10748 /// Sets the *delegate* property to the given value.
10749 pub fn delegate(
10750 mut self,
10751 new_value: &'a mut dyn common::Delegate,
10752 ) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
10753 self._delegate = Some(new_value);
10754 self
10755 }
10756
10757 /// Set any additional parameter of the query string used in the request.
10758 /// It should be used to set parameters which are not yet available through their own
10759 /// setters.
10760 ///
10761 /// Please note that this method must not be used to set any of the known parameters
10762 /// which have their own setter method. If done anyway, the request will fail.
10763 ///
10764 /// # Additional Parameters
10765 ///
10766 /// * *$.xgafv* (query-string) - V1 error format.
10767 /// * *access_token* (query-string) - OAuth access token.
10768 /// * *alt* (query-string) - Data format for response.
10769 /// * *callback* (query-string) - JSONP
10770 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10771 /// * *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.
10772 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10773 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10774 /// * *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.
10775 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10776 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10777 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10778 where
10779 T: AsRef<str>,
10780 {
10781 self._additional_params
10782 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10783 self
10784 }
10785
10786 /// Identifies the authorization scope for the method you are building.
10787 ///
10788 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10789 /// [`Scope::CloudPlatform`].
10790 ///
10791 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10792 /// tokens for more than one scope.
10793 ///
10794 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10795 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10796 /// sufficient, a read-write scope will do as well.
10797 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10798 where
10799 St: AsRef<str>,
10800 {
10801 self._scopes.insert(String::from(scope.as_ref()));
10802 self
10803 }
10804 /// Identifies the authorization scope(s) for the method you are building.
10805 ///
10806 /// See [`Self::add_scope()`] for details.
10807 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C>
10808 where
10809 I: IntoIterator<Item = St>,
10810 St: AsRef<str>,
10811 {
10812 self._scopes
10813 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10814 self
10815 }
10816
10817 /// Removes all scopes, and no default scope will be used either.
10818 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10819 /// for details).
10820 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigBatchGetCall<'a, C> {
10821 self._scopes.clear();
10822 self
10823 }
10824}
10825
10826/// Gets the RecaptchaV3Config for the specified app. For security reasons, the `site_secret` field is never populated in the response.
10827///
10828/// A builder for the *apps.recaptchaV3Config.get* method supported by a *project* resource.
10829/// It is not used directly, but through a [`ProjectMethods`] instance.
10830///
10831/// # Example
10832///
10833/// Instantiate a resource method builder
10834///
10835/// ```test_harness,no_run
10836/// # extern crate hyper;
10837/// # extern crate hyper_rustls;
10838/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
10839/// # async fn dox() {
10840/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10841///
10842/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10843/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10844/// # secret,
10845/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10846/// # ).build().await.unwrap();
10847///
10848/// # let client = hyper_util::client::legacy::Client::builder(
10849/// # hyper_util::rt::TokioExecutor::new()
10850/// # )
10851/// # .build(
10852/// # hyper_rustls::HttpsConnectorBuilder::new()
10853/// # .with_native_roots()
10854/// # .unwrap()
10855/// # .https_or_http()
10856/// # .enable_http1()
10857/// # .build()
10858/// # );
10859/// # let mut hub = Firebaseappcheck::new(client, auth);
10860/// // You can configure optional parameters by calling the respective setters at will, and
10861/// // execute the final call using `doit()`.
10862/// // Values shown here are possibly random and not representative !
10863/// let result = hub.projects().apps_recaptcha_v3_config_get("name")
10864/// .doit().await;
10865/// # }
10866/// ```
10867pub struct ProjectAppRecaptchaV3ConfigGetCall<'a, C>
10868where
10869 C: 'a,
10870{
10871 hub: &'a Firebaseappcheck<C>,
10872 _name: String,
10873 _delegate: Option<&'a mut dyn common::Delegate>,
10874 _additional_params: HashMap<String, String>,
10875 _scopes: BTreeSet<String>,
10876}
10877
10878impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigGetCall<'a, C> {}
10879
10880impl<'a, C> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
10881where
10882 C: common::Connector,
10883{
10884 /// Perform the operation you have build so far.
10885 pub async fn doit(
10886 mut self,
10887 ) -> common::Result<(
10888 common::Response,
10889 GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
10890 )> {
10891 use std::borrow::Cow;
10892 use std::io::{Read, Seek};
10893
10894 use common::{url::Params, ToParts};
10895 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10896
10897 let mut dd = common::DefaultDelegate;
10898 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10899 dlg.begin(common::MethodInfo {
10900 id: "firebaseappcheck.projects.apps.recaptchaV3Config.get",
10901 http_method: hyper::Method::GET,
10902 });
10903
10904 for &field in ["alt", "name"].iter() {
10905 if self._additional_params.contains_key(field) {
10906 dlg.finished(false);
10907 return Err(common::Error::FieldClash(field));
10908 }
10909 }
10910
10911 let mut params = Params::with_capacity(3 + self._additional_params.len());
10912 params.push("name", self._name);
10913
10914 params.extend(self._additional_params.iter());
10915
10916 params.push("alt", "json");
10917 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
10918 if self._scopes.is_empty() {
10919 self._scopes
10920 .insert(Scope::CloudPlatform.as_ref().to_string());
10921 }
10922
10923 #[allow(clippy::single_element_loop)]
10924 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10925 url = params.uri_replacement(url, param_name, find_this, true);
10926 }
10927 {
10928 let to_remove = ["name"];
10929 params.remove_params(&to_remove);
10930 }
10931
10932 let url = params.parse_with_url(&url);
10933
10934 loop {
10935 let token = match self
10936 .hub
10937 .auth
10938 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10939 .await
10940 {
10941 Ok(token) => token,
10942 Err(e) => match dlg.token(e) {
10943 Ok(token) => token,
10944 Err(e) => {
10945 dlg.finished(false);
10946 return Err(common::Error::MissingToken(e));
10947 }
10948 },
10949 };
10950 let mut req_result = {
10951 let client = &self.hub.client;
10952 dlg.pre_request();
10953 let mut req_builder = hyper::Request::builder()
10954 .method(hyper::Method::GET)
10955 .uri(url.as_str())
10956 .header(USER_AGENT, self.hub._user_agent.clone());
10957
10958 if let Some(token) = token.as_ref() {
10959 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10960 }
10961
10962 let request = req_builder
10963 .header(CONTENT_LENGTH, 0_u64)
10964 .body(common::to_body::<String>(None));
10965
10966 client.request(request.unwrap()).await
10967 };
10968
10969 match req_result {
10970 Err(err) => {
10971 if let common::Retry::After(d) = dlg.http_error(&err) {
10972 sleep(d).await;
10973 continue;
10974 }
10975 dlg.finished(false);
10976 return Err(common::Error::HttpError(err));
10977 }
10978 Ok(res) => {
10979 let (mut parts, body) = res.into_parts();
10980 let mut body = common::Body::new(body);
10981 if !parts.status.is_success() {
10982 let bytes = common::to_bytes(body).await.unwrap_or_default();
10983 let error = serde_json::from_str(&common::to_string(&bytes));
10984 let response = common::to_response(parts, bytes.into());
10985
10986 if let common::Retry::After(d) =
10987 dlg.http_failure(&response, error.as_ref().ok())
10988 {
10989 sleep(d).await;
10990 continue;
10991 }
10992
10993 dlg.finished(false);
10994
10995 return Err(match error {
10996 Ok(value) => common::Error::BadRequest(value),
10997 _ => common::Error::Failure(response),
10998 });
10999 }
11000 let response = {
11001 let bytes = common::to_bytes(body).await.unwrap_or_default();
11002 let encoded = common::to_string(&bytes);
11003 match serde_json::from_str(&encoded) {
11004 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11005 Err(error) => {
11006 dlg.response_json_decode_error(&encoded, &error);
11007 return Err(common::Error::JsonDecodeError(
11008 encoded.to_string(),
11009 error,
11010 ));
11011 }
11012 }
11013 };
11014
11015 dlg.finished(true);
11016 return Ok(response);
11017 }
11018 }
11019 }
11020 }
11021
11022 /// Required. The relative resource name of the RecaptchaV3Config, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
11023 ///
11024 /// Sets the *name* path property to the given value.
11025 ///
11026 /// Even though the property as already been set when instantiating this call,
11027 /// we provide this method for API completeness.
11028 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11029 self._name = new_value.to_string();
11030 self
11031 }
11032 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11033 /// while executing the actual API request.
11034 ///
11035 /// ````text
11036 /// It should be used to handle progress information, and to implement a certain level of resilience.
11037 /// ````
11038 ///
11039 /// Sets the *delegate* property to the given value.
11040 pub fn delegate(
11041 mut self,
11042 new_value: &'a mut dyn common::Delegate,
11043 ) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11044 self._delegate = Some(new_value);
11045 self
11046 }
11047
11048 /// Set any additional parameter of the query string used in the request.
11049 /// It should be used to set parameters which are not yet available through their own
11050 /// setters.
11051 ///
11052 /// Please note that this method must not be used to set any of the known parameters
11053 /// which have their own setter method. If done anyway, the request will fail.
11054 ///
11055 /// # Additional Parameters
11056 ///
11057 /// * *$.xgafv* (query-string) - V1 error format.
11058 /// * *access_token* (query-string) - OAuth access token.
11059 /// * *alt* (query-string) - Data format for response.
11060 /// * *callback* (query-string) - JSONP
11061 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11062 /// * *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.
11063 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11064 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11065 /// * *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.
11066 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11067 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11068 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11069 where
11070 T: AsRef<str>,
11071 {
11072 self._additional_params
11073 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11074 self
11075 }
11076
11077 /// Identifies the authorization scope for the method you are building.
11078 ///
11079 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11080 /// [`Scope::CloudPlatform`].
11081 ///
11082 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11083 /// tokens for more than one scope.
11084 ///
11085 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11086 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11087 /// sufficient, a read-write scope will do as well.
11088 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11089 where
11090 St: AsRef<str>,
11091 {
11092 self._scopes.insert(String::from(scope.as_ref()));
11093 self
11094 }
11095 /// Identifies the authorization scope(s) for the method you are building.
11096 ///
11097 /// See [`Self::add_scope()`] for details.
11098 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C>
11099 where
11100 I: IntoIterator<Item = St>,
11101 St: AsRef<str>,
11102 {
11103 self._scopes
11104 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11105 self
11106 }
11107
11108 /// Removes all scopes, and no default scope will be used either.
11109 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11110 /// for details).
11111 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigGetCall<'a, C> {
11112 self._scopes.clear();
11113 self
11114 }
11115}
11116
11117/// 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.
11118///
11119/// A builder for the *apps.recaptchaV3Config.patch* method supported by a *project* resource.
11120/// It is not used directly, but through a [`ProjectMethods`] instance.
11121///
11122/// # Example
11123///
11124/// Instantiate a resource method builder
11125///
11126/// ```test_harness,no_run
11127/// # extern crate hyper;
11128/// # extern crate hyper_rustls;
11129/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11130/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaRecaptchaV3Config;
11131/// # async fn dox() {
11132/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11133///
11134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11135/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11136/// # secret,
11137/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11138/// # ).build().await.unwrap();
11139///
11140/// # let client = hyper_util::client::legacy::Client::builder(
11141/// # hyper_util::rt::TokioExecutor::new()
11142/// # )
11143/// # .build(
11144/// # hyper_rustls::HttpsConnectorBuilder::new()
11145/// # .with_native_roots()
11146/// # .unwrap()
11147/// # .https_or_http()
11148/// # .enable_http1()
11149/// # .build()
11150/// # );
11151/// # let mut hub = Firebaseappcheck::new(client, auth);
11152/// // As the method needs a request, you would usually fill it with the desired information
11153/// // into the respective structure. Some of the parts shown here might not be applicable !
11154/// // Values shown here are possibly random and not representative !
11155/// let mut req = GoogleFirebaseAppcheckV1betaRecaptchaV3Config::default();
11156///
11157/// // You can configure optional parameters by calling the respective setters at will, and
11158/// // execute the final call using `doit()`.
11159/// // Values shown here are possibly random and not representative !
11160/// let result = hub.projects().apps_recaptcha_v3_config_patch(req, "name")
11161/// .update_mask(FieldMask::new::<&str>(&[]))
11162/// .doit().await;
11163/// # }
11164/// ```
11165pub struct ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11166where
11167 C: 'a,
11168{
11169 hub: &'a Firebaseappcheck<C>,
11170 _request: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11171 _name: String,
11172 _update_mask: Option<common::FieldMask>,
11173 _delegate: Option<&'a mut dyn common::Delegate>,
11174 _additional_params: HashMap<String, String>,
11175 _scopes: BTreeSet<String>,
11176}
11177
11178impl<'a, C> common::CallBuilder for ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {}
11179
11180impl<'a, C> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11181where
11182 C: common::Connector,
11183{
11184 /// Perform the operation you have build so far.
11185 pub async fn doit(
11186 mut self,
11187 ) -> common::Result<(
11188 common::Response,
11189 GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11190 )> {
11191 use std::borrow::Cow;
11192 use std::io::{Read, Seek};
11193
11194 use common::{url::Params, ToParts};
11195 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11196
11197 let mut dd = common::DefaultDelegate;
11198 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11199 dlg.begin(common::MethodInfo {
11200 id: "firebaseappcheck.projects.apps.recaptchaV3Config.patch",
11201 http_method: hyper::Method::PATCH,
11202 });
11203
11204 for &field in ["alt", "name", "updateMask"].iter() {
11205 if self._additional_params.contains_key(field) {
11206 dlg.finished(false);
11207 return Err(common::Error::FieldClash(field));
11208 }
11209 }
11210
11211 let mut params = Params::with_capacity(5 + self._additional_params.len());
11212 params.push("name", self._name);
11213 if let Some(value) = self._update_mask.as_ref() {
11214 params.push("updateMask", value.to_string());
11215 }
11216
11217 params.extend(self._additional_params.iter());
11218
11219 params.push("alt", "json");
11220 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
11221 if self._scopes.is_empty() {
11222 self._scopes
11223 .insert(Scope::CloudPlatform.as_ref().to_string());
11224 }
11225
11226 #[allow(clippy::single_element_loop)]
11227 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11228 url = params.uri_replacement(url, param_name, find_this, true);
11229 }
11230 {
11231 let to_remove = ["name"];
11232 params.remove_params(&to_remove);
11233 }
11234
11235 let url = params.parse_with_url(&url);
11236
11237 let mut json_mime_type = mime::APPLICATION_JSON;
11238 let mut request_value_reader = {
11239 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11240 common::remove_json_null_values(&mut value);
11241 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11242 serde_json::to_writer(&mut dst, &value).unwrap();
11243 dst
11244 };
11245 let request_size = request_value_reader
11246 .seek(std::io::SeekFrom::End(0))
11247 .unwrap();
11248 request_value_reader
11249 .seek(std::io::SeekFrom::Start(0))
11250 .unwrap();
11251
11252 loop {
11253 let token = match self
11254 .hub
11255 .auth
11256 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11257 .await
11258 {
11259 Ok(token) => token,
11260 Err(e) => match dlg.token(e) {
11261 Ok(token) => token,
11262 Err(e) => {
11263 dlg.finished(false);
11264 return Err(common::Error::MissingToken(e));
11265 }
11266 },
11267 };
11268 request_value_reader
11269 .seek(std::io::SeekFrom::Start(0))
11270 .unwrap();
11271 let mut req_result = {
11272 let client = &self.hub.client;
11273 dlg.pre_request();
11274 let mut req_builder = hyper::Request::builder()
11275 .method(hyper::Method::PATCH)
11276 .uri(url.as_str())
11277 .header(USER_AGENT, self.hub._user_agent.clone());
11278
11279 if let Some(token) = token.as_ref() {
11280 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11281 }
11282
11283 let request = req_builder
11284 .header(CONTENT_TYPE, json_mime_type.to_string())
11285 .header(CONTENT_LENGTH, request_size as u64)
11286 .body(common::to_body(
11287 request_value_reader.get_ref().clone().into(),
11288 ));
11289
11290 client.request(request.unwrap()).await
11291 };
11292
11293 match req_result {
11294 Err(err) => {
11295 if let common::Retry::After(d) = dlg.http_error(&err) {
11296 sleep(d).await;
11297 continue;
11298 }
11299 dlg.finished(false);
11300 return Err(common::Error::HttpError(err));
11301 }
11302 Ok(res) => {
11303 let (mut parts, body) = res.into_parts();
11304 let mut body = common::Body::new(body);
11305 if !parts.status.is_success() {
11306 let bytes = common::to_bytes(body).await.unwrap_or_default();
11307 let error = serde_json::from_str(&common::to_string(&bytes));
11308 let response = common::to_response(parts, bytes.into());
11309
11310 if let common::Retry::After(d) =
11311 dlg.http_failure(&response, error.as_ref().ok())
11312 {
11313 sleep(d).await;
11314 continue;
11315 }
11316
11317 dlg.finished(false);
11318
11319 return Err(match error {
11320 Ok(value) => common::Error::BadRequest(value),
11321 _ => common::Error::Failure(response),
11322 });
11323 }
11324 let response = {
11325 let bytes = common::to_bytes(body).await.unwrap_or_default();
11326 let encoded = common::to_string(&bytes);
11327 match serde_json::from_str(&encoded) {
11328 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11329 Err(error) => {
11330 dlg.response_json_decode_error(&encoded, &error);
11331 return Err(common::Error::JsonDecodeError(
11332 encoded.to_string(),
11333 error,
11334 ));
11335 }
11336 }
11337 };
11338
11339 dlg.finished(true);
11340 return Ok(response);
11341 }
11342 }
11343 }
11344 }
11345
11346 ///
11347 /// Sets the *request* property to the given value.
11348 ///
11349 /// Even though the property as already been set when instantiating this call,
11350 /// we provide this method for API completeness.
11351 pub fn request(
11352 mut self,
11353 new_value: GoogleFirebaseAppcheckV1betaRecaptchaV3Config,
11354 ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11355 self._request = new_value;
11356 self
11357 }
11358 /// Required. The relative resource name of the reCAPTCHA v3 configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/recaptchaV3Config ```
11359 ///
11360 /// Sets the *name* path property to the given value.
11361 ///
11362 /// Even though the property as already been set when instantiating this call,
11363 /// we provide this method for API completeness.
11364 pub fn name(mut self, new_value: &str) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11365 self._name = new_value.to_string();
11366 self
11367 }
11368 /// Required. A comma-separated list of names of fields in the RecaptchaV3Config to update. Example: `site_secret`.
11369 ///
11370 /// Sets the *update mask* query property to the given value.
11371 pub fn update_mask(
11372 mut self,
11373 new_value: common::FieldMask,
11374 ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11375 self._update_mask = Some(new_value);
11376 self
11377 }
11378 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11379 /// while executing the actual API request.
11380 ///
11381 /// ````text
11382 /// It should be used to handle progress information, and to implement a certain level of resilience.
11383 /// ````
11384 ///
11385 /// Sets the *delegate* property to the given value.
11386 pub fn delegate(
11387 mut self,
11388 new_value: &'a mut dyn common::Delegate,
11389 ) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11390 self._delegate = Some(new_value);
11391 self
11392 }
11393
11394 /// Set any additional parameter of the query string used in the request.
11395 /// It should be used to set parameters which are not yet available through their own
11396 /// setters.
11397 ///
11398 /// Please note that this method must not be used to set any of the known parameters
11399 /// which have their own setter method. If done anyway, the request will fail.
11400 ///
11401 /// # Additional Parameters
11402 ///
11403 /// * *$.xgafv* (query-string) - V1 error format.
11404 /// * *access_token* (query-string) - OAuth access token.
11405 /// * *alt* (query-string) - Data format for response.
11406 /// * *callback* (query-string) - JSONP
11407 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11408 /// * *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.
11409 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11410 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11411 /// * *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.
11412 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11413 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11414 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11415 where
11416 T: AsRef<str>,
11417 {
11418 self._additional_params
11419 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11420 self
11421 }
11422
11423 /// Identifies the authorization scope for the method you are building.
11424 ///
11425 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11426 /// [`Scope::CloudPlatform`].
11427 ///
11428 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11429 /// tokens for more than one scope.
11430 ///
11431 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11432 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11433 /// sufficient, a read-write scope will do as well.
11434 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11435 where
11436 St: AsRef<str>,
11437 {
11438 self._scopes.insert(String::from(scope.as_ref()));
11439 self
11440 }
11441 /// Identifies the authorization scope(s) for the method you are building.
11442 ///
11443 /// See [`Self::add_scope()`] for details.
11444 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C>
11445 where
11446 I: IntoIterator<Item = St>,
11447 St: AsRef<str>,
11448 {
11449 self._scopes
11450 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11451 self
11452 }
11453
11454 /// Removes all scopes, and no default scope will be used either.
11455 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11456 /// for details).
11457 pub fn clear_scopes(mut self) -> ProjectAppRecaptchaV3ConfigPatchCall<'a, C> {
11458 self._scopes.clear();
11459 self
11460 }
11461}
11462
11463/// Atomically gets the SafetyNetConfigs for the specified list of apps.
11464///
11465/// A builder for the *apps.safetyNetConfig.batchGet* method supported by a *project* resource.
11466/// It is not used directly, but through a [`ProjectMethods`] instance.
11467///
11468/// # Example
11469///
11470/// Instantiate a resource method builder
11471///
11472/// ```test_harness,no_run
11473/// # extern crate hyper;
11474/// # extern crate hyper_rustls;
11475/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11476/// # async fn dox() {
11477/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11478///
11479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11481/// # secret,
11482/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11483/// # ).build().await.unwrap();
11484///
11485/// # let client = hyper_util::client::legacy::Client::builder(
11486/// # hyper_util::rt::TokioExecutor::new()
11487/// # )
11488/// # .build(
11489/// # hyper_rustls::HttpsConnectorBuilder::new()
11490/// # .with_native_roots()
11491/// # .unwrap()
11492/// # .https_or_http()
11493/// # .enable_http1()
11494/// # .build()
11495/// # );
11496/// # let mut hub = Firebaseappcheck::new(client, auth);
11497/// // You can configure optional parameters by calling the respective setters at will, and
11498/// // execute the final call using `doit()`.
11499/// // Values shown here are possibly random and not representative !
11500/// let result = hub.projects().apps_safety_net_config_batch_get("parent")
11501/// .add_names("sed")
11502/// .doit().await;
11503/// # }
11504/// ```
11505pub struct ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11506where
11507 C: 'a,
11508{
11509 hub: &'a Firebaseappcheck<C>,
11510 _parent: String,
11511 _names: Vec<String>,
11512 _delegate: Option<&'a mut dyn common::Delegate>,
11513 _additional_params: HashMap<String, String>,
11514 _scopes: BTreeSet<String>,
11515}
11516
11517impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigBatchGetCall<'a, C> {}
11518
11519impl<'a, C> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11520where
11521 C: common::Connector,
11522{
11523 /// Perform the operation you have build so far.
11524 pub async fn doit(
11525 mut self,
11526 ) -> common::Result<(
11527 common::Response,
11528 GoogleFirebaseAppcheckV1betaBatchGetSafetyNetConfigsResponse,
11529 )> {
11530 use std::borrow::Cow;
11531 use std::io::{Read, Seek};
11532
11533 use common::{url::Params, ToParts};
11534 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11535
11536 let mut dd = common::DefaultDelegate;
11537 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11538 dlg.begin(common::MethodInfo {
11539 id: "firebaseappcheck.projects.apps.safetyNetConfig.batchGet",
11540 http_method: hyper::Method::GET,
11541 });
11542
11543 for &field in ["alt", "parent", "names"].iter() {
11544 if self._additional_params.contains_key(field) {
11545 dlg.finished(false);
11546 return Err(common::Error::FieldClash(field));
11547 }
11548 }
11549
11550 let mut params = Params::with_capacity(4 + self._additional_params.len());
11551 params.push("parent", self._parent);
11552 if !self._names.is_empty() {
11553 for f in self._names.iter() {
11554 params.push("names", f);
11555 }
11556 }
11557
11558 params.extend(self._additional_params.iter());
11559
11560 params.push("alt", "json");
11561 let mut url =
11562 self.hub._base_url.clone() + "v1beta/{+parent}/apps/-/safetyNetConfig:batchGet";
11563 if self._scopes.is_empty() {
11564 self._scopes
11565 .insert(Scope::CloudPlatform.as_ref().to_string());
11566 }
11567
11568 #[allow(clippy::single_element_loop)]
11569 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11570 url = params.uri_replacement(url, param_name, find_this, true);
11571 }
11572 {
11573 let to_remove = ["parent"];
11574 params.remove_params(&to_remove);
11575 }
11576
11577 let url = params.parse_with_url(&url);
11578
11579 loop {
11580 let token = match self
11581 .hub
11582 .auth
11583 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11584 .await
11585 {
11586 Ok(token) => token,
11587 Err(e) => match dlg.token(e) {
11588 Ok(token) => token,
11589 Err(e) => {
11590 dlg.finished(false);
11591 return Err(common::Error::MissingToken(e));
11592 }
11593 },
11594 };
11595 let mut req_result = {
11596 let client = &self.hub.client;
11597 dlg.pre_request();
11598 let mut req_builder = hyper::Request::builder()
11599 .method(hyper::Method::GET)
11600 .uri(url.as_str())
11601 .header(USER_AGENT, self.hub._user_agent.clone());
11602
11603 if let Some(token) = token.as_ref() {
11604 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11605 }
11606
11607 let request = req_builder
11608 .header(CONTENT_LENGTH, 0_u64)
11609 .body(common::to_body::<String>(None));
11610
11611 client.request(request.unwrap()).await
11612 };
11613
11614 match req_result {
11615 Err(err) => {
11616 if let common::Retry::After(d) = dlg.http_error(&err) {
11617 sleep(d).await;
11618 continue;
11619 }
11620 dlg.finished(false);
11621 return Err(common::Error::HttpError(err));
11622 }
11623 Ok(res) => {
11624 let (mut parts, body) = res.into_parts();
11625 let mut body = common::Body::new(body);
11626 if !parts.status.is_success() {
11627 let bytes = common::to_bytes(body).await.unwrap_or_default();
11628 let error = serde_json::from_str(&common::to_string(&bytes));
11629 let response = common::to_response(parts, bytes.into());
11630
11631 if let common::Retry::After(d) =
11632 dlg.http_failure(&response, error.as_ref().ok())
11633 {
11634 sleep(d).await;
11635 continue;
11636 }
11637
11638 dlg.finished(false);
11639
11640 return Err(match error {
11641 Ok(value) => common::Error::BadRequest(value),
11642 _ => common::Error::Failure(response),
11643 });
11644 }
11645 let response = {
11646 let bytes = common::to_bytes(body).await.unwrap_or_default();
11647 let encoded = common::to_string(&bytes);
11648 match serde_json::from_str(&encoded) {
11649 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11650 Err(error) => {
11651 dlg.response_json_decode_error(&encoded, &error);
11652 return Err(common::Error::JsonDecodeError(
11653 encoded.to_string(),
11654 error,
11655 ));
11656 }
11657 }
11658 };
11659
11660 dlg.finished(true);
11661 return Ok(response);
11662 }
11663 }
11664 }
11665 }
11666
11667 /// 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.
11668 ///
11669 /// Sets the *parent* path property to the given value.
11670 ///
11671 /// Even though the property as already been set when instantiating this call,
11672 /// we provide this method for API completeness.
11673 pub fn parent(mut self, new_value: &str) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
11674 self._parent = new_value.to_string();
11675 self
11676 }
11677 /// 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.
11678 ///
11679 /// Append the given value to the *names* query property.
11680 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11681 pub fn add_names(mut self, new_value: &str) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
11682 self._names.push(new_value.to_string());
11683 self
11684 }
11685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11686 /// while executing the actual API request.
11687 ///
11688 /// ````text
11689 /// It should be used to handle progress information, and to implement a certain level of resilience.
11690 /// ````
11691 ///
11692 /// Sets the *delegate* property to the given value.
11693 pub fn delegate(
11694 mut self,
11695 new_value: &'a mut dyn common::Delegate,
11696 ) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
11697 self._delegate = Some(new_value);
11698 self
11699 }
11700
11701 /// Set any additional parameter of the query string used in the request.
11702 /// It should be used to set parameters which are not yet available through their own
11703 /// setters.
11704 ///
11705 /// Please note that this method must not be used to set any of the known parameters
11706 /// which have their own setter method. If done anyway, the request will fail.
11707 ///
11708 /// # Additional Parameters
11709 ///
11710 /// * *$.xgafv* (query-string) - V1 error format.
11711 /// * *access_token* (query-string) - OAuth access token.
11712 /// * *alt* (query-string) - Data format for response.
11713 /// * *callback* (query-string) - JSONP
11714 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11715 /// * *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.
11716 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11717 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11718 /// * *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.
11719 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11720 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11721 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11722 where
11723 T: AsRef<str>,
11724 {
11725 self._additional_params
11726 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11727 self
11728 }
11729
11730 /// Identifies the authorization scope for the method you are building.
11731 ///
11732 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11733 /// [`Scope::CloudPlatform`].
11734 ///
11735 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11736 /// tokens for more than one scope.
11737 ///
11738 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11739 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11740 /// sufficient, a read-write scope will do as well.
11741 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11742 where
11743 St: AsRef<str>,
11744 {
11745 self._scopes.insert(String::from(scope.as_ref()));
11746 self
11747 }
11748 /// Identifies the authorization scope(s) for the method you are building.
11749 ///
11750 /// See [`Self::add_scope()`] for details.
11751 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C>
11752 where
11753 I: IntoIterator<Item = St>,
11754 St: AsRef<str>,
11755 {
11756 self._scopes
11757 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11758 self
11759 }
11760
11761 /// Removes all scopes, and no default scope will be used either.
11762 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11763 /// for details).
11764 pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigBatchGetCall<'a, C> {
11765 self._scopes.clear();
11766 self
11767 }
11768}
11769
11770/// Gets the SafetyNetConfig for the specified app.
11771///
11772/// A builder for the *apps.safetyNetConfig.get* method supported by a *project* resource.
11773/// It is not used directly, but through a [`ProjectMethods`] instance.
11774///
11775/// # Example
11776///
11777/// Instantiate a resource method builder
11778///
11779/// ```test_harness,no_run
11780/// # extern crate hyper;
11781/// # extern crate hyper_rustls;
11782/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
11783/// # async fn dox() {
11784/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11785///
11786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11788/// # secret,
11789/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11790/// # ).build().await.unwrap();
11791///
11792/// # let client = hyper_util::client::legacy::Client::builder(
11793/// # hyper_util::rt::TokioExecutor::new()
11794/// # )
11795/// # .build(
11796/// # hyper_rustls::HttpsConnectorBuilder::new()
11797/// # .with_native_roots()
11798/// # .unwrap()
11799/// # .https_or_http()
11800/// # .enable_http1()
11801/// # .build()
11802/// # );
11803/// # let mut hub = Firebaseappcheck::new(client, auth);
11804/// // You can configure optional parameters by calling the respective setters at will, and
11805/// // execute the final call using `doit()`.
11806/// // Values shown here are possibly random and not representative !
11807/// let result = hub.projects().apps_safety_net_config_get("name")
11808/// .doit().await;
11809/// # }
11810/// ```
11811pub struct ProjectAppSafetyNetConfigGetCall<'a, C>
11812where
11813 C: 'a,
11814{
11815 hub: &'a Firebaseappcheck<C>,
11816 _name: String,
11817 _delegate: Option<&'a mut dyn common::Delegate>,
11818 _additional_params: HashMap<String, String>,
11819 _scopes: BTreeSet<String>,
11820}
11821
11822impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigGetCall<'a, C> {}
11823
11824impl<'a, C> ProjectAppSafetyNetConfigGetCall<'a, C>
11825where
11826 C: common::Connector,
11827{
11828 /// Perform the operation you have build so far.
11829 pub async fn doit(
11830 mut self,
11831 ) -> common::Result<(
11832 common::Response,
11833 GoogleFirebaseAppcheckV1betaSafetyNetConfig,
11834 )> {
11835 use std::borrow::Cow;
11836 use std::io::{Read, Seek};
11837
11838 use common::{url::Params, ToParts};
11839 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11840
11841 let mut dd = common::DefaultDelegate;
11842 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11843 dlg.begin(common::MethodInfo {
11844 id: "firebaseappcheck.projects.apps.safetyNetConfig.get",
11845 http_method: hyper::Method::GET,
11846 });
11847
11848 for &field in ["alt", "name"].iter() {
11849 if self._additional_params.contains_key(field) {
11850 dlg.finished(false);
11851 return Err(common::Error::FieldClash(field));
11852 }
11853 }
11854
11855 let mut params = Params::with_capacity(3 + self._additional_params.len());
11856 params.push("name", self._name);
11857
11858 params.extend(self._additional_params.iter());
11859
11860 params.push("alt", "json");
11861 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
11862 if self._scopes.is_empty() {
11863 self._scopes
11864 .insert(Scope::CloudPlatform.as_ref().to_string());
11865 }
11866
11867 #[allow(clippy::single_element_loop)]
11868 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11869 url = params.uri_replacement(url, param_name, find_this, true);
11870 }
11871 {
11872 let to_remove = ["name"];
11873 params.remove_params(&to_remove);
11874 }
11875
11876 let url = params.parse_with_url(&url);
11877
11878 loop {
11879 let token = match self
11880 .hub
11881 .auth
11882 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11883 .await
11884 {
11885 Ok(token) => token,
11886 Err(e) => match dlg.token(e) {
11887 Ok(token) => token,
11888 Err(e) => {
11889 dlg.finished(false);
11890 return Err(common::Error::MissingToken(e));
11891 }
11892 },
11893 };
11894 let mut req_result = {
11895 let client = &self.hub.client;
11896 dlg.pre_request();
11897 let mut req_builder = hyper::Request::builder()
11898 .method(hyper::Method::GET)
11899 .uri(url.as_str())
11900 .header(USER_AGENT, self.hub._user_agent.clone());
11901
11902 if let Some(token) = token.as_ref() {
11903 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11904 }
11905
11906 let request = req_builder
11907 .header(CONTENT_LENGTH, 0_u64)
11908 .body(common::to_body::<String>(None));
11909
11910 client.request(request.unwrap()).await
11911 };
11912
11913 match req_result {
11914 Err(err) => {
11915 if let common::Retry::After(d) = dlg.http_error(&err) {
11916 sleep(d).await;
11917 continue;
11918 }
11919 dlg.finished(false);
11920 return Err(common::Error::HttpError(err));
11921 }
11922 Ok(res) => {
11923 let (mut parts, body) = res.into_parts();
11924 let mut body = common::Body::new(body);
11925 if !parts.status.is_success() {
11926 let bytes = common::to_bytes(body).await.unwrap_or_default();
11927 let error = serde_json::from_str(&common::to_string(&bytes));
11928 let response = common::to_response(parts, bytes.into());
11929
11930 if let common::Retry::After(d) =
11931 dlg.http_failure(&response, error.as_ref().ok())
11932 {
11933 sleep(d).await;
11934 continue;
11935 }
11936
11937 dlg.finished(false);
11938
11939 return Err(match error {
11940 Ok(value) => common::Error::BadRequest(value),
11941 _ => common::Error::Failure(response),
11942 });
11943 }
11944 let response = {
11945 let bytes = common::to_bytes(body).await.unwrap_or_default();
11946 let encoded = common::to_string(&bytes);
11947 match serde_json::from_str(&encoded) {
11948 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11949 Err(error) => {
11950 dlg.response_json_decode_error(&encoded, &error);
11951 return Err(common::Error::JsonDecodeError(
11952 encoded.to_string(),
11953 error,
11954 ));
11955 }
11956 }
11957 };
11958
11959 dlg.finished(true);
11960 return Ok(response);
11961 }
11962 }
11963 }
11964 }
11965
11966 /// Required. The relative resource name of the SafetyNetConfig, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
11967 ///
11968 /// Sets the *name* path property to the given value.
11969 ///
11970 /// Even though the property as already been set when instantiating this call,
11971 /// we provide this method for API completeness.
11972 pub fn name(mut self, new_value: &str) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
11973 self._name = new_value.to_string();
11974 self
11975 }
11976 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11977 /// while executing the actual API request.
11978 ///
11979 /// ````text
11980 /// It should be used to handle progress information, and to implement a certain level of resilience.
11981 /// ````
11982 ///
11983 /// Sets the *delegate* property to the given value.
11984 pub fn delegate(
11985 mut self,
11986 new_value: &'a mut dyn common::Delegate,
11987 ) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
11988 self._delegate = Some(new_value);
11989 self
11990 }
11991
11992 /// Set any additional parameter of the query string used in the request.
11993 /// It should be used to set parameters which are not yet available through their own
11994 /// setters.
11995 ///
11996 /// Please note that this method must not be used to set any of the known parameters
11997 /// which have their own setter method. If done anyway, the request will fail.
11998 ///
11999 /// # Additional Parameters
12000 ///
12001 /// * *$.xgafv* (query-string) - V1 error format.
12002 /// * *access_token* (query-string) - OAuth access token.
12003 /// * *alt* (query-string) - Data format for response.
12004 /// * *callback* (query-string) - JSONP
12005 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12006 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12007 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12008 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12009 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12010 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12011 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12012 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12013 where
12014 T: AsRef<str>,
12015 {
12016 self._additional_params
12017 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12018 self
12019 }
12020
12021 /// Identifies the authorization scope for the method you are building.
12022 ///
12023 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12024 /// [`Scope::CloudPlatform`].
12025 ///
12026 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12027 /// tokens for more than one scope.
12028 ///
12029 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12030 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12031 /// sufficient, a read-write scope will do as well.
12032 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12033 where
12034 St: AsRef<str>,
12035 {
12036 self._scopes.insert(String::from(scope.as_ref()));
12037 self
12038 }
12039 /// Identifies the authorization scope(s) for the method you are building.
12040 ///
12041 /// See [`Self::add_scope()`] for details.
12042 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigGetCall<'a, C>
12043 where
12044 I: IntoIterator<Item = St>,
12045 St: AsRef<str>,
12046 {
12047 self._scopes
12048 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12049 self
12050 }
12051
12052 /// Removes all scopes, and no default scope will be used either.
12053 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12054 /// for details).
12055 pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigGetCall<'a, C> {
12056 self._scopes.clear();
12057 self
12058 }
12059}
12060
12061/// 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.
12062///
12063/// A builder for the *apps.safetyNetConfig.patch* method supported by a *project* resource.
12064/// It is not used directly, but through a [`ProjectMethods`] instance.
12065///
12066/// # Example
12067///
12068/// Instantiate a resource method builder
12069///
12070/// ```test_harness,no_run
12071/// # extern crate hyper;
12072/// # extern crate hyper_rustls;
12073/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12074/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaSafetyNetConfig;
12075/// # async fn dox() {
12076/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12077///
12078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12080/// # secret,
12081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12082/// # ).build().await.unwrap();
12083///
12084/// # let client = hyper_util::client::legacy::Client::builder(
12085/// # hyper_util::rt::TokioExecutor::new()
12086/// # )
12087/// # .build(
12088/// # hyper_rustls::HttpsConnectorBuilder::new()
12089/// # .with_native_roots()
12090/// # .unwrap()
12091/// # .https_or_http()
12092/// # .enable_http1()
12093/// # .build()
12094/// # );
12095/// # let mut hub = Firebaseappcheck::new(client, auth);
12096/// // As the method needs a request, you would usually fill it with the desired information
12097/// // into the respective structure. Some of the parts shown here might not be applicable !
12098/// // Values shown here are possibly random and not representative !
12099/// let mut req = GoogleFirebaseAppcheckV1betaSafetyNetConfig::default();
12100///
12101/// // You can configure optional parameters by calling the respective setters at will, and
12102/// // execute the final call using `doit()`.
12103/// // Values shown here are possibly random and not representative !
12104/// let result = hub.projects().apps_safety_net_config_patch(req, "name")
12105/// .update_mask(FieldMask::new::<&str>(&[]))
12106/// .doit().await;
12107/// # }
12108/// ```
12109pub struct ProjectAppSafetyNetConfigPatchCall<'a, C>
12110where
12111 C: 'a,
12112{
12113 hub: &'a Firebaseappcheck<C>,
12114 _request: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12115 _name: String,
12116 _update_mask: Option<common::FieldMask>,
12117 _delegate: Option<&'a mut dyn common::Delegate>,
12118 _additional_params: HashMap<String, String>,
12119 _scopes: BTreeSet<String>,
12120}
12121
12122impl<'a, C> common::CallBuilder for ProjectAppSafetyNetConfigPatchCall<'a, C> {}
12123
12124impl<'a, C> ProjectAppSafetyNetConfigPatchCall<'a, C>
12125where
12126 C: common::Connector,
12127{
12128 /// Perform the operation you have build so far.
12129 pub async fn doit(
12130 mut self,
12131 ) -> common::Result<(
12132 common::Response,
12133 GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12134 )> {
12135 use std::borrow::Cow;
12136 use std::io::{Read, Seek};
12137
12138 use common::{url::Params, ToParts};
12139 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12140
12141 let mut dd = common::DefaultDelegate;
12142 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12143 dlg.begin(common::MethodInfo {
12144 id: "firebaseappcheck.projects.apps.safetyNetConfig.patch",
12145 http_method: hyper::Method::PATCH,
12146 });
12147
12148 for &field in ["alt", "name", "updateMask"].iter() {
12149 if self._additional_params.contains_key(field) {
12150 dlg.finished(false);
12151 return Err(common::Error::FieldClash(field));
12152 }
12153 }
12154
12155 let mut params = Params::with_capacity(5 + self._additional_params.len());
12156 params.push("name", self._name);
12157 if let Some(value) = self._update_mask.as_ref() {
12158 params.push("updateMask", value.to_string());
12159 }
12160
12161 params.extend(self._additional_params.iter());
12162
12163 params.push("alt", "json");
12164 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
12165 if self._scopes.is_empty() {
12166 self._scopes
12167 .insert(Scope::CloudPlatform.as_ref().to_string());
12168 }
12169
12170 #[allow(clippy::single_element_loop)]
12171 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12172 url = params.uri_replacement(url, param_name, find_this, true);
12173 }
12174 {
12175 let to_remove = ["name"];
12176 params.remove_params(&to_remove);
12177 }
12178
12179 let url = params.parse_with_url(&url);
12180
12181 let mut json_mime_type = mime::APPLICATION_JSON;
12182 let mut request_value_reader = {
12183 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12184 common::remove_json_null_values(&mut value);
12185 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12186 serde_json::to_writer(&mut dst, &value).unwrap();
12187 dst
12188 };
12189 let request_size = request_value_reader
12190 .seek(std::io::SeekFrom::End(0))
12191 .unwrap();
12192 request_value_reader
12193 .seek(std::io::SeekFrom::Start(0))
12194 .unwrap();
12195
12196 loop {
12197 let token = match self
12198 .hub
12199 .auth
12200 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12201 .await
12202 {
12203 Ok(token) => token,
12204 Err(e) => match dlg.token(e) {
12205 Ok(token) => token,
12206 Err(e) => {
12207 dlg.finished(false);
12208 return Err(common::Error::MissingToken(e));
12209 }
12210 },
12211 };
12212 request_value_reader
12213 .seek(std::io::SeekFrom::Start(0))
12214 .unwrap();
12215 let mut req_result = {
12216 let client = &self.hub.client;
12217 dlg.pre_request();
12218 let mut req_builder = hyper::Request::builder()
12219 .method(hyper::Method::PATCH)
12220 .uri(url.as_str())
12221 .header(USER_AGENT, self.hub._user_agent.clone());
12222
12223 if let Some(token) = token.as_ref() {
12224 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12225 }
12226
12227 let request = req_builder
12228 .header(CONTENT_TYPE, json_mime_type.to_string())
12229 .header(CONTENT_LENGTH, request_size as u64)
12230 .body(common::to_body(
12231 request_value_reader.get_ref().clone().into(),
12232 ));
12233
12234 client.request(request.unwrap()).await
12235 };
12236
12237 match req_result {
12238 Err(err) => {
12239 if let common::Retry::After(d) = dlg.http_error(&err) {
12240 sleep(d).await;
12241 continue;
12242 }
12243 dlg.finished(false);
12244 return Err(common::Error::HttpError(err));
12245 }
12246 Ok(res) => {
12247 let (mut parts, body) = res.into_parts();
12248 let mut body = common::Body::new(body);
12249 if !parts.status.is_success() {
12250 let bytes = common::to_bytes(body).await.unwrap_or_default();
12251 let error = serde_json::from_str(&common::to_string(&bytes));
12252 let response = common::to_response(parts, bytes.into());
12253
12254 if let common::Retry::After(d) =
12255 dlg.http_failure(&response, error.as_ref().ok())
12256 {
12257 sleep(d).await;
12258 continue;
12259 }
12260
12261 dlg.finished(false);
12262
12263 return Err(match error {
12264 Ok(value) => common::Error::BadRequest(value),
12265 _ => common::Error::Failure(response),
12266 });
12267 }
12268 let response = {
12269 let bytes = common::to_bytes(body).await.unwrap_or_default();
12270 let encoded = common::to_string(&bytes);
12271 match serde_json::from_str(&encoded) {
12272 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12273 Err(error) => {
12274 dlg.response_json_decode_error(&encoded, &error);
12275 return Err(common::Error::JsonDecodeError(
12276 encoded.to_string(),
12277 error,
12278 ));
12279 }
12280 }
12281 };
12282
12283 dlg.finished(true);
12284 return Ok(response);
12285 }
12286 }
12287 }
12288 }
12289
12290 ///
12291 /// Sets the *request* property to the given value.
12292 ///
12293 /// Even though the property as already been set when instantiating this call,
12294 /// we provide this method for API completeness.
12295 pub fn request(
12296 mut self,
12297 new_value: GoogleFirebaseAppcheckV1betaSafetyNetConfig,
12298 ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12299 self._request = new_value;
12300 self
12301 }
12302 /// Required. The relative resource name of the SafetyNet configuration object, in the format: ``` projects/{project_number}/apps/{app_id}/safetyNetConfig ```
12303 ///
12304 /// Sets the *name* path property to the given value.
12305 ///
12306 /// Even though the property as already been set when instantiating this call,
12307 /// we provide this method for API completeness.
12308 pub fn name(mut self, new_value: &str) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12309 self._name = new_value.to_string();
12310 self
12311 }
12312 /// Required. A comma-separated list of names of fields in the SafetyNetConfig to update. Example: `token_ttl`.
12313 ///
12314 /// Sets the *update mask* query property to the given value.
12315 pub fn update_mask(
12316 mut self,
12317 new_value: common::FieldMask,
12318 ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12319 self._update_mask = Some(new_value);
12320 self
12321 }
12322 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12323 /// while executing the actual API request.
12324 ///
12325 /// ````text
12326 /// It should be used to handle progress information, and to implement a certain level of resilience.
12327 /// ````
12328 ///
12329 /// Sets the *delegate* property to the given value.
12330 pub fn delegate(
12331 mut self,
12332 new_value: &'a mut dyn common::Delegate,
12333 ) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12334 self._delegate = Some(new_value);
12335 self
12336 }
12337
12338 /// Set any additional parameter of the query string used in the request.
12339 /// It should be used to set parameters which are not yet available through their own
12340 /// setters.
12341 ///
12342 /// Please note that this method must not be used to set any of the known parameters
12343 /// which have their own setter method. If done anyway, the request will fail.
12344 ///
12345 /// # Additional Parameters
12346 ///
12347 /// * *$.xgafv* (query-string) - V1 error format.
12348 /// * *access_token* (query-string) - OAuth access token.
12349 /// * *alt* (query-string) - Data format for response.
12350 /// * *callback* (query-string) - JSONP
12351 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12352 /// * *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.
12353 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12354 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12355 /// * *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.
12356 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12357 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12358 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12359 where
12360 T: AsRef<str>,
12361 {
12362 self._additional_params
12363 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12364 self
12365 }
12366
12367 /// Identifies the authorization scope for the method you are building.
12368 ///
12369 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12370 /// [`Scope::CloudPlatform`].
12371 ///
12372 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12373 /// tokens for more than one scope.
12374 ///
12375 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12376 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12377 /// sufficient, a read-write scope will do as well.
12378 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12379 where
12380 St: AsRef<str>,
12381 {
12382 self._scopes.insert(String::from(scope.as_ref()));
12383 self
12384 }
12385 /// Identifies the authorization scope(s) for the method you are building.
12386 ///
12387 /// See [`Self::add_scope()`] for details.
12388 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppSafetyNetConfigPatchCall<'a, C>
12389 where
12390 I: IntoIterator<Item = St>,
12391 St: AsRef<str>,
12392 {
12393 self._scopes
12394 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12395 self
12396 }
12397
12398 /// Removes all scopes, and no default scope will be used either.
12399 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12400 /// for details).
12401 pub fn clear_scopes(mut self) -> ProjectAppSafetyNetConfigPatchCall<'a, C> {
12402 self._scopes.clear();
12403 self
12404 }
12405}
12406
12407/// Accepts an App Attest assertion and an artifact previously obtained from ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns an AppCheckToken.
12408///
12409/// A builder for the *apps.exchangeAppAttestAssertion* method supported by a *project* resource.
12410/// It is not used directly, but through a [`ProjectMethods`] instance.
12411///
12412/// # Example
12413///
12414/// Instantiate a resource method builder
12415///
12416/// ```test_harness,no_run
12417/// # extern crate hyper;
12418/// # extern crate hyper_rustls;
12419/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12420/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
12421/// # async fn dox() {
12422/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12423///
12424/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12425/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12426/// # secret,
12427/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12428/// # ).build().await.unwrap();
12429///
12430/// # let client = hyper_util::client::legacy::Client::builder(
12431/// # hyper_util::rt::TokioExecutor::new()
12432/// # )
12433/// # .build(
12434/// # hyper_rustls::HttpsConnectorBuilder::new()
12435/// # .with_native_roots()
12436/// # .unwrap()
12437/// # .https_or_http()
12438/// # .enable_http1()
12439/// # .build()
12440/// # );
12441/// # let mut hub = Firebaseappcheck::new(client, auth);
12442/// // As the method needs a request, you would usually fill it with the desired information
12443/// // into the respective structure. Some of the parts shown here might not be applicable !
12444/// // Values shown here are possibly random and not representative !
12445/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest::default();
12446///
12447/// // You can configure optional parameters by calling the respective setters at will, and
12448/// // execute the final call using `doit()`.
12449/// // Values shown here are possibly random and not representative !
12450/// let result = hub.projects().apps_exchange_app_attest_assertion(req, "app")
12451/// .doit().await;
12452/// # }
12453/// ```
12454pub struct ProjectAppExchangeAppAttestAssertionCall<'a, C>
12455where
12456 C: 'a,
12457{
12458 hub: &'a Firebaseappcheck<C>,
12459 _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
12460 _app: String,
12461 _delegate: Option<&'a mut dyn common::Delegate>,
12462 _additional_params: HashMap<String, String>,
12463 _scopes: BTreeSet<String>,
12464}
12465
12466impl<'a, C> common::CallBuilder for ProjectAppExchangeAppAttestAssertionCall<'a, C> {}
12467
12468impl<'a, C> ProjectAppExchangeAppAttestAssertionCall<'a, C>
12469where
12470 C: common::Connector,
12471{
12472 /// Perform the operation you have build so far.
12473 pub async fn doit(
12474 mut self,
12475 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
12476 use std::borrow::Cow;
12477 use std::io::{Read, Seek};
12478
12479 use common::{url::Params, ToParts};
12480 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12481
12482 let mut dd = common::DefaultDelegate;
12483 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12484 dlg.begin(common::MethodInfo {
12485 id: "firebaseappcheck.projects.apps.exchangeAppAttestAssertion",
12486 http_method: hyper::Method::POST,
12487 });
12488
12489 for &field in ["alt", "app"].iter() {
12490 if self._additional_params.contains_key(field) {
12491 dlg.finished(false);
12492 return Err(common::Error::FieldClash(field));
12493 }
12494 }
12495
12496 let mut params = Params::with_capacity(4 + self._additional_params.len());
12497 params.push("app", self._app);
12498
12499 params.extend(self._additional_params.iter());
12500
12501 params.push("alt", "json");
12502 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAssertion";
12503 if self._scopes.is_empty() {
12504 self._scopes
12505 .insert(Scope::CloudPlatform.as_ref().to_string());
12506 }
12507
12508 #[allow(clippy::single_element_loop)]
12509 for &(find_this, param_name) in [("{+app}", "app")].iter() {
12510 url = params.uri_replacement(url, param_name, find_this, true);
12511 }
12512 {
12513 let to_remove = ["app"];
12514 params.remove_params(&to_remove);
12515 }
12516
12517 let url = params.parse_with_url(&url);
12518
12519 let mut json_mime_type = mime::APPLICATION_JSON;
12520 let mut request_value_reader = {
12521 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12522 common::remove_json_null_values(&mut value);
12523 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12524 serde_json::to_writer(&mut dst, &value).unwrap();
12525 dst
12526 };
12527 let request_size = request_value_reader
12528 .seek(std::io::SeekFrom::End(0))
12529 .unwrap();
12530 request_value_reader
12531 .seek(std::io::SeekFrom::Start(0))
12532 .unwrap();
12533
12534 loop {
12535 let token = match self
12536 .hub
12537 .auth
12538 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12539 .await
12540 {
12541 Ok(token) => token,
12542 Err(e) => match dlg.token(e) {
12543 Ok(token) => token,
12544 Err(e) => {
12545 dlg.finished(false);
12546 return Err(common::Error::MissingToken(e));
12547 }
12548 },
12549 };
12550 request_value_reader
12551 .seek(std::io::SeekFrom::Start(0))
12552 .unwrap();
12553 let mut req_result = {
12554 let client = &self.hub.client;
12555 dlg.pre_request();
12556 let mut req_builder = hyper::Request::builder()
12557 .method(hyper::Method::POST)
12558 .uri(url.as_str())
12559 .header(USER_AGENT, self.hub._user_agent.clone());
12560
12561 if let Some(token) = token.as_ref() {
12562 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12563 }
12564
12565 let request = req_builder
12566 .header(CONTENT_TYPE, json_mime_type.to_string())
12567 .header(CONTENT_LENGTH, request_size as u64)
12568 .body(common::to_body(
12569 request_value_reader.get_ref().clone().into(),
12570 ));
12571
12572 client.request(request.unwrap()).await
12573 };
12574
12575 match req_result {
12576 Err(err) => {
12577 if let common::Retry::After(d) = dlg.http_error(&err) {
12578 sleep(d).await;
12579 continue;
12580 }
12581 dlg.finished(false);
12582 return Err(common::Error::HttpError(err));
12583 }
12584 Ok(res) => {
12585 let (mut parts, body) = res.into_parts();
12586 let mut body = common::Body::new(body);
12587 if !parts.status.is_success() {
12588 let bytes = common::to_bytes(body).await.unwrap_or_default();
12589 let error = serde_json::from_str(&common::to_string(&bytes));
12590 let response = common::to_response(parts, bytes.into());
12591
12592 if let common::Retry::After(d) =
12593 dlg.http_failure(&response, error.as_ref().ok())
12594 {
12595 sleep(d).await;
12596 continue;
12597 }
12598
12599 dlg.finished(false);
12600
12601 return Err(match error {
12602 Ok(value) => common::Error::BadRequest(value),
12603 _ => common::Error::Failure(response),
12604 });
12605 }
12606 let response = {
12607 let bytes = common::to_bytes(body).await.unwrap_or_default();
12608 let encoded = common::to_string(&bytes);
12609 match serde_json::from_str(&encoded) {
12610 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12611 Err(error) => {
12612 dlg.response_json_decode_error(&encoded, &error);
12613 return Err(common::Error::JsonDecodeError(
12614 encoded.to_string(),
12615 error,
12616 ));
12617 }
12618 }
12619 };
12620
12621 dlg.finished(true);
12622 return Ok(response);
12623 }
12624 }
12625 }
12626 }
12627
12628 ///
12629 /// Sets the *request* property to the given value.
12630 ///
12631 /// Even though the property as already been set when instantiating this call,
12632 /// we provide this method for API completeness.
12633 pub fn request(
12634 mut self,
12635 new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest,
12636 ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
12637 self._request = new_value;
12638 self
12639 }
12640 /// 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.
12641 ///
12642 /// Sets the *app* path property to the given value.
12643 ///
12644 /// Even though the property as already been set when instantiating this call,
12645 /// we provide this method for API completeness.
12646 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
12647 self._app = new_value.to_string();
12648 self
12649 }
12650 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12651 /// while executing the actual API request.
12652 ///
12653 /// ````text
12654 /// It should be used to handle progress information, and to implement a certain level of resilience.
12655 /// ````
12656 ///
12657 /// Sets the *delegate* property to the given value.
12658 pub fn delegate(
12659 mut self,
12660 new_value: &'a mut dyn common::Delegate,
12661 ) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
12662 self._delegate = Some(new_value);
12663 self
12664 }
12665
12666 /// Set any additional parameter of the query string used in the request.
12667 /// It should be used to set parameters which are not yet available through their own
12668 /// setters.
12669 ///
12670 /// Please note that this method must not be used to set any of the known parameters
12671 /// which have their own setter method. If done anyway, the request will fail.
12672 ///
12673 /// # Additional Parameters
12674 ///
12675 /// * *$.xgafv* (query-string) - V1 error format.
12676 /// * *access_token* (query-string) - OAuth access token.
12677 /// * *alt* (query-string) - Data format for response.
12678 /// * *callback* (query-string) - JSONP
12679 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12680 /// * *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.
12681 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12682 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12683 /// * *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.
12684 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12685 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12686 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
12687 where
12688 T: AsRef<str>,
12689 {
12690 self._additional_params
12691 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12692 self
12693 }
12694
12695 /// Identifies the authorization scope for the method you are building.
12696 ///
12697 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12698 /// [`Scope::CloudPlatform`].
12699 ///
12700 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12701 /// tokens for more than one scope.
12702 ///
12703 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12704 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12705 /// sufficient, a read-write scope will do as well.
12706 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
12707 where
12708 St: AsRef<str>,
12709 {
12710 self._scopes.insert(String::from(scope.as_ref()));
12711 self
12712 }
12713 /// Identifies the authorization scope(s) for the method you are building.
12714 ///
12715 /// See [`Self::add_scope()`] for details.
12716 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeAppAttestAssertionCall<'a, C>
12717 where
12718 I: IntoIterator<Item = St>,
12719 St: AsRef<str>,
12720 {
12721 self._scopes
12722 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12723 self
12724 }
12725
12726 /// Removes all scopes, and no default scope will be used either.
12727 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12728 /// for details).
12729 pub fn clear_scopes(mut self) -> ProjectAppExchangeAppAttestAssertionCall<'a, C> {
12730 self._scopes.clear();
12731 self
12732 }
12733}
12734
12735/// 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).
12736///
12737/// A builder for the *apps.exchangeAppAttestAttestation* method supported by a *project* resource.
12738/// It is not used directly, but through a [`ProjectMethods`] instance.
12739///
12740/// # Example
12741///
12742/// Instantiate a resource method builder
12743///
12744/// ```test_harness,no_run
12745/// # extern crate hyper;
12746/// # extern crate hyper_rustls;
12747/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
12748/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest;
12749/// # async fn dox() {
12750/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12751///
12752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12753/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12754/// # secret,
12755/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12756/// # ).build().await.unwrap();
12757///
12758/// # let client = hyper_util::client::legacy::Client::builder(
12759/// # hyper_util::rt::TokioExecutor::new()
12760/// # )
12761/// # .build(
12762/// # hyper_rustls::HttpsConnectorBuilder::new()
12763/// # .with_native_roots()
12764/// # .unwrap()
12765/// # .https_or_http()
12766/// # .enable_http1()
12767/// # .build()
12768/// # );
12769/// # let mut hub = Firebaseappcheck::new(client, auth);
12770/// // As the method needs a request, you would usually fill it with the desired information
12771/// // into the respective structure. Some of the parts shown here might not be applicable !
12772/// // Values shown here are possibly random and not representative !
12773/// let mut req = GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest::default();
12774///
12775/// // You can configure optional parameters by calling the respective setters at will, and
12776/// // execute the final call using `doit()`.
12777/// // Values shown here are possibly random and not representative !
12778/// let result = hub.projects().apps_exchange_app_attest_attestation(req, "app")
12779/// .doit().await;
12780/// # }
12781/// ```
12782pub struct ProjectAppExchangeAppAttestAttestationCall<'a, C>
12783where
12784 C: 'a,
12785{
12786 hub: &'a Firebaseappcheck<C>,
12787 _request: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
12788 _app: String,
12789 _delegate: Option<&'a mut dyn common::Delegate>,
12790 _additional_params: HashMap<String, String>,
12791 _scopes: BTreeSet<String>,
12792}
12793
12794impl<'a, C> common::CallBuilder for ProjectAppExchangeAppAttestAttestationCall<'a, C> {}
12795
12796impl<'a, C> ProjectAppExchangeAppAttestAttestationCall<'a, C>
12797where
12798 C: common::Connector,
12799{
12800 /// Perform the operation you have build so far.
12801 pub async fn doit(
12802 mut self,
12803 ) -> common::Result<(
12804 common::Response,
12805 GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse,
12806 )> {
12807 use std::borrow::Cow;
12808 use std::io::{Read, Seek};
12809
12810 use common::{url::Params, ToParts};
12811 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12812
12813 let mut dd = common::DefaultDelegate;
12814 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12815 dlg.begin(common::MethodInfo {
12816 id: "firebaseappcheck.projects.apps.exchangeAppAttestAttestation",
12817 http_method: hyper::Method::POST,
12818 });
12819
12820 for &field in ["alt", "app"].iter() {
12821 if self._additional_params.contains_key(field) {
12822 dlg.finished(false);
12823 return Err(common::Error::FieldClash(field));
12824 }
12825 }
12826
12827 let mut params = Params::with_capacity(4 + self._additional_params.len());
12828 params.push("app", self._app);
12829
12830 params.extend(self._additional_params.iter());
12831
12832 params.push("alt", "json");
12833 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeAppAttestAttestation";
12834 if self._scopes.is_empty() {
12835 self._scopes
12836 .insert(Scope::CloudPlatform.as_ref().to_string());
12837 }
12838
12839 #[allow(clippy::single_element_loop)]
12840 for &(find_this, param_name) in [("{+app}", "app")].iter() {
12841 url = params.uri_replacement(url, param_name, find_this, true);
12842 }
12843 {
12844 let to_remove = ["app"];
12845 params.remove_params(&to_remove);
12846 }
12847
12848 let url = params.parse_with_url(&url);
12849
12850 let mut json_mime_type = mime::APPLICATION_JSON;
12851 let mut request_value_reader = {
12852 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12853 common::remove_json_null_values(&mut value);
12854 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12855 serde_json::to_writer(&mut dst, &value).unwrap();
12856 dst
12857 };
12858 let request_size = request_value_reader
12859 .seek(std::io::SeekFrom::End(0))
12860 .unwrap();
12861 request_value_reader
12862 .seek(std::io::SeekFrom::Start(0))
12863 .unwrap();
12864
12865 loop {
12866 let token = match self
12867 .hub
12868 .auth
12869 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12870 .await
12871 {
12872 Ok(token) => token,
12873 Err(e) => match dlg.token(e) {
12874 Ok(token) => token,
12875 Err(e) => {
12876 dlg.finished(false);
12877 return Err(common::Error::MissingToken(e));
12878 }
12879 },
12880 };
12881 request_value_reader
12882 .seek(std::io::SeekFrom::Start(0))
12883 .unwrap();
12884 let mut req_result = {
12885 let client = &self.hub.client;
12886 dlg.pre_request();
12887 let mut req_builder = hyper::Request::builder()
12888 .method(hyper::Method::POST)
12889 .uri(url.as_str())
12890 .header(USER_AGENT, self.hub._user_agent.clone());
12891
12892 if let Some(token) = token.as_ref() {
12893 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12894 }
12895
12896 let request = req_builder
12897 .header(CONTENT_TYPE, json_mime_type.to_string())
12898 .header(CONTENT_LENGTH, request_size as u64)
12899 .body(common::to_body(
12900 request_value_reader.get_ref().clone().into(),
12901 ));
12902
12903 client.request(request.unwrap()).await
12904 };
12905
12906 match req_result {
12907 Err(err) => {
12908 if let common::Retry::After(d) = dlg.http_error(&err) {
12909 sleep(d).await;
12910 continue;
12911 }
12912 dlg.finished(false);
12913 return Err(common::Error::HttpError(err));
12914 }
12915 Ok(res) => {
12916 let (mut parts, body) = res.into_parts();
12917 let mut body = common::Body::new(body);
12918 if !parts.status.is_success() {
12919 let bytes = common::to_bytes(body).await.unwrap_or_default();
12920 let error = serde_json::from_str(&common::to_string(&bytes));
12921 let response = common::to_response(parts, bytes.into());
12922
12923 if let common::Retry::After(d) =
12924 dlg.http_failure(&response, error.as_ref().ok())
12925 {
12926 sleep(d).await;
12927 continue;
12928 }
12929
12930 dlg.finished(false);
12931
12932 return Err(match error {
12933 Ok(value) => common::Error::BadRequest(value),
12934 _ => common::Error::Failure(response),
12935 });
12936 }
12937 let response = {
12938 let bytes = common::to_bytes(body).await.unwrap_or_default();
12939 let encoded = common::to_string(&bytes);
12940 match serde_json::from_str(&encoded) {
12941 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12942 Err(error) => {
12943 dlg.response_json_decode_error(&encoded, &error);
12944 return Err(common::Error::JsonDecodeError(
12945 encoded.to_string(),
12946 error,
12947 ));
12948 }
12949 }
12950 };
12951
12952 dlg.finished(true);
12953 return Ok(response);
12954 }
12955 }
12956 }
12957 }
12958
12959 ///
12960 /// Sets the *request* property to the given value.
12961 ///
12962 /// Even though the property as already been set when instantiating this call,
12963 /// we provide this method for API completeness.
12964 pub fn request(
12965 mut self,
12966 new_value: GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest,
12967 ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
12968 self._request = new_value;
12969 self
12970 }
12971 /// 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.
12972 ///
12973 /// Sets the *app* path property to the given value.
12974 ///
12975 /// Even though the property as already been set when instantiating this call,
12976 /// we provide this method for API completeness.
12977 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
12978 self._app = new_value.to_string();
12979 self
12980 }
12981 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12982 /// while executing the actual API request.
12983 ///
12984 /// ````text
12985 /// It should be used to handle progress information, and to implement a certain level of resilience.
12986 /// ````
12987 ///
12988 /// Sets the *delegate* property to the given value.
12989 pub fn delegate(
12990 mut self,
12991 new_value: &'a mut dyn common::Delegate,
12992 ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
12993 self._delegate = Some(new_value);
12994 self
12995 }
12996
12997 /// Set any additional parameter of the query string used in the request.
12998 /// It should be used to set parameters which are not yet available through their own
12999 /// setters.
13000 ///
13001 /// Please note that this method must not be used to set any of the known parameters
13002 /// which have their own setter method. If done anyway, the request will fail.
13003 ///
13004 /// # Additional Parameters
13005 ///
13006 /// * *$.xgafv* (query-string) - V1 error format.
13007 /// * *access_token* (query-string) - OAuth access token.
13008 /// * *alt* (query-string) - Data format for response.
13009 /// * *callback* (query-string) - JSONP
13010 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13011 /// * *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.
13012 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13013 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13014 /// * *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.
13015 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13016 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13017 pub fn param<T>(
13018 mut self,
13019 name: T,
13020 value: T,
13021 ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13022 where
13023 T: AsRef<str>,
13024 {
13025 self._additional_params
13026 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13027 self
13028 }
13029
13030 /// Identifies the authorization scope for the method you are building.
13031 ///
13032 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13033 /// [`Scope::CloudPlatform`].
13034 ///
13035 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13036 /// tokens for more than one scope.
13037 ///
13038 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13039 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13040 /// sufficient, a read-write scope will do as well.
13041 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13042 where
13043 St: AsRef<str>,
13044 {
13045 self._scopes.insert(String::from(scope.as_ref()));
13046 self
13047 }
13048 /// Identifies the authorization scope(s) for the method you are building.
13049 ///
13050 /// See [`Self::add_scope()`] for details.
13051 pub fn add_scopes<I, St>(
13052 mut self,
13053 scopes: I,
13054 ) -> ProjectAppExchangeAppAttestAttestationCall<'a, C>
13055 where
13056 I: IntoIterator<Item = St>,
13057 St: AsRef<str>,
13058 {
13059 self._scopes
13060 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13061 self
13062 }
13063
13064 /// Removes all scopes, and no default scope will be used either.
13065 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13066 /// for details).
13067 pub fn clear_scopes(mut self) -> ProjectAppExchangeAppAttestAttestationCall<'a, C> {
13068 self._scopes.clear();
13069 self
13070 }
13071}
13072
13073/// Validates a custom token signed using your project's Admin SDK service account credentials. If valid, returns an AppCheckToken.
13074///
13075/// A builder for the *apps.exchangeCustomToken* method supported by a *project* resource.
13076/// It is not used directly, but through a [`ProjectMethods`] instance.
13077///
13078/// # Example
13079///
13080/// Instantiate a resource method builder
13081///
13082/// ```test_harness,no_run
13083/// # extern crate hyper;
13084/// # extern crate hyper_rustls;
13085/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13086/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest;
13087/// # async fn dox() {
13088/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13089///
13090/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13091/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13092/// # secret,
13093/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13094/// # ).build().await.unwrap();
13095///
13096/// # let client = hyper_util::client::legacy::Client::builder(
13097/// # hyper_util::rt::TokioExecutor::new()
13098/// # )
13099/// # .build(
13100/// # hyper_rustls::HttpsConnectorBuilder::new()
13101/// # .with_native_roots()
13102/// # .unwrap()
13103/// # .https_or_http()
13104/// # .enable_http1()
13105/// # .build()
13106/// # );
13107/// # let mut hub = Firebaseappcheck::new(client, auth);
13108/// // As the method needs a request, you would usually fill it with the desired information
13109/// // into the respective structure. Some of the parts shown here might not be applicable !
13110/// // Values shown here are possibly random and not representative !
13111/// let mut req = GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest::default();
13112///
13113/// // You can configure optional parameters by calling the respective setters at will, and
13114/// // execute the final call using `doit()`.
13115/// // Values shown here are possibly random and not representative !
13116/// let result = hub.projects().apps_exchange_custom_token(req, "app")
13117/// .doit().await;
13118/// # }
13119/// ```
13120pub struct ProjectAppExchangeCustomTokenCall<'a, C>
13121where
13122 C: 'a,
13123{
13124 hub: &'a Firebaseappcheck<C>,
13125 _request: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
13126 _app: String,
13127 _delegate: Option<&'a mut dyn common::Delegate>,
13128 _additional_params: HashMap<String, String>,
13129 _scopes: BTreeSet<String>,
13130}
13131
13132impl<'a, C> common::CallBuilder for ProjectAppExchangeCustomTokenCall<'a, C> {}
13133
13134impl<'a, C> ProjectAppExchangeCustomTokenCall<'a, C>
13135where
13136 C: common::Connector,
13137{
13138 /// Perform the operation you have build so far.
13139 pub async fn doit(
13140 mut self,
13141 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
13142 use std::borrow::Cow;
13143 use std::io::{Read, Seek};
13144
13145 use common::{url::Params, ToParts};
13146 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13147
13148 let mut dd = common::DefaultDelegate;
13149 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13150 dlg.begin(common::MethodInfo {
13151 id: "firebaseappcheck.projects.apps.exchangeCustomToken",
13152 http_method: hyper::Method::POST,
13153 });
13154
13155 for &field in ["alt", "app"].iter() {
13156 if self._additional_params.contains_key(field) {
13157 dlg.finished(false);
13158 return Err(common::Error::FieldClash(field));
13159 }
13160 }
13161
13162 let mut params = Params::with_capacity(4 + self._additional_params.len());
13163 params.push("app", self._app);
13164
13165 params.extend(self._additional_params.iter());
13166
13167 params.push("alt", "json");
13168 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeCustomToken";
13169 if self._scopes.is_empty() {
13170 self._scopes
13171 .insert(Scope::CloudPlatform.as_ref().to_string());
13172 }
13173
13174 #[allow(clippy::single_element_loop)]
13175 for &(find_this, param_name) in [("{+app}", "app")].iter() {
13176 url = params.uri_replacement(url, param_name, find_this, true);
13177 }
13178 {
13179 let to_remove = ["app"];
13180 params.remove_params(&to_remove);
13181 }
13182
13183 let url = params.parse_with_url(&url);
13184
13185 let mut json_mime_type = mime::APPLICATION_JSON;
13186 let mut request_value_reader = {
13187 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13188 common::remove_json_null_values(&mut value);
13189 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13190 serde_json::to_writer(&mut dst, &value).unwrap();
13191 dst
13192 };
13193 let request_size = request_value_reader
13194 .seek(std::io::SeekFrom::End(0))
13195 .unwrap();
13196 request_value_reader
13197 .seek(std::io::SeekFrom::Start(0))
13198 .unwrap();
13199
13200 loop {
13201 let token = match self
13202 .hub
13203 .auth
13204 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13205 .await
13206 {
13207 Ok(token) => token,
13208 Err(e) => match dlg.token(e) {
13209 Ok(token) => token,
13210 Err(e) => {
13211 dlg.finished(false);
13212 return Err(common::Error::MissingToken(e));
13213 }
13214 },
13215 };
13216 request_value_reader
13217 .seek(std::io::SeekFrom::Start(0))
13218 .unwrap();
13219 let mut req_result = {
13220 let client = &self.hub.client;
13221 dlg.pre_request();
13222 let mut req_builder = hyper::Request::builder()
13223 .method(hyper::Method::POST)
13224 .uri(url.as_str())
13225 .header(USER_AGENT, self.hub._user_agent.clone());
13226
13227 if let Some(token) = token.as_ref() {
13228 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13229 }
13230
13231 let request = req_builder
13232 .header(CONTENT_TYPE, json_mime_type.to_string())
13233 .header(CONTENT_LENGTH, request_size as u64)
13234 .body(common::to_body(
13235 request_value_reader.get_ref().clone().into(),
13236 ));
13237
13238 client.request(request.unwrap()).await
13239 };
13240
13241 match req_result {
13242 Err(err) => {
13243 if let common::Retry::After(d) = dlg.http_error(&err) {
13244 sleep(d).await;
13245 continue;
13246 }
13247 dlg.finished(false);
13248 return Err(common::Error::HttpError(err));
13249 }
13250 Ok(res) => {
13251 let (mut parts, body) = res.into_parts();
13252 let mut body = common::Body::new(body);
13253 if !parts.status.is_success() {
13254 let bytes = common::to_bytes(body).await.unwrap_or_default();
13255 let error = serde_json::from_str(&common::to_string(&bytes));
13256 let response = common::to_response(parts, bytes.into());
13257
13258 if let common::Retry::After(d) =
13259 dlg.http_failure(&response, error.as_ref().ok())
13260 {
13261 sleep(d).await;
13262 continue;
13263 }
13264
13265 dlg.finished(false);
13266
13267 return Err(match error {
13268 Ok(value) => common::Error::BadRequest(value),
13269 _ => common::Error::Failure(response),
13270 });
13271 }
13272 let response = {
13273 let bytes = common::to_bytes(body).await.unwrap_or_default();
13274 let encoded = common::to_string(&bytes);
13275 match serde_json::from_str(&encoded) {
13276 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13277 Err(error) => {
13278 dlg.response_json_decode_error(&encoded, &error);
13279 return Err(common::Error::JsonDecodeError(
13280 encoded.to_string(),
13281 error,
13282 ));
13283 }
13284 }
13285 };
13286
13287 dlg.finished(true);
13288 return Ok(response);
13289 }
13290 }
13291 }
13292 }
13293
13294 ///
13295 /// Sets the *request* property to the given value.
13296 ///
13297 /// Even though the property as already been set when instantiating this call,
13298 /// we provide this method for API completeness.
13299 pub fn request(
13300 mut self,
13301 new_value: GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest,
13302 ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13303 self._request = new_value;
13304 self
13305 }
13306 /// 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.
13307 ///
13308 /// Sets the *app* path property to the given value.
13309 ///
13310 /// Even though the property as already been set when instantiating this call,
13311 /// we provide this method for API completeness.
13312 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13313 self._app = new_value.to_string();
13314 self
13315 }
13316 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13317 /// while executing the actual API request.
13318 ///
13319 /// ````text
13320 /// It should be used to handle progress information, and to implement a certain level of resilience.
13321 /// ````
13322 ///
13323 /// Sets the *delegate* property to the given value.
13324 pub fn delegate(
13325 mut self,
13326 new_value: &'a mut dyn common::Delegate,
13327 ) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13328 self._delegate = Some(new_value);
13329 self
13330 }
13331
13332 /// Set any additional parameter of the query string used in the request.
13333 /// It should be used to set parameters which are not yet available through their own
13334 /// setters.
13335 ///
13336 /// Please note that this method must not be used to set any of the known parameters
13337 /// which have their own setter method. If done anyway, the request will fail.
13338 ///
13339 /// # Additional Parameters
13340 ///
13341 /// * *$.xgafv* (query-string) - V1 error format.
13342 /// * *access_token* (query-string) - OAuth access token.
13343 /// * *alt* (query-string) - Data format for response.
13344 /// * *callback* (query-string) - JSONP
13345 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13346 /// * *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.
13347 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13348 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13349 /// * *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.
13350 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13351 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13352 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeCustomTokenCall<'a, C>
13353 where
13354 T: AsRef<str>,
13355 {
13356 self._additional_params
13357 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13358 self
13359 }
13360
13361 /// Identifies the authorization scope for the method you are building.
13362 ///
13363 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13364 /// [`Scope::CloudPlatform`].
13365 ///
13366 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13367 /// tokens for more than one scope.
13368 ///
13369 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13370 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13371 /// sufficient, a read-write scope will do as well.
13372 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeCustomTokenCall<'a, C>
13373 where
13374 St: AsRef<str>,
13375 {
13376 self._scopes.insert(String::from(scope.as_ref()));
13377 self
13378 }
13379 /// Identifies the authorization scope(s) for the method you are building.
13380 ///
13381 /// See [`Self::add_scope()`] for details.
13382 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeCustomTokenCall<'a, C>
13383 where
13384 I: IntoIterator<Item = St>,
13385 St: AsRef<str>,
13386 {
13387 self._scopes
13388 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13389 self
13390 }
13391
13392 /// Removes all scopes, and no default scope will be used either.
13393 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13394 /// for details).
13395 pub fn clear_scopes(mut self) -> ProjectAppExchangeCustomTokenCall<'a, C> {
13396 self._scopes.clear();
13397 self
13398 }
13399}
13400
13401/// 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.
13402///
13403/// A builder for the *apps.exchangeDebugToken* method supported by a *project* resource.
13404/// It is not used directly, but through a [`ProjectMethods`] instance.
13405///
13406/// # Example
13407///
13408/// Instantiate a resource method builder
13409///
13410/// ```test_harness,no_run
13411/// # extern crate hyper;
13412/// # extern crate hyper_rustls;
13413/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13414/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest;
13415/// # async fn dox() {
13416/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13417///
13418/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13419/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13420/// # secret,
13421/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13422/// # ).build().await.unwrap();
13423///
13424/// # let client = hyper_util::client::legacy::Client::builder(
13425/// # hyper_util::rt::TokioExecutor::new()
13426/// # )
13427/// # .build(
13428/// # hyper_rustls::HttpsConnectorBuilder::new()
13429/// # .with_native_roots()
13430/// # .unwrap()
13431/// # .https_or_http()
13432/// # .enable_http1()
13433/// # .build()
13434/// # );
13435/// # let mut hub = Firebaseappcheck::new(client, auth);
13436/// // As the method needs a request, you would usually fill it with the desired information
13437/// // into the respective structure. Some of the parts shown here might not be applicable !
13438/// // Values shown here are possibly random and not representative !
13439/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest::default();
13440///
13441/// // You can configure optional parameters by calling the respective setters at will, and
13442/// // execute the final call using `doit()`.
13443/// // Values shown here are possibly random and not representative !
13444/// let result = hub.projects().apps_exchange_debug_token(req, "app")
13445/// .doit().await;
13446/// # }
13447/// ```
13448pub struct ProjectAppExchangeDebugTokenCall<'a, C>
13449where
13450 C: 'a,
13451{
13452 hub: &'a Firebaseappcheck<C>,
13453 _request: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
13454 _app: String,
13455 _delegate: Option<&'a mut dyn common::Delegate>,
13456 _additional_params: HashMap<String, String>,
13457 _scopes: BTreeSet<String>,
13458}
13459
13460impl<'a, C> common::CallBuilder for ProjectAppExchangeDebugTokenCall<'a, C> {}
13461
13462impl<'a, C> ProjectAppExchangeDebugTokenCall<'a, C>
13463where
13464 C: common::Connector,
13465{
13466 /// Perform the operation you have build so far.
13467 pub async fn doit(
13468 mut self,
13469 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
13470 use std::borrow::Cow;
13471 use std::io::{Read, Seek};
13472
13473 use common::{url::Params, ToParts};
13474 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13475
13476 let mut dd = common::DefaultDelegate;
13477 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13478 dlg.begin(common::MethodInfo {
13479 id: "firebaseappcheck.projects.apps.exchangeDebugToken",
13480 http_method: hyper::Method::POST,
13481 });
13482
13483 for &field in ["alt", "app"].iter() {
13484 if self._additional_params.contains_key(field) {
13485 dlg.finished(false);
13486 return Err(common::Error::FieldClash(field));
13487 }
13488 }
13489
13490 let mut params = Params::with_capacity(4 + self._additional_params.len());
13491 params.push("app", self._app);
13492
13493 params.extend(self._additional_params.iter());
13494
13495 params.push("alt", "json");
13496 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDebugToken";
13497 if self._scopes.is_empty() {
13498 self._scopes
13499 .insert(Scope::CloudPlatform.as_ref().to_string());
13500 }
13501
13502 #[allow(clippy::single_element_loop)]
13503 for &(find_this, param_name) in [("{+app}", "app")].iter() {
13504 url = params.uri_replacement(url, param_name, find_this, true);
13505 }
13506 {
13507 let to_remove = ["app"];
13508 params.remove_params(&to_remove);
13509 }
13510
13511 let url = params.parse_with_url(&url);
13512
13513 let mut json_mime_type = mime::APPLICATION_JSON;
13514 let mut request_value_reader = {
13515 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13516 common::remove_json_null_values(&mut value);
13517 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13518 serde_json::to_writer(&mut dst, &value).unwrap();
13519 dst
13520 };
13521 let request_size = request_value_reader
13522 .seek(std::io::SeekFrom::End(0))
13523 .unwrap();
13524 request_value_reader
13525 .seek(std::io::SeekFrom::Start(0))
13526 .unwrap();
13527
13528 loop {
13529 let token = match self
13530 .hub
13531 .auth
13532 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13533 .await
13534 {
13535 Ok(token) => token,
13536 Err(e) => match dlg.token(e) {
13537 Ok(token) => token,
13538 Err(e) => {
13539 dlg.finished(false);
13540 return Err(common::Error::MissingToken(e));
13541 }
13542 },
13543 };
13544 request_value_reader
13545 .seek(std::io::SeekFrom::Start(0))
13546 .unwrap();
13547 let mut req_result = {
13548 let client = &self.hub.client;
13549 dlg.pre_request();
13550 let mut req_builder = hyper::Request::builder()
13551 .method(hyper::Method::POST)
13552 .uri(url.as_str())
13553 .header(USER_AGENT, self.hub._user_agent.clone());
13554
13555 if let Some(token) = token.as_ref() {
13556 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13557 }
13558
13559 let request = req_builder
13560 .header(CONTENT_TYPE, json_mime_type.to_string())
13561 .header(CONTENT_LENGTH, request_size as u64)
13562 .body(common::to_body(
13563 request_value_reader.get_ref().clone().into(),
13564 ));
13565
13566 client.request(request.unwrap()).await
13567 };
13568
13569 match req_result {
13570 Err(err) => {
13571 if let common::Retry::After(d) = dlg.http_error(&err) {
13572 sleep(d).await;
13573 continue;
13574 }
13575 dlg.finished(false);
13576 return Err(common::Error::HttpError(err));
13577 }
13578 Ok(res) => {
13579 let (mut parts, body) = res.into_parts();
13580 let mut body = common::Body::new(body);
13581 if !parts.status.is_success() {
13582 let bytes = common::to_bytes(body).await.unwrap_or_default();
13583 let error = serde_json::from_str(&common::to_string(&bytes));
13584 let response = common::to_response(parts, bytes.into());
13585
13586 if let common::Retry::After(d) =
13587 dlg.http_failure(&response, error.as_ref().ok())
13588 {
13589 sleep(d).await;
13590 continue;
13591 }
13592
13593 dlg.finished(false);
13594
13595 return Err(match error {
13596 Ok(value) => common::Error::BadRequest(value),
13597 _ => common::Error::Failure(response),
13598 });
13599 }
13600 let response = {
13601 let bytes = common::to_bytes(body).await.unwrap_or_default();
13602 let encoded = common::to_string(&bytes);
13603 match serde_json::from_str(&encoded) {
13604 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13605 Err(error) => {
13606 dlg.response_json_decode_error(&encoded, &error);
13607 return Err(common::Error::JsonDecodeError(
13608 encoded.to_string(),
13609 error,
13610 ));
13611 }
13612 }
13613 };
13614
13615 dlg.finished(true);
13616 return Ok(response);
13617 }
13618 }
13619 }
13620 }
13621
13622 ///
13623 /// Sets the *request* property to the given value.
13624 ///
13625 /// Even though the property as already been set when instantiating this call,
13626 /// we provide this method for API completeness.
13627 pub fn request(
13628 mut self,
13629 new_value: GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest,
13630 ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
13631 self._request = new_value;
13632 self
13633 }
13634 /// 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.
13635 ///
13636 /// Sets the *app* path property to the given value.
13637 ///
13638 /// Even though the property as already been set when instantiating this call,
13639 /// we provide this method for API completeness.
13640 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeDebugTokenCall<'a, C> {
13641 self._app = new_value.to_string();
13642 self
13643 }
13644 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13645 /// while executing the actual API request.
13646 ///
13647 /// ````text
13648 /// It should be used to handle progress information, and to implement a certain level of resilience.
13649 /// ````
13650 ///
13651 /// Sets the *delegate* property to the given value.
13652 pub fn delegate(
13653 mut self,
13654 new_value: &'a mut dyn common::Delegate,
13655 ) -> ProjectAppExchangeDebugTokenCall<'a, C> {
13656 self._delegate = Some(new_value);
13657 self
13658 }
13659
13660 /// Set any additional parameter of the query string used in the request.
13661 /// It should be used to set parameters which are not yet available through their own
13662 /// setters.
13663 ///
13664 /// Please note that this method must not be used to set any of the known parameters
13665 /// which have their own setter method. If done anyway, the request will fail.
13666 ///
13667 /// # Additional Parameters
13668 ///
13669 /// * *$.xgafv* (query-string) - V1 error format.
13670 /// * *access_token* (query-string) - OAuth access token.
13671 /// * *alt* (query-string) - Data format for response.
13672 /// * *callback* (query-string) - JSONP
13673 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13674 /// * *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.
13675 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13676 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13677 /// * *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.
13678 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13679 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13680 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeDebugTokenCall<'a, C>
13681 where
13682 T: AsRef<str>,
13683 {
13684 self._additional_params
13685 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13686 self
13687 }
13688
13689 /// Identifies the authorization scope for the method you are building.
13690 ///
13691 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13692 /// [`Scope::CloudPlatform`].
13693 ///
13694 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13695 /// tokens for more than one scope.
13696 ///
13697 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13698 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13699 /// sufficient, a read-write scope will do as well.
13700 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeDebugTokenCall<'a, C>
13701 where
13702 St: AsRef<str>,
13703 {
13704 self._scopes.insert(String::from(scope.as_ref()));
13705 self
13706 }
13707 /// Identifies the authorization scope(s) for the method you are building.
13708 ///
13709 /// See [`Self::add_scope()`] for details.
13710 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeDebugTokenCall<'a, C>
13711 where
13712 I: IntoIterator<Item = St>,
13713 St: AsRef<str>,
13714 {
13715 self._scopes
13716 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13717 self
13718 }
13719
13720 /// Removes all scopes, and no default scope will be used either.
13721 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13722 /// for details).
13723 pub fn clear_scopes(mut self) -> ProjectAppExchangeDebugTokenCall<'a, C> {
13724 self._scopes.clear();
13725 self
13726 }
13727}
13728
13729/// 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.
13730///
13731/// A builder for the *apps.exchangeDeviceCheckToken* method supported by a *project* resource.
13732/// It is not used directly, but through a [`ProjectMethods`] instance.
13733///
13734/// # Example
13735///
13736/// Instantiate a resource method builder
13737///
13738/// ```test_harness,no_run
13739/// # extern crate hyper;
13740/// # extern crate hyper_rustls;
13741/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
13742/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest;
13743/// # async fn dox() {
13744/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13745///
13746/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13747/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13748/// # secret,
13749/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13750/// # ).build().await.unwrap();
13751///
13752/// # let client = hyper_util::client::legacy::Client::builder(
13753/// # hyper_util::rt::TokioExecutor::new()
13754/// # )
13755/// # .build(
13756/// # hyper_rustls::HttpsConnectorBuilder::new()
13757/// # .with_native_roots()
13758/// # .unwrap()
13759/// # .https_or_http()
13760/// # .enable_http1()
13761/// # .build()
13762/// # );
13763/// # let mut hub = Firebaseappcheck::new(client, auth);
13764/// // As the method needs a request, you would usually fill it with the desired information
13765/// // into the respective structure. Some of the parts shown here might not be applicable !
13766/// // Values shown here are possibly random and not representative !
13767/// let mut req = GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest::default();
13768///
13769/// // You can configure optional parameters by calling the respective setters at will, and
13770/// // execute the final call using `doit()`.
13771/// // Values shown here are possibly random and not representative !
13772/// let result = hub.projects().apps_exchange_device_check_token(req, "app")
13773/// .doit().await;
13774/// # }
13775/// ```
13776pub struct ProjectAppExchangeDeviceCheckTokenCall<'a, C>
13777where
13778 C: 'a,
13779{
13780 hub: &'a Firebaseappcheck<C>,
13781 _request: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
13782 _app: String,
13783 _delegate: Option<&'a mut dyn common::Delegate>,
13784 _additional_params: HashMap<String, String>,
13785 _scopes: BTreeSet<String>,
13786}
13787
13788impl<'a, C> common::CallBuilder for ProjectAppExchangeDeviceCheckTokenCall<'a, C> {}
13789
13790impl<'a, C> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
13791where
13792 C: common::Connector,
13793{
13794 /// Perform the operation you have build so far.
13795 pub async fn doit(
13796 mut self,
13797 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
13798 use std::borrow::Cow;
13799 use std::io::{Read, Seek};
13800
13801 use common::{url::Params, ToParts};
13802 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13803
13804 let mut dd = common::DefaultDelegate;
13805 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13806 dlg.begin(common::MethodInfo {
13807 id: "firebaseappcheck.projects.apps.exchangeDeviceCheckToken",
13808 http_method: hyper::Method::POST,
13809 });
13810
13811 for &field in ["alt", "app"].iter() {
13812 if self._additional_params.contains_key(field) {
13813 dlg.finished(false);
13814 return Err(common::Error::FieldClash(field));
13815 }
13816 }
13817
13818 let mut params = Params::with_capacity(4 + self._additional_params.len());
13819 params.push("app", self._app);
13820
13821 params.extend(self._additional_params.iter());
13822
13823 params.push("alt", "json");
13824 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeDeviceCheckToken";
13825 if self._scopes.is_empty() {
13826 self._scopes
13827 .insert(Scope::CloudPlatform.as_ref().to_string());
13828 }
13829
13830 #[allow(clippy::single_element_loop)]
13831 for &(find_this, param_name) in [("{+app}", "app")].iter() {
13832 url = params.uri_replacement(url, param_name, find_this, true);
13833 }
13834 {
13835 let to_remove = ["app"];
13836 params.remove_params(&to_remove);
13837 }
13838
13839 let url = params.parse_with_url(&url);
13840
13841 let mut json_mime_type = mime::APPLICATION_JSON;
13842 let mut request_value_reader = {
13843 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13844 common::remove_json_null_values(&mut value);
13845 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13846 serde_json::to_writer(&mut dst, &value).unwrap();
13847 dst
13848 };
13849 let request_size = request_value_reader
13850 .seek(std::io::SeekFrom::End(0))
13851 .unwrap();
13852 request_value_reader
13853 .seek(std::io::SeekFrom::Start(0))
13854 .unwrap();
13855
13856 loop {
13857 let token = match self
13858 .hub
13859 .auth
13860 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13861 .await
13862 {
13863 Ok(token) => token,
13864 Err(e) => match dlg.token(e) {
13865 Ok(token) => token,
13866 Err(e) => {
13867 dlg.finished(false);
13868 return Err(common::Error::MissingToken(e));
13869 }
13870 },
13871 };
13872 request_value_reader
13873 .seek(std::io::SeekFrom::Start(0))
13874 .unwrap();
13875 let mut req_result = {
13876 let client = &self.hub.client;
13877 dlg.pre_request();
13878 let mut req_builder = hyper::Request::builder()
13879 .method(hyper::Method::POST)
13880 .uri(url.as_str())
13881 .header(USER_AGENT, self.hub._user_agent.clone());
13882
13883 if let Some(token) = token.as_ref() {
13884 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13885 }
13886
13887 let request = req_builder
13888 .header(CONTENT_TYPE, json_mime_type.to_string())
13889 .header(CONTENT_LENGTH, request_size as u64)
13890 .body(common::to_body(
13891 request_value_reader.get_ref().clone().into(),
13892 ));
13893
13894 client.request(request.unwrap()).await
13895 };
13896
13897 match req_result {
13898 Err(err) => {
13899 if let common::Retry::After(d) = dlg.http_error(&err) {
13900 sleep(d).await;
13901 continue;
13902 }
13903 dlg.finished(false);
13904 return Err(common::Error::HttpError(err));
13905 }
13906 Ok(res) => {
13907 let (mut parts, body) = res.into_parts();
13908 let mut body = common::Body::new(body);
13909 if !parts.status.is_success() {
13910 let bytes = common::to_bytes(body).await.unwrap_or_default();
13911 let error = serde_json::from_str(&common::to_string(&bytes));
13912 let response = common::to_response(parts, bytes.into());
13913
13914 if let common::Retry::After(d) =
13915 dlg.http_failure(&response, error.as_ref().ok())
13916 {
13917 sleep(d).await;
13918 continue;
13919 }
13920
13921 dlg.finished(false);
13922
13923 return Err(match error {
13924 Ok(value) => common::Error::BadRequest(value),
13925 _ => common::Error::Failure(response),
13926 });
13927 }
13928 let response = {
13929 let bytes = common::to_bytes(body).await.unwrap_or_default();
13930 let encoded = common::to_string(&bytes);
13931 match serde_json::from_str(&encoded) {
13932 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13933 Err(error) => {
13934 dlg.response_json_decode_error(&encoded, &error);
13935 return Err(common::Error::JsonDecodeError(
13936 encoded.to_string(),
13937 error,
13938 ));
13939 }
13940 }
13941 };
13942
13943 dlg.finished(true);
13944 return Ok(response);
13945 }
13946 }
13947 }
13948 }
13949
13950 ///
13951 /// Sets the *request* property to the given value.
13952 ///
13953 /// Even though the property as already been set when instantiating this call,
13954 /// we provide this method for API completeness.
13955 pub fn request(
13956 mut self,
13957 new_value: GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest,
13958 ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
13959 self._request = new_value;
13960 self
13961 }
13962 /// 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.
13963 ///
13964 /// Sets the *app* path property to the given value.
13965 ///
13966 /// Even though the property as already been set when instantiating this call,
13967 /// we provide this method for API completeness.
13968 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
13969 self._app = new_value.to_string();
13970 self
13971 }
13972 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13973 /// while executing the actual API request.
13974 ///
13975 /// ````text
13976 /// It should be used to handle progress information, and to implement a certain level of resilience.
13977 /// ````
13978 ///
13979 /// Sets the *delegate* property to the given value.
13980 pub fn delegate(
13981 mut self,
13982 new_value: &'a mut dyn common::Delegate,
13983 ) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
13984 self._delegate = Some(new_value);
13985 self
13986 }
13987
13988 /// Set any additional parameter of the query string used in the request.
13989 /// It should be used to set parameters which are not yet available through their own
13990 /// setters.
13991 ///
13992 /// Please note that this method must not be used to set any of the known parameters
13993 /// which have their own setter method. If done anyway, the request will fail.
13994 ///
13995 /// # Additional Parameters
13996 ///
13997 /// * *$.xgafv* (query-string) - V1 error format.
13998 /// * *access_token* (query-string) - OAuth access token.
13999 /// * *alt* (query-string) - Data format for response.
14000 /// * *callback* (query-string) - JSONP
14001 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14002 /// * *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.
14003 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14004 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14005 /// * *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.
14006 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14007 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14008 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14009 where
14010 T: AsRef<str>,
14011 {
14012 self._additional_params
14013 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14014 self
14015 }
14016
14017 /// Identifies the authorization scope for the method you are building.
14018 ///
14019 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14020 /// [`Scope::CloudPlatform`].
14021 ///
14022 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14023 /// tokens for more than one scope.
14024 ///
14025 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14026 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14027 /// sufficient, a read-write scope will do as well.
14028 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14029 where
14030 St: AsRef<str>,
14031 {
14032 self._scopes.insert(String::from(scope.as_ref()));
14033 self
14034 }
14035 /// Identifies the authorization scope(s) for the method you are building.
14036 ///
14037 /// See [`Self::add_scope()`] for details.
14038 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C>
14039 where
14040 I: IntoIterator<Item = St>,
14041 St: AsRef<str>,
14042 {
14043 self._scopes
14044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14045 self
14046 }
14047
14048 /// Removes all scopes, and no default scope will be used either.
14049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14050 /// for details).
14051 pub fn clear_scopes(mut self) -> ProjectAppExchangeDeviceCheckTokenCall<'a, C> {
14052 self._scopes.clear();
14053 self
14054 }
14055}
14056
14057/// Validates an [integrity verdict response token from Play Integrity](https://developer.android.com/google/play/integrity/verdict#decrypt-verify). If valid, returns an AppCheckToken.
14058///
14059/// A builder for the *apps.exchangePlayIntegrityToken* method supported by a *project* resource.
14060/// It is not used directly, but through a [`ProjectMethods`] instance.
14061///
14062/// # Example
14063///
14064/// Instantiate a resource method builder
14065///
14066/// ```test_harness,no_run
14067/// # extern crate hyper;
14068/// # extern crate hyper_rustls;
14069/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14070/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest;
14071/// # async fn dox() {
14072/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14073///
14074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14075/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14076/// # secret,
14077/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14078/// # ).build().await.unwrap();
14079///
14080/// # let client = hyper_util::client::legacy::Client::builder(
14081/// # hyper_util::rt::TokioExecutor::new()
14082/// # )
14083/// # .build(
14084/// # hyper_rustls::HttpsConnectorBuilder::new()
14085/// # .with_native_roots()
14086/// # .unwrap()
14087/// # .https_or_http()
14088/// # .enable_http1()
14089/// # .build()
14090/// # );
14091/// # let mut hub = Firebaseappcheck::new(client, auth);
14092/// // As the method needs a request, you would usually fill it with the desired information
14093/// // into the respective structure. Some of the parts shown here might not be applicable !
14094/// // Values shown here are possibly random and not representative !
14095/// let mut req = GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest::default();
14096///
14097/// // You can configure optional parameters by calling the respective setters at will, and
14098/// // execute the final call using `doit()`.
14099/// // Values shown here are possibly random and not representative !
14100/// let result = hub.projects().apps_exchange_play_integrity_token(req, "app")
14101/// .doit().await;
14102/// # }
14103/// ```
14104pub struct ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14105where
14106 C: 'a,
14107{
14108 hub: &'a Firebaseappcheck<C>,
14109 _request: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
14110 _app: String,
14111 _delegate: Option<&'a mut dyn common::Delegate>,
14112 _additional_params: HashMap<String, String>,
14113 _scopes: BTreeSet<String>,
14114}
14115
14116impl<'a, C> common::CallBuilder for ProjectAppExchangePlayIntegrityTokenCall<'a, C> {}
14117
14118impl<'a, C> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14119where
14120 C: common::Connector,
14121{
14122 /// Perform the operation you have build so far.
14123 pub async fn doit(
14124 mut self,
14125 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14126 use std::borrow::Cow;
14127 use std::io::{Read, Seek};
14128
14129 use common::{url::Params, ToParts};
14130 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14131
14132 let mut dd = common::DefaultDelegate;
14133 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14134 dlg.begin(common::MethodInfo {
14135 id: "firebaseappcheck.projects.apps.exchangePlayIntegrityToken",
14136 http_method: hyper::Method::POST,
14137 });
14138
14139 for &field in ["alt", "app"].iter() {
14140 if self._additional_params.contains_key(field) {
14141 dlg.finished(false);
14142 return Err(common::Error::FieldClash(field));
14143 }
14144 }
14145
14146 let mut params = Params::with_capacity(4 + self._additional_params.len());
14147 params.push("app", self._app);
14148
14149 params.extend(self._additional_params.iter());
14150
14151 params.push("alt", "json");
14152 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangePlayIntegrityToken";
14153 if self._scopes.is_empty() {
14154 self._scopes
14155 .insert(Scope::CloudPlatform.as_ref().to_string());
14156 }
14157
14158 #[allow(clippy::single_element_loop)]
14159 for &(find_this, param_name) in [("{+app}", "app")].iter() {
14160 url = params.uri_replacement(url, param_name, find_this, true);
14161 }
14162 {
14163 let to_remove = ["app"];
14164 params.remove_params(&to_remove);
14165 }
14166
14167 let url = params.parse_with_url(&url);
14168
14169 let mut json_mime_type = mime::APPLICATION_JSON;
14170 let mut request_value_reader = {
14171 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14172 common::remove_json_null_values(&mut value);
14173 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14174 serde_json::to_writer(&mut dst, &value).unwrap();
14175 dst
14176 };
14177 let request_size = request_value_reader
14178 .seek(std::io::SeekFrom::End(0))
14179 .unwrap();
14180 request_value_reader
14181 .seek(std::io::SeekFrom::Start(0))
14182 .unwrap();
14183
14184 loop {
14185 let token = match self
14186 .hub
14187 .auth
14188 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14189 .await
14190 {
14191 Ok(token) => token,
14192 Err(e) => match dlg.token(e) {
14193 Ok(token) => token,
14194 Err(e) => {
14195 dlg.finished(false);
14196 return Err(common::Error::MissingToken(e));
14197 }
14198 },
14199 };
14200 request_value_reader
14201 .seek(std::io::SeekFrom::Start(0))
14202 .unwrap();
14203 let mut req_result = {
14204 let client = &self.hub.client;
14205 dlg.pre_request();
14206 let mut req_builder = hyper::Request::builder()
14207 .method(hyper::Method::POST)
14208 .uri(url.as_str())
14209 .header(USER_AGENT, self.hub._user_agent.clone());
14210
14211 if let Some(token) = token.as_ref() {
14212 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14213 }
14214
14215 let request = req_builder
14216 .header(CONTENT_TYPE, json_mime_type.to_string())
14217 .header(CONTENT_LENGTH, request_size as u64)
14218 .body(common::to_body(
14219 request_value_reader.get_ref().clone().into(),
14220 ));
14221
14222 client.request(request.unwrap()).await
14223 };
14224
14225 match req_result {
14226 Err(err) => {
14227 if let common::Retry::After(d) = dlg.http_error(&err) {
14228 sleep(d).await;
14229 continue;
14230 }
14231 dlg.finished(false);
14232 return Err(common::Error::HttpError(err));
14233 }
14234 Ok(res) => {
14235 let (mut parts, body) = res.into_parts();
14236 let mut body = common::Body::new(body);
14237 if !parts.status.is_success() {
14238 let bytes = common::to_bytes(body).await.unwrap_or_default();
14239 let error = serde_json::from_str(&common::to_string(&bytes));
14240 let response = common::to_response(parts, bytes.into());
14241
14242 if let common::Retry::After(d) =
14243 dlg.http_failure(&response, error.as_ref().ok())
14244 {
14245 sleep(d).await;
14246 continue;
14247 }
14248
14249 dlg.finished(false);
14250
14251 return Err(match error {
14252 Ok(value) => common::Error::BadRequest(value),
14253 _ => common::Error::Failure(response),
14254 });
14255 }
14256 let response = {
14257 let bytes = common::to_bytes(body).await.unwrap_or_default();
14258 let encoded = common::to_string(&bytes);
14259 match serde_json::from_str(&encoded) {
14260 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14261 Err(error) => {
14262 dlg.response_json_decode_error(&encoded, &error);
14263 return Err(common::Error::JsonDecodeError(
14264 encoded.to_string(),
14265 error,
14266 ));
14267 }
14268 }
14269 };
14270
14271 dlg.finished(true);
14272 return Ok(response);
14273 }
14274 }
14275 }
14276 }
14277
14278 ///
14279 /// Sets the *request* property to the given value.
14280 ///
14281 /// Even though the property as already been set when instantiating this call,
14282 /// we provide this method for API completeness.
14283 pub fn request(
14284 mut self,
14285 new_value: GoogleFirebaseAppcheckV1betaExchangePlayIntegrityTokenRequest,
14286 ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14287 self._request = new_value;
14288 self
14289 }
14290 /// 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.
14291 ///
14292 /// Sets the *app* path property to the given value.
14293 ///
14294 /// Even though the property as already been set when instantiating this call,
14295 /// we provide this method for API completeness.
14296 pub fn app(mut self, new_value: &str) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14297 self._app = new_value.to_string();
14298 self
14299 }
14300 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14301 /// while executing the actual API request.
14302 ///
14303 /// ````text
14304 /// It should be used to handle progress information, and to implement a certain level of resilience.
14305 /// ````
14306 ///
14307 /// Sets the *delegate* property to the given value.
14308 pub fn delegate(
14309 mut self,
14310 new_value: &'a mut dyn common::Delegate,
14311 ) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14312 self._delegate = Some(new_value);
14313 self
14314 }
14315
14316 /// Set any additional parameter of the query string used in the request.
14317 /// It should be used to set parameters which are not yet available through their own
14318 /// setters.
14319 ///
14320 /// Please note that this method must not be used to set any of the known parameters
14321 /// which have their own setter method. If done anyway, the request will fail.
14322 ///
14323 /// # Additional Parameters
14324 ///
14325 /// * *$.xgafv* (query-string) - V1 error format.
14326 /// * *access_token* (query-string) - OAuth access token.
14327 /// * *alt* (query-string) - Data format for response.
14328 /// * *callback* (query-string) - JSONP
14329 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14330 /// * *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.
14331 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14332 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14333 /// * *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.
14334 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14335 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14336 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14337 where
14338 T: AsRef<str>,
14339 {
14340 self._additional_params
14341 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14342 self
14343 }
14344
14345 /// Identifies the authorization scope for the method you are building.
14346 ///
14347 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14348 /// [`Scope::CloudPlatform`].
14349 ///
14350 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14351 /// tokens for more than one scope.
14352 ///
14353 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14354 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14355 /// sufficient, a read-write scope will do as well.
14356 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14357 where
14358 St: AsRef<str>,
14359 {
14360 self._scopes.insert(String::from(scope.as_ref()));
14361 self
14362 }
14363 /// Identifies the authorization scope(s) for the method you are building.
14364 ///
14365 /// See [`Self::add_scope()`] for details.
14366 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C>
14367 where
14368 I: IntoIterator<Item = St>,
14369 St: AsRef<str>,
14370 {
14371 self._scopes
14372 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14373 self
14374 }
14375
14376 /// Removes all scopes, and no default scope will be used either.
14377 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14378 /// for details).
14379 pub fn clear_scopes(mut self) -> ProjectAppExchangePlayIntegrityTokenCall<'a, C> {
14380 self._scopes.clear();
14381 self
14382 }
14383}
14384
14385/// 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.
14386///
14387/// A builder for the *apps.exchangeRecaptchaEnterpriseToken* method supported by a *project* resource.
14388/// It is not used directly, but through a [`ProjectMethods`] instance.
14389///
14390/// # Example
14391///
14392/// Instantiate a resource method builder
14393///
14394/// ```test_harness,no_run
14395/// # extern crate hyper;
14396/// # extern crate hyper_rustls;
14397/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14398/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest;
14399/// # async fn dox() {
14400/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14401///
14402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14403/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14404/// # secret,
14405/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14406/// # ).build().await.unwrap();
14407///
14408/// # let client = hyper_util::client::legacy::Client::builder(
14409/// # hyper_util::rt::TokioExecutor::new()
14410/// # )
14411/// # .build(
14412/// # hyper_rustls::HttpsConnectorBuilder::new()
14413/// # .with_native_roots()
14414/// # .unwrap()
14415/// # .https_or_http()
14416/// # .enable_http1()
14417/// # .build()
14418/// # );
14419/// # let mut hub = Firebaseappcheck::new(client, auth);
14420/// // As the method needs a request, you would usually fill it with the desired information
14421/// // into the respective structure. Some of the parts shown here might not be applicable !
14422/// // Values shown here are possibly random and not representative !
14423/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest::default();
14424///
14425/// // You can configure optional parameters by calling the respective setters at will, and
14426/// // execute the final call using `doit()`.
14427/// // Values shown here are possibly random and not representative !
14428/// let result = hub.projects().apps_exchange_recaptcha_enterprise_token(req, "app")
14429/// .doit().await;
14430/// # }
14431/// ```
14432pub struct ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14433where
14434 C: 'a,
14435{
14436 hub: &'a Firebaseappcheck<C>,
14437 _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
14438 _app: String,
14439 _delegate: Option<&'a mut dyn common::Delegate>,
14440 _additional_params: HashMap<String, String>,
14441 _scopes: BTreeSet<String>,
14442}
14443
14444impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {}
14445
14446impl<'a, C> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14447where
14448 C: common::Connector,
14449{
14450 /// Perform the operation you have build so far.
14451 pub async fn doit(
14452 mut self,
14453 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14454 use std::borrow::Cow;
14455 use std::io::{Read, Seek};
14456
14457 use common::{url::Params, ToParts};
14458 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14459
14460 let mut dd = common::DefaultDelegate;
14461 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14462 dlg.begin(common::MethodInfo {
14463 id: "firebaseappcheck.projects.apps.exchangeRecaptchaEnterpriseToken",
14464 http_method: hyper::Method::POST,
14465 });
14466
14467 for &field in ["alt", "app"].iter() {
14468 if self._additional_params.contains_key(field) {
14469 dlg.finished(false);
14470 return Err(common::Error::FieldClash(field));
14471 }
14472 }
14473
14474 let mut params = Params::with_capacity(4 + self._additional_params.len());
14475 params.push("app", self._app);
14476
14477 params.extend(self._additional_params.iter());
14478
14479 params.push("alt", "json");
14480 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaEnterpriseToken";
14481 if self._scopes.is_empty() {
14482 self._scopes
14483 .insert(Scope::CloudPlatform.as_ref().to_string());
14484 }
14485
14486 #[allow(clippy::single_element_loop)]
14487 for &(find_this, param_name) in [("{+app}", "app")].iter() {
14488 url = params.uri_replacement(url, param_name, find_this, true);
14489 }
14490 {
14491 let to_remove = ["app"];
14492 params.remove_params(&to_remove);
14493 }
14494
14495 let url = params.parse_with_url(&url);
14496
14497 let mut json_mime_type = mime::APPLICATION_JSON;
14498 let mut request_value_reader = {
14499 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14500 common::remove_json_null_values(&mut value);
14501 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14502 serde_json::to_writer(&mut dst, &value).unwrap();
14503 dst
14504 };
14505 let request_size = request_value_reader
14506 .seek(std::io::SeekFrom::End(0))
14507 .unwrap();
14508 request_value_reader
14509 .seek(std::io::SeekFrom::Start(0))
14510 .unwrap();
14511
14512 loop {
14513 let token = match self
14514 .hub
14515 .auth
14516 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14517 .await
14518 {
14519 Ok(token) => token,
14520 Err(e) => match dlg.token(e) {
14521 Ok(token) => token,
14522 Err(e) => {
14523 dlg.finished(false);
14524 return Err(common::Error::MissingToken(e));
14525 }
14526 },
14527 };
14528 request_value_reader
14529 .seek(std::io::SeekFrom::Start(0))
14530 .unwrap();
14531 let mut req_result = {
14532 let client = &self.hub.client;
14533 dlg.pre_request();
14534 let mut req_builder = hyper::Request::builder()
14535 .method(hyper::Method::POST)
14536 .uri(url.as_str())
14537 .header(USER_AGENT, self.hub._user_agent.clone());
14538
14539 if let Some(token) = token.as_ref() {
14540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14541 }
14542
14543 let request = req_builder
14544 .header(CONTENT_TYPE, json_mime_type.to_string())
14545 .header(CONTENT_LENGTH, request_size as u64)
14546 .body(common::to_body(
14547 request_value_reader.get_ref().clone().into(),
14548 ));
14549
14550 client.request(request.unwrap()).await
14551 };
14552
14553 match req_result {
14554 Err(err) => {
14555 if let common::Retry::After(d) = dlg.http_error(&err) {
14556 sleep(d).await;
14557 continue;
14558 }
14559 dlg.finished(false);
14560 return Err(common::Error::HttpError(err));
14561 }
14562 Ok(res) => {
14563 let (mut parts, body) = res.into_parts();
14564 let mut body = common::Body::new(body);
14565 if !parts.status.is_success() {
14566 let bytes = common::to_bytes(body).await.unwrap_or_default();
14567 let error = serde_json::from_str(&common::to_string(&bytes));
14568 let response = common::to_response(parts, bytes.into());
14569
14570 if let common::Retry::After(d) =
14571 dlg.http_failure(&response, error.as_ref().ok())
14572 {
14573 sleep(d).await;
14574 continue;
14575 }
14576
14577 dlg.finished(false);
14578
14579 return Err(match error {
14580 Ok(value) => common::Error::BadRequest(value),
14581 _ => common::Error::Failure(response),
14582 });
14583 }
14584 let response = {
14585 let bytes = common::to_bytes(body).await.unwrap_or_default();
14586 let encoded = common::to_string(&bytes);
14587 match serde_json::from_str(&encoded) {
14588 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14589 Err(error) => {
14590 dlg.response_json_decode_error(&encoded, &error);
14591 return Err(common::Error::JsonDecodeError(
14592 encoded.to_string(),
14593 error,
14594 ));
14595 }
14596 }
14597 };
14598
14599 dlg.finished(true);
14600 return Ok(response);
14601 }
14602 }
14603 }
14604 }
14605
14606 ///
14607 /// Sets the *request* property to the given value.
14608 ///
14609 /// Even though the property as already been set when instantiating this call,
14610 /// we provide this method for API completeness.
14611 pub fn request(
14612 mut self,
14613 new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest,
14614 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
14615 self._request = new_value;
14616 self
14617 }
14618 /// 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.
14619 ///
14620 /// Sets the *app* path property to the given value.
14621 ///
14622 /// Even though the property as already been set when instantiating this call,
14623 /// we provide this method for API completeness.
14624 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
14625 self._app = new_value.to_string();
14626 self
14627 }
14628 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14629 /// while executing the actual API request.
14630 ///
14631 /// ````text
14632 /// It should be used to handle progress information, and to implement a certain level of resilience.
14633 /// ````
14634 ///
14635 /// Sets the *delegate* property to the given value.
14636 pub fn delegate(
14637 mut self,
14638 new_value: &'a mut dyn common::Delegate,
14639 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
14640 self._delegate = Some(new_value);
14641 self
14642 }
14643
14644 /// Set any additional parameter of the query string used in the request.
14645 /// It should be used to set parameters which are not yet available through their own
14646 /// setters.
14647 ///
14648 /// Please note that this method must not be used to set any of the known parameters
14649 /// which have their own setter method. If done anyway, the request will fail.
14650 ///
14651 /// # Additional Parameters
14652 ///
14653 /// * *$.xgafv* (query-string) - V1 error format.
14654 /// * *access_token* (query-string) - OAuth access token.
14655 /// * *alt* (query-string) - Data format for response.
14656 /// * *callback* (query-string) - JSONP
14657 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14658 /// * *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.
14659 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14660 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14661 /// * *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.
14662 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14663 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14664 pub fn param<T>(
14665 mut self,
14666 name: T,
14667 value: T,
14668 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14669 where
14670 T: AsRef<str>,
14671 {
14672 self._additional_params
14673 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14674 self
14675 }
14676
14677 /// Identifies the authorization scope for the method you are building.
14678 ///
14679 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14680 /// [`Scope::CloudPlatform`].
14681 ///
14682 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14683 /// tokens for more than one scope.
14684 ///
14685 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14686 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14687 /// sufficient, a read-write scope will do as well.
14688 pub fn add_scope<St>(
14689 mut self,
14690 scope: St,
14691 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14692 where
14693 St: AsRef<str>,
14694 {
14695 self._scopes.insert(String::from(scope.as_ref()));
14696 self
14697 }
14698 /// Identifies the authorization scope(s) for the method you are building.
14699 ///
14700 /// See [`Self::add_scope()`] for details.
14701 pub fn add_scopes<I, St>(
14702 mut self,
14703 scopes: I,
14704 ) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C>
14705 where
14706 I: IntoIterator<Item = St>,
14707 St: AsRef<str>,
14708 {
14709 self._scopes
14710 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14711 self
14712 }
14713
14714 /// Removes all scopes, and no default scope will be used either.
14715 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14716 /// for details).
14717 pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaEnterpriseTokenCall<'a, C> {
14718 self._scopes.clear();
14719 self
14720 }
14721}
14722
14723/// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
14724///
14725/// A builder for the *apps.exchangeRecaptchaToken* method supported by a *project* resource.
14726/// It is not used directly, but through a [`ProjectMethods`] instance.
14727///
14728/// # Example
14729///
14730/// Instantiate a resource method builder
14731///
14732/// ```test_harness,no_run
14733/// # extern crate hyper;
14734/// # extern crate hyper_rustls;
14735/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
14736/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest;
14737/// # async fn dox() {
14738/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14739///
14740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14741/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14742/// # secret,
14743/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14744/// # ).build().await.unwrap();
14745///
14746/// # let client = hyper_util::client::legacy::Client::builder(
14747/// # hyper_util::rt::TokioExecutor::new()
14748/// # )
14749/// # .build(
14750/// # hyper_rustls::HttpsConnectorBuilder::new()
14751/// # .with_native_roots()
14752/// # .unwrap()
14753/// # .https_or_http()
14754/// # .enable_http1()
14755/// # .build()
14756/// # );
14757/// # let mut hub = Firebaseappcheck::new(client, auth);
14758/// // As the method needs a request, you would usually fill it with the desired information
14759/// // into the respective structure. Some of the parts shown here might not be applicable !
14760/// // Values shown here are possibly random and not representative !
14761/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest::default();
14762///
14763/// // You can configure optional parameters by calling the respective setters at will, and
14764/// // execute the final call using `doit()`.
14765/// // Values shown here are possibly random and not representative !
14766/// let result = hub.projects().apps_exchange_recaptcha_token(req, "app")
14767/// .doit().await;
14768/// # }
14769/// ```
14770pub struct ProjectAppExchangeRecaptchaTokenCall<'a, C>
14771where
14772 C: 'a,
14773{
14774 hub: &'a Firebaseappcheck<C>,
14775 _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
14776 _app: String,
14777 _delegate: Option<&'a mut dyn common::Delegate>,
14778 _additional_params: HashMap<String, String>,
14779 _scopes: BTreeSet<String>,
14780}
14781
14782impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaTokenCall<'a, C> {}
14783
14784impl<'a, C> ProjectAppExchangeRecaptchaTokenCall<'a, C>
14785where
14786 C: common::Connector,
14787{
14788 /// Perform the operation you have build so far.
14789 pub async fn doit(
14790 mut self,
14791 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
14792 use std::borrow::Cow;
14793 use std::io::{Read, Seek};
14794
14795 use common::{url::Params, ToParts};
14796 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14797
14798 let mut dd = common::DefaultDelegate;
14799 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14800 dlg.begin(common::MethodInfo {
14801 id: "firebaseappcheck.projects.apps.exchangeRecaptchaToken",
14802 http_method: hyper::Method::POST,
14803 });
14804
14805 for &field in ["alt", "app"].iter() {
14806 if self._additional_params.contains_key(field) {
14807 dlg.finished(false);
14808 return Err(common::Error::FieldClash(field));
14809 }
14810 }
14811
14812 let mut params = Params::with_capacity(4 + self._additional_params.len());
14813 params.push("app", self._app);
14814
14815 params.extend(self._additional_params.iter());
14816
14817 params.push("alt", "json");
14818 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaToken";
14819 if self._scopes.is_empty() {
14820 self._scopes
14821 .insert(Scope::CloudPlatform.as_ref().to_string());
14822 }
14823
14824 #[allow(clippy::single_element_loop)]
14825 for &(find_this, param_name) in [("{+app}", "app")].iter() {
14826 url = params.uri_replacement(url, param_name, find_this, true);
14827 }
14828 {
14829 let to_remove = ["app"];
14830 params.remove_params(&to_remove);
14831 }
14832
14833 let url = params.parse_with_url(&url);
14834
14835 let mut json_mime_type = mime::APPLICATION_JSON;
14836 let mut request_value_reader = {
14837 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14838 common::remove_json_null_values(&mut value);
14839 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14840 serde_json::to_writer(&mut dst, &value).unwrap();
14841 dst
14842 };
14843 let request_size = request_value_reader
14844 .seek(std::io::SeekFrom::End(0))
14845 .unwrap();
14846 request_value_reader
14847 .seek(std::io::SeekFrom::Start(0))
14848 .unwrap();
14849
14850 loop {
14851 let token = match self
14852 .hub
14853 .auth
14854 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14855 .await
14856 {
14857 Ok(token) => token,
14858 Err(e) => match dlg.token(e) {
14859 Ok(token) => token,
14860 Err(e) => {
14861 dlg.finished(false);
14862 return Err(common::Error::MissingToken(e));
14863 }
14864 },
14865 };
14866 request_value_reader
14867 .seek(std::io::SeekFrom::Start(0))
14868 .unwrap();
14869 let mut req_result = {
14870 let client = &self.hub.client;
14871 dlg.pre_request();
14872 let mut req_builder = hyper::Request::builder()
14873 .method(hyper::Method::POST)
14874 .uri(url.as_str())
14875 .header(USER_AGENT, self.hub._user_agent.clone());
14876
14877 if let Some(token) = token.as_ref() {
14878 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14879 }
14880
14881 let request = req_builder
14882 .header(CONTENT_TYPE, json_mime_type.to_string())
14883 .header(CONTENT_LENGTH, request_size as u64)
14884 .body(common::to_body(
14885 request_value_reader.get_ref().clone().into(),
14886 ));
14887
14888 client.request(request.unwrap()).await
14889 };
14890
14891 match req_result {
14892 Err(err) => {
14893 if let common::Retry::After(d) = dlg.http_error(&err) {
14894 sleep(d).await;
14895 continue;
14896 }
14897 dlg.finished(false);
14898 return Err(common::Error::HttpError(err));
14899 }
14900 Ok(res) => {
14901 let (mut parts, body) = res.into_parts();
14902 let mut body = common::Body::new(body);
14903 if !parts.status.is_success() {
14904 let bytes = common::to_bytes(body).await.unwrap_or_default();
14905 let error = serde_json::from_str(&common::to_string(&bytes));
14906 let response = common::to_response(parts, bytes.into());
14907
14908 if let common::Retry::After(d) =
14909 dlg.http_failure(&response, error.as_ref().ok())
14910 {
14911 sleep(d).await;
14912 continue;
14913 }
14914
14915 dlg.finished(false);
14916
14917 return Err(match error {
14918 Ok(value) => common::Error::BadRequest(value),
14919 _ => common::Error::Failure(response),
14920 });
14921 }
14922 let response = {
14923 let bytes = common::to_bytes(body).await.unwrap_or_default();
14924 let encoded = common::to_string(&bytes);
14925 match serde_json::from_str(&encoded) {
14926 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14927 Err(error) => {
14928 dlg.response_json_decode_error(&encoded, &error);
14929 return Err(common::Error::JsonDecodeError(
14930 encoded.to_string(),
14931 error,
14932 ));
14933 }
14934 }
14935 };
14936
14937 dlg.finished(true);
14938 return Ok(response);
14939 }
14940 }
14941 }
14942 }
14943
14944 ///
14945 /// Sets the *request* property to the given value.
14946 ///
14947 /// Even though the property as already been set when instantiating this call,
14948 /// we provide this method for API completeness.
14949 pub fn request(
14950 mut self,
14951 new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest,
14952 ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
14953 self._request = new_value;
14954 self
14955 }
14956 /// 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.
14957 ///
14958 /// Sets the *app* path property to the given value.
14959 ///
14960 /// Even though the property as already been set when instantiating this call,
14961 /// we provide this method for API completeness.
14962 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
14963 self._app = new_value.to_string();
14964 self
14965 }
14966 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14967 /// while executing the actual API request.
14968 ///
14969 /// ````text
14970 /// It should be used to handle progress information, and to implement a certain level of resilience.
14971 /// ````
14972 ///
14973 /// Sets the *delegate* property to the given value.
14974 pub fn delegate(
14975 mut self,
14976 new_value: &'a mut dyn common::Delegate,
14977 ) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
14978 self._delegate = Some(new_value);
14979 self
14980 }
14981
14982 /// Set any additional parameter of the query string used in the request.
14983 /// It should be used to set parameters which are not yet available through their own
14984 /// setters.
14985 ///
14986 /// Please note that this method must not be used to set any of the known parameters
14987 /// which have their own setter method. If done anyway, the request will fail.
14988 ///
14989 /// # Additional Parameters
14990 ///
14991 /// * *$.xgafv* (query-string) - V1 error format.
14992 /// * *access_token* (query-string) - OAuth access token.
14993 /// * *alt* (query-string) - Data format for response.
14994 /// * *callback* (query-string) - JSONP
14995 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14996 /// * *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.
14997 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14998 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14999 /// * *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.
15000 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15001 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15002 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15003 where
15004 T: AsRef<str>,
15005 {
15006 self._additional_params
15007 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15008 self
15009 }
15010
15011 /// Identifies the authorization scope for the method you are building.
15012 ///
15013 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15014 /// [`Scope::CloudPlatform`].
15015 ///
15016 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15017 /// tokens for more than one scope.
15018 ///
15019 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15020 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15021 /// sufficient, a read-write scope will do as well.
15022 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15023 where
15024 St: AsRef<str>,
15025 {
15026 self._scopes.insert(String::from(scope.as_ref()));
15027 self
15028 }
15029 /// Identifies the authorization scope(s) for the method you are building.
15030 ///
15031 /// See [`Self::add_scope()`] for details.
15032 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeRecaptchaTokenCall<'a, C>
15033 where
15034 I: IntoIterator<Item = St>,
15035 St: AsRef<str>,
15036 {
15037 self._scopes
15038 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15039 self
15040 }
15041
15042 /// Removes all scopes, and no default scope will be used either.
15043 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15044 /// for details).
15045 pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaTokenCall<'a, C> {
15046 self._scopes.clear();
15047 self
15048 }
15049}
15050
15051/// Validates a [reCAPTCHA v3 response token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an AppCheckToken.
15052///
15053/// A builder for the *apps.exchangeRecaptchaV3Token* method supported by a *project* resource.
15054/// It is not used directly, but through a [`ProjectMethods`] instance.
15055///
15056/// # Example
15057///
15058/// Instantiate a resource method builder
15059///
15060/// ```test_harness,no_run
15061/// # extern crate hyper;
15062/// # extern crate hyper_rustls;
15063/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15064/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest;
15065/// # async fn dox() {
15066/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15067///
15068/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15069/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15070/// # secret,
15071/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15072/// # ).build().await.unwrap();
15073///
15074/// # let client = hyper_util::client::legacy::Client::builder(
15075/// # hyper_util::rt::TokioExecutor::new()
15076/// # )
15077/// # .build(
15078/// # hyper_rustls::HttpsConnectorBuilder::new()
15079/// # .with_native_roots()
15080/// # .unwrap()
15081/// # .https_or_http()
15082/// # .enable_http1()
15083/// # .build()
15084/// # );
15085/// # let mut hub = Firebaseappcheck::new(client, auth);
15086/// // As the method needs a request, you would usually fill it with the desired information
15087/// // into the respective structure. Some of the parts shown here might not be applicable !
15088/// // Values shown here are possibly random and not representative !
15089/// let mut req = GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest::default();
15090///
15091/// // You can configure optional parameters by calling the respective setters at will, and
15092/// // execute the final call using `doit()`.
15093/// // Values shown here are possibly random and not representative !
15094/// let result = hub.projects().apps_exchange_recaptcha_v3_token(req, "app")
15095/// .doit().await;
15096/// # }
15097/// ```
15098pub struct ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15099where
15100 C: 'a,
15101{
15102 hub: &'a Firebaseappcheck<C>,
15103 _request: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
15104 _app: String,
15105 _delegate: Option<&'a mut dyn common::Delegate>,
15106 _additional_params: HashMap<String, String>,
15107 _scopes: BTreeSet<String>,
15108}
15109
15110impl<'a, C> common::CallBuilder for ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {}
15111
15112impl<'a, C> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15113where
15114 C: common::Connector,
15115{
15116 /// Perform the operation you have build so far.
15117 pub async fn doit(
15118 mut self,
15119 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
15120 use std::borrow::Cow;
15121 use std::io::{Read, Seek};
15122
15123 use common::{url::Params, ToParts};
15124 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15125
15126 let mut dd = common::DefaultDelegate;
15127 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15128 dlg.begin(common::MethodInfo {
15129 id: "firebaseappcheck.projects.apps.exchangeRecaptchaV3Token",
15130 http_method: hyper::Method::POST,
15131 });
15132
15133 for &field in ["alt", "app"].iter() {
15134 if self._additional_params.contains_key(field) {
15135 dlg.finished(false);
15136 return Err(common::Error::FieldClash(field));
15137 }
15138 }
15139
15140 let mut params = Params::with_capacity(4 + self._additional_params.len());
15141 params.push("app", self._app);
15142
15143 params.extend(self._additional_params.iter());
15144
15145 params.push("alt", "json");
15146 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeRecaptchaV3Token";
15147 if self._scopes.is_empty() {
15148 self._scopes
15149 .insert(Scope::CloudPlatform.as_ref().to_string());
15150 }
15151
15152 #[allow(clippy::single_element_loop)]
15153 for &(find_this, param_name) in [("{+app}", "app")].iter() {
15154 url = params.uri_replacement(url, param_name, find_this, true);
15155 }
15156 {
15157 let to_remove = ["app"];
15158 params.remove_params(&to_remove);
15159 }
15160
15161 let url = params.parse_with_url(&url);
15162
15163 let mut json_mime_type = mime::APPLICATION_JSON;
15164 let mut request_value_reader = {
15165 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15166 common::remove_json_null_values(&mut value);
15167 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15168 serde_json::to_writer(&mut dst, &value).unwrap();
15169 dst
15170 };
15171 let request_size = request_value_reader
15172 .seek(std::io::SeekFrom::End(0))
15173 .unwrap();
15174 request_value_reader
15175 .seek(std::io::SeekFrom::Start(0))
15176 .unwrap();
15177
15178 loop {
15179 let token = match self
15180 .hub
15181 .auth
15182 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15183 .await
15184 {
15185 Ok(token) => token,
15186 Err(e) => match dlg.token(e) {
15187 Ok(token) => token,
15188 Err(e) => {
15189 dlg.finished(false);
15190 return Err(common::Error::MissingToken(e));
15191 }
15192 },
15193 };
15194 request_value_reader
15195 .seek(std::io::SeekFrom::Start(0))
15196 .unwrap();
15197 let mut req_result = {
15198 let client = &self.hub.client;
15199 dlg.pre_request();
15200 let mut req_builder = hyper::Request::builder()
15201 .method(hyper::Method::POST)
15202 .uri(url.as_str())
15203 .header(USER_AGENT, self.hub._user_agent.clone());
15204
15205 if let Some(token) = token.as_ref() {
15206 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15207 }
15208
15209 let request = req_builder
15210 .header(CONTENT_TYPE, json_mime_type.to_string())
15211 .header(CONTENT_LENGTH, request_size as u64)
15212 .body(common::to_body(
15213 request_value_reader.get_ref().clone().into(),
15214 ));
15215
15216 client.request(request.unwrap()).await
15217 };
15218
15219 match req_result {
15220 Err(err) => {
15221 if let common::Retry::After(d) = dlg.http_error(&err) {
15222 sleep(d).await;
15223 continue;
15224 }
15225 dlg.finished(false);
15226 return Err(common::Error::HttpError(err));
15227 }
15228 Ok(res) => {
15229 let (mut parts, body) = res.into_parts();
15230 let mut body = common::Body::new(body);
15231 if !parts.status.is_success() {
15232 let bytes = common::to_bytes(body).await.unwrap_or_default();
15233 let error = serde_json::from_str(&common::to_string(&bytes));
15234 let response = common::to_response(parts, bytes.into());
15235
15236 if let common::Retry::After(d) =
15237 dlg.http_failure(&response, error.as_ref().ok())
15238 {
15239 sleep(d).await;
15240 continue;
15241 }
15242
15243 dlg.finished(false);
15244
15245 return Err(match error {
15246 Ok(value) => common::Error::BadRequest(value),
15247 _ => common::Error::Failure(response),
15248 });
15249 }
15250 let response = {
15251 let bytes = common::to_bytes(body).await.unwrap_or_default();
15252 let encoded = common::to_string(&bytes);
15253 match serde_json::from_str(&encoded) {
15254 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15255 Err(error) => {
15256 dlg.response_json_decode_error(&encoded, &error);
15257 return Err(common::Error::JsonDecodeError(
15258 encoded.to_string(),
15259 error,
15260 ));
15261 }
15262 }
15263 };
15264
15265 dlg.finished(true);
15266 return Ok(response);
15267 }
15268 }
15269 }
15270 }
15271
15272 ///
15273 /// Sets the *request* property to the given value.
15274 ///
15275 /// Even though the property as already been set when instantiating this call,
15276 /// we provide this method for API completeness.
15277 pub fn request(
15278 mut self,
15279 new_value: GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest,
15280 ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15281 self._request = new_value;
15282 self
15283 }
15284 /// 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.
15285 ///
15286 /// Sets the *app* path property to the given value.
15287 ///
15288 /// Even though the property as already been set when instantiating this call,
15289 /// we provide this method for API completeness.
15290 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15291 self._app = new_value.to_string();
15292 self
15293 }
15294 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15295 /// while executing the actual API request.
15296 ///
15297 /// ````text
15298 /// It should be used to handle progress information, and to implement a certain level of resilience.
15299 /// ````
15300 ///
15301 /// Sets the *delegate* property to the given value.
15302 pub fn delegate(
15303 mut self,
15304 new_value: &'a mut dyn common::Delegate,
15305 ) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15306 self._delegate = Some(new_value);
15307 self
15308 }
15309
15310 /// Set any additional parameter of the query string used in the request.
15311 /// It should be used to set parameters which are not yet available through their own
15312 /// setters.
15313 ///
15314 /// Please note that this method must not be used to set any of the known parameters
15315 /// which have their own setter method. If done anyway, the request will fail.
15316 ///
15317 /// # Additional Parameters
15318 ///
15319 /// * *$.xgafv* (query-string) - V1 error format.
15320 /// * *access_token* (query-string) - OAuth access token.
15321 /// * *alt* (query-string) - Data format for response.
15322 /// * *callback* (query-string) - JSONP
15323 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15324 /// * *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.
15325 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15326 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15327 /// * *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.
15328 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15329 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15330 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15331 where
15332 T: AsRef<str>,
15333 {
15334 self._additional_params
15335 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15336 self
15337 }
15338
15339 /// Identifies the authorization scope for the method you are building.
15340 ///
15341 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15342 /// [`Scope::CloudPlatform`].
15343 ///
15344 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15345 /// tokens for more than one scope.
15346 ///
15347 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15348 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15349 /// sufficient, a read-write scope will do as well.
15350 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15351 where
15352 St: AsRef<str>,
15353 {
15354 self._scopes.insert(String::from(scope.as_ref()));
15355 self
15356 }
15357 /// Identifies the authorization scope(s) for the method you are building.
15358 ///
15359 /// See [`Self::add_scope()`] for details.
15360 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C>
15361 where
15362 I: IntoIterator<Item = St>,
15363 St: AsRef<str>,
15364 {
15365 self._scopes
15366 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15367 self
15368 }
15369
15370 /// Removes all scopes, and no default scope will be used either.
15371 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15372 /// for details).
15373 pub fn clear_scopes(mut self) -> ProjectAppExchangeRecaptchaV3TokenCall<'a, C> {
15374 self._scopes.clear();
15375 self
15376 }
15377}
15378
15379/// Validates a [SafetyNet token](https://developer.android.com/training/safetynet/attestation#request-attestation-step). If valid, returns an AppCheckToken.
15380///
15381/// A builder for the *apps.exchangeSafetyNetToken* method supported by a *project* resource.
15382/// It is not used directly, but through a [`ProjectMethods`] instance.
15383///
15384/// # Example
15385///
15386/// Instantiate a resource method builder
15387///
15388/// ```test_harness,no_run
15389/// # extern crate hyper;
15390/// # extern crate hyper_rustls;
15391/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15392/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest;
15393/// # async fn dox() {
15394/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15395///
15396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15398/// # secret,
15399/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15400/// # ).build().await.unwrap();
15401///
15402/// # let client = hyper_util::client::legacy::Client::builder(
15403/// # hyper_util::rt::TokioExecutor::new()
15404/// # )
15405/// # .build(
15406/// # hyper_rustls::HttpsConnectorBuilder::new()
15407/// # .with_native_roots()
15408/// # .unwrap()
15409/// # .https_or_http()
15410/// # .enable_http1()
15411/// # .build()
15412/// # );
15413/// # let mut hub = Firebaseappcheck::new(client, auth);
15414/// // As the method needs a request, you would usually fill it with the desired information
15415/// // into the respective structure. Some of the parts shown here might not be applicable !
15416/// // Values shown here are possibly random and not representative !
15417/// let mut req = GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest::default();
15418///
15419/// // You can configure optional parameters by calling the respective setters at will, and
15420/// // execute the final call using `doit()`.
15421/// // Values shown here are possibly random and not representative !
15422/// let result = hub.projects().apps_exchange_safety_net_token(req, "app")
15423/// .doit().await;
15424/// # }
15425/// ```
15426pub struct ProjectAppExchangeSafetyNetTokenCall<'a, C>
15427where
15428 C: 'a,
15429{
15430 hub: &'a Firebaseappcheck<C>,
15431 _request: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
15432 _app: String,
15433 _delegate: Option<&'a mut dyn common::Delegate>,
15434 _additional_params: HashMap<String, String>,
15435 _scopes: BTreeSet<String>,
15436}
15437
15438impl<'a, C> common::CallBuilder for ProjectAppExchangeSafetyNetTokenCall<'a, C> {}
15439
15440impl<'a, C> ProjectAppExchangeSafetyNetTokenCall<'a, C>
15441where
15442 C: common::Connector,
15443{
15444 /// Perform the operation you have build so far.
15445 pub async fn doit(
15446 mut self,
15447 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaAppCheckToken)> {
15448 use std::borrow::Cow;
15449 use std::io::{Read, Seek};
15450
15451 use common::{url::Params, ToParts};
15452 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15453
15454 let mut dd = common::DefaultDelegate;
15455 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15456 dlg.begin(common::MethodInfo {
15457 id: "firebaseappcheck.projects.apps.exchangeSafetyNetToken",
15458 http_method: hyper::Method::POST,
15459 });
15460
15461 for &field in ["alt", "app"].iter() {
15462 if self._additional_params.contains_key(field) {
15463 dlg.finished(false);
15464 return Err(common::Error::FieldClash(field));
15465 }
15466 }
15467
15468 let mut params = Params::with_capacity(4 + self._additional_params.len());
15469 params.push("app", self._app);
15470
15471 params.extend(self._additional_params.iter());
15472
15473 params.push("alt", "json");
15474 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:exchangeSafetyNetToken";
15475 if self._scopes.is_empty() {
15476 self._scopes
15477 .insert(Scope::CloudPlatform.as_ref().to_string());
15478 }
15479
15480 #[allow(clippy::single_element_loop)]
15481 for &(find_this, param_name) in [("{+app}", "app")].iter() {
15482 url = params.uri_replacement(url, param_name, find_this, true);
15483 }
15484 {
15485 let to_remove = ["app"];
15486 params.remove_params(&to_remove);
15487 }
15488
15489 let url = params.parse_with_url(&url);
15490
15491 let mut json_mime_type = mime::APPLICATION_JSON;
15492 let mut request_value_reader = {
15493 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15494 common::remove_json_null_values(&mut value);
15495 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15496 serde_json::to_writer(&mut dst, &value).unwrap();
15497 dst
15498 };
15499 let request_size = request_value_reader
15500 .seek(std::io::SeekFrom::End(0))
15501 .unwrap();
15502 request_value_reader
15503 .seek(std::io::SeekFrom::Start(0))
15504 .unwrap();
15505
15506 loop {
15507 let token = match self
15508 .hub
15509 .auth
15510 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15511 .await
15512 {
15513 Ok(token) => token,
15514 Err(e) => match dlg.token(e) {
15515 Ok(token) => token,
15516 Err(e) => {
15517 dlg.finished(false);
15518 return Err(common::Error::MissingToken(e));
15519 }
15520 },
15521 };
15522 request_value_reader
15523 .seek(std::io::SeekFrom::Start(0))
15524 .unwrap();
15525 let mut req_result = {
15526 let client = &self.hub.client;
15527 dlg.pre_request();
15528 let mut req_builder = hyper::Request::builder()
15529 .method(hyper::Method::POST)
15530 .uri(url.as_str())
15531 .header(USER_AGENT, self.hub._user_agent.clone());
15532
15533 if let Some(token) = token.as_ref() {
15534 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15535 }
15536
15537 let request = req_builder
15538 .header(CONTENT_TYPE, json_mime_type.to_string())
15539 .header(CONTENT_LENGTH, request_size as u64)
15540 .body(common::to_body(
15541 request_value_reader.get_ref().clone().into(),
15542 ));
15543
15544 client.request(request.unwrap()).await
15545 };
15546
15547 match req_result {
15548 Err(err) => {
15549 if let common::Retry::After(d) = dlg.http_error(&err) {
15550 sleep(d).await;
15551 continue;
15552 }
15553 dlg.finished(false);
15554 return Err(common::Error::HttpError(err));
15555 }
15556 Ok(res) => {
15557 let (mut parts, body) = res.into_parts();
15558 let mut body = common::Body::new(body);
15559 if !parts.status.is_success() {
15560 let bytes = common::to_bytes(body).await.unwrap_or_default();
15561 let error = serde_json::from_str(&common::to_string(&bytes));
15562 let response = common::to_response(parts, bytes.into());
15563
15564 if let common::Retry::After(d) =
15565 dlg.http_failure(&response, error.as_ref().ok())
15566 {
15567 sleep(d).await;
15568 continue;
15569 }
15570
15571 dlg.finished(false);
15572
15573 return Err(match error {
15574 Ok(value) => common::Error::BadRequest(value),
15575 _ => common::Error::Failure(response),
15576 });
15577 }
15578 let response = {
15579 let bytes = common::to_bytes(body).await.unwrap_or_default();
15580 let encoded = common::to_string(&bytes);
15581 match serde_json::from_str(&encoded) {
15582 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15583 Err(error) => {
15584 dlg.response_json_decode_error(&encoded, &error);
15585 return Err(common::Error::JsonDecodeError(
15586 encoded.to_string(),
15587 error,
15588 ));
15589 }
15590 }
15591 };
15592
15593 dlg.finished(true);
15594 return Ok(response);
15595 }
15596 }
15597 }
15598 }
15599
15600 ///
15601 /// Sets the *request* property to the given value.
15602 ///
15603 /// Even though the property as already been set when instantiating this call,
15604 /// we provide this method for API completeness.
15605 pub fn request(
15606 mut self,
15607 new_value: GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest,
15608 ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
15609 self._request = new_value;
15610 self
15611 }
15612 /// 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.
15613 ///
15614 /// Sets the *app* path property to the given value.
15615 ///
15616 /// Even though the property as already been set when instantiating this call,
15617 /// we provide this method for API completeness.
15618 pub fn app(mut self, new_value: &str) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
15619 self._app = new_value.to_string();
15620 self
15621 }
15622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15623 /// while executing the actual API request.
15624 ///
15625 /// ````text
15626 /// It should be used to handle progress information, and to implement a certain level of resilience.
15627 /// ````
15628 ///
15629 /// Sets the *delegate* property to the given value.
15630 pub fn delegate(
15631 mut self,
15632 new_value: &'a mut dyn common::Delegate,
15633 ) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
15634 self._delegate = Some(new_value);
15635 self
15636 }
15637
15638 /// Set any additional parameter of the query string used in the request.
15639 /// It should be used to set parameters which are not yet available through their own
15640 /// setters.
15641 ///
15642 /// Please note that this method must not be used to set any of the known parameters
15643 /// which have their own setter method. If done anyway, the request will fail.
15644 ///
15645 /// # Additional Parameters
15646 ///
15647 /// * *$.xgafv* (query-string) - V1 error format.
15648 /// * *access_token* (query-string) - OAuth access token.
15649 /// * *alt* (query-string) - Data format for response.
15650 /// * *callback* (query-string) - JSONP
15651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15652 /// * *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.
15653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15655 /// * *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.
15656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15658 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
15659 where
15660 T: AsRef<str>,
15661 {
15662 self._additional_params
15663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15664 self
15665 }
15666
15667 /// Identifies the authorization scope for the method you are building.
15668 ///
15669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15670 /// [`Scope::CloudPlatform`].
15671 ///
15672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15673 /// tokens for more than one scope.
15674 ///
15675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15677 /// sufficient, a read-write scope will do as well.
15678 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
15679 where
15680 St: AsRef<str>,
15681 {
15682 self._scopes.insert(String::from(scope.as_ref()));
15683 self
15684 }
15685 /// Identifies the authorization scope(s) for the method you are building.
15686 ///
15687 /// See [`Self::add_scope()`] for details.
15688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppExchangeSafetyNetTokenCall<'a, C>
15689 where
15690 I: IntoIterator<Item = St>,
15691 St: AsRef<str>,
15692 {
15693 self._scopes
15694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15695 self
15696 }
15697
15698 /// Removes all scopes, and no default scope will be used either.
15699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15700 /// for details).
15701 pub fn clear_scopes(mut self) -> ProjectAppExchangeSafetyNetTokenCall<'a, C> {
15702 self._scopes.clear();
15703 self
15704 }
15705}
15706
15707/// 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.
15708///
15709/// A builder for the *apps.generateAppAttestChallenge* method supported by a *project* resource.
15710/// It is not used directly, but through a [`ProjectMethods`] instance.
15711///
15712/// # Example
15713///
15714/// Instantiate a resource method builder
15715///
15716/// ```test_harness,no_run
15717/// # extern crate hyper;
15718/// # extern crate hyper_rustls;
15719/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
15720/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest;
15721/// # async fn dox() {
15722/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15723///
15724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15726/// # secret,
15727/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15728/// # ).build().await.unwrap();
15729///
15730/// # let client = hyper_util::client::legacy::Client::builder(
15731/// # hyper_util::rt::TokioExecutor::new()
15732/// # )
15733/// # .build(
15734/// # hyper_rustls::HttpsConnectorBuilder::new()
15735/// # .with_native_roots()
15736/// # .unwrap()
15737/// # .https_or_http()
15738/// # .enable_http1()
15739/// # .build()
15740/// # );
15741/// # let mut hub = Firebaseappcheck::new(client, auth);
15742/// // As the method needs a request, you would usually fill it with the desired information
15743/// // into the respective structure. Some of the parts shown here might not be applicable !
15744/// // Values shown here are possibly random and not representative !
15745/// let mut req = GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest::default();
15746///
15747/// // You can configure optional parameters by calling the respective setters at will, and
15748/// // execute the final call using `doit()`.
15749/// // Values shown here are possibly random and not representative !
15750/// let result = hub.projects().apps_generate_app_attest_challenge(req, "app")
15751/// .doit().await;
15752/// # }
15753/// ```
15754pub struct ProjectAppGenerateAppAttestChallengeCall<'a, C>
15755where
15756 C: 'a,
15757{
15758 hub: &'a Firebaseappcheck<C>,
15759 _request: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
15760 _app: String,
15761 _delegate: Option<&'a mut dyn common::Delegate>,
15762 _additional_params: HashMap<String, String>,
15763 _scopes: BTreeSet<String>,
15764}
15765
15766impl<'a, C> common::CallBuilder for ProjectAppGenerateAppAttestChallengeCall<'a, C> {}
15767
15768impl<'a, C> ProjectAppGenerateAppAttestChallengeCall<'a, C>
15769where
15770 C: common::Connector,
15771{
15772 /// Perform the operation you have build so far.
15773 pub async fn doit(
15774 mut self,
15775 ) -> common::Result<(
15776 common::Response,
15777 GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse,
15778 )> {
15779 use std::borrow::Cow;
15780 use std::io::{Read, Seek};
15781
15782 use common::{url::Params, ToParts};
15783 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15784
15785 let mut dd = common::DefaultDelegate;
15786 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15787 dlg.begin(common::MethodInfo {
15788 id: "firebaseappcheck.projects.apps.generateAppAttestChallenge",
15789 http_method: hyper::Method::POST,
15790 });
15791
15792 for &field in ["alt", "app"].iter() {
15793 if self._additional_params.contains_key(field) {
15794 dlg.finished(false);
15795 return Err(common::Error::FieldClash(field));
15796 }
15797 }
15798
15799 let mut params = Params::with_capacity(4 + self._additional_params.len());
15800 params.push("app", self._app);
15801
15802 params.extend(self._additional_params.iter());
15803
15804 params.push("alt", "json");
15805 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generateAppAttestChallenge";
15806 if self._scopes.is_empty() {
15807 self._scopes
15808 .insert(Scope::CloudPlatform.as_ref().to_string());
15809 }
15810
15811 #[allow(clippy::single_element_loop)]
15812 for &(find_this, param_name) in [("{+app}", "app")].iter() {
15813 url = params.uri_replacement(url, param_name, find_this, true);
15814 }
15815 {
15816 let to_remove = ["app"];
15817 params.remove_params(&to_remove);
15818 }
15819
15820 let url = params.parse_with_url(&url);
15821
15822 let mut json_mime_type = mime::APPLICATION_JSON;
15823 let mut request_value_reader = {
15824 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15825 common::remove_json_null_values(&mut value);
15826 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15827 serde_json::to_writer(&mut dst, &value).unwrap();
15828 dst
15829 };
15830 let request_size = request_value_reader
15831 .seek(std::io::SeekFrom::End(0))
15832 .unwrap();
15833 request_value_reader
15834 .seek(std::io::SeekFrom::Start(0))
15835 .unwrap();
15836
15837 loop {
15838 let token = match self
15839 .hub
15840 .auth
15841 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15842 .await
15843 {
15844 Ok(token) => token,
15845 Err(e) => match dlg.token(e) {
15846 Ok(token) => token,
15847 Err(e) => {
15848 dlg.finished(false);
15849 return Err(common::Error::MissingToken(e));
15850 }
15851 },
15852 };
15853 request_value_reader
15854 .seek(std::io::SeekFrom::Start(0))
15855 .unwrap();
15856 let mut req_result = {
15857 let client = &self.hub.client;
15858 dlg.pre_request();
15859 let mut req_builder = hyper::Request::builder()
15860 .method(hyper::Method::POST)
15861 .uri(url.as_str())
15862 .header(USER_AGENT, self.hub._user_agent.clone());
15863
15864 if let Some(token) = token.as_ref() {
15865 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15866 }
15867
15868 let request = req_builder
15869 .header(CONTENT_TYPE, json_mime_type.to_string())
15870 .header(CONTENT_LENGTH, request_size as u64)
15871 .body(common::to_body(
15872 request_value_reader.get_ref().clone().into(),
15873 ));
15874
15875 client.request(request.unwrap()).await
15876 };
15877
15878 match req_result {
15879 Err(err) => {
15880 if let common::Retry::After(d) = dlg.http_error(&err) {
15881 sleep(d).await;
15882 continue;
15883 }
15884 dlg.finished(false);
15885 return Err(common::Error::HttpError(err));
15886 }
15887 Ok(res) => {
15888 let (mut parts, body) = res.into_parts();
15889 let mut body = common::Body::new(body);
15890 if !parts.status.is_success() {
15891 let bytes = common::to_bytes(body).await.unwrap_or_default();
15892 let error = serde_json::from_str(&common::to_string(&bytes));
15893 let response = common::to_response(parts, bytes.into());
15894
15895 if let common::Retry::After(d) =
15896 dlg.http_failure(&response, error.as_ref().ok())
15897 {
15898 sleep(d).await;
15899 continue;
15900 }
15901
15902 dlg.finished(false);
15903
15904 return Err(match error {
15905 Ok(value) => common::Error::BadRequest(value),
15906 _ => common::Error::Failure(response),
15907 });
15908 }
15909 let response = {
15910 let bytes = common::to_bytes(body).await.unwrap_or_default();
15911 let encoded = common::to_string(&bytes);
15912 match serde_json::from_str(&encoded) {
15913 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15914 Err(error) => {
15915 dlg.response_json_decode_error(&encoded, &error);
15916 return Err(common::Error::JsonDecodeError(
15917 encoded.to_string(),
15918 error,
15919 ));
15920 }
15921 }
15922 };
15923
15924 dlg.finished(true);
15925 return Ok(response);
15926 }
15927 }
15928 }
15929 }
15930
15931 ///
15932 /// Sets the *request* property to the given value.
15933 ///
15934 /// Even though the property as already been set when instantiating this call,
15935 /// we provide this method for API completeness.
15936 pub fn request(
15937 mut self,
15938 new_value: GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest,
15939 ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
15940 self._request = new_value;
15941 self
15942 }
15943 /// 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.
15944 ///
15945 /// Sets the *app* path property to the given value.
15946 ///
15947 /// Even though the property as already been set when instantiating this call,
15948 /// we provide this method for API completeness.
15949 pub fn app(mut self, new_value: &str) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
15950 self._app = new_value.to_string();
15951 self
15952 }
15953 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15954 /// while executing the actual API request.
15955 ///
15956 /// ````text
15957 /// It should be used to handle progress information, and to implement a certain level of resilience.
15958 /// ````
15959 ///
15960 /// Sets the *delegate* property to the given value.
15961 pub fn delegate(
15962 mut self,
15963 new_value: &'a mut dyn common::Delegate,
15964 ) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
15965 self._delegate = Some(new_value);
15966 self
15967 }
15968
15969 /// Set any additional parameter of the query string used in the request.
15970 /// It should be used to set parameters which are not yet available through their own
15971 /// setters.
15972 ///
15973 /// Please note that this method must not be used to set any of the known parameters
15974 /// which have their own setter method. If done anyway, the request will fail.
15975 ///
15976 /// # Additional Parameters
15977 ///
15978 /// * *$.xgafv* (query-string) - V1 error format.
15979 /// * *access_token* (query-string) - OAuth access token.
15980 /// * *alt* (query-string) - Data format for response.
15981 /// * *callback* (query-string) - JSONP
15982 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15983 /// * *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.
15984 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15985 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15986 /// * *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.
15987 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15988 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15989 pub fn param<T>(mut self, name: T, value: T) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
15990 where
15991 T: AsRef<str>,
15992 {
15993 self._additional_params
15994 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15995 self
15996 }
15997
15998 /// Identifies the authorization scope for the method you are building.
15999 ///
16000 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16001 /// [`Scope::CloudPlatform`].
16002 ///
16003 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16004 /// tokens for more than one scope.
16005 ///
16006 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16007 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16008 /// sufficient, a read-write scope will do as well.
16009 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16010 where
16011 St: AsRef<str>,
16012 {
16013 self._scopes.insert(String::from(scope.as_ref()));
16014 self
16015 }
16016 /// Identifies the authorization scope(s) for the method you are building.
16017 ///
16018 /// See [`Self::add_scope()`] for details.
16019 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAppGenerateAppAttestChallengeCall<'a, C>
16020 where
16021 I: IntoIterator<Item = St>,
16022 St: AsRef<str>,
16023 {
16024 self._scopes
16025 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16026 self
16027 }
16028
16029 /// Removes all scopes, and no default scope will be used either.
16030 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16031 /// for details).
16032 pub fn clear_scopes(mut self) -> ProjectAppGenerateAppAttestChallengeCall<'a, C> {
16033 self._scopes.clear();
16034 self
16035 }
16036}
16037
16038/// 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.
16039///
16040/// A builder for the *apps.generatePlayIntegrityChallenge* method supported by a *project* resource.
16041/// It is not used directly, but through a [`ProjectMethods`] instance.
16042///
16043/// # Example
16044///
16045/// Instantiate a resource method builder
16046///
16047/// ```test_harness,no_run
16048/// # extern crate hyper;
16049/// # extern crate hyper_rustls;
16050/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16051/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest;
16052/// # async fn dox() {
16053/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16054///
16055/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16056/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16057/// # secret,
16058/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16059/// # ).build().await.unwrap();
16060///
16061/// # let client = hyper_util::client::legacy::Client::builder(
16062/// # hyper_util::rt::TokioExecutor::new()
16063/// # )
16064/// # .build(
16065/// # hyper_rustls::HttpsConnectorBuilder::new()
16066/// # .with_native_roots()
16067/// # .unwrap()
16068/// # .https_or_http()
16069/// # .enable_http1()
16070/// # .build()
16071/// # );
16072/// # let mut hub = Firebaseappcheck::new(client, auth);
16073/// // As the method needs a request, you would usually fill it with the desired information
16074/// // into the respective structure. Some of the parts shown here might not be applicable !
16075/// // Values shown here are possibly random and not representative !
16076/// let mut req = GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest::default();
16077///
16078/// // You can configure optional parameters by calling the respective setters at will, and
16079/// // execute the final call using `doit()`.
16080/// // Values shown here are possibly random and not representative !
16081/// let result = hub.projects().apps_generate_play_integrity_challenge(req, "app")
16082/// .doit().await;
16083/// # }
16084/// ```
16085pub struct ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16086where
16087 C: 'a,
16088{
16089 hub: &'a Firebaseappcheck<C>,
16090 _request: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
16091 _app: String,
16092 _delegate: Option<&'a mut dyn common::Delegate>,
16093 _additional_params: HashMap<String, String>,
16094 _scopes: BTreeSet<String>,
16095}
16096
16097impl<'a, C> common::CallBuilder for ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {}
16098
16099impl<'a, C> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16100where
16101 C: common::Connector,
16102{
16103 /// Perform the operation you have build so far.
16104 pub async fn doit(
16105 mut self,
16106 ) -> common::Result<(
16107 common::Response,
16108 GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeResponse,
16109 )> {
16110 use std::borrow::Cow;
16111 use std::io::{Read, Seek};
16112
16113 use common::{url::Params, ToParts};
16114 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16115
16116 let mut dd = common::DefaultDelegate;
16117 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16118 dlg.begin(common::MethodInfo {
16119 id: "firebaseappcheck.projects.apps.generatePlayIntegrityChallenge",
16120 http_method: hyper::Method::POST,
16121 });
16122
16123 for &field in ["alt", "app"].iter() {
16124 if self._additional_params.contains_key(field) {
16125 dlg.finished(false);
16126 return Err(common::Error::FieldClash(field));
16127 }
16128 }
16129
16130 let mut params = Params::with_capacity(4 + self._additional_params.len());
16131 params.push("app", self._app);
16132
16133 params.extend(self._additional_params.iter());
16134
16135 params.push("alt", "json");
16136 let mut url = self.hub._base_url.clone() + "v1beta/{+app}:generatePlayIntegrityChallenge";
16137 if self._scopes.is_empty() {
16138 self._scopes
16139 .insert(Scope::CloudPlatform.as_ref().to_string());
16140 }
16141
16142 #[allow(clippy::single_element_loop)]
16143 for &(find_this, param_name) in [("{+app}", "app")].iter() {
16144 url = params.uri_replacement(url, param_name, find_this, true);
16145 }
16146 {
16147 let to_remove = ["app"];
16148 params.remove_params(&to_remove);
16149 }
16150
16151 let url = params.parse_with_url(&url);
16152
16153 let mut json_mime_type = mime::APPLICATION_JSON;
16154 let mut request_value_reader = {
16155 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16156 common::remove_json_null_values(&mut value);
16157 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16158 serde_json::to_writer(&mut dst, &value).unwrap();
16159 dst
16160 };
16161 let request_size = request_value_reader
16162 .seek(std::io::SeekFrom::End(0))
16163 .unwrap();
16164 request_value_reader
16165 .seek(std::io::SeekFrom::Start(0))
16166 .unwrap();
16167
16168 loop {
16169 let token = match self
16170 .hub
16171 .auth
16172 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16173 .await
16174 {
16175 Ok(token) => token,
16176 Err(e) => match dlg.token(e) {
16177 Ok(token) => token,
16178 Err(e) => {
16179 dlg.finished(false);
16180 return Err(common::Error::MissingToken(e));
16181 }
16182 },
16183 };
16184 request_value_reader
16185 .seek(std::io::SeekFrom::Start(0))
16186 .unwrap();
16187 let mut req_result = {
16188 let client = &self.hub.client;
16189 dlg.pre_request();
16190 let mut req_builder = hyper::Request::builder()
16191 .method(hyper::Method::POST)
16192 .uri(url.as_str())
16193 .header(USER_AGENT, self.hub._user_agent.clone());
16194
16195 if let Some(token) = token.as_ref() {
16196 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16197 }
16198
16199 let request = req_builder
16200 .header(CONTENT_TYPE, json_mime_type.to_string())
16201 .header(CONTENT_LENGTH, request_size as u64)
16202 .body(common::to_body(
16203 request_value_reader.get_ref().clone().into(),
16204 ));
16205
16206 client.request(request.unwrap()).await
16207 };
16208
16209 match req_result {
16210 Err(err) => {
16211 if let common::Retry::After(d) = dlg.http_error(&err) {
16212 sleep(d).await;
16213 continue;
16214 }
16215 dlg.finished(false);
16216 return Err(common::Error::HttpError(err));
16217 }
16218 Ok(res) => {
16219 let (mut parts, body) = res.into_parts();
16220 let mut body = common::Body::new(body);
16221 if !parts.status.is_success() {
16222 let bytes = common::to_bytes(body).await.unwrap_or_default();
16223 let error = serde_json::from_str(&common::to_string(&bytes));
16224 let response = common::to_response(parts, bytes.into());
16225
16226 if let common::Retry::After(d) =
16227 dlg.http_failure(&response, error.as_ref().ok())
16228 {
16229 sleep(d).await;
16230 continue;
16231 }
16232
16233 dlg.finished(false);
16234
16235 return Err(match error {
16236 Ok(value) => common::Error::BadRequest(value),
16237 _ => common::Error::Failure(response),
16238 });
16239 }
16240 let response = {
16241 let bytes = common::to_bytes(body).await.unwrap_or_default();
16242 let encoded = common::to_string(&bytes);
16243 match serde_json::from_str(&encoded) {
16244 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16245 Err(error) => {
16246 dlg.response_json_decode_error(&encoded, &error);
16247 return Err(common::Error::JsonDecodeError(
16248 encoded.to_string(),
16249 error,
16250 ));
16251 }
16252 }
16253 };
16254
16255 dlg.finished(true);
16256 return Ok(response);
16257 }
16258 }
16259 }
16260 }
16261
16262 ///
16263 /// Sets the *request* property to the given value.
16264 ///
16265 /// Even though the property as already been set when instantiating this call,
16266 /// we provide this method for API completeness.
16267 pub fn request(
16268 mut self,
16269 new_value: GoogleFirebaseAppcheckV1betaGeneratePlayIntegrityChallengeRequest,
16270 ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16271 self._request = new_value;
16272 self
16273 }
16274 /// 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.
16275 ///
16276 /// Sets the *app* path property to the given value.
16277 ///
16278 /// Even though the property as already been set when instantiating this call,
16279 /// we provide this method for API completeness.
16280 pub fn app(mut self, new_value: &str) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16281 self._app = new_value.to_string();
16282 self
16283 }
16284 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16285 /// while executing the actual API request.
16286 ///
16287 /// ````text
16288 /// It should be used to handle progress information, and to implement a certain level of resilience.
16289 /// ````
16290 ///
16291 /// Sets the *delegate* property to the given value.
16292 pub fn delegate(
16293 mut self,
16294 new_value: &'a mut dyn common::Delegate,
16295 ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16296 self._delegate = Some(new_value);
16297 self
16298 }
16299
16300 /// Set any additional parameter of the query string used in the request.
16301 /// It should be used to set parameters which are not yet available through their own
16302 /// setters.
16303 ///
16304 /// Please note that this method must not be used to set any of the known parameters
16305 /// which have their own setter method. If done anyway, the request will fail.
16306 ///
16307 /// # Additional Parameters
16308 ///
16309 /// * *$.xgafv* (query-string) - V1 error format.
16310 /// * *access_token* (query-string) - OAuth access token.
16311 /// * *alt* (query-string) - Data format for response.
16312 /// * *callback* (query-string) - JSONP
16313 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16314 /// * *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.
16315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16316 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16317 /// * *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.
16318 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16319 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16320 pub fn param<T>(
16321 mut self,
16322 name: T,
16323 value: T,
16324 ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16325 where
16326 T: AsRef<str>,
16327 {
16328 self._additional_params
16329 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16330 self
16331 }
16332
16333 /// Identifies the authorization scope for the method you are building.
16334 ///
16335 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16336 /// [`Scope::CloudPlatform`].
16337 ///
16338 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16339 /// tokens for more than one scope.
16340 ///
16341 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16342 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16343 /// sufficient, a read-write scope will do as well.
16344 pub fn add_scope<St>(mut self, scope: St) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16345 where
16346 St: AsRef<str>,
16347 {
16348 self._scopes.insert(String::from(scope.as_ref()));
16349 self
16350 }
16351 /// Identifies the authorization scope(s) for the method you are building.
16352 ///
16353 /// See [`Self::add_scope()`] for details.
16354 pub fn add_scopes<I, St>(
16355 mut self,
16356 scopes: I,
16357 ) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C>
16358 where
16359 I: IntoIterator<Item = St>,
16360 St: AsRef<str>,
16361 {
16362 self._scopes
16363 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16364 self
16365 }
16366
16367 /// Removes all scopes, and no default scope will be used either.
16368 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16369 /// for details).
16370 pub fn clear_scopes(mut self) -> ProjectAppGeneratePlayIntegrityChallengeCall<'a, C> {
16371 self._scopes.clear();
16372 self
16373 }
16374}
16375
16376/// Atomically updates the specified ResourcePolicy configurations.
16377///
16378/// A builder for the *services.resourcePolicies.batchUpdate* method supported by a *project* resource.
16379/// It is not used directly, but through a [`ProjectMethods`] instance.
16380///
16381/// # Example
16382///
16383/// Instantiate a resource method builder
16384///
16385/// ```test_harness,no_run
16386/// # extern crate hyper;
16387/// # extern crate hyper_rustls;
16388/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16389/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest;
16390/// # async fn dox() {
16391/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16392///
16393/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16395/// # secret,
16396/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16397/// # ).build().await.unwrap();
16398///
16399/// # let client = hyper_util::client::legacy::Client::builder(
16400/// # hyper_util::rt::TokioExecutor::new()
16401/// # )
16402/// # .build(
16403/// # hyper_rustls::HttpsConnectorBuilder::new()
16404/// # .with_native_roots()
16405/// # .unwrap()
16406/// # .https_or_http()
16407/// # .enable_http1()
16408/// # .build()
16409/// # );
16410/// # let mut hub = Firebaseappcheck::new(client, auth);
16411/// // As the method needs a request, you would usually fill it with the desired information
16412/// // into the respective structure. Some of the parts shown here might not be applicable !
16413/// // Values shown here are possibly random and not representative !
16414/// let mut req = GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest::default();
16415///
16416/// // You can configure optional parameters by calling the respective setters at will, and
16417/// // execute the final call using `doit()`.
16418/// // Values shown here are possibly random and not representative !
16419/// let result = hub.projects().services_resource_policies_batch_update(req, "parent")
16420/// .doit().await;
16421/// # }
16422/// ```
16423pub struct ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
16424where
16425 C: 'a,
16426{
16427 hub: &'a Firebaseappcheck<C>,
16428 _request: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
16429 _parent: String,
16430 _delegate: Option<&'a mut dyn common::Delegate>,
16431 _additional_params: HashMap<String, String>,
16432 _scopes: BTreeSet<String>,
16433}
16434
16435impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {}
16436
16437impl<'a, C> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
16438where
16439 C: common::Connector,
16440{
16441 /// Perform the operation you have build so far.
16442 pub async fn doit(
16443 mut self,
16444 ) -> common::Result<(
16445 common::Response,
16446 GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesResponse,
16447 )> {
16448 use std::borrow::Cow;
16449 use std::io::{Read, Seek};
16450
16451 use common::{url::Params, ToParts};
16452 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16453
16454 let mut dd = common::DefaultDelegate;
16455 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16456 dlg.begin(common::MethodInfo {
16457 id: "firebaseappcheck.projects.services.resourcePolicies.batchUpdate",
16458 http_method: hyper::Method::POST,
16459 });
16460
16461 for &field in ["alt", "parent"].iter() {
16462 if self._additional_params.contains_key(field) {
16463 dlg.finished(false);
16464 return Err(common::Error::FieldClash(field));
16465 }
16466 }
16467
16468 let mut params = Params::with_capacity(4 + self._additional_params.len());
16469 params.push("parent", self._parent);
16470
16471 params.extend(self._additional_params.iter());
16472
16473 params.push("alt", "json");
16474 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies:batchUpdate";
16475 if self._scopes.is_empty() {
16476 self._scopes
16477 .insert(Scope::CloudPlatform.as_ref().to_string());
16478 }
16479
16480 #[allow(clippy::single_element_loop)]
16481 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16482 url = params.uri_replacement(url, param_name, find_this, true);
16483 }
16484 {
16485 let to_remove = ["parent"];
16486 params.remove_params(&to_remove);
16487 }
16488
16489 let url = params.parse_with_url(&url);
16490
16491 let mut json_mime_type = mime::APPLICATION_JSON;
16492 let mut request_value_reader = {
16493 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16494 common::remove_json_null_values(&mut value);
16495 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16496 serde_json::to_writer(&mut dst, &value).unwrap();
16497 dst
16498 };
16499 let request_size = request_value_reader
16500 .seek(std::io::SeekFrom::End(0))
16501 .unwrap();
16502 request_value_reader
16503 .seek(std::io::SeekFrom::Start(0))
16504 .unwrap();
16505
16506 loop {
16507 let token = match self
16508 .hub
16509 .auth
16510 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16511 .await
16512 {
16513 Ok(token) => token,
16514 Err(e) => match dlg.token(e) {
16515 Ok(token) => token,
16516 Err(e) => {
16517 dlg.finished(false);
16518 return Err(common::Error::MissingToken(e));
16519 }
16520 },
16521 };
16522 request_value_reader
16523 .seek(std::io::SeekFrom::Start(0))
16524 .unwrap();
16525 let mut req_result = {
16526 let client = &self.hub.client;
16527 dlg.pre_request();
16528 let mut req_builder = hyper::Request::builder()
16529 .method(hyper::Method::POST)
16530 .uri(url.as_str())
16531 .header(USER_AGENT, self.hub._user_agent.clone());
16532
16533 if let Some(token) = token.as_ref() {
16534 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16535 }
16536
16537 let request = req_builder
16538 .header(CONTENT_TYPE, json_mime_type.to_string())
16539 .header(CONTENT_LENGTH, request_size as u64)
16540 .body(common::to_body(
16541 request_value_reader.get_ref().clone().into(),
16542 ));
16543
16544 client.request(request.unwrap()).await
16545 };
16546
16547 match req_result {
16548 Err(err) => {
16549 if let common::Retry::After(d) = dlg.http_error(&err) {
16550 sleep(d).await;
16551 continue;
16552 }
16553 dlg.finished(false);
16554 return Err(common::Error::HttpError(err));
16555 }
16556 Ok(res) => {
16557 let (mut parts, body) = res.into_parts();
16558 let mut body = common::Body::new(body);
16559 if !parts.status.is_success() {
16560 let bytes = common::to_bytes(body).await.unwrap_or_default();
16561 let error = serde_json::from_str(&common::to_string(&bytes));
16562 let response = common::to_response(parts, bytes.into());
16563
16564 if let common::Retry::After(d) =
16565 dlg.http_failure(&response, error.as_ref().ok())
16566 {
16567 sleep(d).await;
16568 continue;
16569 }
16570
16571 dlg.finished(false);
16572
16573 return Err(match error {
16574 Ok(value) => common::Error::BadRequest(value),
16575 _ => common::Error::Failure(response),
16576 });
16577 }
16578 let response = {
16579 let bytes = common::to_bytes(body).await.unwrap_or_default();
16580 let encoded = common::to_string(&bytes);
16581 match serde_json::from_str(&encoded) {
16582 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16583 Err(error) => {
16584 dlg.response_json_decode_error(&encoded, &error);
16585 return Err(common::Error::JsonDecodeError(
16586 encoded.to_string(),
16587 error,
16588 ));
16589 }
16590 }
16591 };
16592
16593 dlg.finished(true);
16594 return Ok(response);
16595 }
16596 }
16597 }
16598 }
16599
16600 ///
16601 /// Sets the *request* property to the given value.
16602 ///
16603 /// Even though the property as already been set when instantiating this call,
16604 /// we provide this method for API completeness.
16605 pub fn request(
16606 mut self,
16607 new_value: GoogleFirebaseAppcheckV1betaBatchUpdateResourcePoliciesRequest,
16608 ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
16609 self._request = new_value;
16610 self
16611 }
16612 /// 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.
16613 ///
16614 /// Sets the *parent* path property to the given value.
16615 ///
16616 /// Even though the property as already been set when instantiating this call,
16617 /// we provide this method for API completeness.
16618 pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
16619 self._parent = new_value.to_string();
16620 self
16621 }
16622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16623 /// while executing the actual API request.
16624 ///
16625 /// ````text
16626 /// It should be used to handle progress information, and to implement a certain level of resilience.
16627 /// ````
16628 ///
16629 /// Sets the *delegate* property to the given value.
16630 pub fn delegate(
16631 mut self,
16632 new_value: &'a mut dyn common::Delegate,
16633 ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
16634 self._delegate = Some(new_value);
16635 self
16636 }
16637
16638 /// Set any additional parameter of the query string used in the request.
16639 /// It should be used to set parameters which are not yet available through their own
16640 /// setters.
16641 ///
16642 /// Please note that this method must not be used to set any of the known parameters
16643 /// which have their own setter method. If done anyway, the request will fail.
16644 ///
16645 /// # Additional Parameters
16646 ///
16647 /// * *$.xgafv* (query-string) - V1 error format.
16648 /// * *access_token* (query-string) - OAuth access token.
16649 /// * *alt* (query-string) - Data format for response.
16650 /// * *callback* (query-string) - JSONP
16651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16652 /// * *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.
16653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16655 /// * *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.
16656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16658 pub fn param<T>(
16659 mut self,
16660 name: T,
16661 value: T,
16662 ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
16663 where
16664 T: AsRef<str>,
16665 {
16666 self._additional_params
16667 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16668 self
16669 }
16670
16671 /// Identifies the authorization scope for the method you are building.
16672 ///
16673 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16674 /// [`Scope::CloudPlatform`].
16675 ///
16676 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16677 /// tokens for more than one scope.
16678 ///
16679 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16680 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16681 /// sufficient, a read-write scope will do as well.
16682 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
16683 where
16684 St: AsRef<str>,
16685 {
16686 self._scopes.insert(String::from(scope.as_ref()));
16687 self
16688 }
16689 /// Identifies the authorization scope(s) for the method you are building.
16690 ///
16691 /// See [`Self::add_scope()`] for details.
16692 pub fn add_scopes<I, St>(
16693 mut self,
16694 scopes: I,
16695 ) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C>
16696 where
16697 I: IntoIterator<Item = St>,
16698 St: AsRef<str>,
16699 {
16700 self._scopes
16701 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16702 self
16703 }
16704
16705 /// Removes all scopes, and no default scope will be used either.
16706 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16707 /// for details).
16708 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyBatchUpdateCall<'a, C> {
16709 self._scopes.clear();
16710 self
16711 }
16712}
16713
16714/// Creates the specified ResourcePolicy configuration.
16715///
16716/// A builder for the *services.resourcePolicies.create* method supported by a *project* resource.
16717/// It is not used directly, but through a [`ProjectMethods`] instance.
16718///
16719/// # Example
16720///
16721/// Instantiate a resource method builder
16722///
16723/// ```test_harness,no_run
16724/// # extern crate hyper;
16725/// # extern crate hyper_rustls;
16726/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
16727/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaResourcePolicy;
16728/// # async fn dox() {
16729/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16730///
16731/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16732/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16733/// # secret,
16734/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16735/// # ).build().await.unwrap();
16736///
16737/// # let client = hyper_util::client::legacy::Client::builder(
16738/// # hyper_util::rt::TokioExecutor::new()
16739/// # )
16740/// # .build(
16741/// # hyper_rustls::HttpsConnectorBuilder::new()
16742/// # .with_native_roots()
16743/// # .unwrap()
16744/// # .https_or_http()
16745/// # .enable_http1()
16746/// # .build()
16747/// # );
16748/// # let mut hub = Firebaseappcheck::new(client, auth);
16749/// // As the method needs a request, you would usually fill it with the desired information
16750/// // into the respective structure. Some of the parts shown here might not be applicable !
16751/// // Values shown here are possibly random and not representative !
16752/// let mut req = GoogleFirebaseAppcheckV1betaResourcePolicy::default();
16753///
16754/// // You can configure optional parameters by calling the respective setters at will, and
16755/// // execute the final call using `doit()`.
16756/// // Values shown here are possibly random and not representative !
16757/// let result = hub.projects().services_resource_policies_create(req, "parent")
16758/// .doit().await;
16759/// # }
16760/// ```
16761pub struct ProjectServiceResourcePolicyCreateCall<'a, C>
16762where
16763 C: 'a,
16764{
16765 hub: &'a Firebaseappcheck<C>,
16766 _request: GoogleFirebaseAppcheckV1betaResourcePolicy,
16767 _parent: String,
16768 _delegate: Option<&'a mut dyn common::Delegate>,
16769 _additional_params: HashMap<String, String>,
16770 _scopes: BTreeSet<String>,
16771}
16772
16773impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyCreateCall<'a, C> {}
16774
16775impl<'a, C> ProjectServiceResourcePolicyCreateCall<'a, C>
16776where
16777 C: common::Connector,
16778{
16779 /// Perform the operation you have build so far.
16780 pub async fn doit(
16781 mut self,
16782 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
16783 use std::borrow::Cow;
16784 use std::io::{Read, Seek};
16785
16786 use common::{url::Params, ToParts};
16787 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16788
16789 let mut dd = common::DefaultDelegate;
16790 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16791 dlg.begin(common::MethodInfo {
16792 id: "firebaseappcheck.projects.services.resourcePolicies.create",
16793 http_method: hyper::Method::POST,
16794 });
16795
16796 for &field in ["alt", "parent"].iter() {
16797 if self._additional_params.contains_key(field) {
16798 dlg.finished(false);
16799 return Err(common::Error::FieldClash(field));
16800 }
16801 }
16802
16803 let mut params = Params::with_capacity(4 + self._additional_params.len());
16804 params.push("parent", self._parent);
16805
16806 params.extend(self._additional_params.iter());
16807
16808 params.push("alt", "json");
16809 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies";
16810 if self._scopes.is_empty() {
16811 self._scopes
16812 .insert(Scope::CloudPlatform.as_ref().to_string());
16813 }
16814
16815 #[allow(clippy::single_element_loop)]
16816 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16817 url = params.uri_replacement(url, param_name, find_this, true);
16818 }
16819 {
16820 let to_remove = ["parent"];
16821 params.remove_params(&to_remove);
16822 }
16823
16824 let url = params.parse_with_url(&url);
16825
16826 let mut json_mime_type = mime::APPLICATION_JSON;
16827 let mut request_value_reader = {
16828 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16829 common::remove_json_null_values(&mut value);
16830 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16831 serde_json::to_writer(&mut dst, &value).unwrap();
16832 dst
16833 };
16834 let request_size = request_value_reader
16835 .seek(std::io::SeekFrom::End(0))
16836 .unwrap();
16837 request_value_reader
16838 .seek(std::io::SeekFrom::Start(0))
16839 .unwrap();
16840
16841 loop {
16842 let token = match self
16843 .hub
16844 .auth
16845 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16846 .await
16847 {
16848 Ok(token) => token,
16849 Err(e) => match dlg.token(e) {
16850 Ok(token) => token,
16851 Err(e) => {
16852 dlg.finished(false);
16853 return Err(common::Error::MissingToken(e));
16854 }
16855 },
16856 };
16857 request_value_reader
16858 .seek(std::io::SeekFrom::Start(0))
16859 .unwrap();
16860 let mut req_result = {
16861 let client = &self.hub.client;
16862 dlg.pre_request();
16863 let mut req_builder = hyper::Request::builder()
16864 .method(hyper::Method::POST)
16865 .uri(url.as_str())
16866 .header(USER_AGENT, self.hub._user_agent.clone());
16867
16868 if let Some(token) = token.as_ref() {
16869 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16870 }
16871
16872 let request = req_builder
16873 .header(CONTENT_TYPE, json_mime_type.to_string())
16874 .header(CONTENT_LENGTH, request_size as u64)
16875 .body(common::to_body(
16876 request_value_reader.get_ref().clone().into(),
16877 ));
16878
16879 client.request(request.unwrap()).await
16880 };
16881
16882 match req_result {
16883 Err(err) => {
16884 if let common::Retry::After(d) = dlg.http_error(&err) {
16885 sleep(d).await;
16886 continue;
16887 }
16888 dlg.finished(false);
16889 return Err(common::Error::HttpError(err));
16890 }
16891 Ok(res) => {
16892 let (mut parts, body) = res.into_parts();
16893 let mut body = common::Body::new(body);
16894 if !parts.status.is_success() {
16895 let bytes = common::to_bytes(body).await.unwrap_or_default();
16896 let error = serde_json::from_str(&common::to_string(&bytes));
16897 let response = common::to_response(parts, bytes.into());
16898
16899 if let common::Retry::After(d) =
16900 dlg.http_failure(&response, error.as_ref().ok())
16901 {
16902 sleep(d).await;
16903 continue;
16904 }
16905
16906 dlg.finished(false);
16907
16908 return Err(match error {
16909 Ok(value) => common::Error::BadRequest(value),
16910 _ => common::Error::Failure(response),
16911 });
16912 }
16913 let response = {
16914 let bytes = common::to_bytes(body).await.unwrap_or_default();
16915 let encoded = common::to_string(&bytes);
16916 match serde_json::from_str(&encoded) {
16917 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16918 Err(error) => {
16919 dlg.response_json_decode_error(&encoded, &error);
16920 return Err(common::Error::JsonDecodeError(
16921 encoded.to_string(),
16922 error,
16923 ));
16924 }
16925 }
16926 };
16927
16928 dlg.finished(true);
16929 return Ok(response);
16930 }
16931 }
16932 }
16933 }
16934
16935 ///
16936 /// Sets the *request* property to the given value.
16937 ///
16938 /// Even though the property as already been set when instantiating this call,
16939 /// we provide this method for API completeness.
16940 pub fn request(
16941 mut self,
16942 new_value: GoogleFirebaseAppcheckV1betaResourcePolicy,
16943 ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
16944 self._request = new_value;
16945 self
16946 }
16947 /// 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)
16948 ///
16949 /// Sets the *parent* path property to the given value.
16950 ///
16951 /// Even though the property as already been set when instantiating this call,
16952 /// we provide this method for API completeness.
16953 pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
16954 self._parent = new_value.to_string();
16955 self
16956 }
16957 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16958 /// while executing the actual API request.
16959 ///
16960 /// ````text
16961 /// It should be used to handle progress information, and to implement a certain level of resilience.
16962 /// ````
16963 ///
16964 /// Sets the *delegate* property to the given value.
16965 pub fn delegate(
16966 mut self,
16967 new_value: &'a mut dyn common::Delegate,
16968 ) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
16969 self._delegate = Some(new_value);
16970 self
16971 }
16972
16973 /// Set any additional parameter of the query string used in the request.
16974 /// It should be used to set parameters which are not yet available through their own
16975 /// setters.
16976 ///
16977 /// Please note that this method must not be used to set any of the known parameters
16978 /// which have their own setter method. If done anyway, the request will fail.
16979 ///
16980 /// # Additional Parameters
16981 ///
16982 /// * *$.xgafv* (query-string) - V1 error format.
16983 /// * *access_token* (query-string) - OAuth access token.
16984 /// * *alt* (query-string) - Data format for response.
16985 /// * *callback* (query-string) - JSONP
16986 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16987 /// * *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.
16988 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16989 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16990 /// * *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.
16991 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16992 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16993 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyCreateCall<'a, C>
16994 where
16995 T: AsRef<str>,
16996 {
16997 self._additional_params
16998 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16999 self
17000 }
17001
17002 /// Identifies the authorization scope for the method you are building.
17003 ///
17004 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17005 /// [`Scope::CloudPlatform`].
17006 ///
17007 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17008 /// tokens for more than one scope.
17009 ///
17010 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17011 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17012 /// sufficient, a read-write scope will do as well.
17013 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyCreateCall<'a, C>
17014 where
17015 St: AsRef<str>,
17016 {
17017 self._scopes.insert(String::from(scope.as_ref()));
17018 self
17019 }
17020 /// Identifies the authorization scope(s) for the method you are building.
17021 ///
17022 /// See [`Self::add_scope()`] for details.
17023 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyCreateCall<'a, C>
17024 where
17025 I: IntoIterator<Item = St>,
17026 St: AsRef<str>,
17027 {
17028 self._scopes
17029 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17030 self
17031 }
17032
17033 /// Removes all scopes, and no default scope will be used either.
17034 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17035 /// for details).
17036 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyCreateCall<'a, C> {
17037 self._scopes.clear();
17038 self
17039 }
17040}
17041
17042/// Deletes the specified ResourcePolicy configuration.
17043///
17044/// A builder for the *services.resourcePolicies.delete* method supported by a *project* resource.
17045/// It is not used directly, but through a [`ProjectMethods`] instance.
17046///
17047/// # Example
17048///
17049/// Instantiate a resource method builder
17050///
17051/// ```test_harness,no_run
17052/// # extern crate hyper;
17053/// # extern crate hyper_rustls;
17054/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17055/// # async fn dox() {
17056/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17057///
17058/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17059/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17060/// # secret,
17061/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17062/// # ).build().await.unwrap();
17063///
17064/// # let client = hyper_util::client::legacy::Client::builder(
17065/// # hyper_util::rt::TokioExecutor::new()
17066/// # )
17067/// # .build(
17068/// # hyper_rustls::HttpsConnectorBuilder::new()
17069/// # .with_native_roots()
17070/// # .unwrap()
17071/// # .https_or_http()
17072/// # .enable_http1()
17073/// # .build()
17074/// # );
17075/// # let mut hub = Firebaseappcheck::new(client, auth);
17076/// // You can configure optional parameters by calling the respective setters at will, and
17077/// // execute the final call using `doit()`.
17078/// // Values shown here are possibly random and not representative !
17079/// let result = hub.projects().services_resource_policies_delete("name")
17080/// .etag("dolor")
17081/// .doit().await;
17082/// # }
17083/// ```
17084pub struct ProjectServiceResourcePolicyDeleteCall<'a, C>
17085where
17086 C: 'a,
17087{
17088 hub: &'a Firebaseappcheck<C>,
17089 _name: String,
17090 _etag: Option<String>,
17091 _delegate: Option<&'a mut dyn common::Delegate>,
17092 _additional_params: HashMap<String, String>,
17093 _scopes: BTreeSet<String>,
17094}
17095
17096impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyDeleteCall<'a, C> {}
17097
17098impl<'a, C> ProjectServiceResourcePolicyDeleteCall<'a, C>
17099where
17100 C: common::Connector,
17101{
17102 /// Perform the operation you have build so far.
17103 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
17104 use std::borrow::Cow;
17105 use std::io::{Read, Seek};
17106
17107 use common::{url::Params, ToParts};
17108 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17109
17110 let mut dd = common::DefaultDelegate;
17111 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17112 dlg.begin(common::MethodInfo {
17113 id: "firebaseappcheck.projects.services.resourcePolicies.delete",
17114 http_method: hyper::Method::DELETE,
17115 });
17116
17117 for &field in ["alt", "name", "etag"].iter() {
17118 if self._additional_params.contains_key(field) {
17119 dlg.finished(false);
17120 return Err(common::Error::FieldClash(field));
17121 }
17122 }
17123
17124 let mut params = Params::with_capacity(4 + self._additional_params.len());
17125 params.push("name", self._name);
17126 if let Some(value) = self._etag.as_ref() {
17127 params.push("etag", value);
17128 }
17129
17130 params.extend(self._additional_params.iter());
17131
17132 params.push("alt", "json");
17133 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
17134 if self._scopes.is_empty() {
17135 self._scopes
17136 .insert(Scope::CloudPlatform.as_ref().to_string());
17137 }
17138
17139 #[allow(clippy::single_element_loop)]
17140 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17141 url = params.uri_replacement(url, param_name, find_this, true);
17142 }
17143 {
17144 let to_remove = ["name"];
17145 params.remove_params(&to_remove);
17146 }
17147
17148 let url = params.parse_with_url(&url);
17149
17150 loop {
17151 let token = match self
17152 .hub
17153 .auth
17154 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17155 .await
17156 {
17157 Ok(token) => token,
17158 Err(e) => match dlg.token(e) {
17159 Ok(token) => token,
17160 Err(e) => {
17161 dlg.finished(false);
17162 return Err(common::Error::MissingToken(e));
17163 }
17164 },
17165 };
17166 let mut req_result = {
17167 let client = &self.hub.client;
17168 dlg.pre_request();
17169 let mut req_builder = hyper::Request::builder()
17170 .method(hyper::Method::DELETE)
17171 .uri(url.as_str())
17172 .header(USER_AGENT, self.hub._user_agent.clone());
17173
17174 if let Some(token) = token.as_ref() {
17175 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17176 }
17177
17178 let request = req_builder
17179 .header(CONTENT_LENGTH, 0_u64)
17180 .body(common::to_body::<String>(None));
17181
17182 client.request(request.unwrap()).await
17183 };
17184
17185 match req_result {
17186 Err(err) => {
17187 if let common::Retry::After(d) = dlg.http_error(&err) {
17188 sleep(d).await;
17189 continue;
17190 }
17191 dlg.finished(false);
17192 return Err(common::Error::HttpError(err));
17193 }
17194 Ok(res) => {
17195 let (mut parts, body) = res.into_parts();
17196 let mut body = common::Body::new(body);
17197 if !parts.status.is_success() {
17198 let bytes = common::to_bytes(body).await.unwrap_or_default();
17199 let error = serde_json::from_str(&common::to_string(&bytes));
17200 let response = common::to_response(parts, bytes.into());
17201
17202 if let common::Retry::After(d) =
17203 dlg.http_failure(&response, error.as_ref().ok())
17204 {
17205 sleep(d).await;
17206 continue;
17207 }
17208
17209 dlg.finished(false);
17210
17211 return Err(match error {
17212 Ok(value) => common::Error::BadRequest(value),
17213 _ => common::Error::Failure(response),
17214 });
17215 }
17216 let response = {
17217 let bytes = common::to_bytes(body).await.unwrap_or_default();
17218 let encoded = common::to_string(&bytes);
17219 match serde_json::from_str(&encoded) {
17220 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17221 Err(error) => {
17222 dlg.response_json_decode_error(&encoded, &error);
17223 return Err(common::Error::JsonDecodeError(
17224 encoded.to_string(),
17225 error,
17226 ));
17227 }
17228 }
17229 };
17230
17231 dlg.finished(true);
17232 return Ok(response);
17233 }
17234 }
17235 }
17236 }
17237
17238 /// Required. The relative resource name of the ResourcePolicy to delete, in the format: ``` projects/{project_number}/services/{service_id}/resourcePolicies/{resource_policy_id} ```
17239 ///
17240 /// Sets the *name* path property to the given value.
17241 ///
17242 /// Even though the property as already been set when instantiating this call,
17243 /// we provide this method for API completeness.
17244 pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17245 self._name = new_value.to_string();
17246 self
17247 }
17248 /// 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.
17249 ///
17250 /// Sets the *etag* query property to the given value.
17251 pub fn etag(mut self, new_value: &str) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17252 self._etag = Some(new_value.to_string());
17253 self
17254 }
17255 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17256 /// while executing the actual API request.
17257 ///
17258 /// ````text
17259 /// It should be used to handle progress information, and to implement a certain level of resilience.
17260 /// ````
17261 ///
17262 /// Sets the *delegate* property to the given value.
17263 pub fn delegate(
17264 mut self,
17265 new_value: &'a mut dyn common::Delegate,
17266 ) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17267 self._delegate = Some(new_value);
17268 self
17269 }
17270
17271 /// Set any additional parameter of the query string used in the request.
17272 /// It should be used to set parameters which are not yet available through their own
17273 /// setters.
17274 ///
17275 /// Please note that this method must not be used to set any of the known parameters
17276 /// which have their own setter method. If done anyway, the request will fail.
17277 ///
17278 /// # Additional Parameters
17279 ///
17280 /// * *$.xgafv* (query-string) - V1 error format.
17281 /// * *access_token* (query-string) - OAuth access token.
17282 /// * *alt* (query-string) - Data format for response.
17283 /// * *callback* (query-string) - JSONP
17284 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17285 /// * *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.
17286 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17287 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17288 /// * *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.
17289 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17290 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17291 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17292 where
17293 T: AsRef<str>,
17294 {
17295 self._additional_params
17296 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17297 self
17298 }
17299
17300 /// Identifies the authorization scope for the method you are building.
17301 ///
17302 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17303 /// [`Scope::CloudPlatform`].
17304 ///
17305 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17306 /// tokens for more than one scope.
17307 ///
17308 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17309 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17310 /// sufficient, a read-write scope will do as well.
17311 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17312 where
17313 St: AsRef<str>,
17314 {
17315 self._scopes.insert(String::from(scope.as_ref()));
17316 self
17317 }
17318 /// Identifies the authorization scope(s) for the method you are building.
17319 ///
17320 /// See [`Self::add_scope()`] for details.
17321 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyDeleteCall<'a, C>
17322 where
17323 I: IntoIterator<Item = St>,
17324 St: AsRef<str>,
17325 {
17326 self._scopes
17327 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17328 self
17329 }
17330
17331 /// Removes all scopes, and no default scope will be used either.
17332 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17333 /// for details).
17334 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyDeleteCall<'a, C> {
17335 self._scopes.clear();
17336 self
17337 }
17338}
17339
17340/// Gets the requested ResourcePolicy configuration.
17341///
17342/// A builder for the *services.resourcePolicies.get* method supported by a *project* resource.
17343/// It is not used directly, but through a [`ProjectMethods`] instance.
17344///
17345/// # Example
17346///
17347/// Instantiate a resource method builder
17348///
17349/// ```test_harness,no_run
17350/// # extern crate hyper;
17351/// # extern crate hyper_rustls;
17352/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17353/// # async fn dox() {
17354/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17355///
17356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17357/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17358/// # secret,
17359/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17360/// # ).build().await.unwrap();
17361///
17362/// # let client = hyper_util::client::legacy::Client::builder(
17363/// # hyper_util::rt::TokioExecutor::new()
17364/// # )
17365/// # .build(
17366/// # hyper_rustls::HttpsConnectorBuilder::new()
17367/// # .with_native_roots()
17368/// # .unwrap()
17369/// # .https_or_http()
17370/// # .enable_http1()
17371/// # .build()
17372/// # );
17373/// # let mut hub = Firebaseappcheck::new(client, auth);
17374/// // You can configure optional parameters by calling the respective setters at will, and
17375/// // execute the final call using `doit()`.
17376/// // Values shown here are possibly random and not representative !
17377/// let result = hub.projects().services_resource_policies_get("name")
17378/// .doit().await;
17379/// # }
17380/// ```
17381pub struct ProjectServiceResourcePolicyGetCall<'a, C>
17382where
17383 C: 'a,
17384{
17385 hub: &'a Firebaseappcheck<C>,
17386 _name: String,
17387 _delegate: Option<&'a mut dyn common::Delegate>,
17388 _additional_params: HashMap<String, String>,
17389 _scopes: BTreeSet<String>,
17390}
17391
17392impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyGetCall<'a, C> {}
17393
17394impl<'a, C> ProjectServiceResourcePolicyGetCall<'a, C>
17395where
17396 C: common::Connector,
17397{
17398 /// Perform the operation you have build so far.
17399 pub async fn doit(
17400 mut self,
17401 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
17402 use std::borrow::Cow;
17403 use std::io::{Read, Seek};
17404
17405 use common::{url::Params, ToParts};
17406 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17407
17408 let mut dd = common::DefaultDelegate;
17409 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17410 dlg.begin(common::MethodInfo {
17411 id: "firebaseappcheck.projects.services.resourcePolicies.get",
17412 http_method: hyper::Method::GET,
17413 });
17414
17415 for &field in ["alt", "name"].iter() {
17416 if self._additional_params.contains_key(field) {
17417 dlg.finished(false);
17418 return Err(common::Error::FieldClash(field));
17419 }
17420 }
17421
17422 let mut params = Params::with_capacity(3 + self._additional_params.len());
17423 params.push("name", self._name);
17424
17425 params.extend(self._additional_params.iter());
17426
17427 params.push("alt", "json");
17428 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
17429 if self._scopes.is_empty() {
17430 self._scopes
17431 .insert(Scope::CloudPlatform.as_ref().to_string());
17432 }
17433
17434 #[allow(clippy::single_element_loop)]
17435 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17436 url = params.uri_replacement(url, param_name, find_this, true);
17437 }
17438 {
17439 let to_remove = ["name"];
17440 params.remove_params(&to_remove);
17441 }
17442
17443 let url = params.parse_with_url(&url);
17444
17445 loop {
17446 let token = match self
17447 .hub
17448 .auth
17449 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17450 .await
17451 {
17452 Ok(token) => token,
17453 Err(e) => match dlg.token(e) {
17454 Ok(token) => token,
17455 Err(e) => {
17456 dlg.finished(false);
17457 return Err(common::Error::MissingToken(e));
17458 }
17459 },
17460 };
17461 let mut req_result = {
17462 let client = &self.hub.client;
17463 dlg.pre_request();
17464 let mut req_builder = hyper::Request::builder()
17465 .method(hyper::Method::GET)
17466 .uri(url.as_str())
17467 .header(USER_AGENT, self.hub._user_agent.clone());
17468
17469 if let Some(token) = token.as_ref() {
17470 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17471 }
17472
17473 let request = req_builder
17474 .header(CONTENT_LENGTH, 0_u64)
17475 .body(common::to_body::<String>(None));
17476
17477 client.request(request.unwrap()).await
17478 };
17479
17480 match req_result {
17481 Err(err) => {
17482 if let common::Retry::After(d) = dlg.http_error(&err) {
17483 sleep(d).await;
17484 continue;
17485 }
17486 dlg.finished(false);
17487 return Err(common::Error::HttpError(err));
17488 }
17489 Ok(res) => {
17490 let (mut parts, body) = res.into_parts();
17491 let mut body = common::Body::new(body);
17492 if !parts.status.is_success() {
17493 let bytes = common::to_bytes(body).await.unwrap_or_default();
17494 let error = serde_json::from_str(&common::to_string(&bytes));
17495 let response = common::to_response(parts, bytes.into());
17496
17497 if let common::Retry::After(d) =
17498 dlg.http_failure(&response, error.as_ref().ok())
17499 {
17500 sleep(d).await;
17501 continue;
17502 }
17503
17504 dlg.finished(false);
17505
17506 return Err(match error {
17507 Ok(value) => common::Error::BadRequest(value),
17508 _ => common::Error::Failure(response),
17509 });
17510 }
17511 let response = {
17512 let bytes = common::to_bytes(body).await.unwrap_or_default();
17513 let encoded = common::to_string(&bytes);
17514 match serde_json::from_str(&encoded) {
17515 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17516 Err(error) => {
17517 dlg.response_json_decode_error(&encoded, &error);
17518 return Err(common::Error::JsonDecodeError(
17519 encoded.to_string(),
17520 error,
17521 ));
17522 }
17523 }
17524 };
17525
17526 dlg.finished(true);
17527 return Ok(response);
17528 }
17529 }
17530 }
17531 }
17532
17533 /// 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)
17534 ///
17535 /// Sets the *name* path property to the given value.
17536 ///
17537 /// Even though the property as already been set when instantiating this call,
17538 /// we provide this method for API completeness.
17539 pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyGetCall<'a, C> {
17540 self._name = new_value.to_string();
17541 self
17542 }
17543 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17544 /// while executing the actual API request.
17545 ///
17546 /// ````text
17547 /// It should be used to handle progress information, and to implement a certain level of resilience.
17548 /// ````
17549 ///
17550 /// Sets the *delegate* property to the given value.
17551 pub fn delegate(
17552 mut self,
17553 new_value: &'a mut dyn common::Delegate,
17554 ) -> ProjectServiceResourcePolicyGetCall<'a, C> {
17555 self._delegate = Some(new_value);
17556 self
17557 }
17558
17559 /// Set any additional parameter of the query string used in the request.
17560 /// It should be used to set parameters which are not yet available through their own
17561 /// setters.
17562 ///
17563 /// Please note that this method must not be used to set any of the known parameters
17564 /// which have their own setter method. If done anyway, the request will fail.
17565 ///
17566 /// # Additional Parameters
17567 ///
17568 /// * *$.xgafv* (query-string) - V1 error format.
17569 /// * *access_token* (query-string) - OAuth access token.
17570 /// * *alt* (query-string) - Data format for response.
17571 /// * *callback* (query-string) - JSONP
17572 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17573 /// * *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.
17574 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17575 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17576 /// * *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.
17577 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17578 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17579 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyGetCall<'a, C>
17580 where
17581 T: AsRef<str>,
17582 {
17583 self._additional_params
17584 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17585 self
17586 }
17587
17588 /// Identifies the authorization scope for the method you are building.
17589 ///
17590 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17591 /// [`Scope::CloudPlatform`].
17592 ///
17593 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17594 /// tokens for more than one scope.
17595 ///
17596 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17597 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17598 /// sufficient, a read-write scope will do as well.
17599 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyGetCall<'a, C>
17600 where
17601 St: AsRef<str>,
17602 {
17603 self._scopes.insert(String::from(scope.as_ref()));
17604 self
17605 }
17606 /// Identifies the authorization scope(s) for the method you are building.
17607 ///
17608 /// See [`Self::add_scope()`] for details.
17609 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyGetCall<'a, C>
17610 where
17611 I: IntoIterator<Item = St>,
17612 St: AsRef<str>,
17613 {
17614 self._scopes
17615 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17616 self
17617 }
17618
17619 /// Removes all scopes, and no default scope will be used either.
17620 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17621 /// for details).
17622 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyGetCall<'a, C> {
17623 self._scopes.clear();
17624 self
17625 }
17626}
17627
17628/// Lists all ResourcePolicy configurations for the specified project and service.
17629///
17630/// A builder for the *services.resourcePolicies.list* method supported by a *project* resource.
17631/// It is not used directly, but through a [`ProjectMethods`] instance.
17632///
17633/// # Example
17634///
17635/// Instantiate a resource method builder
17636///
17637/// ```test_harness,no_run
17638/// # extern crate hyper;
17639/// # extern crate hyper_rustls;
17640/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17641/// # async fn dox() {
17642/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17643///
17644/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17645/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17646/// # secret,
17647/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17648/// # ).build().await.unwrap();
17649///
17650/// # let client = hyper_util::client::legacy::Client::builder(
17651/// # hyper_util::rt::TokioExecutor::new()
17652/// # )
17653/// # .build(
17654/// # hyper_rustls::HttpsConnectorBuilder::new()
17655/// # .with_native_roots()
17656/// # .unwrap()
17657/// # .https_or_http()
17658/// # .enable_http1()
17659/// # .build()
17660/// # );
17661/// # let mut hub = Firebaseappcheck::new(client, auth);
17662/// // You can configure optional parameters by calling the respective setters at will, and
17663/// // execute the final call using `doit()`.
17664/// // Values shown here are possibly random and not representative !
17665/// let result = hub.projects().services_resource_policies_list("parent")
17666/// .page_token("sadipscing")
17667/// .page_size(-15)
17668/// .filter("dolor")
17669/// .doit().await;
17670/// # }
17671/// ```
17672pub struct ProjectServiceResourcePolicyListCall<'a, C>
17673where
17674 C: 'a,
17675{
17676 hub: &'a Firebaseappcheck<C>,
17677 _parent: String,
17678 _page_token: Option<String>,
17679 _page_size: Option<i32>,
17680 _filter: Option<String>,
17681 _delegate: Option<&'a mut dyn common::Delegate>,
17682 _additional_params: HashMap<String, String>,
17683 _scopes: BTreeSet<String>,
17684}
17685
17686impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyListCall<'a, C> {}
17687
17688impl<'a, C> ProjectServiceResourcePolicyListCall<'a, C>
17689where
17690 C: common::Connector,
17691{
17692 /// Perform the operation you have build so far.
17693 pub async fn doit(
17694 mut self,
17695 ) -> common::Result<(
17696 common::Response,
17697 GoogleFirebaseAppcheckV1betaListResourcePoliciesResponse,
17698 )> {
17699 use std::borrow::Cow;
17700 use std::io::{Read, Seek};
17701
17702 use common::{url::Params, ToParts};
17703 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17704
17705 let mut dd = common::DefaultDelegate;
17706 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17707 dlg.begin(common::MethodInfo {
17708 id: "firebaseappcheck.projects.services.resourcePolicies.list",
17709 http_method: hyper::Method::GET,
17710 });
17711
17712 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
17713 if self._additional_params.contains_key(field) {
17714 dlg.finished(false);
17715 return Err(common::Error::FieldClash(field));
17716 }
17717 }
17718
17719 let mut params = Params::with_capacity(6 + self._additional_params.len());
17720 params.push("parent", self._parent);
17721 if let Some(value) = self._page_token.as_ref() {
17722 params.push("pageToken", value);
17723 }
17724 if let Some(value) = self._page_size.as_ref() {
17725 params.push("pageSize", value.to_string());
17726 }
17727 if let Some(value) = self._filter.as_ref() {
17728 params.push("filter", value);
17729 }
17730
17731 params.extend(self._additional_params.iter());
17732
17733 params.push("alt", "json");
17734 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/resourcePolicies";
17735 if self._scopes.is_empty() {
17736 self._scopes
17737 .insert(Scope::CloudPlatform.as_ref().to_string());
17738 }
17739
17740 #[allow(clippy::single_element_loop)]
17741 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17742 url = params.uri_replacement(url, param_name, find_this, true);
17743 }
17744 {
17745 let to_remove = ["parent"];
17746 params.remove_params(&to_remove);
17747 }
17748
17749 let url = params.parse_with_url(&url);
17750
17751 loop {
17752 let token = match self
17753 .hub
17754 .auth
17755 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17756 .await
17757 {
17758 Ok(token) => token,
17759 Err(e) => match dlg.token(e) {
17760 Ok(token) => token,
17761 Err(e) => {
17762 dlg.finished(false);
17763 return Err(common::Error::MissingToken(e));
17764 }
17765 },
17766 };
17767 let mut req_result = {
17768 let client = &self.hub.client;
17769 dlg.pre_request();
17770 let mut req_builder = hyper::Request::builder()
17771 .method(hyper::Method::GET)
17772 .uri(url.as_str())
17773 .header(USER_AGENT, self.hub._user_agent.clone());
17774
17775 if let Some(token) = token.as_ref() {
17776 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17777 }
17778
17779 let request = req_builder
17780 .header(CONTENT_LENGTH, 0_u64)
17781 .body(common::to_body::<String>(None));
17782
17783 client.request(request.unwrap()).await
17784 };
17785
17786 match req_result {
17787 Err(err) => {
17788 if let common::Retry::After(d) = dlg.http_error(&err) {
17789 sleep(d).await;
17790 continue;
17791 }
17792 dlg.finished(false);
17793 return Err(common::Error::HttpError(err));
17794 }
17795 Ok(res) => {
17796 let (mut parts, body) = res.into_parts();
17797 let mut body = common::Body::new(body);
17798 if !parts.status.is_success() {
17799 let bytes = common::to_bytes(body).await.unwrap_or_default();
17800 let error = serde_json::from_str(&common::to_string(&bytes));
17801 let response = common::to_response(parts, bytes.into());
17802
17803 if let common::Retry::After(d) =
17804 dlg.http_failure(&response, error.as_ref().ok())
17805 {
17806 sleep(d).await;
17807 continue;
17808 }
17809
17810 dlg.finished(false);
17811
17812 return Err(match error {
17813 Ok(value) => common::Error::BadRequest(value),
17814 _ => common::Error::Failure(response),
17815 });
17816 }
17817 let response = {
17818 let bytes = common::to_bytes(body).await.unwrap_or_default();
17819 let encoded = common::to_string(&bytes);
17820 match serde_json::from_str(&encoded) {
17821 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17822 Err(error) => {
17823 dlg.response_json_decode_error(&encoded, &error);
17824 return Err(common::Error::JsonDecodeError(
17825 encoded.to_string(),
17826 error,
17827 ));
17828 }
17829 }
17830 };
17831
17832 dlg.finished(true);
17833 return Ok(response);
17834 }
17835 }
17836 }
17837 }
17838
17839 /// 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)
17840 ///
17841 /// Sets the *parent* path property to the given value.
17842 ///
17843 /// Even though the property as already been set when instantiating this call,
17844 /// we provide this method for API completeness.
17845 pub fn parent(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
17846 self._parent = new_value.to_string();
17847 self
17848 }
17849 /// 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.
17850 ///
17851 /// Sets the *page token* query property to the given value.
17852 pub fn page_token(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
17853 self._page_token = Some(new_value.to_string());
17854 self
17855 }
17856 /// 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.
17857 ///
17858 /// Sets the *page size* query property to the given value.
17859 pub fn page_size(mut self, new_value: i32) -> ProjectServiceResourcePolicyListCall<'a, C> {
17860 self._page_size = Some(new_value);
17861 self
17862 }
17863 /// 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/"`
17864 ///
17865 /// Sets the *filter* query property to the given value.
17866 pub fn filter(mut self, new_value: &str) -> ProjectServiceResourcePolicyListCall<'a, C> {
17867 self._filter = Some(new_value.to_string());
17868 self
17869 }
17870 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17871 /// while executing the actual API request.
17872 ///
17873 /// ````text
17874 /// It should be used to handle progress information, and to implement a certain level of resilience.
17875 /// ````
17876 ///
17877 /// Sets the *delegate* property to the given value.
17878 pub fn delegate(
17879 mut self,
17880 new_value: &'a mut dyn common::Delegate,
17881 ) -> ProjectServiceResourcePolicyListCall<'a, C> {
17882 self._delegate = Some(new_value);
17883 self
17884 }
17885
17886 /// Set any additional parameter of the query string used in the request.
17887 /// It should be used to set parameters which are not yet available through their own
17888 /// setters.
17889 ///
17890 /// Please note that this method must not be used to set any of the known parameters
17891 /// which have their own setter method. If done anyway, the request will fail.
17892 ///
17893 /// # Additional Parameters
17894 ///
17895 /// * *$.xgafv* (query-string) - V1 error format.
17896 /// * *access_token* (query-string) - OAuth access token.
17897 /// * *alt* (query-string) - Data format for response.
17898 /// * *callback* (query-string) - JSONP
17899 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17900 /// * *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.
17901 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17902 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17903 /// * *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.
17904 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17905 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17906 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyListCall<'a, C>
17907 where
17908 T: AsRef<str>,
17909 {
17910 self._additional_params
17911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17912 self
17913 }
17914
17915 /// Identifies the authorization scope for the method you are building.
17916 ///
17917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17918 /// [`Scope::CloudPlatform`].
17919 ///
17920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17921 /// tokens for more than one scope.
17922 ///
17923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17925 /// sufficient, a read-write scope will do as well.
17926 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyListCall<'a, C>
17927 where
17928 St: AsRef<str>,
17929 {
17930 self._scopes.insert(String::from(scope.as_ref()));
17931 self
17932 }
17933 /// Identifies the authorization scope(s) for the method you are building.
17934 ///
17935 /// See [`Self::add_scope()`] for details.
17936 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyListCall<'a, C>
17937 where
17938 I: IntoIterator<Item = St>,
17939 St: AsRef<str>,
17940 {
17941 self._scopes
17942 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17943 self
17944 }
17945
17946 /// Removes all scopes, and no default scope will be used either.
17947 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17948 /// for details).
17949 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyListCall<'a, C> {
17950 self._scopes.clear();
17951 self
17952 }
17953}
17954
17955/// Updates the specified ResourcePolicy configuration.
17956///
17957/// A builder for the *services.resourcePolicies.patch* method supported by a *project* resource.
17958/// It is not used directly, but through a [`ProjectMethods`] instance.
17959///
17960/// # Example
17961///
17962/// Instantiate a resource method builder
17963///
17964/// ```test_harness,no_run
17965/// # extern crate hyper;
17966/// # extern crate hyper_rustls;
17967/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
17968/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaResourcePolicy;
17969/// # async fn dox() {
17970/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17971///
17972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17974/// # secret,
17975/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17976/// # ).build().await.unwrap();
17977///
17978/// # let client = hyper_util::client::legacy::Client::builder(
17979/// # hyper_util::rt::TokioExecutor::new()
17980/// # )
17981/// # .build(
17982/// # hyper_rustls::HttpsConnectorBuilder::new()
17983/// # .with_native_roots()
17984/// # .unwrap()
17985/// # .https_or_http()
17986/// # .enable_http1()
17987/// # .build()
17988/// # );
17989/// # let mut hub = Firebaseappcheck::new(client, auth);
17990/// // As the method needs a request, you would usually fill it with the desired information
17991/// // into the respective structure. Some of the parts shown here might not be applicable !
17992/// // Values shown here are possibly random and not representative !
17993/// let mut req = GoogleFirebaseAppcheckV1betaResourcePolicy::default();
17994///
17995/// // You can configure optional parameters by calling the respective setters at will, and
17996/// // execute the final call using `doit()`.
17997/// // Values shown here are possibly random and not representative !
17998/// let result = hub.projects().services_resource_policies_patch(req, "name")
17999/// .update_mask(FieldMask::new::<&str>(&[]))
18000/// .doit().await;
18001/// # }
18002/// ```
18003pub struct ProjectServiceResourcePolicyPatchCall<'a, C>
18004where
18005 C: 'a,
18006{
18007 hub: &'a Firebaseappcheck<C>,
18008 _request: GoogleFirebaseAppcheckV1betaResourcePolicy,
18009 _name: String,
18010 _update_mask: Option<common::FieldMask>,
18011 _delegate: Option<&'a mut dyn common::Delegate>,
18012 _additional_params: HashMap<String, String>,
18013 _scopes: BTreeSet<String>,
18014}
18015
18016impl<'a, C> common::CallBuilder for ProjectServiceResourcePolicyPatchCall<'a, C> {}
18017
18018impl<'a, C> ProjectServiceResourcePolicyPatchCall<'a, C>
18019where
18020 C: common::Connector,
18021{
18022 /// Perform the operation you have build so far.
18023 pub async fn doit(
18024 mut self,
18025 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaResourcePolicy)> {
18026 use std::borrow::Cow;
18027 use std::io::{Read, Seek};
18028
18029 use common::{url::Params, ToParts};
18030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18031
18032 let mut dd = common::DefaultDelegate;
18033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18034 dlg.begin(common::MethodInfo {
18035 id: "firebaseappcheck.projects.services.resourcePolicies.patch",
18036 http_method: hyper::Method::PATCH,
18037 });
18038
18039 for &field in ["alt", "name", "updateMask"].iter() {
18040 if self._additional_params.contains_key(field) {
18041 dlg.finished(false);
18042 return Err(common::Error::FieldClash(field));
18043 }
18044 }
18045
18046 let mut params = Params::with_capacity(5 + self._additional_params.len());
18047 params.push("name", self._name);
18048 if let Some(value) = self._update_mask.as_ref() {
18049 params.push("updateMask", value.to_string());
18050 }
18051
18052 params.extend(self._additional_params.iter());
18053
18054 params.push("alt", "json");
18055 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
18056 if self._scopes.is_empty() {
18057 self._scopes
18058 .insert(Scope::CloudPlatform.as_ref().to_string());
18059 }
18060
18061 #[allow(clippy::single_element_loop)]
18062 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18063 url = params.uri_replacement(url, param_name, find_this, true);
18064 }
18065 {
18066 let to_remove = ["name"];
18067 params.remove_params(&to_remove);
18068 }
18069
18070 let url = params.parse_with_url(&url);
18071
18072 let mut json_mime_type = mime::APPLICATION_JSON;
18073 let mut request_value_reader = {
18074 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18075 common::remove_json_null_values(&mut value);
18076 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18077 serde_json::to_writer(&mut dst, &value).unwrap();
18078 dst
18079 };
18080 let request_size = request_value_reader
18081 .seek(std::io::SeekFrom::End(0))
18082 .unwrap();
18083 request_value_reader
18084 .seek(std::io::SeekFrom::Start(0))
18085 .unwrap();
18086
18087 loop {
18088 let token = match self
18089 .hub
18090 .auth
18091 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18092 .await
18093 {
18094 Ok(token) => token,
18095 Err(e) => match dlg.token(e) {
18096 Ok(token) => token,
18097 Err(e) => {
18098 dlg.finished(false);
18099 return Err(common::Error::MissingToken(e));
18100 }
18101 },
18102 };
18103 request_value_reader
18104 .seek(std::io::SeekFrom::Start(0))
18105 .unwrap();
18106 let mut req_result = {
18107 let client = &self.hub.client;
18108 dlg.pre_request();
18109 let mut req_builder = hyper::Request::builder()
18110 .method(hyper::Method::PATCH)
18111 .uri(url.as_str())
18112 .header(USER_AGENT, self.hub._user_agent.clone());
18113
18114 if let Some(token) = token.as_ref() {
18115 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18116 }
18117
18118 let request = req_builder
18119 .header(CONTENT_TYPE, json_mime_type.to_string())
18120 .header(CONTENT_LENGTH, request_size as u64)
18121 .body(common::to_body(
18122 request_value_reader.get_ref().clone().into(),
18123 ));
18124
18125 client.request(request.unwrap()).await
18126 };
18127
18128 match req_result {
18129 Err(err) => {
18130 if let common::Retry::After(d) = dlg.http_error(&err) {
18131 sleep(d).await;
18132 continue;
18133 }
18134 dlg.finished(false);
18135 return Err(common::Error::HttpError(err));
18136 }
18137 Ok(res) => {
18138 let (mut parts, body) = res.into_parts();
18139 let mut body = common::Body::new(body);
18140 if !parts.status.is_success() {
18141 let bytes = common::to_bytes(body).await.unwrap_or_default();
18142 let error = serde_json::from_str(&common::to_string(&bytes));
18143 let response = common::to_response(parts, bytes.into());
18144
18145 if let common::Retry::After(d) =
18146 dlg.http_failure(&response, error.as_ref().ok())
18147 {
18148 sleep(d).await;
18149 continue;
18150 }
18151
18152 dlg.finished(false);
18153
18154 return Err(match error {
18155 Ok(value) => common::Error::BadRequest(value),
18156 _ => common::Error::Failure(response),
18157 });
18158 }
18159 let response = {
18160 let bytes = common::to_bytes(body).await.unwrap_or_default();
18161 let encoded = common::to_string(&bytes);
18162 match serde_json::from_str(&encoded) {
18163 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18164 Err(error) => {
18165 dlg.response_json_decode_error(&encoded, &error);
18166 return Err(common::Error::JsonDecodeError(
18167 encoded.to_string(),
18168 error,
18169 ));
18170 }
18171 }
18172 };
18173
18174 dlg.finished(true);
18175 return Ok(response);
18176 }
18177 }
18178 }
18179 }
18180
18181 ///
18182 /// Sets the *request* property to the given value.
18183 ///
18184 /// Even though the property as already been set when instantiating this call,
18185 /// we provide this method for API completeness.
18186 pub fn request(
18187 mut self,
18188 new_value: GoogleFirebaseAppcheckV1betaResourcePolicy,
18189 ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18190 self._request = new_value;
18191 self
18192 }
18193 /// 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.
18194 ///
18195 /// Sets the *name* path property to the given value.
18196 ///
18197 /// Even though the property as already been set when instantiating this call,
18198 /// we provide this method for API completeness.
18199 pub fn name(mut self, new_value: &str) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18200 self._name = new_value.to_string();
18201 self
18202 }
18203 /// Required. A comma-separated list of names of fields in the ResourcePolicy to update. Example: `enforcement_mode`.
18204 ///
18205 /// Sets the *update mask* query property to the given value.
18206 pub fn update_mask(
18207 mut self,
18208 new_value: common::FieldMask,
18209 ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18210 self._update_mask = Some(new_value);
18211 self
18212 }
18213 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18214 /// while executing the actual API request.
18215 ///
18216 /// ````text
18217 /// It should be used to handle progress information, and to implement a certain level of resilience.
18218 /// ````
18219 ///
18220 /// Sets the *delegate* property to the given value.
18221 pub fn delegate(
18222 mut self,
18223 new_value: &'a mut dyn common::Delegate,
18224 ) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18225 self._delegate = Some(new_value);
18226 self
18227 }
18228
18229 /// Set any additional parameter of the query string used in the request.
18230 /// It should be used to set parameters which are not yet available through their own
18231 /// setters.
18232 ///
18233 /// Please note that this method must not be used to set any of the known parameters
18234 /// which have their own setter method. If done anyway, the request will fail.
18235 ///
18236 /// # Additional Parameters
18237 ///
18238 /// * *$.xgafv* (query-string) - V1 error format.
18239 /// * *access_token* (query-string) - OAuth access token.
18240 /// * *alt* (query-string) - Data format for response.
18241 /// * *callback* (query-string) - JSONP
18242 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18243 /// * *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.
18244 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18245 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18246 /// * *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.
18247 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18248 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18249 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18250 where
18251 T: AsRef<str>,
18252 {
18253 self._additional_params
18254 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18255 self
18256 }
18257
18258 /// Identifies the authorization scope for the method you are building.
18259 ///
18260 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18261 /// [`Scope::CloudPlatform`].
18262 ///
18263 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18264 /// tokens for more than one scope.
18265 ///
18266 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18267 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18268 /// sufficient, a read-write scope will do as well.
18269 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18270 where
18271 St: AsRef<str>,
18272 {
18273 self._scopes.insert(String::from(scope.as_ref()));
18274 self
18275 }
18276 /// Identifies the authorization scope(s) for the method you are building.
18277 ///
18278 /// See [`Self::add_scope()`] for details.
18279 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceResourcePolicyPatchCall<'a, C>
18280 where
18281 I: IntoIterator<Item = St>,
18282 St: AsRef<str>,
18283 {
18284 self._scopes
18285 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18286 self
18287 }
18288
18289 /// Removes all scopes, and no default scope will be used either.
18290 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18291 /// for details).
18292 pub fn clear_scopes(mut self) -> ProjectServiceResourcePolicyPatchCall<'a, C> {
18293 self._scopes.clear();
18294 self
18295 }
18296}
18297
18298/// Atomically updates the specified Service configurations.
18299///
18300/// A builder for the *services.batchUpdate* method supported by a *project* resource.
18301/// It is not used directly, but through a [`ProjectMethods`] instance.
18302///
18303/// # Example
18304///
18305/// Instantiate a resource method builder
18306///
18307/// ```test_harness,no_run
18308/// # extern crate hyper;
18309/// # extern crate hyper_rustls;
18310/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18311/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest;
18312/// # async fn dox() {
18313/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18314///
18315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18317/// # secret,
18318/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18319/// # ).build().await.unwrap();
18320///
18321/// # let client = hyper_util::client::legacy::Client::builder(
18322/// # hyper_util::rt::TokioExecutor::new()
18323/// # )
18324/// # .build(
18325/// # hyper_rustls::HttpsConnectorBuilder::new()
18326/// # .with_native_roots()
18327/// # .unwrap()
18328/// # .https_or_http()
18329/// # .enable_http1()
18330/// # .build()
18331/// # );
18332/// # let mut hub = Firebaseappcheck::new(client, auth);
18333/// // As the method needs a request, you would usually fill it with the desired information
18334/// // into the respective structure. Some of the parts shown here might not be applicable !
18335/// // Values shown here are possibly random and not representative !
18336/// let mut req = GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest::default();
18337///
18338/// // You can configure optional parameters by calling the respective setters at will, and
18339/// // execute the final call using `doit()`.
18340/// // Values shown here are possibly random and not representative !
18341/// let result = hub.projects().services_batch_update(req, "parent")
18342/// .doit().await;
18343/// # }
18344/// ```
18345pub struct ProjectServiceBatchUpdateCall<'a, C>
18346where
18347 C: 'a,
18348{
18349 hub: &'a Firebaseappcheck<C>,
18350 _request: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
18351 _parent: String,
18352 _delegate: Option<&'a mut dyn common::Delegate>,
18353 _additional_params: HashMap<String, String>,
18354 _scopes: BTreeSet<String>,
18355}
18356
18357impl<'a, C> common::CallBuilder for ProjectServiceBatchUpdateCall<'a, C> {}
18358
18359impl<'a, C> ProjectServiceBatchUpdateCall<'a, C>
18360where
18361 C: common::Connector,
18362{
18363 /// Perform the operation you have build so far.
18364 pub async fn doit(
18365 mut self,
18366 ) -> common::Result<(
18367 common::Response,
18368 GoogleFirebaseAppcheckV1betaBatchUpdateServicesResponse,
18369 )> {
18370 use std::borrow::Cow;
18371 use std::io::{Read, Seek};
18372
18373 use common::{url::Params, ToParts};
18374 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18375
18376 let mut dd = common::DefaultDelegate;
18377 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18378 dlg.begin(common::MethodInfo {
18379 id: "firebaseappcheck.projects.services.batchUpdate",
18380 http_method: hyper::Method::POST,
18381 });
18382
18383 for &field in ["alt", "parent"].iter() {
18384 if self._additional_params.contains_key(field) {
18385 dlg.finished(false);
18386 return Err(common::Error::FieldClash(field));
18387 }
18388 }
18389
18390 let mut params = Params::with_capacity(4 + self._additional_params.len());
18391 params.push("parent", self._parent);
18392
18393 params.extend(self._additional_params.iter());
18394
18395 params.push("alt", "json");
18396 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services:batchUpdate";
18397 if self._scopes.is_empty() {
18398 self._scopes
18399 .insert(Scope::CloudPlatform.as_ref().to_string());
18400 }
18401
18402 #[allow(clippy::single_element_loop)]
18403 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18404 url = params.uri_replacement(url, param_name, find_this, true);
18405 }
18406 {
18407 let to_remove = ["parent"];
18408 params.remove_params(&to_remove);
18409 }
18410
18411 let url = params.parse_with_url(&url);
18412
18413 let mut json_mime_type = mime::APPLICATION_JSON;
18414 let mut request_value_reader = {
18415 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18416 common::remove_json_null_values(&mut value);
18417 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18418 serde_json::to_writer(&mut dst, &value).unwrap();
18419 dst
18420 };
18421 let request_size = request_value_reader
18422 .seek(std::io::SeekFrom::End(0))
18423 .unwrap();
18424 request_value_reader
18425 .seek(std::io::SeekFrom::Start(0))
18426 .unwrap();
18427
18428 loop {
18429 let token = match self
18430 .hub
18431 .auth
18432 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18433 .await
18434 {
18435 Ok(token) => token,
18436 Err(e) => match dlg.token(e) {
18437 Ok(token) => token,
18438 Err(e) => {
18439 dlg.finished(false);
18440 return Err(common::Error::MissingToken(e));
18441 }
18442 },
18443 };
18444 request_value_reader
18445 .seek(std::io::SeekFrom::Start(0))
18446 .unwrap();
18447 let mut req_result = {
18448 let client = &self.hub.client;
18449 dlg.pre_request();
18450 let mut req_builder = hyper::Request::builder()
18451 .method(hyper::Method::POST)
18452 .uri(url.as_str())
18453 .header(USER_AGENT, self.hub._user_agent.clone());
18454
18455 if let Some(token) = token.as_ref() {
18456 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18457 }
18458
18459 let request = req_builder
18460 .header(CONTENT_TYPE, json_mime_type.to_string())
18461 .header(CONTENT_LENGTH, request_size as u64)
18462 .body(common::to_body(
18463 request_value_reader.get_ref().clone().into(),
18464 ));
18465
18466 client.request(request.unwrap()).await
18467 };
18468
18469 match req_result {
18470 Err(err) => {
18471 if let common::Retry::After(d) = dlg.http_error(&err) {
18472 sleep(d).await;
18473 continue;
18474 }
18475 dlg.finished(false);
18476 return Err(common::Error::HttpError(err));
18477 }
18478 Ok(res) => {
18479 let (mut parts, body) = res.into_parts();
18480 let mut body = common::Body::new(body);
18481 if !parts.status.is_success() {
18482 let bytes = common::to_bytes(body).await.unwrap_or_default();
18483 let error = serde_json::from_str(&common::to_string(&bytes));
18484 let response = common::to_response(parts, bytes.into());
18485
18486 if let common::Retry::After(d) =
18487 dlg.http_failure(&response, error.as_ref().ok())
18488 {
18489 sleep(d).await;
18490 continue;
18491 }
18492
18493 dlg.finished(false);
18494
18495 return Err(match error {
18496 Ok(value) => common::Error::BadRequest(value),
18497 _ => common::Error::Failure(response),
18498 });
18499 }
18500 let response = {
18501 let bytes = common::to_bytes(body).await.unwrap_or_default();
18502 let encoded = common::to_string(&bytes);
18503 match serde_json::from_str(&encoded) {
18504 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18505 Err(error) => {
18506 dlg.response_json_decode_error(&encoded, &error);
18507 return Err(common::Error::JsonDecodeError(
18508 encoded.to_string(),
18509 error,
18510 ));
18511 }
18512 }
18513 };
18514
18515 dlg.finished(true);
18516 return Ok(response);
18517 }
18518 }
18519 }
18520 }
18521
18522 ///
18523 /// Sets the *request* property to the given value.
18524 ///
18525 /// Even though the property as already been set when instantiating this call,
18526 /// we provide this method for API completeness.
18527 pub fn request(
18528 mut self,
18529 new_value: GoogleFirebaseAppcheckV1betaBatchUpdateServicesRequest,
18530 ) -> ProjectServiceBatchUpdateCall<'a, C> {
18531 self._request = new_value;
18532 self
18533 }
18534 /// 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.
18535 ///
18536 /// Sets the *parent* path property to the given value.
18537 ///
18538 /// Even though the property as already been set when instantiating this call,
18539 /// we provide this method for API completeness.
18540 pub fn parent(mut self, new_value: &str) -> ProjectServiceBatchUpdateCall<'a, C> {
18541 self._parent = new_value.to_string();
18542 self
18543 }
18544 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18545 /// while executing the actual API request.
18546 ///
18547 /// ````text
18548 /// It should be used to handle progress information, and to implement a certain level of resilience.
18549 /// ````
18550 ///
18551 /// Sets the *delegate* property to the given value.
18552 pub fn delegate(
18553 mut self,
18554 new_value: &'a mut dyn common::Delegate,
18555 ) -> ProjectServiceBatchUpdateCall<'a, C> {
18556 self._delegate = Some(new_value);
18557 self
18558 }
18559
18560 /// Set any additional parameter of the query string used in the request.
18561 /// It should be used to set parameters which are not yet available through their own
18562 /// setters.
18563 ///
18564 /// Please note that this method must not be used to set any of the known parameters
18565 /// which have their own setter method. If done anyway, the request will fail.
18566 ///
18567 /// # Additional Parameters
18568 ///
18569 /// * *$.xgafv* (query-string) - V1 error format.
18570 /// * *access_token* (query-string) - OAuth access token.
18571 /// * *alt* (query-string) - Data format for response.
18572 /// * *callback* (query-string) - JSONP
18573 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18574 /// * *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.
18575 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18576 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18577 /// * *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.
18578 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18579 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18580 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceBatchUpdateCall<'a, C>
18581 where
18582 T: AsRef<str>,
18583 {
18584 self._additional_params
18585 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18586 self
18587 }
18588
18589 /// Identifies the authorization scope for the method you are building.
18590 ///
18591 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18592 /// [`Scope::CloudPlatform`].
18593 ///
18594 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18595 /// tokens for more than one scope.
18596 ///
18597 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18598 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18599 /// sufficient, a read-write scope will do as well.
18600 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceBatchUpdateCall<'a, C>
18601 where
18602 St: AsRef<str>,
18603 {
18604 self._scopes.insert(String::from(scope.as_ref()));
18605 self
18606 }
18607 /// Identifies the authorization scope(s) for the method you are building.
18608 ///
18609 /// See [`Self::add_scope()`] for details.
18610 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceBatchUpdateCall<'a, C>
18611 where
18612 I: IntoIterator<Item = St>,
18613 St: AsRef<str>,
18614 {
18615 self._scopes
18616 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18617 self
18618 }
18619
18620 /// Removes all scopes, and no default scope will be used either.
18621 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18622 /// for details).
18623 pub fn clear_scopes(mut self) -> ProjectServiceBatchUpdateCall<'a, C> {
18624 self._scopes.clear();
18625 self
18626 }
18627}
18628
18629/// Gets the Service configuration for the specified service name.
18630///
18631/// A builder for the *services.get* method supported by a *project* resource.
18632/// It is not used directly, but through a [`ProjectMethods`] instance.
18633///
18634/// # Example
18635///
18636/// Instantiate a resource method builder
18637///
18638/// ```test_harness,no_run
18639/// # extern crate hyper;
18640/// # extern crate hyper_rustls;
18641/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18642/// # async fn dox() {
18643/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18644///
18645/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18646/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18647/// # secret,
18648/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18649/// # ).build().await.unwrap();
18650///
18651/// # let client = hyper_util::client::legacy::Client::builder(
18652/// # hyper_util::rt::TokioExecutor::new()
18653/// # )
18654/// # .build(
18655/// # hyper_rustls::HttpsConnectorBuilder::new()
18656/// # .with_native_roots()
18657/// # .unwrap()
18658/// # .https_or_http()
18659/// # .enable_http1()
18660/// # .build()
18661/// # );
18662/// # let mut hub = Firebaseappcheck::new(client, auth);
18663/// // You can configure optional parameters by calling the respective setters at will, and
18664/// // execute the final call using `doit()`.
18665/// // Values shown here are possibly random and not representative !
18666/// let result = hub.projects().services_get("name")
18667/// .doit().await;
18668/// # }
18669/// ```
18670pub struct ProjectServiceGetCall<'a, C>
18671where
18672 C: 'a,
18673{
18674 hub: &'a Firebaseappcheck<C>,
18675 _name: String,
18676 _delegate: Option<&'a mut dyn common::Delegate>,
18677 _additional_params: HashMap<String, String>,
18678 _scopes: BTreeSet<String>,
18679}
18680
18681impl<'a, C> common::CallBuilder for ProjectServiceGetCall<'a, C> {}
18682
18683impl<'a, C> ProjectServiceGetCall<'a, C>
18684where
18685 C: common::Connector,
18686{
18687 /// Perform the operation you have build so far.
18688 pub async fn doit(
18689 mut self,
18690 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaService)> {
18691 use std::borrow::Cow;
18692 use std::io::{Read, Seek};
18693
18694 use common::{url::Params, ToParts};
18695 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18696
18697 let mut dd = common::DefaultDelegate;
18698 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18699 dlg.begin(common::MethodInfo {
18700 id: "firebaseappcheck.projects.services.get",
18701 http_method: hyper::Method::GET,
18702 });
18703
18704 for &field in ["alt", "name"].iter() {
18705 if self._additional_params.contains_key(field) {
18706 dlg.finished(false);
18707 return Err(common::Error::FieldClash(field));
18708 }
18709 }
18710
18711 let mut params = Params::with_capacity(3 + self._additional_params.len());
18712 params.push("name", self._name);
18713
18714 params.extend(self._additional_params.iter());
18715
18716 params.push("alt", "json");
18717 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
18718 if self._scopes.is_empty() {
18719 self._scopes
18720 .insert(Scope::CloudPlatform.as_ref().to_string());
18721 }
18722
18723 #[allow(clippy::single_element_loop)]
18724 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18725 url = params.uri_replacement(url, param_name, find_this, true);
18726 }
18727 {
18728 let to_remove = ["name"];
18729 params.remove_params(&to_remove);
18730 }
18731
18732 let url = params.parse_with_url(&url);
18733
18734 loop {
18735 let token = match self
18736 .hub
18737 .auth
18738 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18739 .await
18740 {
18741 Ok(token) => token,
18742 Err(e) => match dlg.token(e) {
18743 Ok(token) => token,
18744 Err(e) => {
18745 dlg.finished(false);
18746 return Err(common::Error::MissingToken(e));
18747 }
18748 },
18749 };
18750 let mut req_result = {
18751 let client = &self.hub.client;
18752 dlg.pre_request();
18753 let mut req_builder = hyper::Request::builder()
18754 .method(hyper::Method::GET)
18755 .uri(url.as_str())
18756 .header(USER_AGENT, self.hub._user_agent.clone());
18757
18758 if let Some(token) = token.as_ref() {
18759 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18760 }
18761
18762 let request = req_builder
18763 .header(CONTENT_LENGTH, 0_u64)
18764 .body(common::to_body::<String>(None));
18765
18766 client.request(request.unwrap()).await
18767 };
18768
18769 match req_result {
18770 Err(err) => {
18771 if let common::Retry::After(d) = dlg.http_error(&err) {
18772 sleep(d).await;
18773 continue;
18774 }
18775 dlg.finished(false);
18776 return Err(common::Error::HttpError(err));
18777 }
18778 Ok(res) => {
18779 let (mut parts, body) = res.into_parts();
18780 let mut body = common::Body::new(body);
18781 if !parts.status.is_success() {
18782 let bytes = common::to_bytes(body).await.unwrap_or_default();
18783 let error = serde_json::from_str(&common::to_string(&bytes));
18784 let response = common::to_response(parts, bytes.into());
18785
18786 if let common::Retry::After(d) =
18787 dlg.http_failure(&response, error.as_ref().ok())
18788 {
18789 sleep(d).await;
18790 continue;
18791 }
18792
18793 dlg.finished(false);
18794
18795 return Err(match error {
18796 Ok(value) => common::Error::BadRequest(value),
18797 _ => common::Error::Failure(response),
18798 });
18799 }
18800 let response = {
18801 let bytes = common::to_bytes(body).await.unwrap_or_default();
18802 let encoded = common::to_string(&bytes);
18803 match serde_json::from_str(&encoded) {
18804 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18805 Err(error) => {
18806 dlg.response_json_decode_error(&encoded, &error);
18807 return Err(common::Error::JsonDecodeError(
18808 encoded.to_string(),
18809 error,
18810 ));
18811 }
18812 }
18813 };
18814
18815 dlg.finished(true);
18816 return Ok(response);
18817 }
18818 }
18819 }
18820 }
18821
18822 /// 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)
18823 ///
18824 /// Sets the *name* path property to the given value.
18825 ///
18826 /// Even though the property as already been set when instantiating this call,
18827 /// we provide this method for API completeness.
18828 pub fn name(mut self, new_value: &str) -> ProjectServiceGetCall<'a, C> {
18829 self._name = new_value.to_string();
18830 self
18831 }
18832 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18833 /// while executing the actual API request.
18834 ///
18835 /// ````text
18836 /// It should be used to handle progress information, and to implement a certain level of resilience.
18837 /// ````
18838 ///
18839 /// Sets the *delegate* property to the given value.
18840 pub fn delegate(
18841 mut self,
18842 new_value: &'a mut dyn common::Delegate,
18843 ) -> ProjectServiceGetCall<'a, C> {
18844 self._delegate = Some(new_value);
18845 self
18846 }
18847
18848 /// Set any additional parameter of the query string used in the request.
18849 /// It should be used to set parameters which are not yet available through their own
18850 /// setters.
18851 ///
18852 /// Please note that this method must not be used to set any of the known parameters
18853 /// which have their own setter method. If done anyway, the request will fail.
18854 ///
18855 /// # Additional Parameters
18856 ///
18857 /// * *$.xgafv* (query-string) - V1 error format.
18858 /// * *access_token* (query-string) - OAuth access token.
18859 /// * *alt* (query-string) - Data format for response.
18860 /// * *callback* (query-string) - JSONP
18861 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18862 /// * *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.
18863 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18864 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18865 /// * *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.
18866 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18868 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceGetCall<'a, C>
18869 where
18870 T: AsRef<str>,
18871 {
18872 self._additional_params
18873 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18874 self
18875 }
18876
18877 /// Identifies the authorization scope for the method you are building.
18878 ///
18879 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18880 /// [`Scope::CloudPlatform`].
18881 ///
18882 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18883 /// tokens for more than one scope.
18884 ///
18885 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18886 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18887 /// sufficient, a read-write scope will do as well.
18888 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceGetCall<'a, C>
18889 where
18890 St: AsRef<str>,
18891 {
18892 self._scopes.insert(String::from(scope.as_ref()));
18893 self
18894 }
18895 /// Identifies the authorization scope(s) for the method you are building.
18896 ///
18897 /// See [`Self::add_scope()`] for details.
18898 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceGetCall<'a, C>
18899 where
18900 I: IntoIterator<Item = St>,
18901 St: AsRef<str>,
18902 {
18903 self._scopes
18904 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18905 self
18906 }
18907
18908 /// Removes all scopes, and no default scope will be used either.
18909 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18910 /// for details).
18911 pub fn clear_scopes(mut self) -> ProjectServiceGetCall<'a, C> {
18912 self._scopes.clear();
18913 self
18914 }
18915}
18916
18917/// Lists all Service configurations for the specified project. Only Services which were explicitly configured using UpdateService or BatchUpdateServices will be returned.
18918///
18919/// A builder for the *services.list* method supported by a *project* resource.
18920/// It is not used directly, but through a [`ProjectMethods`] instance.
18921///
18922/// # Example
18923///
18924/// Instantiate a resource method builder
18925///
18926/// ```test_harness,no_run
18927/// # extern crate hyper;
18928/// # extern crate hyper_rustls;
18929/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
18930/// # async fn dox() {
18931/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18932///
18933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18935/// # secret,
18936/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18937/// # ).build().await.unwrap();
18938///
18939/// # let client = hyper_util::client::legacy::Client::builder(
18940/// # hyper_util::rt::TokioExecutor::new()
18941/// # )
18942/// # .build(
18943/// # hyper_rustls::HttpsConnectorBuilder::new()
18944/// # .with_native_roots()
18945/// # .unwrap()
18946/// # .https_or_http()
18947/// # .enable_http1()
18948/// # .build()
18949/// # );
18950/// # let mut hub = Firebaseappcheck::new(client, auth);
18951/// // You can configure optional parameters by calling the respective setters at will, and
18952/// // execute the final call using `doit()`.
18953/// // Values shown here are possibly random and not representative !
18954/// let result = hub.projects().services_list("parent")
18955/// .page_token("Stet")
18956/// .page_size(-76)
18957/// .doit().await;
18958/// # }
18959/// ```
18960pub struct ProjectServiceListCall<'a, C>
18961where
18962 C: 'a,
18963{
18964 hub: &'a Firebaseappcheck<C>,
18965 _parent: String,
18966 _page_token: Option<String>,
18967 _page_size: Option<i32>,
18968 _delegate: Option<&'a mut dyn common::Delegate>,
18969 _additional_params: HashMap<String, String>,
18970 _scopes: BTreeSet<String>,
18971}
18972
18973impl<'a, C> common::CallBuilder for ProjectServiceListCall<'a, C> {}
18974
18975impl<'a, C> ProjectServiceListCall<'a, C>
18976where
18977 C: common::Connector,
18978{
18979 /// Perform the operation you have build so far.
18980 pub async fn doit(
18981 mut self,
18982 ) -> common::Result<(
18983 common::Response,
18984 GoogleFirebaseAppcheckV1betaListServicesResponse,
18985 )> {
18986 use std::borrow::Cow;
18987 use std::io::{Read, Seek};
18988
18989 use common::{url::Params, ToParts};
18990 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18991
18992 let mut dd = common::DefaultDelegate;
18993 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18994 dlg.begin(common::MethodInfo {
18995 id: "firebaseappcheck.projects.services.list",
18996 http_method: hyper::Method::GET,
18997 });
18998
18999 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19000 if self._additional_params.contains_key(field) {
19001 dlg.finished(false);
19002 return Err(common::Error::FieldClash(field));
19003 }
19004 }
19005
19006 let mut params = Params::with_capacity(5 + self._additional_params.len());
19007 params.push("parent", self._parent);
19008 if let Some(value) = self._page_token.as_ref() {
19009 params.push("pageToken", value);
19010 }
19011 if let Some(value) = self._page_size.as_ref() {
19012 params.push("pageSize", value.to_string());
19013 }
19014
19015 params.extend(self._additional_params.iter());
19016
19017 params.push("alt", "json");
19018 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services";
19019 if self._scopes.is_empty() {
19020 self._scopes
19021 .insert(Scope::CloudPlatform.as_ref().to_string());
19022 }
19023
19024 #[allow(clippy::single_element_loop)]
19025 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19026 url = params.uri_replacement(url, param_name, find_this, true);
19027 }
19028 {
19029 let to_remove = ["parent"];
19030 params.remove_params(&to_remove);
19031 }
19032
19033 let url = params.parse_with_url(&url);
19034
19035 loop {
19036 let token = match self
19037 .hub
19038 .auth
19039 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19040 .await
19041 {
19042 Ok(token) => token,
19043 Err(e) => match dlg.token(e) {
19044 Ok(token) => token,
19045 Err(e) => {
19046 dlg.finished(false);
19047 return Err(common::Error::MissingToken(e));
19048 }
19049 },
19050 };
19051 let mut req_result = {
19052 let client = &self.hub.client;
19053 dlg.pre_request();
19054 let mut req_builder = hyper::Request::builder()
19055 .method(hyper::Method::GET)
19056 .uri(url.as_str())
19057 .header(USER_AGENT, self.hub._user_agent.clone());
19058
19059 if let Some(token) = token.as_ref() {
19060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19061 }
19062
19063 let request = req_builder
19064 .header(CONTENT_LENGTH, 0_u64)
19065 .body(common::to_body::<String>(None));
19066
19067 client.request(request.unwrap()).await
19068 };
19069
19070 match req_result {
19071 Err(err) => {
19072 if let common::Retry::After(d) = dlg.http_error(&err) {
19073 sleep(d).await;
19074 continue;
19075 }
19076 dlg.finished(false);
19077 return Err(common::Error::HttpError(err));
19078 }
19079 Ok(res) => {
19080 let (mut parts, body) = res.into_parts();
19081 let mut body = common::Body::new(body);
19082 if !parts.status.is_success() {
19083 let bytes = common::to_bytes(body).await.unwrap_or_default();
19084 let error = serde_json::from_str(&common::to_string(&bytes));
19085 let response = common::to_response(parts, bytes.into());
19086
19087 if let common::Retry::After(d) =
19088 dlg.http_failure(&response, error.as_ref().ok())
19089 {
19090 sleep(d).await;
19091 continue;
19092 }
19093
19094 dlg.finished(false);
19095
19096 return Err(match error {
19097 Ok(value) => common::Error::BadRequest(value),
19098 _ => common::Error::Failure(response),
19099 });
19100 }
19101 let response = {
19102 let bytes = common::to_bytes(body).await.unwrap_or_default();
19103 let encoded = common::to_string(&bytes);
19104 match serde_json::from_str(&encoded) {
19105 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19106 Err(error) => {
19107 dlg.response_json_decode_error(&encoded, &error);
19108 return Err(common::Error::JsonDecodeError(
19109 encoded.to_string(),
19110 error,
19111 ));
19112 }
19113 }
19114 };
19115
19116 dlg.finished(true);
19117 return Ok(response);
19118 }
19119 }
19120 }
19121 }
19122
19123 /// Required. The relative resource name of the parent project for which to list each associated Service, in the format: ``` projects/{project_number} ```
19124 ///
19125 /// Sets the *parent* path property to the given value.
19126 ///
19127 /// Even though the property as already been set when instantiating this call,
19128 /// we provide this method for API completeness.
19129 pub fn parent(mut self, new_value: &str) -> ProjectServiceListCall<'a, C> {
19130 self._parent = new_value.to_string();
19131 self
19132 }
19133 /// 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.
19134 ///
19135 /// Sets the *page token* query property to the given value.
19136 pub fn page_token(mut self, new_value: &str) -> ProjectServiceListCall<'a, C> {
19137 self._page_token = Some(new_value.to_string());
19138 self
19139 }
19140 /// 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.
19141 ///
19142 /// Sets the *page size* query property to the given value.
19143 pub fn page_size(mut self, new_value: i32) -> ProjectServiceListCall<'a, C> {
19144 self._page_size = Some(new_value);
19145 self
19146 }
19147 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19148 /// while executing the actual API request.
19149 ///
19150 /// ````text
19151 /// It should be used to handle progress information, and to implement a certain level of resilience.
19152 /// ````
19153 ///
19154 /// Sets the *delegate* property to the given value.
19155 pub fn delegate(
19156 mut self,
19157 new_value: &'a mut dyn common::Delegate,
19158 ) -> ProjectServiceListCall<'a, C> {
19159 self._delegate = Some(new_value);
19160 self
19161 }
19162
19163 /// Set any additional parameter of the query string used in the request.
19164 /// It should be used to set parameters which are not yet available through their own
19165 /// setters.
19166 ///
19167 /// Please note that this method must not be used to set any of the known parameters
19168 /// which have their own setter method. If done anyway, the request will fail.
19169 ///
19170 /// # Additional Parameters
19171 ///
19172 /// * *$.xgafv* (query-string) - V1 error format.
19173 /// * *access_token* (query-string) - OAuth access token.
19174 /// * *alt* (query-string) - Data format for response.
19175 /// * *callback* (query-string) - JSONP
19176 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19177 /// * *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.
19178 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19179 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19180 /// * *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.
19181 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19182 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19183 pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceListCall<'a, C>
19184 where
19185 T: AsRef<str>,
19186 {
19187 self._additional_params
19188 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19189 self
19190 }
19191
19192 /// Identifies the authorization scope for the method you are building.
19193 ///
19194 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19195 /// [`Scope::CloudPlatform`].
19196 ///
19197 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19198 /// tokens for more than one scope.
19199 ///
19200 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19201 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19202 /// sufficient, a read-write scope will do as well.
19203 pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceListCall<'a, C>
19204 where
19205 St: AsRef<str>,
19206 {
19207 self._scopes.insert(String::from(scope.as_ref()));
19208 self
19209 }
19210 /// Identifies the authorization scope(s) for the method you are building.
19211 ///
19212 /// See [`Self::add_scope()`] for details.
19213 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceListCall<'a, C>
19214 where
19215 I: IntoIterator<Item = St>,
19216 St: AsRef<str>,
19217 {
19218 self._scopes
19219 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19220 self
19221 }
19222
19223 /// Removes all scopes, and no default scope will be used either.
19224 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19225 /// for details).
19226 pub fn clear_scopes(mut self) -> ProjectServiceListCall<'a, C> {
19227 self._scopes.clear();
19228 self
19229 }
19230}
19231
19232/// Updates the specified Service configuration.
19233///
19234/// A builder for the *services.patch* method supported by a *project* resource.
19235/// It is not used directly, but through a [`ProjectMethods`] instance.
19236///
19237/// # Example
19238///
19239/// Instantiate a resource method builder
19240///
19241/// ```test_harness,no_run
19242/// # extern crate hyper;
19243/// # extern crate hyper_rustls;
19244/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
19245/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaService;
19246/// # async fn dox() {
19247/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19248///
19249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19251/// # secret,
19252/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19253/// # ).build().await.unwrap();
19254///
19255/// # let client = hyper_util::client::legacy::Client::builder(
19256/// # hyper_util::rt::TokioExecutor::new()
19257/// # )
19258/// # .build(
19259/// # hyper_rustls::HttpsConnectorBuilder::new()
19260/// # .with_native_roots()
19261/// # .unwrap()
19262/// # .https_or_http()
19263/// # .enable_http1()
19264/// # .build()
19265/// # );
19266/// # let mut hub = Firebaseappcheck::new(client, auth);
19267/// // As the method needs a request, you would usually fill it with the desired information
19268/// // into the respective structure. Some of the parts shown here might not be applicable !
19269/// // Values shown here are possibly random and not representative !
19270/// let mut req = GoogleFirebaseAppcheckV1betaService::default();
19271///
19272/// // You can configure optional parameters by calling the respective setters at will, and
19273/// // execute the final call using `doit()`.
19274/// // Values shown here are possibly random and not representative !
19275/// let result = hub.projects().services_patch(req, "name")
19276/// .update_mask(FieldMask::new::<&str>(&[]))
19277/// .doit().await;
19278/// # }
19279/// ```
19280pub struct ProjectServicePatchCall<'a, C>
19281where
19282 C: 'a,
19283{
19284 hub: &'a Firebaseappcheck<C>,
19285 _request: GoogleFirebaseAppcheckV1betaService,
19286 _name: String,
19287 _update_mask: Option<common::FieldMask>,
19288 _delegate: Option<&'a mut dyn common::Delegate>,
19289 _additional_params: HashMap<String, String>,
19290 _scopes: BTreeSet<String>,
19291}
19292
19293impl<'a, C> common::CallBuilder for ProjectServicePatchCall<'a, C> {}
19294
19295impl<'a, C> ProjectServicePatchCall<'a, C>
19296where
19297 C: common::Connector,
19298{
19299 /// Perform the operation you have build so far.
19300 pub async fn doit(
19301 mut self,
19302 ) -> common::Result<(common::Response, GoogleFirebaseAppcheckV1betaService)> {
19303 use std::borrow::Cow;
19304 use std::io::{Read, Seek};
19305
19306 use common::{url::Params, ToParts};
19307 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19308
19309 let mut dd = common::DefaultDelegate;
19310 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19311 dlg.begin(common::MethodInfo {
19312 id: "firebaseappcheck.projects.services.patch",
19313 http_method: hyper::Method::PATCH,
19314 });
19315
19316 for &field in ["alt", "name", "updateMask"].iter() {
19317 if self._additional_params.contains_key(field) {
19318 dlg.finished(false);
19319 return Err(common::Error::FieldClash(field));
19320 }
19321 }
19322
19323 let mut params = Params::with_capacity(5 + self._additional_params.len());
19324 params.push("name", self._name);
19325 if let Some(value) = self._update_mask.as_ref() {
19326 params.push("updateMask", value.to_string());
19327 }
19328
19329 params.extend(self._additional_params.iter());
19330
19331 params.push("alt", "json");
19332 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
19333 if self._scopes.is_empty() {
19334 self._scopes
19335 .insert(Scope::CloudPlatform.as_ref().to_string());
19336 }
19337
19338 #[allow(clippy::single_element_loop)]
19339 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19340 url = params.uri_replacement(url, param_name, find_this, true);
19341 }
19342 {
19343 let to_remove = ["name"];
19344 params.remove_params(&to_remove);
19345 }
19346
19347 let url = params.parse_with_url(&url);
19348
19349 let mut json_mime_type = mime::APPLICATION_JSON;
19350 let mut request_value_reader = {
19351 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19352 common::remove_json_null_values(&mut value);
19353 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19354 serde_json::to_writer(&mut dst, &value).unwrap();
19355 dst
19356 };
19357 let request_size = request_value_reader
19358 .seek(std::io::SeekFrom::End(0))
19359 .unwrap();
19360 request_value_reader
19361 .seek(std::io::SeekFrom::Start(0))
19362 .unwrap();
19363
19364 loop {
19365 let token = match self
19366 .hub
19367 .auth
19368 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19369 .await
19370 {
19371 Ok(token) => token,
19372 Err(e) => match dlg.token(e) {
19373 Ok(token) => token,
19374 Err(e) => {
19375 dlg.finished(false);
19376 return Err(common::Error::MissingToken(e));
19377 }
19378 },
19379 };
19380 request_value_reader
19381 .seek(std::io::SeekFrom::Start(0))
19382 .unwrap();
19383 let mut req_result = {
19384 let client = &self.hub.client;
19385 dlg.pre_request();
19386 let mut req_builder = hyper::Request::builder()
19387 .method(hyper::Method::PATCH)
19388 .uri(url.as_str())
19389 .header(USER_AGENT, self.hub._user_agent.clone());
19390
19391 if let Some(token) = token.as_ref() {
19392 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19393 }
19394
19395 let request = req_builder
19396 .header(CONTENT_TYPE, json_mime_type.to_string())
19397 .header(CONTENT_LENGTH, request_size as u64)
19398 .body(common::to_body(
19399 request_value_reader.get_ref().clone().into(),
19400 ));
19401
19402 client.request(request.unwrap()).await
19403 };
19404
19405 match req_result {
19406 Err(err) => {
19407 if let common::Retry::After(d) = dlg.http_error(&err) {
19408 sleep(d).await;
19409 continue;
19410 }
19411 dlg.finished(false);
19412 return Err(common::Error::HttpError(err));
19413 }
19414 Ok(res) => {
19415 let (mut parts, body) = res.into_parts();
19416 let mut body = common::Body::new(body);
19417 if !parts.status.is_success() {
19418 let bytes = common::to_bytes(body).await.unwrap_or_default();
19419 let error = serde_json::from_str(&common::to_string(&bytes));
19420 let response = common::to_response(parts, bytes.into());
19421
19422 if let common::Retry::After(d) =
19423 dlg.http_failure(&response, error.as_ref().ok())
19424 {
19425 sleep(d).await;
19426 continue;
19427 }
19428
19429 dlg.finished(false);
19430
19431 return Err(match error {
19432 Ok(value) => common::Error::BadRequest(value),
19433 _ => common::Error::Failure(response),
19434 });
19435 }
19436 let response = {
19437 let bytes = common::to_bytes(body).await.unwrap_or_default();
19438 let encoded = common::to_string(&bytes);
19439 match serde_json::from_str(&encoded) {
19440 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19441 Err(error) => {
19442 dlg.response_json_decode_error(&encoded, &error);
19443 return Err(common::Error::JsonDecodeError(
19444 encoded.to_string(),
19445 error,
19446 ));
19447 }
19448 }
19449 };
19450
19451 dlg.finished(true);
19452 return Ok(response);
19453 }
19454 }
19455 }
19456 }
19457
19458 ///
19459 /// Sets the *request* property to the given value.
19460 ///
19461 /// Even though the property as already been set when instantiating this call,
19462 /// we provide this method for API completeness.
19463 pub fn request(
19464 mut self,
19465 new_value: GoogleFirebaseAppcheckV1betaService,
19466 ) -> ProjectServicePatchCall<'a, C> {
19467 self._request = new_value;
19468 self
19469 }
19470 /// 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)
19471 ///
19472 /// Sets the *name* path property to the given value.
19473 ///
19474 /// Even though the property as already been set when instantiating this call,
19475 /// we provide this method for API completeness.
19476 pub fn name(mut self, new_value: &str) -> ProjectServicePatchCall<'a, C> {
19477 self._name = new_value.to_string();
19478 self
19479 }
19480 /// Required. A comma-separated list of names of fields in the Service to update. Example: `enforcement_mode`.
19481 ///
19482 /// Sets the *update mask* query property to the given value.
19483 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectServicePatchCall<'a, C> {
19484 self._update_mask = Some(new_value);
19485 self
19486 }
19487 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19488 /// while executing the actual API request.
19489 ///
19490 /// ````text
19491 /// It should be used to handle progress information, and to implement a certain level of resilience.
19492 /// ````
19493 ///
19494 /// Sets the *delegate* property to the given value.
19495 pub fn delegate(
19496 mut self,
19497 new_value: &'a mut dyn common::Delegate,
19498 ) -> ProjectServicePatchCall<'a, C> {
19499 self._delegate = Some(new_value);
19500 self
19501 }
19502
19503 /// Set any additional parameter of the query string used in the request.
19504 /// It should be used to set parameters which are not yet available through their own
19505 /// setters.
19506 ///
19507 /// Please note that this method must not be used to set any of the known parameters
19508 /// which have their own setter method. If done anyway, the request will fail.
19509 ///
19510 /// # Additional Parameters
19511 ///
19512 /// * *$.xgafv* (query-string) - V1 error format.
19513 /// * *access_token* (query-string) - OAuth access token.
19514 /// * *alt* (query-string) - Data format for response.
19515 /// * *callback* (query-string) - JSONP
19516 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19517 /// * *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.
19518 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19519 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19520 /// * *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.
19521 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19522 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19523 pub fn param<T>(mut self, name: T, value: T) -> ProjectServicePatchCall<'a, C>
19524 where
19525 T: AsRef<str>,
19526 {
19527 self._additional_params
19528 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19529 self
19530 }
19531
19532 /// Identifies the authorization scope for the method you are building.
19533 ///
19534 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19535 /// [`Scope::CloudPlatform`].
19536 ///
19537 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19538 /// tokens for more than one scope.
19539 ///
19540 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19541 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19542 /// sufficient, a read-write scope will do as well.
19543 pub fn add_scope<St>(mut self, scope: St) -> ProjectServicePatchCall<'a, C>
19544 where
19545 St: AsRef<str>,
19546 {
19547 self._scopes.insert(String::from(scope.as_ref()));
19548 self
19549 }
19550 /// Identifies the authorization scope(s) for the method you are building.
19551 ///
19552 /// See [`Self::add_scope()`] for details.
19553 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServicePatchCall<'a, C>
19554 where
19555 I: IntoIterator<Item = St>,
19556 St: AsRef<str>,
19557 {
19558 self._scopes
19559 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19560 self
19561 }
19562
19563 /// Removes all scopes, and no default scope will be used either.
19564 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19565 /// for details).
19566 pub fn clear_scopes(mut self) -> ProjectServicePatchCall<'a, C> {
19567 self._scopes.clear();
19568 self
19569 }
19570}
19571
19572/// 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).
19573///
19574/// A builder for the *verifyAppCheckToken* method supported by a *project* resource.
19575/// It is not used directly, but through a [`ProjectMethods`] instance.
19576///
19577/// # Example
19578///
19579/// Instantiate a resource method builder
19580///
19581/// ```test_harness,no_run
19582/// # extern crate hyper;
19583/// # extern crate hyper_rustls;
19584/// # extern crate google_firebaseappcheck1_beta as firebaseappcheck1_beta;
19585/// use firebaseappcheck1_beta::api::GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest;
19586/// # async fn dox() {
19587/// # use firebaseappcheck1_beta::{Firebaseappcheck, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19588///
19589/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19590/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19591/// # secret,
19592/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19593/// # ).build().await.unwrap();
19594///
19595/// # let client = hyper_util::client::legacy::Client::builder(
19596/// # hyper_util::rt::TokioExecutor::new()
19597/// # )
19598/// # .build(
19599/// # hyper_rustls::HttpsConnectorBuilder::new()
19600/// # .with_native_roots()
19601/// # .unwrap()
19602/// # .https_or_http()
19603/// # .enable_http1()
19604/// # .build()
19605/// # );
19606/// # let mut hub = Firebaseappcheck::new(client, auth);
19607/// // As the method needs a request, you would usually fill it with the desired information
19608/// // into the respective structure. Some of the parts shown here might not be applicable !
19609/// // Values shown here are possibly random and not representative !
19610/// let mut req = GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest::default();
19611///
19612/// // You can configure optional parameters by calling the respective setters at will, and
19613/// // execute the final call using `doit()`.
19614/// // Values shown here are possibly random and not representative !
19615/// let result = hub.projects().verify_app_check_token(req, "project")
19616/// .doit().await;
19617/// # }
19618/// ```
19619pub struct ProjectVerifyAppCheckTokenCall<'a, C>
19620where
19621 C: 'a,
19622{
19623 hub: &'a Firebaseappcheck<C>,
19624 _request: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
19625 _project: String,
19626 _delegate: Option<&'a mut dyn common::Delegate>,
19627 _additional_params: HashMap<String, String>,
19628 _scopes: BTreeSet<String>,
19629}
19630
19631impl<'a, C> common::CallBuilder for ProjectVerifyAppCheckTokenCall<'a, C> {}
19632
19633impl<'a, C> ProjectVerifyAppCheckTokenCall<'a, C>
19634where
19635 C: common::Connector,
19636{
19637 /// Perform the operation you have build so far.
19638 pub async fn doit(
19639 mut self,
19640 ) -> common::Result<(
19641 common::Response,
19642 GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse,
19643 )> {
19644 use std::borrow::Cow;
19645 use std::io::{Read, Seek};
19646
19647 use common::{url::Params, ToParts};
19648 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19649
19650 let mut dd = common::DefaultDelegate;
19651 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19652 dlg.begin(common::MethodInfo {
19653 id: "firebaseappcheck.projects.verifyAppCheckToken",
19654 http_method: hyper::Method::POST,
19655 });
19656
19657 for &field in ["alt", "project"].iter() {
19658 if self._additional_params.contains_key(field) {
19659 dlg.finished(false);
19660 return Err(common::Error::FieldClash(field));
19661 }
19662 }
19663
19664 let mut params = Params::with_capacity(4 + self._additional_params.len());
19665 params.push("project", self._project);
19666
19667 params.extend(self._additional_params.iter());
19668
19669 params.push("alt", "json");
19670 let mut url = self.hub._base_url.clone() + "v1beta/{+project}:verifyAppCheckToken";
19671 if self._scopes.is_empty() {
19672 self._scopes
19673 .insert(Scope::CloudPlatform.as_ref().to_string());
19674 }
19675
19676 #[allow(clippy::single_element_loop)]
19677 for &(find_this, param_name) in [("{+project}", "project")].iter() {
19678 url = params.uri_replacement(url, param_name, find_this, true);
19679 }
19680 {
19681 let to_remove = ["project"];
19682 params.remove_params(&to_remove);
19683 }
19684
19685 let url = params.parse_with_url(&url);
19686
19687 let mut json_mime_type = mime::APPLICATION_JSON;
19688 let mut request_value_reader = {
19689 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19690 common::remove_json_null_values(&mut value);
19691 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19692 serde_json::to_writer(&mut dst, &value).unwrap();
19693 dst
19694 };
19695 let request_size = request_value_reader
19696 .seek(std::io::SeekFrom::End(0))
19697 .unwrap();
19698 request_value_reader
19699 .seek(std::io::SeekFrom::Start(0))
19700 .unwrap();
19701
19702 loop {
19703 let token = match self
19704 .hub
19705 .auth
19706 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19707 .await
19708 {
19709 Ok(token) => token,
19710 Err(e) => match dlg.token(e) {
19711 Ok(token) => token,
19712 Err(e) => {
19713 dlg.finished(false);
19714 return Err(common::Error::MissingToken(e));
19715 }
19716 },
19717 };
19718 request_value_reader
19719 .seek(std::io::SeekFrom::Start(0))
19720 .unwrap();
19721 let mut req_result = {
19722 let client = &self.hub.client;
19723 dlg.pre_request();
19724 let mut req_builder = hyper::Request::builder()
19725 .method(hyper::Method::POST)
19726 .uri(url.as_str())
19727 .header(USER_AGENT, self.hub._user_agent.clone());
19728
19729 if let Some(token) = token.as_ref() {
19730 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19731 }
19732
19733 let request = req_builder
19734 .header(CONTENT_TYPE, json_mime_type.to_string())
19735 .header(CONTENT_LENGTH, request_size as u64)
19736 .body(common::to_body(
19737 request_value_reader.get_ref().clone().into(),
19738 ));
19739
19740 client.request(request.unwrap()).await
19741 };
19742
19743 match req_result {
19744 Err(err) => {
19745 if let common::Retry::After(d) = dlg.http_error(&err) {
19746 sleep(d).await;
19747 continue;
19748 }
19749 dlg.finished(false);
19750 return Err(common::Error::HttpError(err));
19751 }
19752 Ok(res) => {
19753 let (mut parts, body) = res.into_parts();
19754 let mut body = common::Body::new(body);
19755 if !parts.status.is_success() {
19756 let bytes = common::to_bytes(body).await.unwrap_or_default();
19757 let error = serde_json::from_str(&common::to_string(&bytes));
19758 let response = common::to_response(parts, bytes.into());
19759
19760 if let common::Retry::After(d) =
19761 dlg.http_failure(&response, error.as_ref().ok())
19762 {
19763 sleep(d).await;
19764 continue;
19765 }
19766
19767 dlg.finished(false);
19768
19769 return Err(match error {
19770 Ok(value) => common::Error::BadRequest(value),
19771 _ => common::Error::Failure(response),
19772 });
19773 }
19774 let response = {
19775 let bytes = common::to_bytes(body).await.unwrap_or_default();
19776 let encoded = common::to_string(&bytes);
19777 match serde_json::from_str(&encoded) {
19778 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19779 Err(error) => {
19780 dlg.response_json_decode_error(&encoded, &error);
19781 return Err(common::Error::JsonDecodeError(
19782 encoded.to_string(),
19783 error,
19784 ));
19785 }
19786 }
19787 };
19788
19789 dlg.finished(true);
19790 return Ok(response);
19791 }
19792 }
19793 }
19794 }
19795
19796 ///
19797 /// Sets the *request* property to the given value.
19798 ///
19799 /// Even though the property as already been set when instantiating this call,
19800 /// we provide this method for API completeness.
19801 pub fn request(
19802 mut self,
19803 new_value: GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest,
19804 ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
19805 self._request = new_value;
19806 self
19807 }
19808 /// 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.
19809 ///
19810 /// Sets the *project* path property to the given value.
19811 ///
19812 /// Even though the property as already been set when instantiating this call,
19813 /// we provide this method for API completeness.
19814 pub fn project(mut self, new_value: &str) -> ProjectVerifyAppCheckTokenCall<'a, C> {
19815 self._project = new_value.to_string();
19816 self
19817 }
19818 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19819 /// while executing the actual API request.
19820 ///
19821 /// ````text
19822 /// It should be used to handle progress information, and to implement a certain level of resilience.
19823 /// ````
19824 ///
19825 /// Sets the *delegate* property to the given value.
19826 pub fn delegate(
19827 mut self,
19828 new_value: &'a mut dyn common::Delegate,
19829 ) -> ProjectVerifyAppCheckTokenCall<'a, C> {
19830 self._delegate = Some(new_value);
19831 self
19832 }
19833
19834 /// Set any additional parameter of the query string used in the request.
19835 /// It should be used to set parameters which are not yet available through their own
19836 /// setters.
19837 ///
19838 /// Please note that this method must not be used to set any of the known parameters
19839 /// which have their own setter method. If done anyway, the request will fail.
19840 ///
19841 /// # Additional Parameters
19842 ///
19843 /// * *$.xgafv* (query-string) - V1 error format.
19844 /// * *access_token* (query-string) - OAuth access token.
19845 /// * *alt* (query-string) - Data format for response.
19846 /// * *callback* (query-string) - JSONP
19847 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19848 /// * *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.
19849 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19850 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19851 /// * *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.
19852 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19853 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19854 pub fn param<T>(mut self, name: T, value: T) -> ProjectVerifyAppCheckTokenCall<'a, C>
19855 where
19856 T: AsRef<str>,
19857 {
19858 self._additional_params
19859 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19860 self
19861 }
19862
19863 /// Identifies the authorization scope for the method you are building.
19864 ///
19865 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19866 /// [`Scope::CloudPlatform`].
19867 ///
19868 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19869 /// tokens for more than one scope.
19870 ///
19871 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19872 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19873 /// sufficient, a read-write scope will do as well.
19874 pub fn add_scope<St>(mut self, scope: St) -> ProjectVerifyAppCheckTokenCall<'a, C>
19875 where
19876 St: AsRef<str>,
19877 {
19878 self._scopes.insert(String::from(scope.as_ref()));
19879 self
19880 }
19881 /// Identifies the authorization scope(s) for the method you are building.
19882 ///
19883 /// See [`Self::add_scope()`] for details.
19884 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectVerifyAppCheckTokenCall<'a, C>
19885 where
19886 I: IntoIterator<Item = St>,
19887 St: AsRef<str>,
19888 {
19889 self._scopes
19890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19891 self
19892 }
19893
19894 /// Removes all scopes, and no default scope will be used either.
19895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19896 /// for details).
19897 pub fn clear_scopes(mut self) -> ProjectVerifyAppCheckTokenCall<'a, C> {
19898 self._scopes.clear();
19899 self
19900 }
19901}