Skip to main content

google_identitytoolkit3/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// View and manage your data across Google Cloud Platform services
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 IdentityToolkit 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_identitytoolkit3 as identitytoolkit3;
53/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyVerifyAssertionRequest;
54/// use identitytoolkit3::{Result, Error};
55/// # async fn dox() {
56/// use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57///
58/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
59/// // `client_secret`, among other things.
60/// let secret: yup_oauth2::ApplicationSecret = Default::default();
61/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
62/// // unless you replace  `None` with the desired Flow.
63/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
64/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
65/// // retrieve them from storage.
66/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
67///     .with_native_roots()
68///     .unwrap()
69///     .https_only()
70///     .enable_http2()
71///     .build();
72///
73/// let executor = hyper_util::rt::TokioExecutor::new();
74/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
75///     secret,
76///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77///     yup_oauth2::client::CustomHyperClientBuilder::from(
78///         hyper_util::client::legacy::Client::builder(executor).build(connector),
79///     ),
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83///     hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86///     hyper_rustls::HttpsConnectorBuilder::new()
87///         .with_native_roots()
88///         .unwrap()
89///         .https_or_http()
90///         .enable_http2()
91///         .build()
92/// );
93/// let mut hub = IdentityToolkit::new(client, auth);
94/// // As the method needs a request, you would usually fill it with the desired information
95/// // into the respective structure. Some of the parts shown here might not be applicable !
96/// // Values shown here are possibly random and not representative !
97/// let mut req = IdentitytoolkitRelyingpartyVerifyAssertionRequest::default();
98///
99/// // You can configure optional parameters by calling the respective setters at will, and
100/// // execute the final call using `doit()`.
101/// // Values shown here are possibly random and not representative !
102/// let result = hub.relyingparty().verify_assertion(req)
103///              .doit().await;
104///
105/// match result {
106///     Err(e) => match e {
107///         // The Error enum provides details about what exactly happened.
108///         // You can also just use its `Debug`, `Display` or `Error` traits
109///          Error::HttpError(_)
110///         |Error::Io(_)
111///         |Error::MissingAPIKey
112///         |Error::MissingToken(_)
113///         |Error::Cancelled
114///         |Error::UploadSizeLimitExceeded(_, _)
115///         |Error::Failure(_)
116///         |Error::BadRequest(_)
117///         |Error::FieldClash(_)
118///         |Error::JsonDecodeError(_, _) => println!("{}", e),
119///     },
120///     Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct IdentityToolkit<C> {
126    pub client: common::Client<C>,
127    pub auth: Box<dyn common::GetToken>,
128    _user_agent: String,
129    _base_url: String,
130    _root_url: String,
131}
132
133impl<C> common::Hub for IdentityToolkit<C> {}
134
135impl<'a, C> IdentityToolkit<C> {
136    pub fn new<A: 'static + common::GetToken>(
137        client: common::Client<C>,
138        auth: A,
139    ) -> IdentityToolkit<C> {
140        IdentityToolkit {
141            client,
142            auth: Box::new(auth),
143            _user_agent: "google-api-rust-client/7.0.0".to_string(),
144            _base_url: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/".to_string(),
145            _root_url: "https://www.googleapis.com/".to_string(),
146        }
147    }
148
149    pub fn relyingparty(&'a self) -> RelyingpartyMethods<'a, C> {
150        RelyingpartyMethods { hub: self }
151    }
152
153    /// Set the user-agent header field to use in all requests to the server.
154    /// It defaults to `google-api-rust-client/7.0.0`.
155    ///
156    /// Returns the previously set user-agent.
157    pub fn user_agent(&mut self, agent_name: String) -> String {
158        std::mem::replace(&mut self._user_agent, agent_name)
159    }
160
161    /// Set the base url to use in all requests to the server.
162    /// It defaults to `https://www.googleapis.com/identitytoolkit/v3/relyingparty/`.
163    ///
164    /// Returns the previously set base url.
165    pub fn base_url(&mut self, new_base_url: String) -> String {
166        std::mem::replace(&mut self._base_url, new_base_url)
167    }
168
169    /// Set the root url to use in all requests to the server.
170    /// It defaults to `https://www.googleapis.com/`.
171    ///
172    /// Returns the previously set root url.
173    pub fn root_url(&mut self, new_root_url: String) -> String {
174        std::mem::replace(&mut self._root_url, new_root_url)
175    }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// Response of creating the IDP authentication URL.
182///
183/// # Activities
184///
185/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
186/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
187///
188/// * [create auth uri relyingparty](RelyingpartyCreateAuthUriCall) (response)
189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
190#[serde_with::serde_as]
191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
192pub struct CreateAuthUriResponse {
193    /// all providers the user has once used to do federated login
194    #[serde(rename = "allProviders")]
195    pub all_providers: Option<Vec<String>>,
196    /// The URI used by the IDP to authenticate the user.
197    #[serde(rename = "authUri")]
198    pub auth_uri: Option<String>,
199    /// True if captcha is required.
200    #[serde(rename = "captchaRequired")]
201    pub captcha_required: Option<bool>,
202    /// True if the authUri is for user's existing provider.
203    #[serde(rename = "forExistingProvider")]
204    pub for_existing_provider: Option<bool>,
205    /// The fixed string identitytoolkit#CreateAuthUriResponse".
206    pub kind: Option<String>,
207    /// The provider ID of the auth URI.
208    #[serde(rename = "providerId")]
209    pub provider_id: Option<String>,
210    /// Whether the user is registered if the identifier is an email.
211    pub registered: Option<bool>,
212    /// Session ID which should be passed in the following verifyAssertion request.
213    #[serde(rename = "sessionId")]
214    pub session_id: Option<String>,
215    /// All sign-in methods this user has used.
216    #[serde(rename = "signinMethods")]
217    pub signin_methods: Option<Vec<String>>,
218}
219
220impl common::ResponseResult for CreateAuthUriResponse {}
221
222/// Respone of deleting account.
223///
224/// # Activities
225///
226/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
227/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
228///
229/// * [delete account relyingparty](RelyingpartyDeleteAccountCall) (response)
230#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
231#[serde_with::serde_as]
232#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
233pub struct DeleteAccountResponse {
234    /// The fixed string "identitytoolkit#DeleteAccountResponse".
235    pub kind: Option<String>,
236}
237
238impl common::ResponseResult for DeleteAccountResponse {}
239
240/// Response of downloading accounts in batch.
241///
242/// # Activities
243///
244/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
245/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
246///
247/// * [download account relyingparty](RelyingpartyDownloadAccountCall) (response)
248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
249#[serde_with::serde_as]
250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
251pub struct DownloadAccountResponse {
252    /// The fixed string "identitytoolkit#DownloadAccountResponse".
253    pub kind: Option<String>,
254    /// The next page token. To be used in a subsequent request to return the next page of results.
255    #[serde(rename = "nextPageToken")]
256    pub next_page_token: Option<String>,
257    /// The user accounts data.
258    pub users: Option<Vec<UserInfo>>,
259}
260
261impl common::ResponseResult for DownloadAccountResponse {}
262
263/// Response of email signIn.
264///
265/// # Activities
266///
267/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
268/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
269///
270/// * [email link signin relyingparty](RelyingpartyEmailLinkSigninCall) (response)
271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
272#[serde_with::serde_as]
273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
274pub struct EmailLinkSigninResponse {
275    /// The user's email.
276    pub email: Option<String>,
277    /// Expiration time of STS id token in seconds.
278    #[serde(rename = "expiresIn")]
279    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
280    pub expires_in: Option<i64>,
281    /// The STS id token to login the newly signed in user.
282    #[serde(rename = "idToken")]
283    pub id_token: Option<String>,
284    /// Whether the user is new.
285    #[serde(rename = "isNewUser")]
286    pub is_new_user: Option<bool>,
287    /// The fixed string "identitytoolkit#EmailLinkSigninResponse".
288    pub kind: Option<String>,
289    /// The RP local ID of the user.
290    #[serde(rename = "localId")]
291    pub local_id: Option<String>,
292    /// The refresh token for the signed in user.
293    #[serde(rename = "refreshToken")]
294    pub refresh_token: Option<String>,
295}
296
297impl common::ResponseResult for EmailLinkSigninResponse {}
298
299/// Template for an email template.
300///
301/// This type is not used in any activity, and only used as *part* of another schema.
302///
303#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
304#[serde_with::serde_as]
305#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
306pub struct EmailTemplate {
307    /// Email body.
308    pub body: Option<String>,
309    /// Email body format.
310    pub format: Option<String>,
311    /// From address of the email.
312    pub from: Option<String>,
313    /// From display name.
314    #[serde(rename = "fromDisplayName")]
315    pub from_display_name: Option<String>,
316    /// Reply-to address.
317    #[serde(rename = "replyTo")]
318    pub reply_to: Option<String>,
319    /// Subject of the email.
320    pub subject: Option<String>,
321}
322
323impl common::Part for EmailTemplate {}
324
325/// Response of getting account information.
326///
327/// # Activities
328///
329/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
330/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
331///
332/// * [get account info relyingparty](RelyingpartyGetAccountInfoCall) (response)
333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
334#[serde_with::serde_as]
335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
336pub struct GetAccountInfoResponse {
337    /// The fixed string "identitytoolkit#GetAccountInfoResponse".
338    pub kind: Option<String>,
339    /// The info of the users.
340    pub users: Option<Vec<UserInfo>>,
341}
342
343impl common::ResponseResult for GetAccountInfoResponse {}
344
345/// Response of getting a code for user confirmation (reset password, change email etc.).
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/// * [get oob confirmation code relyingparty](RelyingpartyGetOobConfirmationCodeCall) (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 GetOobConfirmationCodeResponse {
357    /// The email address that the email is sent to.
358    pub email: Option<String>,
359    /// The fixed string "identitytoolkit#GetOobConfirmationCodeResponse".
360    pub kind: Option<String>,
361    /// The code to be send to the user.
362    #[serde(rename = "oobCode")]
363    pub oob_code: Option<String>,
364}
365
366impl common::ResponseResult for GetOobConfirmationCodeResponse {}
367
368/// Response of getting recaptcha param.
369///
370/// # Activities
371///
372/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
373/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
374///
375/// * [get recaptcha param relyingparty](RelyingpartyGetRecaptchaParamCall) (response)
376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
377#[serde_with::serde_as]
378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
379pub struct GetRecaptchaParamResponse {
380    /// The fixed string "identitytoolkit#GetRecaptchaParamResponse".
381    pub kind: Option<String>,
382    /// Site key registered at recaptcha.
383    #[serde(rename = "recaptchaSiteKey")]
384    pub recaptcha_site_key: Option<String>,
385    /// The stoken field for the recaptcha widget, used to request captcha challenge.
386    #[serde(rename = "recaptchaStoken")]
387    pub recaptcha_stoken: Option<String>,
388}
389
390impl common::ResponseResult for GetRecaptchaParamResponse {}
391
392/// Request to get the IDP authentication URL.
393///
394/// # Activities
395///
396/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
397/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
398///
399/// * [create auth uri relyingparty](RelyingpartyCreateAuthUriCall) (request)
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct IdentitytoolkitRelyingpartyCreateAuthUriRequest {
404    /// The app ID of the mobile app, base64(CERT_SHA1):PACKAGE_NAME for Android, BUNDLE_ID for iOS.
405    #[serde(rename = "appId")]
406    pub app_id: Option<String>,
407    /// Explicitly specify the auth flow type. Currently only support "CODE_FLOW" type. The field is only used for Google provider.
408    #[serde(rename = "authFlowType")]
409    pub auth_flow_type: Option<String>,
410    /// The relying party OAuth client ID.
411    #[serde(rename = "clientId")]
412    pub client_id: Option<String>,
413    /// The opaque value used by the client to maintain context info between the authentication request and the IDP callback.
414    pub context: Option<String>,
415    /// The URI to which the IDP redirects the user after the federated login flow.
416    #[serde(rename = "continueUri")]
417    pub continue_uri: Option<String>,
418    /// The query parameter that client can customize by themselves in auth url. The following parameters are reserved for server so that they cannot be customized by clients: client_id, response_type, scope, redirect_uri, state, oauth_token.
419    #[serde(rename = "customParameter")]
420    pub custom_parameter: Option<HashMap<String, String>>,
421    /// The hosted domain to restrict sign-in to accounts at that domain for Google Apps hosted accounts.
422    #[serde(rename = "hostedDomain")]
423    pub hosted_domain: Option<String>,
424    /// The email or federated ID of the user.
425    pub identifier: Option<String>,
426    /// The developer's consumer key for OpenId OAuth Extension
427    #[serde(rename = "oauthConsumerKey")]
428    pub oauth_consumer_key: Option<String>,
429    /// Additional oauth scopes, beyond the basid user profile, that the user would be prompted to grant
430    #[serde(rename = "oauthScope")]
431    pub oauth_scope: Option<String>,
432    /// Optional realm for OpenID protocol. The sub string "scheme://domain:port" of the param "continueUri" is used if this is not set.
433    #[serde(rename = "openidRealm")]
434    pub openid_realm: Option<String>,
435    /// The native app package for OTA installation.
436    #[serde(rename = "otaApp")]
437    pub ota_app: Option<String>,
438    /// The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, live.net and yahoo.com. For other OpenID IdPs it's the OP identifier.
439    #[serde(rename = "providerId")]
440    pub provider_id: Option<String>,
441    /// The session_id passed by client.
442    #[serde(rename = "sessionId")]
443    pub session_id: Option<String>,
444    /// For multi-tenant use cases, in order to construct sign-in URL with the correct IDP parameters, Firebear needs to know which Tenant to retrieve IDP configs from.
445    #[serde(rename = "tenantId")]
446    pub tenant_id: Option<String>,
447    /// Tenant project number to be used for idp discovery.
448    #[serde(rename = "tenantProjectNumber")]
449    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
450    pub tenant_project_number: Option<u64>,
451}
452
453impl common::RequestValue for IdentitytoolkitRelyingpartyCreateAuthUriRequest {}
454
455/// Request to delete account.
456///
457/// # Activities
458///
459/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
460/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
461///
462/// * [delete account relyingparty](RelyingpartyDeleteAccountCall) (request)
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct IdentitytoolkitRelyingpartyDeleteAccountRequest {
467    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
468    #[serde(rename = "delegatedProjectNumber")]
469    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
470    pub delegated_project_number: Option<i64>,
471    /// The GITKit token or STS id token of the authenticated user.
472    #[serde(rename = "idToken")]
473    pub id_token: Option<String>,
474    /// The local ID of the user.
475    #[serde(rename = "localId")]
476    pub local_id: Option<String>,
477}
478
479impl common::RequestValue for IdentitytoolkitRelyingpartyDeleteAccountRequest {}
480
481/// Request to download user account in batch.
482///
483/// # Activities
484///
485/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
486/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
487///
488/// * [download account relyingparty](RelyingpartyDownloadAccountCall) (request)
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct IdentitytoolkitRelyingpartyDownloadAccountRequest {
493    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
494    #[serde(rename = "delegatedProjectNumber")]
495    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
496    pub delegated_project_number: Option<i64>,
497    /// The max number of results to return in the response.
498    #[serde(rename = "maxResults")]
499    pub max_results: Option<u32>,
500    /// The token for the next page. This should be taken from the previous response.
501    #[serde(rename = "nextPageToken")]
502    pub next_page_token: Option<String>,
503    /// Specify which project (field value is actually project id) to operate. Only used when provided credential.
504    #[serde(rename = "targetProjectId")]
505    pub target_project_id: Option<String>,
506}
507
508impl common::RequestValue for IdentitytoolkitRelyingpartyDownloadAccountRequest {}
509
510/// Request to sign in with email.
511///
512/// # Activities
513///
514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
516///
517/// * [email link signin relyingparty](RelyingpartyEmailLinkSigninCall) (request)
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct IdentitytoolkitRelyingpartyEmailLinkSigninRequest {
522    /// The email address of the user.
523    pub email: Option<String>,
524    /// Token for linking flow.
525    #[serde(rename = "idToken")]
526    pub id_token: Option<String>,
527    /// The confirmation code.
528    #[serde(rename = "oobCode")]
529    pub oob_code: Option<String>,
530}
531
532impl common::RequestValue for IdentitytoolkitRelyingpartyEmailLinkSigninRequest {}
533
534/// Request to get the account information.
535///
536/// # Activities
537///
538/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
539/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
540///
541/// * [get account info relyingparty](RelyingpartyGetAccountInfoCall) (request)
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct IdentitytoolkitRelyingpartyGetAccountInfoRequest {
546    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
547    #[serde(rename = "delegatedProjectNumber")]
548    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
549    pub delegated_project_number: Option<i64>,
550    /// The list of emails of the users to inquiry.
551    pub email: Option<Vec<String>>,
552    /// The GITKit token of the authenticated user.
553    #[serde(rename = "idToken")]
554    pub id_token: Option<String>,
555    /// The list of local ID's of the users to inquiry.
556    #[serde(rename = "localId")]
557    pub local_id: Option<Vec<String>>,
558    /// Privileged caller can query users by specified phone number.
559    #[serde(rename = "phoneNumber")]
560    pub phone_number: Option<Vec<String>>,
561}
562
563impl common::RequestValue for IdentitytoolkitRelyingpartyGetAccountInfoRequest {}
564
565/// Response of getting the project configuration.
566///
567/// # Activities
568///
569/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
570/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
571///
572/// * [get project config relyingparty](RelyingpartyGetProjectConfigCall) (response)
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct IdentitytoolkitRelyingpartyGetProjectConfigResponse {
577    /// Whether to allow password user sign in or sign up.
578    #[serde(rename = "allowPasswordUser")]
579    pub allow_password_user: Option<bool>,
580    /// Browser API key, needed when making http request to Apiary.
581    #[serde(rename = "apiKey")]
582    pub api_key: Option<String>,
583    /// Authorized domains.
584    #[serde(rename = "authorizedDomains")]
585    pub authorized_domains: Option<Vec<String>>,
586    /// Change email template.
587    #[serde(rename = "changeEmailTemplate")]
588    pub change_email_template: Option<EmailTemplate>,
589    /// no description provided
590    #[serde(rename = "dynamicLinksDomain")]
591    pub dynamic_links_domain: Option<String>,
592    /// Whether anonymous user is enabled.
593    #[serde(rename = "enableAnonymousUser")]
594    pub enable_anonymous_user: Option<bool>,
595    /// OAuth2 provider configuration.
596    #[serde(rename = "idpConfig")]
597    pub idp_config: Option<Vec<IdpConfig>>,
598    /// Legacy reset password email template.
599    #[serde(rename = "legacyResetPasswordTemplate")]
600    pub legacy_reset_password_template: Option<EmailTemplate>,
601    /// Project ID of the relying party.
602    #[serde(rename = "projectId")]
603    pub project_id: Option<String>,
604    /// Reset password email template.
605    #[serde(rename = "resetPasswordTemplate")]
606    pub reset_password_template: Option<EmailTemplate>,
607    /// Whether to use email sending provided by Firebear.
608    #[serde(rename = "useEmailSending")]
609    pub use_email_sending: Option<bool>,
610    /// Verify email template.
611    #[serde(rename = "verifyEmailTemplate")]
612    pub verify_email_template: Option<EmailTemplate>,
613}
614
615impl common::ResponseResult for IdentitytoolkitRelyingpartyGetProjectConfigResponse {}
616
617/// Respone of getting public keys.
618///
619/// # Activities
620///
621/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
622/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
623///
624/// * [get public keys relyingparty](RelyingpartyGetPublicKeyCall) (response)
625#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
626#[serde_with::serde_as]
627#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
628pub struct IdentitytoolkitRelyingpartyGetPublicKeysResponse(pub Option<HashMap<String, String>>);
629
630impl common::ResponseResult for IdentitytoolkitRelyingpartyGetPublicKeysResponse {}
631
632/// Request to reset the password.
633///
634/// # Activities
635///
636/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
637/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
638///
639/// * [reset password relyingparty](RelyingpartyResetPasswordCall) (request)
640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
641#[serde_with::serde_as]
642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
643pub struct IdentitytoolkitRelyingpartyResetPasswordRequest {
644    /// The email address of the user.
645    pub email: Option<String>,
646    /// The new password inputted by the user.
647    #[serde(rename = "newPassword")]
648    pub new_password: Option<String>,
649    /// The old password inputted by the user.
650    #[serde(rename = "oldPassword")]
651    pub old_password: Option<String>,
652    /// The confirmation code.
653    #[serde(rename = "oobCode")]
654    pub oob_code: Option<String>,
655}
656
657impl common::RequestValue for IdentitytoolkitRelyingpartyResetPasswordRequest {}
658
659/// Request for Identitytoolkit-SendVerificationCode
660///
661/// # Activities
662///
663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
665///
666/// * [send verification code relyingparty](RelyingpartySendVerificationCodeCall) (request)
667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
668#[serde_with::serde_as]
669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
670pub struct IdentitytoolkitRelyingpartySendVerificationCodeRequest {
671    /// Receipt of successful app token validation with APNS.
672    #[serde(rename = "iosReceipt")]
673    pub ios_receipt: Option<String>,
674    /// Secret delivered to iOS app via APNS.
675    #[serde(rename = "iosSecret")]
676    pub ios_secret: Option<String>,
677    /// The phone number to send the verification code to in E.164 format.
678    #[serde(rename = "phoneNumber")]
679    pub phone_number: Option<String>,
680    /// Recaptcha solution.
681    #[serde(rename = "recaptchaToken")]
682    pub recaptcha_token: Option<String>,
683}
684
685impl common::RequestValue for IdentitytoolkitRelyingpartySendVerificationCodeRequest {}
686
687/// Response for Identitytoolkit-SendVerificationCode
688///
689/// # Activities
690///
691/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
692/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
693///
694/// * [send verification code relyingparty](RelyingpartySendVerificationCodeCall) (response)
695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
696#[serde_with::serde_as]
697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
698pub struct IdentitytoolkitRelyingpartySendVerificationCodeResponse {
699    /// Encrypted session information
700    #[serde(rename = "sessionInfo")]
701    pub session_info: Option<String>,
702}
703
704impl common::ResponseResult for IdentitytoolkitRelyingpartySendVerificationCodeResponse {}
705
706/// Request to set the account information.
707///
708/// # Activities
709///
710/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
711/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
712///
713/// * [set account info relyingparty](RelyingpartySetAccountInfoCall) (request)
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct IdentitytoolkitRelyingpartySetAccountInfoRequest {
718    /// The captcha challenge.
719    #[serde(rename = "captchaChallenge")]
720    pub captcha_challenge: Option<String>,
721    /// Response to the captcha.
722    #[serde(rename = "captchaResponse")]
723    pub captcha_response: Option<String>,
724    /// The timestamp when the account is created.
725    #[serde(rename = "createdAt")]
726    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
727    pub created_at: Option<i64>,
728    /// The custom attributes to be set in the user's id token.
729    #[serde(rename = "customAttributes")]
730    pub custom_attributes: Option<String>,
731    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
732    #[serde(rename = "delegatedProjectNumber")]
733    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
734    pub delegated_project_number: Option<i64>,
735    /// The attributes users request to delete.
736    #[serde(rename = "deleteAttribute")]
737    pub delete_attribute: Option<Vec<String>>,
738    /// The IDPs the user request to delete.
739    #[serde(rename = "deleteProvider")]
740    pub delete_provider: Option<Vec<String>>,
741    /// Whether to disable the user.
742    #[serde(rename = "disableUser")]
743    pub disable_user: Option<bool>,
744    /// The name of the user.
745    #[serde(rename = "displayName")]
746    pub display_name: Option<String>,
747    /// The email of the user.
748    pub email: Option<String>,
749    /// Mark the email as verified or not.
750    #[serde(rename = "emailVerified")]
751    pub email_verified: Option<bool>,
752    /// The GITKit token of the authenticated user.
753    #[serde(rename = "idToken")]
754    pub id_token: Option<String>,
755    /// Instance id token of the app.
756    #[serde(rename = "instanceId")]
757    pub instance_id: Option<String>,
758    /// Last login timestamp.
759    #[serde(rename = "lastLoginAt")]
760    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
761    pub last_login_at: Option<i64>,
762    /// The local ID of the user.
763    #[serde(rename = "localId")]
764    pub local_id: Option<String>,
765    /// The out-of-band code of the change email request.
766    #[serde(rename = "oobCode")]
767    pub oob_code: Option<String>,
768    /// The new password of the user.
769    pub password: Option<String>,
770    /// Privileged caller can update user with specified phone number.
771    #[serde(rename = "phoneNumber")]
772    pub phone_number: Option<String>,
773    /// The photo url of the user.
774    #[serde(rename = "photoUrl")]
775    pub photo_url: Option<String>,
776    /// The associated IDPs of the user.
777    pub provider: Option<Vec<String>>,
778    /// Whether return sts id token and refresh token instead of gitkit token.
779    #[serde(rename = "returnSecureToken")]
780    pub return_secure_token: Option<bool>,
781    /// Mark the user to upgrade to federated login.
782    #[serde(rename = "upgradeToFederatedLogin")]
783    pub upgrade_to_federated_login: Option<bool>,
784    /// Timestamp in seconds for valid login token.
785    #[serde(rename = "validSince")]
786    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
787    pub valid_since: Option<i64>,
788}
789
790impl common::RequestValue for IdentitytoolkitRelyingpartySetAccountInfoRequest {}
791
792/// Request to set the project configuration.
793///
794/// # Activities
795///
796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
798///
799/// * [set project config relyingparty](RelyingpartySetProjectConfigCall) (request)
800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
801#[serde_with::serde_as]
802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
803pub struct IdentitytoolkitRelyingpartySetProjectConfigRequest {
804    /// Whether to allow password user sign in or sign up.
805    #[serde(rename = "allowPasswordUser")]
806    pub allow_password_user: Option<bool>,
807    /// Browser API key, needed when making http request to Apiary.
808    #[serde(rename = "apiKey")]
809    pub api_key: Option<String>,
810    /// Authorized domains for widget redirect.
811    #[serde(rename = "authorizedDomains")]
812    pub authorized_domains: Option<Vec<String>>,
813    /// Change email template.
814    #[serde(rename = "changeEmailTemplate")]
815    pub change_email_template: Option<EmailTemplate>,
816    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
817    #[serde(rename = "delegatedProjectNumber")]
818    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
819    pub delegated_project_number: Option<i64>,
820    /// Whether to enable anonymous user.
821    #[serde(rename = "enableAnonymousUser")]
822    pub enable_anonymous_user: Option<bool>,
823    /// Oauth2 provider configuration.
824    #[serde(rename = "idpConfig")]
825    pub idp_config: Option<Vec<IdpConfig>>,
826    /// Legacy reset password email template.
827    #[serde(rename = "legacyResetPasswordTemplate")]
828    pub legacy_reset_password_template: Option<EmailTemplate>,
829    /// Reset password email template.
830    #[serde(rename = "resetPasswordTemplate")]
831    pub reset_password_template: Option<EmailTemplate>,
832    /// Whether to use email sending provided by Firebear.
833    #[serde(rename = "useEmailSending")]
834    pub use_email_sending: Option<bool>,
835    /// Verify email template.
836    #[serde(rename = "verifyEmailTemplate")]
837    pub verify_email_template: Option<EmailTemplate>,
838}
839
840impl common::RequestValue for IdentitytoolkitRelyingpartySetProjectConfigRequest {}
841
842/// Response of setting the project configuration.
843///
844/// # Activities
845///
846/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
847/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
848///
849/// * [set project config relyingparty](RelyingpartySetProjectConfigCall) (response)
850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
851#[serde_with::serde_as]
852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
853pub struct IdentitytoolkitRelyingpartySetProjectConfigResponse {
854    /// Project ID of the relying party.
855    #[serde(rename = "projectId")]
856    pub project_id: Option<String>,
857}
858
859impl common::ResponseResult for IdentitytoolkitRelyingpartySetProjectConfigResponse {}
860
861/// Request to sign out user.
862///
863/// # Activities
864///
865/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
866/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
867///
868/// * [sign out user relyingparty](RelyingpartySignOutUserCall) (request)
869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
870#[serde_with::serde_as]
871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
872pub struct IdentitytoolkitRelyingpartySignOutUserRequest {
873    /// Instance id token of the app.
874    #[serde(rename = "instanceId")]
875    pub instance_id: Option<String>,
876    /// The local ID of the user.
877    #[serde(rename = "localId")]
878    pub local_id: Option<String>,
879}
880
881impl common::RequestValue for IdentitytoolkitRelyingpartySignOutUserRequest {}
882
883/// Response of signing out user.
884///
885/// # Activities
886///
887/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
888/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
889///
890/// * [sign out user relyingparty](RelyingpartySignOutUserCall) (response)
891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
892#[serde_with::serde_as]
893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
894pub struct IdentitytoolkitRelyingpartySignOutUserResponse {
895    /// The local ID of the user.
896    #[serde(rename = "localId")]
897    pub local_id: Option<String>,
898}
899
900impl common::ResponseResult for IdentitytoolkitRelyingpartySignOutUserResponse {}
901
902/// Request to signup new user, create anonymous user or anonymous user reauth.
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/// * [signup new user relyingparty](RelyingpartySignupNewUserCall) (request)
910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
911#[serde_with::serde_as]
912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
913pub struct IdentitytoolkitRelyingpartySignupNewUserRequest {
914    /// The captcha challenge.
915    #[serde(rename = "captchaChallenge")]
916    pub captcha_challenge: Option<String>,
917    /// Response to the captcha.
918    #[serde(rename = "captchaResponse")]
919    pub captcha_response: Option<String>,
920    /// Whether to disable the user. Only can be used by service account.
921    pub disabled: Option<bool>,
922    /// The name of the user.
923    #[serde(rename = "displayName")]
924    pub display_name: Option<String>,
925    /// The email of the user.
926    pub email: Option<String>,
927    /// Mark the email as verified or not. Only can be used by service account.
928    #[serde(rename = "emailVerified")]
929    pub email_verified: Option<bool>,
930    /// The GITKit token of the authenticated user.
931    #[serde(rename = "idToken")]
932    pub id_token: Option<String>,
933    /// Instance id token of the app.
934    #[serde(rename = "instanceId")]
935    pub instance_id: Option<String>,
936    /// Privileged caller can create user with specified user id.
937    #[serde(rename = "localId")]
938    pub local_id: Option<String>,
939    /// The new password of the user.
940    pub password: Option<String>,
941    /// Privileged caller can create user with specified phone number.
942    #[serde(rename = "phoneNumber")]
943    pub phone_number: Option<String>,
944    /// The photo url of the user.
945    #[serde(rename = "photoUrl")]
946    pub photo_url: Option<String>,
947    /// For multi-tenant use cases, in order to construct sign-in URL with the correct IDP parameters, Firebear needs to know which Tenant to retrieve IDP configs from.
948    #[serde(rename = "tenantId")]
949    pub tenant_id: Option<String>,
950    /// Tenant project number to be used for idp discovery.
951    #[serde(rename = "tenantProjectNumber")]
952    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
953    pub tenant_project_number: Option<u64>,
954}
955
956impl common::RequestValue for IdentitytoolkitRelyingpartySignupNewUserRequest {}
957
958/// Request to upload user account in batch.
959///
960/// # Activities
961///
962/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
963/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
964///
965/// * [upload account relyingparty](RelyingpartyUploadAccountCall) (request)
966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
967#[serde_with::serde_as]
968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
969pub struct IdentitytoolkitRelyingpartyUploadAccountRequest {
970    /// Whether allow overwrite existing account when user local_id exists.
971    #[serde(rename = "allowOverwrite")]
972    pub allow_overwrite: Option<bool>,
973    /// no description provided
974    #[serde(rename = "blockSize")]
975    pub block_size: Option<i32>,
976    /// The following 4 fields are for standard scrypt algorithm.
977    #[serde(rename = "cpuMemCost")]
978    pub cpu_mem_cost: Option<i32>,
979    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
980    #[serde(rename = "delegatedProjectNumber")]
981    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
982    pub delegated_project_number: Option<i64>,
983    /// no description provided
984    #[serde(rename = "dkLen")]
985    pub dk_len: Option<i32>,
986    /// The password hash algorithm.
987    #[serde(rename = "hashAlgorithm")]
988    pub hash_algorithm: Option<String>,
989    /// Memory cost for hash calculation. Used by scrypt similar algorithms.
990    #[serde(rename = "memoryCost")]
991    pub memory_cost: Option<i32>,
992    /// no description provided
993    pub parallelization: Option<i32>,
994    /// Rounds for hash calculation. Used by scrypt and similar algorithms.
995    pub rounds: Option<i32>,
996    /// The salt separator.
997    #[serde(rename = "saltSeparator")]
998    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
999    pub salt_separator: Option<Vec<u8>>,
1000    /// If true, backend will do sanity check(including duplicate email and federated id) when uploading account.
1001    #[serde(rename = "sanityCheck")]
1002    pub sanity_check: Option<bool>,
1003    /// The key for to hash the password.
1004    #[serde(rename = "signerKey")]
1005    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1006    pub signer_key: Option<Vec<u8>>,
1007    /// Specify which project (field value is actually project id) to operate. Only used when provided credential.
1008    #[serde(rename = "targetProjectId")]
1009    pub target_project_id: Option<String>,
1010    /// The account info to be stored.
1011    pub users: Option<Vec<UserInfo>>,
1012}
1013
1014impl common::RequestValue for IdentitytoolkitRelyingpartyUploadAccountRequest {}
1015
1016/// Request to verify the IDP assertion.
1017///
1018/// # Activities
1019///
1020/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1021/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1022///
1023/// * [verify assertion relyingparty](RelyingpartyVerifyAssertionCall) (request)
1024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1025#[serde_with::serde_as]
1026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1027pub struct IdentitytoolkitRelyingpartyVerifyAssertionRequest {
1028    /// When it's true, automatically creates a new account if the user doesn't exist. When it's false, allows existing user to sign in normally and throws exception if the user doesn't exist.
1029    #[serde(rename = "autoCreate")]
1030    pub auto_create: Option<bool>,
1031    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
1032    #[serde(rename = "delegatedProjectNumber")]
1033    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1034    pub delegated_project_number: Option<i64>,
1035    /// The GITKit token of the authenticated user.
1036    #[serde(rename = "idToken")]
1037    pub id_token: Option<String>,
1038    /// Instance id token of the app.
1039    #[serde(rename = "instanceId")]
1040    pub instance_id: Option<String>,
1041    /// The GITKit token for the non-trusted IDP pending to be confirmed by the user.
1042    #[serde(rename = "pendingIdToken")]
1043    pub pending_id_token: Option<String>,
1044    /// The post body if the request is a HTTP POST.
1045    #[serde(rename = "postBody")]
1046    pub post_body: Option<String>,
1047    /// The URI to which the IDP redirects the user back. It may contain federated login result params added by the IDP.
1048    #[serde(rename = "requestUri")]
1049    pub request_uri: Option<String>,
1050    /// Whether return 200 and IDP credential rather than throw exception when federated id is already linked.
1051    #[serde(rename = "returnIdpCredential")]
1052    pub return_idp_credential: Option<bool>,
1053    /// Whether to return refresh tokens.
1054    #[serde(rename = "returnRefreshToken")]
1055    pub return_refresh_token: Option<bool>,
1056    /// Whether return sts id token and refresh token instead of gitkit token.
1057    #[serde(rename = "returnSecureToken")]
1058    pub return_secure_token: Option<bool>,
1059    /// Session ID, which should match the one in previous createAuthUri request.
1060    #[serde(rename = "sessionId")]
1061    pub session_id: Option<String>,
1062    /// For multi-tenant use cases, in order to construct sign-in URL with the correct IDP parameters, Firebear needs to know which Tenant to retrieve IDP configs from.
1063    #[serde(rename = "tenantId")]
1064    pub tenant_id: Option<String>,
1065    /// Tenant project number to be used for idp discovery.
1066    #[serde(rename = "tenantProjectNumber")]
1067    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1068    pub tenant_project_number: Option<u64>,
1069}
1070
1071impl common::RequestValue for IdentitytoolkitRelyingpartyVerifyAssertionRequest {}
1072
1073/// Request to verify a custom token
1074///
1075/// # Activities
1076///
1077/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1078/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1079///
1080/// * [verify custom token relyingparty](RelyingpartyVerifyCustomTokenCall) (request)
1081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1082#[serde_with::serde_as]
1083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1084pub struct IdentitytoolkitRelyingpartyVerifyCustomTokenRequest {
1085    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
1086    #[serde(rename = "delegatedProjectNumber")]
1087    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1088    pub delegated_project_number: Option<i64>,
1089    /// Instance id token of the app.
1090    #[serde(rename = "instanceId")]
1091    pub instance_id: Option<String>,
1092    /// Whether return sts id token and refresh token instead of gitkit token.
1093    #[serde(rename = "returnSecureToken")]
1094    pub return_secure_token: Option<bool>,
1095    /// The custom token to verify
1096    pub token: Option<String>,
1097}
1098
1099impl common::RequestValue for IdentitytoolkitRelyingpartyVerifyCustomTokenRequest {}
1100
1101/// Request to verify the password.
1102///
1103/// # Activities
1104///
1105/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1106/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1107///
1108/// * [verify password relyingparty](RelyingpartyVerifyPasswordCall) (request)
1109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1110#[serde_with::serde_as]
1111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1112pub struct IdentitytoolkitRelyingpartyVerifyPasswordRequest {
1113    /// The captcha challenge.
1114    #[serde(rename = "captchaChallenge")]
1115    pub captcha_challenge: Option<String>,
1116    /// Response to the captcha.
1117    #[serde(rename = "captchaResponse")]
1118    pub captcha_response: Option<String>,
1119    /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
1120    #[serde(rename = "delegatedProjectNumber")]
1121    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1122    pub delegated_project_number: Option<i64>,
1123    /// The email of the user.
1124    pub email: Option<String>,
1125    /// The GITKit token of the authenticated user.
1126    #[serde(rename = "idToken")]
1127    pub id_token: Option<String>,
1128    /// Instance id token of the app.
1129    #[serde(rename = "instanceId")]
1130    pub instance_id: Option<String>,
1131    /// The password inputed by the user.
1132    pub password: Option<String>,
1133    /// The GITKit token for the non-trusted IDP, which is to be confirmed by the user.
1134    #[serde(rename = "pendingIdToken")]
1135    pub pending_id_token: Option<String>,
1136    /// Whether return sts id token and refresh token instead of gitkit token.
1137    #[serde(rename = "returnSecureToken")]
1138    pub return_secure_token: Option<bool>,
1139    /// For multi-tenant use cases, in order to construct sign-in URL with the correct IDP parameters, Firebear needs to know which Tenant to retrieve IDP configs from.
1140    #[serde(rename = "tenantId")]
1141    pub tenant_id: Option<String>,
1142    /// Tenant project number to be used for idp discovery.
1143    #[serde(rename = "tenantProjectNumber")]
1144    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1145    pub tenant_project_number: Option<u64>,
1146}
1147
1148impl common::RequestValue for IdentitytoolkitRelyingpartyVerifyPasswordRequest {}
1149
1150/// Request for Identitytoolkit-VerifyPhoneNumber
1151///
1152/// # Activities
1153///
1154/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1155/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1156///
1157/// * [verify phone number relyingparty](RelyingpartyVerifyPhoneNumberCall) (request)
1158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1159#[serde_with::serde_as]
1160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1161pub struct IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest {
1162    /// no description provided
1163    pub code: Option<String>,
1164    /// no description provided
1165    #[serde(rename = "idToken")]
1166    pub id_token: Option<String>,
1167    /// no description provided
1168    pub operation: Option<String>,
1169    /// no description provided
1170    #[serde(rename = "phoneNumber")]
1171    pub phone_number: Option<String>,
1172    /// The session info previously returned by IdentityToolkit-SendVerificationCode.
1173    #[serde(rename = "sessionInfo")]
1174    pub session_info: Option<String>,
1175    /// no description provided
1176    #[serde(rename = "temporaryProof")]
1177    pub temporary_proof: Option<String>,
1178    /// no description provided
1179    #[serde(rename = "verificationProof")]
1180    pub verification_proof: Option<String>,
1181}
1182
1183impl common::RequestValue for IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest {}
1184
1185/// Response for Identitytoolkit-VerifyPhoneNumber
1186///
1187/// # Activities
1188///
1189/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1190/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1191///
1192/// * [verify phone number relyingparty](RelyingpartyVerifyPhoneNumberCall) (response)
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct IdentitytoolkitRelyingpartyVerifyPhoneNumberResponse {
1197    /// no description provided
1198    #[serde(rename = "expiresIn")]
1199    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1200    pub expires_in: Option<i64>,
1201    /// no description provided
1202    #[serde(rename = "idToken")]
1203    pub id_token: Option<String>,
1204    /// no description provided
1205    #[serde(rename = "isNewUser")]
1206    pub is_new_user: Option<bool>,
1207    /// no description provided
1208    #[serde(rename = "localId")]
1209    pub local_id: Option<String>,
1210    /// no description provided
1211    #[serde(rename = "phoneNumber")]
1212    pub phone_number: Option<String>,
1213    /// no description provided
1214    #[serde(rename = "refreshToken")]
1215    pub refresh_token: Option<String>,
1216    /// no description provided
1217    #[serde(rename = "temporaryProof")]
1218    pub temporary_proof: Option<String>,
1219    /// no description provided
1220    #[serde(rename = "temporaryProofExpiresIn")]
1221    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1222    pub temporary_proof_expires_in: Option<i64>,
1223    /// no description provided
1224    #[serde(rename = "verificationProof")]
1225    pub verification_proof: Option<String>,
1226    /// no description provided
1227    #[serde(rename = "verificationProofExpiresIn")]
1228    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1229    pub verification_proof_expires_in: Option<i64>,
1230}
1231
1232impl common::ResponseResult for IdentitytoolkitRelyingpartyVerifyPhoneNumberResponse {}
1233
1234/// Template for a single idp configuration.
1235///
1236/// This type is not used in any activity, and only used as *part* of another schema.
1237///
1238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1239#[serde_with::serde_as]
1240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1241pub struct IdpConfig {
1242    /// OAuth2 client ID.
1243    #[serde(rename = "clientId")]
1244    pub client_id: Option<String>,
1245    /// Whether this IDP is enabled.
1246    pub enabled: Option<bool>,
1247    /// Percent of users who will be prompted/redirected federated login for this IDP.
1248    #[serde(rename = "experimentPercent")]
1249    pub experiment_percent: Option<i32>,
1250    /// OAuth2 provider.
1251    pub provider: Option<String>,
1252    /// OAuth2 client secret.
1253    pub secret: Option<String>,
1254    /// Whitelisted client IDs for audience check.
1255    #[serde(rename = "whitelistedAudiences")]
1256    pub whitelisted_audiences: Option<Vec<String>>,
1257}
1258
1259impl common::Part for IdpConfig {}
1260
1261/// Request of getting a code for user confirmation (reset password, change email etc.)
1262///
1263/// # Activities
1264///
1265/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1266/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1267///
1268/// * [get oob confirmation code relyingparty](RelyingpartyGetOobConfirmationCodeCall) (request)
1269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1270#[serde_with::serde_as]
1271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1272pub struct Relyingparty {
1273    /// whether or not to install the android app on the device where the link is opened
1274    #[serde(rename = "androidInstallApp")]
1275    pub android_install_app: Option<bool>,
1276    /// minimum version of the app. if the version on the device is lower than this version then the user is taken to the play store to upgrade the app
1277    #[serde(rename = "androidMinimumVersion")]
1278    pub android_minimum_version: Option<String>,
1279    /// android package name of the android app to handle the action code
1280    #[serde(rename = "androidPackageName")]
1281    pub android_package_name: Option<String>,
1282    /// whether or not the app can handle the oob code without first going to web
1283    #[serde(rename = "canHandleCodeInApp")]
1284    pub can_handle_code_in_app: Option<bool>,
1285    /// The recaptcha response from the user.
1286    #[serde(rename = "captchaResp")]
1287    pub captcha_resp: Option<String>,
1288    /// The recaptcha challenge presented to the user.
1289    pub challenge: Option<String>,
1290    /// The url to continue to the Gitkit app
1291    #[serde(rename = "continueUrl")]
1292    pub continue_url: Option<String>,
1293    /// The email of the user.
1294    pub email: Option<String>,
1295    /// iOS app store id to download the app if it's not already installed
1296    #[serde(rename = "iOSAppStoreId")]
1297    pub i_os_app_store_id: Option<String>,
1298    /// the iOS bundle id of iOS app to handle the action code
1299    #[serde(rename = "iOSBundleId")]
1300    pub i_os_bundle_id: Option<String>,
1301    /// The user's Gitkit login token for email change.
1302    #[serde(rename = "idToken")]
1303    pub id_token: Option<String>,
1304    /// The fixed string "identitytoolkit#relyingparty".
1305    pub kind: Option<String>,
1306    /// The new email if the code is for email change.
1307    #[serde(rename = "newEmail")]
1308    pub new_email: Option<String>,
1309    /// The request type.
1310    #[serde(rename = "requestType")]
1311    pub request_type: Option<String>,
1312    /// The IP address of the user.
1313    #[serde(rename = "userIp")]
1314    pub user_ip: Option<String>,
1315}
1316
1317impl common::RequestValue for Relyingparty {}
1318
1319/// Response of resetting the password.
1320///
1321/// # Activities
1322///
1323/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1324/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1325///
1326/// * [reset password relyingparty](RelyingpartyResetPasswordCall) (response)
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct ResetPasswordResponse {
1331    /// The user's email. If the out-of-band code is for email recovery, the user's original email.
1332    pub email: Option<String>,
1333    /// The fixed string "identitytoolkit#ResetPasswordResponse".
1334    pub kind: Option<String>,
1335    /// If the out-of-band code is for email recovery, the user's new email.
1336    #[serde(rename = "newEmail")]
1337    pub new_email: Option<String>,
1338    /// The request type.
1339    #[serde(rename = "requestType")]
1340    pub request_type: Option<String>,
1341}
1342
1343impl common::ResponseResult for ResetPasswordResponse {}
1344
1345/// Respone of setting the account information.
1346///
1347/// # Activities
1348///
1349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1351///
1352/// * [set account info relyingparty](RelyingpartySetAccountInfoCall) (response)
1353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1354#[serde_with::serde_as]
1355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1356pub struct SetAccountInfoResponse {
1357    /// The name of the user.
1358    #[serde(rename = "displayName")]
1359    pub display_name: Option<String>,
1360    /// The email of the user.
1361    pub email: Option<String>,
1362    /// If email has been verified.
1363    #[serde(rename = "emailVerified")]
1364    pub email_verified: Option<bool>,
1365    /// If idToken is STS id token, then this field will be expiration time of STS id token in seconds.
1366    #[serde(rename = "expiresIn")]
1367    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1368    pub expires_in: Option<i64>,
1369    /// The Gitkit id token to login the newly sign up user.
1370    #[serde(rename = "idToken")]
1371    pub id_token: Option<String>,
1372    /// The fixed string "identitytoolkit#SetAccountInfoResponse".
1373    pub kind: Option<String>,
1374    /// The local ID of the user.
1375    #[serde(rename = "localId")]
1376    pub local_id: Option<String>,
1377    /// The new email the user attempts to change to.
1378    #[serde(rename = "newEmail")]
1379    pub new_email: Option<String>,
1380    /// The user's hashed password.
1381    #[serde(rename = "passwordHash")]
1382    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1383    pub password_hash: Option<Vec<u8>>,
1384    /// The photo url of the user.
1385    #[serde(rename = "photoUrl")]
1386    pub photo_url: Option<String>,
1387    /// The user's profiles at the associated IdPs.
1388    #[serde(rename = "providerUserInfo")]
1389    pub provider_user_info: Option<Vec<SetAccountInfoResponseProviderUserInfo>>,
1390    /// If idToken is STS id token, then this field will be refresh token.
1391    #[serde(rename = "refreshToken")]
1392    pub refresh_token: Option<String>,
1393}
1394
1395impl common::ResponseResult for SetAccountInfoResponse {}
1396
1397/// Response of signing up new user, creating anonymous user or anonymous user reauth.
1398///
1399/// # Activities
1400///
1401/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1402/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1403///
1404/// * [signup new user relyingparty](RelyingpartySignupNewUserCall) (response)
1405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1406#[serde_with::serde_as]
1407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1408pub struct SignupNewUserResponse {
1409    /// The name of the user.
1410    #[serde(rename = "displayName")]
1411    pub display_name: Option<String>,
1412    /// The email of the user.
1413    pub email: Option<String>,
1414    /// If idToken is STS id token, then this field will be expiration time of STS id token in seconds.
1415    #[serde(rename = "expiresIn")]
1416    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1417    pub expires_in: Option<i64>,
1418    /// The Gitkit id token to login the newly sign up user.
1419    #[serde(rename = "idToken")]
1420    pub id_token: Option<String>,
1421    /// The fixed string "identitytoolkit#SignupNewUserResponse".
1422    pub kind: Option<String>,
1423    /// The RP local ID of the user.
1424    #[serde(rename = "localId")]
1425    pub local_id: Option<String>,
1426    /// If idToken is STS id token, then this field will be refresh token.
1427    #[serde(rename = "refreshToken")]
1428    pub refresh_token: Option<String>,
1429}
1430
1431impl common::ResponseResult for SignupNewUserResponse {}
1432
1433/// Respone of uploading accounts in batch.
1434///
1435/// # Activities
1436///
1437/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1438/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1439///
1440/// * [upload account relyingparty](RelyingpartyUploadAccountCall) (response)
1441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1442#[serde_with::serde_as]
1443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1444pub struct UploadAccountResponse {
1445    /// The error encountered while processing the account info.
1446    pub error: Option<Vec<UploadAccountResponseError>>,
1447    /// The fixed string "identitytoolkit#UploadAccountResponse".
1448    pub kind: Option<String>,
1449}
1450
1451impl common::ResponseResult for UploadAccountResponse {}
1452
1453/// Template for an individual account info.
1454///
1455/// This type is not used in any activity, and only used as *part* of another schema.
1456///
1457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1458#[serde_with::serde_as]
1459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1460pub struct UserInfo {
1461    /// User creation timestamp.
1462    #[serde(rename = "createdAt")]
1463    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1464    pub created_at: Option<i64>,
1465    /// The custom attributes to be set in the user's id token.
1466    #[serde(rename = "customAttributes")]
1467    pub custom_attributes: Option<String>,
1468    /// Whether the user is authenticated by the developer.
1469    #[serde(rename = "customAuth")]
1470    pub custom_auth: Option<bool>,
1471    /// Whether the user is disabled.
1472    pub disabled: Option<bool>,
1473    /// The name of the user.
1474    #[serde(rename = "displayName")]
1475    pub display_name: Option<String>,
1476    /// The email of the user.
1477    pub email: Option<String>,
1478    /// Whether the email has been verified.
1479    #[serde(rename = "emailVerified")]
1480    pub email_verified: Option<bool>,
1481    /// last login timestamp.
1482    #[serde(rename = "lastLoginAt")]
1483    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1484    pub last_login_at: Option<i64>,
1485    /// The local ID of the user.
1486    #[serde(rename = "localId")]
1487    pub local_id: Option<String>,
1488    /// The user's hashed password.
1489    #[serde(rename = "passwordHash")]
1490    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1491    pub password_hash: Option<Vec<u8>>,
1492    /// The timestamp when the password was last updated.
1493    #[serde(rename = "passwordUpdatedAt")]
1494    pub password_updated_at: Option<f64>,
1495    /// User's phone number.
1496    #[serde(rename = "phoneNumber")]
1497    pub phone_number: Option<String>,
1498    /// The URL of the user profile photo.
1499    #[serde(rename = "photoUrl")]
1500    pub photo_url: Option<String>,
1501    /// The IDP of the user.
1502    #[serde(rename = "providerUserInfo")]
1503    pub provider_user_info: Option<Vec<UserInfoProviderUserInfo>>,
1504    /// The user's plain text password.
1505    #[serde(rename = "rawPassword")]
1506    pub raw_password: Option<String>,
1507    /// The user's password salt.
1508    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1509    pub salt: Option<Vec<u8>>,
1510    /// User's screen name at Twitter or login name at Github.
1511    #[serde(rename = "screenName")]
1512    pub screen_name: Option<String>,
1513    /// Timestamp in seconds for valid login token.
1514    #[serde(rename = "validSince")]
1515    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1516    pub valid_since: Option<i64>,
1517    /// Version of the user's password.
1518    pub version: Option<i32>,
1519}
1520
1521impl common::Part for UserInfo {}
1522
1523/// Response of verifying the IDP assertion.
1524///
1525/// # Activities
1526///
1527/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1528/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1529///
1530/// * [verify assertion relyingparty](RelyingpartyVerifyAssertionCall) (response)
1531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1532#[serde_with::serde_as]
1533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1534pub struct VerifyAssertionResponse {
1535    /// The action code.
1536    pub action: Option<String>,
1537    /// URL for OTA app installation.
1538    #[serde(rename = "appInstallationUrl")]
1539    pub app_installation_url: Option<String>,
1540    /// The custom scheme used by mobile app.
1541    #[serde(rename = "appScheme")]
1542    pub app_scheme: Option<String>,
1543    /// The opaque value used by the client to maintain context info between the authentication request and the IDP callback.
1544    pub context: Option<String>,
1545    /// The birth date of the IdP account.
1546    #[serde(rename = "dateOfBirth")]
1547    pub date_of_birth: Option<String>,
1548    /// The display name of the user.
1549    #[serde(rename = "displayName")]
1550    pub display_name: Option<String>,
1551    /// The email returned by the IdP. NOTE: The federated login user may not own the email.
1552    pub email: Option<String>,
1553    /// It's true if the email is recycled.
1554    #[serde(rename = "emailRecycled")]
1555    pub email_recycled: Option<bool>,
1556    /// The value is true if the IDP is also the email provider. It means the user owns the email.
1557    #[serde(rename = "emailVerified")]
1558    pub email_verified: Option<bool>,
1559    /// Client error code.
1560    #[serde(rename = "errorMessage")]
1561    pub error_message: Option<String>,
1562    /// If idToken is STS id token, then this field will be expiration time of STS id token in seconds.
1563    #[serde(rename = "expiresIn")]
1564    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1565    pub expires_in: Option<i64>,
1566    /// The unique ID identifies the IdP account.
1567    #[serde(rename = "federatedId")]
1568    pub federated_id: Option<String>,
1569    /// The first name of the user.
1570    #[serde(rename = "firstName")]
1571    pub first_name: Option<String>,
1572    /// The full name of the user.
1573    #[serde(rename = "fullName")]
1574    pub full_name: Option<String>,
1575    /// The ID token.
1576    #[serde(rename = "idToken")]
1577    pub id_token: Option<String>,
1578    /// It's the identifier param in the createAuthUri request if the identifier is an email. It can be used to check whether the user input email is different from the asserted email.
1579    #[serde(rename = "inputEmail")]
1580    pub input_email: Option<String>,
1581    /// True if it's a new user sign-in, false if it's a returning user.
1582    #[serde(rename = "isNewUser")]
1583    pub is_new_user: Option<bool>,
1584    /// The fixed string "identitytoolkit#VerifyAssertionResponse".
1585    pub kind: Option<String>,
1586    /// The language preference of the user.
1587    pub language: Option<String>,
1588    /// The last name of the user.
1589    #[serde(rename = "lastName")]
1590    pub last_name: Option<String>,
1591    /// The RP local ID if it's already been mapped to the IdP account identified by the federated ID.
1592    #[serde(rename = "localId")]
1593    pub local_id: Option<String>,
1594    /// Whether the assertion is from a non-trusted IDP and need account linking confirmation.
1595    #[serde(rename = "needConfirmation")]
1596    pub need_confirmation: Option<bool>,
1597    /// Whether need client to supply email to complete the federated login flow.
1598    #[serde(rename = "needEmail")]
1599    pub need_email: Option<bool>,
1600    /// The nick name of the user.
1601    #[serde(rename = "nickName")]
1602    pub nick_name: Option<String>,
1603    /// The OAuth2 access token.
1604    #[serde(rename = "oauthAccessToken")]
1605    pub oauth_access_token: Option<String>,
1606    /// The OAuth2 authorization code.
1607    #[serde(rename = "oauthAuthorizationCode")]
1608    pub oauth_authorization_code: Option<String>,
1609    /// The lifetime in seconds of the OAuth2 access token.
1610    #[serde(rename = "oauthExpireIn")]
1611    pub oauth_expire_in: Option<i32>,
1612    /// The OIDC id token.
1613    #[serde(rename = "oauthIdToken")]
1614    pub oauth_id_token: Option<String>,
1615    /// The user approved request token for the OpenID OAuth extension.
1616    #[serde(rename = "oauthRequestToken")]
1617    pub oauth_request_token: Option<String>,
1618    /// The scope for the OpenID OAuth extension.
1619    #[serde(rename = "oauthScope")]
1620    pub oauth_scope: Option<String>,
1621    /// The OAuth1 access token secret.
1622    #[serde(rename = "oauthTokenSecret")]
1623    pub oauth_token_secret: Option<String>,
1624    /// The original email stored in the mapping storage. It's returned when the federated ID is associated to a different email.
1625    #[serde(rename = "originalEmail")]
1626    pub original_email: Option<String>,
1627    /// The URI of the public accessible profiel picture.
1628    #[serde(rename = "photoUrl")]
1629    pub photo_url: Option<String>,
1630    /// The IdP ID. For white listed IdPs it's a short domain name e.g. google.com, aol.com, live.net and yahoo.com. If the "providerId" param is set to OpenID OP identifer other than the whilte listed IdPs the OP identifier is returned. If the "identifier" param is federated ID in the createAuthUri request. The domain part of the federated ID is returned.
1631    #[serde(rename = "providerId")]
1632    pub provider_id: Option<String>,
1633    /// Raw IDP-returned user info.
1634    #[serde(rename = "rawUserInfo")]
1635    pub raw_user_info: Option<String>,
1636    /// If idToken is STS id token, then this field will be refresh token.
1637    #[serde(rename = "refreshToken")]
1638    pub refresh_token: Option<String>,
1639    /// The screen_name of a Twitter user or the login name at Github.
1640    #[serde(rename = "screenName")]
1641    pub screen_name: Option<String>,
1642    /// The timezone of the user.
1643    #[serde(rename = "timeZone")]
1644    pub time_zone: Option<String>,
1645    /// When action is 'map', contains the idps which can be used for confirmation.
1646    #[serde(rename = "verifiedProvider")]
1647    pub verified_provider: Option<Vec<String>>,
1648}
1649
1650impl common::ResponseResult for VerifyAssertionResponse {}
1651
1652/// Response from verifying a custom token
1653///
1654/// # Activities
1655///
1656/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1657/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1658///
1659/// * [verify custom token relyingparty](RelyingpartyVerifyCustomTokenCall) (response)
1660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1661#[serde_with::serde_as]
1662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1663pub struct VerifyCustomTokenResponse {
1664    /// If idToken is STS id token, then this field will be expiration time of STS id token in seconds.
1665    #[serde(rename = "expiresIn")]
1666    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1667    pub expires_in: Option<i64>,
1668    /// The GITKit token for authenticated user.
1669    #[serde(rename = "idToken")]
1670    pub id_token: Option<String>,
1671    /// True if it's a new user sign-in, false if it's a returning user.
1672    #[serde(rename = "isNewUser")]
1673    pub is_new_user: Option<bool>,
1674    /// The fixed string "identitytoolkit#VerifyCustomTokenResponse".
1675    pub kind: Option<String>,
1676    /// If idToken is STS id token, then this field will be refresh token.
1677    #[serde(rename = "refreshToken")]
1678    pub refresh_token: Option<String>,
1679}
1680
1681impl common::ResponseResult for VerifyCustomTokenResponse {}
1682
1683/// Request of verifying the password.
1684///
1685/// # Activities
1686///
1687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1689///
1690/// * [verify password relyingparty](RelyingpartyVerifyPasswordCall) (response)
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct VerifyPasswordResponse {
1695    /// The name of the user.
1696    #[serde(rename = "displayName")]
1697    pub display_name: Option<String>,
1698    /// The email returned by the IdP. NOTE: The federated login user may not own the email.
1699    pub email: Option<String>,
1700    /// If idToken is STS id token, then this field will be expiration time of STS id token in seconds.
1701    #[serde(rename = "expiresIn")]
1702    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1703    pub expires_in: Option<i64>,
1704    /// The GITKit token for authenticated user.
1705    #[serde(rename = "idToken")]
1706    pub id_token: Option<String>,
1707    /// The fixed string "identitytoolkit#VerifyPasswordResponse".
1708    pub kind: Option<String>,
1709    /// The RP local ID if it's already been mapped to the IdP account identified by the federated ID.
1710    #[serde(rename = "localId")]
1711    pub local_id: Option<String>,
1712    /// The OAuth2 access token.
1713    #[serde(rename = "oauthAccessToken")]
1714    pub oauth_access_token: Option<String>,
1715    /// The OAuth2 authorization code.
1716    #[serde(rename = "oauthAuthorizationCode")]
1717    pub oauth_authorization_code: Option<String>,
1718    /// The lifetime in seconds of the OAuth2 access token.
1719    #[serde(rename = "oauthExpireIn")]
1720    pub oauth_expire_in: Option<i32>,
1721    /// The URI of the user's photo at IdP
1722    #[serde(rename = "photoUrl")]
1723    pub photo_url: Option<String>,
1724    /// If idToken is STS id token, then this field will be refresh token.
1725    #[serde(rename = "refreshToken")]
1726    pub refresh_token: Option<String>,
1727    /// Whether the email is registered.
1728    pub registered: Option<bool>,
1729}
1730
1731impl common::ResponseResult for VerifyPasswordResponse {}
1732
1733/// The user's profiles at the associated IdPs.
1734///
1735/// This type is not used in any activity, and only used as *part* of another schema.
1736///
1737#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1738#[serde_with::serde_as]
1739#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1740pub struct SetAccountInfoResponseProviderUserInfo {
1741    /// The user's display name at the IDP.
1742    #[serde(rename = "displayName")]
1743    pub display_name: Option<String>,
1744    /// User's identifier at IDP.
1745    #[serde(rename = "federatedId")]
1746    pub federated_id: Option<String>,
1747    /// The user's photo url at the IDP.
1748    #[serde(rename = "photoUrl")]
1749    pub photo_url: Option<String>,
1750    /// The IdP ID. For whitelisted IdPs it's a short domain name, e.g., google.com, aol.com, live.net and yahoo.com. For other OpenID IdPs it's the OP identifier.
1751    #[serde(rename = "providerId")]
1752    pub provider_id: Option<String>,
1753}
1754
1755impl common::NestedType for SetAccountInfoResponseProviderUserInfo {}
1756impl common::Part for SetAccountInfoResponseProviderUserInfo {}
1757
1758/// The error encountered while processing the account info.
1759///
1760/// This type is not used in any activity, and only used as *part* of another schema.
1761///
1762#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1763#[serde_with::serde_as]
1764#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1765pub struct UploadAccountResponseError {
1766    /// The index of the malformed account, starting from 0.
1767    pub index: Option<i32>,
1768    /// Detailed error message for the account info.
1769    pub message: Option<String>,
1770}
1771
1772impl common::NestedType for UploadAccountResponseError {}
1773impl common::Part for UploadAccountResponseError {}
1774
1775/// The IDP of the user.
1776///
1777/// This type is not used in any activity, and only used as *part* of another schema.
1778///
1779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1780#[serde_with::serde_as]
1781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1782pub struct UserInfoProviderUserInfo {
1783    /// The user's display name at the IDP.
1784    #[serde(rename = "displayName")]
1785    pub display_name: Option<String>,
1786    /// User's email at IDP.
1787    pub email: Option<String>,
1788    /// User's identifier at IDP.
1789    #[serde(rename = "federatedId")]
1790    pub federated_id: Option<String>,
1791    /// User's phone number.
1792    #[serde(rename = "phoneNumber")]
1793    pub phone_number: Option<String>,
1794    /// The user's photo url at the IDP.
1795    #[serde(rename = "photoUrl")]
1796    pub photo_url: Option<String>,
1797    /// The IdP ID. For white listed IdPs it's a short domain name, e.g., google.com, aol.com, live.net and yahoo.com. For other OpenID IdPs it's the OP identifier.
1798    #[serde(rename = "providerId")]
1799    pub provider_id: Option<String>,
1800    /// User's raw identifier directly returned from IDP.
1801    #[serde(rename = "rawId")]
1802    pub raw_id: Option<String>,
1803    /// User's screen name at Twitter or login name at Github.
1804    #[serde(rename = "screenName")]
1805    pub screen_name: Option<String>,
1806}
1807
1808impl common::NestedType for UserInfoProviderUserInfo {}
1809impl common::Part for UserInfoProviderUserInfo {}
1810
1811// ###################
1812// MethodBuilders ###
1813// #################
1814
1815/// A builder providing access to all methods supported on *relyingparty* resources.
1816/// It is not used directly, but through the [`IdentityToolkit`] hub.
1817///
1818/// # Example
1819///
1820/// Instantiate a resource builder
1821///
1822/// ```test_harness,no_run
1823/// extern crate hyper;
1824/// extern crate hyper_rustls;
1825/// extern crate google_identitytoolkit3 as identitytoolkit3;
1826///
1827/// # async fn dox() {
1828/// use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1829///
1830/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1831/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1832///     .with_native_roots()
1833///     .unwrap()
1834///     .https_only()
1835///     .enable_http2()
1836///     .build();
1837///
1838/// let executor = hyper_util::rt::TokioExecutor::new();
1839/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1840///     secret,
1841///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1842///     yup_oauth2::client::CustomHyperClientBuilder::from(
1843///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1844///     ),
1845/// ).build().await.unwrap();
1846///
1847/// let client = hyper_util::client::legacy::Client::builder(
1848///     hyper_util::rt::TokioExecutor::new()
1849/// )
1850/// .build(
1851///     hyper_rustls::HttpsConnectorBuilder::new()
1852///         .with_native_roots()
1853///         .unwrap()
1854///         .https_or_http()
1855///         .enable_http2()
1856///         .build()
1857/// );
1858/// let mut hub = IdentityToolkit::new(client, auth);
1859/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1860/// // like `create_auth_uri(...)`, `delete_account(...)`, `download_account(...)`, `email_link_signin(...)`, `get_account_info(...)`, `get_oob_confirmation_code(...)`, `get_project_config(...)`, `get_public_keys(...)`, `get_recaptcha_param(...)`, `reset_password(...)`, `send_verification_code(...)`, `set_account_info(...)`, `set_project_config(...)`, `sign_out_user(...)`, `signup_new_user(...)`, `upload_account(...)`, `verify_assertion(...)`, `verify_custom_token(...)`, `verify_password(...)` and `verify_phone_number(...)`
1861/// // to build up your call.
1862/// let rb = hub.relyingparty();
1863/// # }
1864/// ```
1865pub struct RelyingpartyMethods<'a, C>
1866where
1867    C: 'a,
1868{
1869    hub: &'a IdentityToolkit<C>,
1870}
1871
1872impl<'a, C> common::MethodsBuilder for RelyingpartyMethods<'a, C> {}
1873
1874impl<'a, C> RelyingpartyMethods<'a, C> {
1875    /// Create a builder to help you perform the following task:
1876    ///
1877    /// Creates the URI used by the IdP to authenticate the user.
1878    ///
1879    /// # Arguments
1880    ///
1881    /// * `request` - No description provided.
1882    pub fn create_auth_uri(
1883        &self,
1884        request: IdentitytoolkitRelyingpartyCreateAuthUriRequest,
1885    ) -> RelyingpartyCreateAuthUriCall<'a, C> {
1886        RelyingpartyCreateAuthUriCall {
1887            hub: self.hub,
1888            _request: request,
1889            _delegate: Default::default(),
1890            _additional_params: Default::default(),
1891            _scopes: Default::default(),
1892        }
1893    }
1894
1895    /// Create a builder to help you perform the following task:
1896    ///
1897    /// Delete user account.
1898    ///
1899    /// # Arguments
1900    ///
1901    /// * `request` - No description provided.
1902    pub fn delete_account(
1903        &self,
1904        request: IdentitytoolkitRelyingpartyDeleteAccountRequest,
1905    ) -> RelyingpartyDeleteAccountCall<'a, C> {
1906        RelyingpartyDeleteAccountCall {
1907            hub: self.hub,
1908            _request: request,
1909            _delegate: Default::default(),
1910            _additional_params: Default::default(),
1911            _scopes: Default::default(),
1912        }
1913    }
1914
1915    /// Create a builder to help you perform the following task:
1916    ///
1917    /// Batch download user accounts.
1918    ///
1919    /// # Arguments
1920    ///
1921    /// * `request` - No description provided.
1922    pub fn download_account(
1923        &self,
1924        request: IdentitytoolkitRelyingpartyDownloadAccountRequest,
1925    ) -> RelyingpartyDownloadAccountCall<'a, C> {
1926        RelyingpartyDownloadAccountCall {
1927            hub: self.hub,
1928            _request: request,
1929            _delegate: Default::default(),
1930            _additional_params: Default::default(),
1931            _scopes: Default::default(),
1932        }
1933    }
1934
1935    /// Create a builder to help you perform the following task:
1936    ///
1937    /// Reset password for a user.
1938    ///
1939    /// # Arguments
1940    ///
1941    /// * `request` - No description provided.
1942    pub fn email_link_signin(
1943        &self,
1944        request: IdentitytoolkitRelyingpartyEmailLinkSigninRequest,
1945    ) -> RelyingpartyEmailLinkSigninCall<'a, C> {
1946        RelyingpartyEmailLinkSigninCall {
1947            hub: self.hub,
1948            _request: request,
1949            _delegate: Default::default(),
1950            _additional_params: Default::default(),
1951            _scopes: Default::default(),
1952        }
1953    }
1954
1955    /// Create a builder to help you perform the following task:
1956    ///
1957    /// Returns the account info.
1958    ///
1959    /// # Arguments
1960    ///
1961    /// * `request` - No description provided.
1962    pub fn get_account_info(
1963        &self,
1964        request: IdentitytoolkitRelyingpartyGetAccountInfoRequest,
1965    ) -> RelyingpartyGetAccountInfoCall<'a, C> {
1966        RelyingpartyGetAccountInfoCall {
1967            hub: self.hub,
1968            _request: request,
1969            _delegate: Default::default(),
1970            _additional_params: Default::default(),
1971            _scopes: Default::default(),
1972        }
1973    }
1974
1975    /// Create a builder to help you perform the following task:
1976    ///
1977    /// Get a code for user action confirmation.
1978    ///
1979    /// # Arguments
1980    ///
1981    /// * `request` - No description provided.
1982    pub fn get_oob_confirmation_code(
1983        &self,
1984        request: Relyingparty,
1985    ) -> RelyingpartyGetOobConfirmationCodeCall<'a, C> {
1986        RelyingpartyGetOobConfirmationCodeCall {
1987            hub: self.hub,
1988            _request: request,
1989            _delegate: Default::default(),
1990            _additional_params: Default::default(),
1991            _scopes: Default::default(),
1992        }
1993    }
1994
1995    /// Create a builder to help you perform the following task:
1996    ///
1997    /// Get project configuration.
1998    pub fn get_project_config(&self) -> RelyingpartyGetProjectConfigCall<'a, C> {
1999        RelyingpartyGetProjectConfigCall {
2000            hub: self.hub,
2001            _project_number: Default::default(),
2002            _delegated_project_number: Default::default(),
2003            _delegate: Default::default(),
2004            _additional_params: Default::default(),
2005            _scopes: Default::default(),
2006        }
2007    }
2008
2009    /// Create a builder to help you perform the following task:
2010    ///
2011    /// Get token signing public key.
2012    pub fn get_public_keys(&self) -> RelyingpartyGetPublicKeyCall<'a, C> {
2013        RelyingpartyGetPublicKeyCall {
2014            hub: self.hub,
2015            _delegate: Default::default(),
2016            _additional_params: Default::default(),
2017            _scopes: Default::default(),
2018        }
2019    }
2020
2021    /// Create a builder to help you perform the following task:
2022    ///
2023    /// Get recaptcha secure param.
2024    pub fn get_recaptcha_param(&self) -> RelyingpartyGetRecaptchaParamCall<'a, C> {
2025        RelyingpartyGetRecaptchaParamCall {
2026            hub: self.hub,
2027            _delegate: Default::default(),
2028            _additional_params: Default::default(),
2029            _scopes: Default::default(),
2030        }
2031    }
2032
2033    /// Create a builder to help you perform the following task:
2034    ///
2035    /// Reset password for a user.
2036    ///
2037    /// # Arguments
2038    ///
2039    /// * `request` - No description provided.
2040    pub fn reset_password(
2041        &self,
2042        request: IdentitytoolkitRelyingpartyResetPasswordRequest,
2043    ) -> RelyingpartyResetPasswordCall<'a, C> {
2044        RelyingpartyResetPasswordCall {
2045            hub: self.hub,
2046            _request: request,
2047            _delegate: Default::default(),
2048            _additional_params: Default::default(),
2049            _scopes: Default::default(),
2050        }
2051    }
2052
2053    /// Create a builder to help you perform the following task:
2054    ///
2055    /// Send SMS verification code.
2056    ///
2057    /// # Arguments
2058    ///
2059    /// * `request` - No description provided.
2060    pub fn send_verification_code(
2061        &self,
2062        request: IdentitytoolkitRelyingpartySendVerificationCodeRequest,
2063    ) -> RelyingpartySendVerificationCodeCall<'a, C> {
2064        RelyingpartySendVerificationCodeCall {
2065            hub: self.hub,
2066            _request: request,
2067            _delegate: Default::default(),
2068            _additional_params: Default::default(),
2069            _scopes: Default::default(),
2070        }
2071    }
2072
2073    /// Create a builder to help you perform the following task:
2074    ///
2075    /// Set account info for a user.
2076    ///
2077    /// # Arguments
2078    ///
2079    /// * `request` - No description provided.
2080    pub fn set_account_info(
2081        &self,
2082        request: IdentitytoolkitRelyingpartySetAccountInfoRequest,
2083    ) -> RelyingpartySetAccountInfoCall<'a, C> {
2084        RelyingpartySetAccountInfoCall {
2085            hub: self.hub,
2086            _request: request,
2087            _delegate: Default::default(),
2088            _additional_params: Default::default(),
2089            _scopes: Default::default(),
2090        }
2091    }
2092
2093    /// Create a builder to help you perform the following task:
2094    ///
2095    /// Set project configuration.
2096    ///
2097    /// # Arguments
2098    ///
2099    /// * `request` - No description provided.
2100    pub fn set_project_config(
2101        &self,
2102        request: IdentitytoolkitRelyingpartySetProjectConfigRequest,
2103    ) -> RelyingpartySetProjectConfigCall<'a, C> {
2104        RelyingpartySetProjectConfigCall {
2105            hub: self.hub,
2106            _request: request,
2107            _delegate: Default::default(),
2108            _additional_params: Default::default(),
2109            _scopes: Default::default(),
2110        }
2111    }
2112
2113    /// Create a builder to help you perform the following task:
2114    ///
2115    /// Sign out user.
2116    ///
2117    /// # Arguments
2118    ///
2119    /// * `request` - No description provided.
2120    pub fn sign_out_user(
2121        &self,
2122        request: IdentitytoolkitRelyingpartySignOutUserRequest,
2123    ) -> RelyingpartySignOutUserCall<'a, C> {
2124        RelyingpartySignOutUserCall {
2125            hub: self.hub,
2126            _request: request,
2127            _delegate: Default::default(),
2128            _additional_params: Default::default(),
2129            _scopes: Default::default(),
2130        }
2131    }
2132
2133    /// Create a builder to help you perform the following task:
2134    ///
2135    /// Signup new user.
2136    ///
2137    /// # Arguments
2138    ///
2139    /// * `request` - No description provided.
2140    pub fn signup_new_user(
2141        &self,
2142        request: IdentitytoolkitRelyingpartySignupNewUserRequest,
2143    ) -> RelyingpartySignupNewUserCall<'a, C> {
2144        RelyingpartySignupNewUserCall {
2145            hub: self.hub,
2146            _request: request,
2147            _delegate: Default::default(),
2148            _additional_params: Default::default(),
2149            _scopes: Default::default(),
2150        }
2151    }
2152
2153    /// Create a builder to help you perform the following task:
2154    ///
2155    /// Batch upload existing user accounts.
2156    ///
2157    /// # Arguments
2158    ///
2159    /// * `request` - No description provided.
2160    pub fn upload_account(
2161        &self,
2162        request: IdentitytoolkitRelyingpartyUploadAccountRequest,
2163    ) -> RelyingpartyUploadAccountCall<'a, C> {
2164        RelyingpartyUploadAccountCall {
2165            hub: self.hub,
2166            _request: request,
2167            _delegate: Default::default(),
2168            _additional_params: Default::default(),
2169            _scopes: Default::default(),
2170        }
2171    }
2172
2173    /// Create a builder to help you perform the following task:
2174    ///
2175    /// Verifies the assertion returned by the IdP.
2176    ///
2177    /// # Arguments
2178    ///
2179    /// * `request` - No description provided.
2180    pub fn verify_assertion(
2181        &self,
2182        request: IdentitytoolkitRelyingpartyVerifyAssertionRequest,
2183    ) -> RelyingpartyVerifyAssertionCall<'a, C> {
2184        RelyingpartyVerifyAssertionCall {
2185            hub: self.hub,
2186            _request: request,
2187            _delegate: Default::default(),
2188            _additional_params: Default::default(),
2189            _scopes: Default::default(),
2190        }
2191    }
2192
2193    /// Create a builder to help you perform the following task:
2194    ///
2195    /// Verifies the developer asserted ID token.
2196    ///
2197    /// # Arguments
2198    ///
2199    /// * `request` - No description provided.
2200    pub fn verify_custom_token(
2201        &self,
2202        request: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest,
2203    ) -> RelyingpartyVerifyCustomTokenCall<'a, C> {
2204        RelyingpartyVerifyCustomTokenCall {
2205            hub: self.hub,
2206            _request: request,
2207            _delegate: Default::default(),
2208            _additional_params: Default::default(),
2209            _scopes: Default::default(),
2210        }
2211    }
2212
2213    /// Create a builder to help you perform the following task:
2214    ///
2215    /// Verifies the user entered password.
2216    ///
2217    /// # Arguments
2218    ///
2219    /// * `request` - No description provided.
2220    pub fn verify_password(
2221        &self,
2222        request: IdentitytoolkitRelyingpartyVerifyPasswordRequest,
2223    ) -> RelyingpartyVerifyPasswordCall<'a, C> {
2224        RelyingpartyVerifyPasswordCall {
2225            hub: self.hub,
2226            _request: request,
2227            _delegate: Default::default(),
2228            _additional_params: Default::default(),
2229            _scopes: Default::default(),
2230        }
2231    }
2232
2233    /// Create a builder to help you perform the following task:
2234    ///
2235    /// Verifies ownership of a phone number and creates/updates the user account accordingly.
2236    ///
2237    /// # Arguments
2238    ///
2239    /// * `request` - No description provided.
2240    pub fn verify_phone_number(
2241        &self,
2242        request: IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest,
2243    ) -> RelyingpartyVerifyPhoneNumberCall<'a, C> {
2244        RelyingpartyVerifyPhoneNumberCall {
2245            hub: self.hub,
2246            _request: request,
2247            _delegate: Default::default(),
2248            _additional_params: Default::default(),
2249            _scopes: Default::default(),
2250        }
2251    }
2252}
2253
2254// ###################
2255// CallBuilders   ###
2256// #################
2257
2258/// Creates the URI used by the IdP to authenticate the user.
2259///
2260/// A builder for the *createAuthUri* method supported by a *relyingparty* resource.
2261/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
2262///
2263/// # Example
2264///
2265/// Instantiate a resource method builder
2266///
2267/// ```test_harness,no_run
2268/// # extern crate hyper;
2269/// # extern crate hyper_rustls;
2270/// # extern crate google_identitytoolkit3 as identitytoolkit3;
2271/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyCreateAuthUriRequest;
2272/// # async fn dox() {
2273/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2274///
2275/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2276/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2277/// #     .with_native_roots()
2278/// #     .unwrap()
2279/// #     .https_only()
2280/// #     .enable_http2()
2281/// #     .build();
2282///
2283/// # let executor = hyper_util::rt::TokioExecutor::new();
2284/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2285/// #     secret,
2286/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2287/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2288/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2289/// #     ),
2290/// # ).build().await.unwrap();
2291///
2292/// # let client = hyper_util::client::legacy::Client::builder(
2293/// #     hyper_util::rt::TokioExecutor::new()
2294/// # )
2295/// # .build(
2296/// #     hyper_rustls::HttpsConnectorBuilder::new()
2297/// #         .with_native_roots()
2298/// #         .unwrap()
2299/// #         .https_or_http()
2300/// #         .enable_http2()
2301/// #         .build()
2302/// # );
2303/// # let mut hub = IdentityToolkit::new(client, auth);
2304/// // As the method needs a request, you would usually fill it with the desired information
2305/// // into the respective structure. Some of the parts shown here might not be applicable !
2306/// // Values shown here are possibly random and not representative !
2307/// let mut req = IdentitytoolkitRelyingpartyCreateAuthUriRequest::default();
2308///
2309/// // You can configure optional parameters by calling the respective setters at will, and
2310/// // execute the final call using `doit()`.
2311/// // Values shown here are possibly random and not representative !
2312/// let result = hub.relyingparty().create_auth_uri(req)
2313///              .doit().await;
2314/// # }
2315/// ```
2316pub struct RelyingpartyCreateAuthUriCall<'a, C>
2317where
2318    C: 'a,
2319{
2320    hub: &'a IdentityToolkit<C>,
2321    _request: IdentitytoolkitRelyingpartyCreateAuthUriRequest,
2322    _delegate: Option<&'a mut dyn common::Delegate>,
2323    _additional_params: HashMap<String, String>,
2324    _scopes: BTreeSet<String>,
2325}
2326
2327impl<'a, C> common::CallBuilder for RelyingpartyCreateAuthUriCall<'a, C> {}
2328
2329impl<'a, C> RelyingpartyCreateAuthUriCall<'a, C>
2330where
2331    C: common::Connector,
2332{
2333    /// Perform the operation you have build so far.
2334    pub async fn doit(mut self) -> common::Result<(common::Response, CreateAuthUriResponse)> {
2335        use std::borrow::Cow;
2336        use std::io::{Read, Seek};
2337
2338        use common::{url::Params, ToParts};
2339        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2340
2341        let mut dd = common::DefaultDelegate;
2342        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2343        dlg.begin(common::MethodInfo {
2344            id: "identitytoolkit.relyingparty.createAuthUri",
2345            http_method: hyper::Method::POST,
2346        });
2347
2348        for &field in ["alt"].iter() {
2349            if self._additional_params.contains_key(field) {
2350                dlg.finished(false);
2351                return Err(common::Error::FieldClash(field));
2352            }
2353        }
2354
2355        let mut params = Params::with_capacity(3 + self._additional_params.len());
2356
2357        params.extend(self._additional_params.iter());
2358
2359        params.push("alt", "json");
2360        let mut url = self.hub._base_url.clone() + "createAuthUri";
2361        if self._scopes.is_empty() {
2362            self._scopes
2363                .insert(Scope::CloudPlatform.as_ref().to_string());
2364        }
2365
2366        let url = params.parse_with_url(&url);
2367
2368        let mut json_mime_type = mime::APPLICATION_JSON;
2369        let mut request_value_reader = {
2370            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2371            common::remove_json_null_values(&mut value);
2372            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2373            serde_json::to_writer(&mut dst, &value).unwrap();
2374            dst
2375        };
2376        let request_size = request_value_reader
2377            .seek(std::io::SeekFrom::End(0))
2378            .unwrap();
2379        request_value_reader
2380            .seek(std::io::SeekFrom::Start(0))
2381            .unwrap();
2382
2383        loop {
2384            let token = match self
2385                .hub
2386                .auth
2387                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2388                .await
2389            {
2390                Ok(token) => token,
2391                Err(e) => match dlg.token(e) {
2392                    Ok(token) => token,
2393                    Err(e) => {
2394                        dlg.finished(false);
2395                        return Err(common::Error::MissingToken(e));
2396                    }
2397                },
2398            };
2399            request_value_reader
2400                .seek(std::io::SeekFrom::Start(0))
2401                .unwrap();
2402            let mut req_result = {
2403                let client = &self.hub.client;
2404                dlg.pre_request();
2405                let mut req_builder = hyper::Request::builder()
2406                    .method(hyper::Method::POST)
2407                    .uri(url.as_str())
2408                    .header(USER_AGENT, self.hub._user_agent.clone());
2409
2410                if let Some(token) = token.as_ref() {
2411                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2412                }
2413
2414                let request = req_builder
2415                    .header(CONTENT_TYPE, json_mime_type.to_string())
2416                    .header(CONTENT_LENGTH, request_size as u64)
2417                    .body(common::to_body(
2418                        request_value_reader.get_ref().clone().into(),
2419                    ));
2420
2421                client.request(request.unwrap()).await
2422            };
2423
2424            match req_result {
2425                Err(err) => {
2426                    if let common::Retry::After(d) = dlg.http_error(&err) {
2427                        sleep(d).await;
2428                        continue;
2429                    }
2430                    dlg.finished(false);
2431                    return Err(common::Error::HttpError(err));
2432                }
2433                Ok(res) => {
2434                    let (mut parts, body) = res.into_parts();
2435                    let mut body = common::Body::new(body);
2436                    if !parts.status.is_success() {
2437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2438                        let error = serde_json::from_str(&common::to_string(&bytes));
2439                        let response = common::to_response(parts, bytes.into());
2440
2441                        if let common::Retry::After(d) =
2442                            dlg.http_failure(&response, error.as_ref().ok())
2443                        {
2444                            sleep(d).await;
2445                            continue;
2446                        }
2447
2448                        dlg.finished(false);
2449
2450                        return Err(match error {
2451                            Ok(value) => common::Error::BadRequest(value),
2452                            _ => common::Error::Failure(response),
2453                        });
2454                    }
2455                    let response = {
2456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2457                        let encoded = common::to_string(&bytes);
2458                        match serde_json::from_str(&encoded) {
2459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2460                            Err(error) => {
2461                                dlg.response_json_decode_error(&encoded, &error);
2462                                return Err(common::Error::JsonDecodeError(
2463                                    encoded.to_string(),
2464                                    error,
2465                                ));
2466                            }
2467                        }
2468                    };
2469
2470                    dlg.finished(true);
2471                    return Ok(response);
2472                }
2473            }
2474        }
2475    }
2476
2477    ///
2478    /// Sets the *request* property to the given value.
2479    ///
2480    /// Even though the property as already been set when instantiating this call,
2481    /// we provide this method for API completeness.
2482    pub fn request(
2483        mut self,
2484        new_value: IdentitytoolkitRelyingpartyCreateAuthUriRequest,
2485    ) -> RelyingpartyCreateAuthUriCall<'a, C> {
2486        self._request = new_value;
2487        self
2488    }
2489    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2490    /// while executing the actual API request.
2491    ///
2492    /// ````text
2493    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2494    /// ````
2495    ///
2496    /// Sets the *delegate* property to the given value.
2497    pub fn delegate(
2498        mut self,
2499        new_value: &'a mut dyn common::Delegate,
2500    ) -> RelyingpartyCreateAuthUriCall<'a, C> {
2501        self._delegate = Some(new_value);
2502        self
2503    }
2504
2505    /// Set any additional parameter of the query string used in the request.
2506    /// It should be used to set parameters which are not yet available through their own
2507    /// setters.
2508    ///
2509    /// Please note that this method must not be used to set any of the known parameters
2510    /// which have their own setter method. If done anyway, the request will fail.
2511    ///
2512    /// # Additional Parameters
2513    ///
2514    /// * *alt* (query-string) - Data format for the response.
2515    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2516    /// * *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.
2517    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2518    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2519    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2520    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2521    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyCreateAuthUriCall<'a, C>
2522    where
2523        T: AsRef<str>,
2524    {
2525        self._additional_params
2526            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2527        self
2528    }
2529
2530    /// Identifies the authorization scope for the method you are building.
2531    ///
2532    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2533    /// [`Scope::CloudPlatform`].
2534    ///
2535    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2536    /// tokens for more than one scope.
2537    ///
2538    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2539    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2540    /// sufficient, a read-write scope will do as well.
2541    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyCreateAuthUriCall<'a, C>
2542    where
2543        St: AsRef<str>,
2544    {
2545        self._scopes.insert(String::from(scope.as_ref()));
2546        self
2547    }
2548    /// Identifies the authorization scope(s) for the method you are building.
2549    ///
2550    /// See [`Self::add_scope()`] for details.
2551    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyCreateAuthUriCall<'a, C>
2552    where
2553        I: IntoIterator<Item = St>,
2554        St: AsRef<str>,
2555    {
2556        self._scopes
2557            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2558        self
2559    }
2560
2561    /// Removes all scopes, and no default scope will be used either.
2562    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2563    /// for details).
2564    pub fn clear_scopes(mut self) -> RelyingpartyCreateAuthUriCall<'a, C> {
2565        self._scopes.clear();
2566        self
2567    }
2568}
2569
2570/// Delete user account.
2571///
2572/// A builder for the *deleteAccount* method supported by a *relyingparty* resource.
2573/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
2574///
2575/// # Example
2576///
2577/// Instantiate a resource method builder
2578///
2579/// ```test_harness,no_run
2580/// # extern crate hyper;
2581/// # extern crate hyper_rustls;
2582/// # extern crate google_identitytoolkit3 as identitytoolkit3;
2583/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyDeleteAccountRequest;
2584/// # async fn dox() {
2585/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2586///
2587/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2588/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2589/// #     .with_native_roots()
2590/// #     .unwrap()
2591/// #     .https_only()
2592/// #     .enable_http2()
2593/// #     .build();
2594///
2595/// # let executor = hyper_util::rt::TokioExecutor::new();
2596/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2597/// #     secret,
2598/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2599/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2600/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2601/// #     ),
2602/// # ).build().await.unwrap();
2603///
2604/// # let client = hyper_util::client::legacy::Client::builder(
2605/// #     hyper_util::rt::TokioExecutor::new()
2606/// # )
2607/// # .build(
2608/// #     hyper_rustls::HttpsConnectorBuilder::new()
2609/// #         .with_native_roots()
2610/// #         .unwrap()
2611/// #         .https_or_http()
2612/// #         .enable_http2()
2613/// #         .build()
2614/// # );
2615/// # let mut hub = IdentityToolkit::new(client, auth);
2616/// // As the method needs a request, you would usually fill it with the desired information
2617/// // into the respective structure. Some of the parts shown here might not be applicable !
2618/// // Values shown here are possibly random and not representative !
2619/// let mut req = IdentitytoolkitRelyingpartyDeleteAccountRequest::default();
2620///
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.relyingparty().delete_account(req)
2625///              .doit().await;
2626/// # }
2627/// ```
2628pub struct RelyingpartyDeleteAccountCall<'a, C>
2629where
2630    C: 'a,
2631{
2632    hub: &'a IdentityToolkit<C>,
2633    _request: IdentitytoolkitRelyingpartyDeleteAccountRequest,
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 RelyingpartyDeleteAccountCall<'a, C> {}
2640
2641impl<'a, C> RelyingpartyDeleteAccountCall<'a, C>
2642where
2643    C: common::Connector,
2644{
2645    /// Perform the operation you have build so far.
2646    pub async fn doit(mut self) -> common::Result<(common::Response, DeleteAccountResponse)> {
2647        use std::borrow::Cow;
2648        use std::io::{Read, Seek};
2649
2650        use common::{url::Params, ToParts};
2651        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2652
2653        let mut dd = common::DefaultDelegate;
2654        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2655        dlg.begin(common::MethodInfo {
2656            id: "identitytoolkit.relyingparty.deleteAccount",
2657            http_method: hyper::Method::POST,
2658        });
2659
2660        for &field in ["alt"].iter() {
2661            if self._additional_params.contains_key(field) {
2662                dlg.finished(false);
2663                return Err(common::Error::FieldClash(field));
2664            }
2665        }
2666
2667        let mut params = Params::with_capacity(3 + self._additional_params.len());
2668
2669        params.extend(self._additional_params.iter());
2670
2671        params.push("alt", "json");
2672        let mut url = self.hub._base_url.clone() + "deleteAccount";
2673        if self._scopes.is_empty() {
2674            self._scopes
2675                .insert(Scope::CloudPlatform.as_ref().to_string());
2676        }
2677
2678        let url = params.parse_with_url(&url);
2679
2680        let mut json_mime_type = mime::APPLICATION_JSON;
2681        let mut request_value_reader = {
2682            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2683            common::remove_json_null_values(&mut value);
2684            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2685            serde_json::to_writer(&mut dst, &value).unwrap();
2686            dst
2687        };
2688        let request_size = request_value_reader
2689            .seek(std::io::SeekFrom::End(0))
2690            .unwrap();
2691        request_value_reader
2692            .seek(std::io::SeekFrom::Start(0))
2693            .unwrap();
2694
2695        loop {
2696            let token = match self
2697                .hub
2698                .auth
2699                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2700                .await
2701            {
2702                Ok(token) => token,
2703                Err(e) => match dlg.token(e) {
2704                    Ok(token) => token,
2705                    Err(e) => {
2706                        dlg.finished(false);
2707                        return Err(common::Error::MissingToken(e));
2708                    }
2709                },
2710            };
2711            request_value_reader
2712                .seek(std::io::SeekFrom::Start(0))
2713                .unwrap();
2714            let mut req_result = {
2715                let client = &self.hub.client;
2716                dlg.pre_request();
2717                let mut req_builder = hyper::Request::builder()
2718                    .method(hyper::Method::POST)
2719                    .uri(url.as_str())
2720                    .header(USER_AGENT, self.hub._user_agent.clone());
2721
2722                if let Some(token) = token.as_ref() {
2723                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2724                }
2725
2726                let request = req_builder
2727                    .header(CONTENT_TYPE, json_mime_type.to_string())
2728                    .header(CONTENT_LENGTH, request_size as u64)
2729                    .body(common::to_body(
2730                        request_value_reader.get_ref().clone().into(),
2731                    ));
2732
2733                client.request(request.unwrap()).await
2734            };
2735
2736            match req_result {
2737                Err(err) => {
2738                    if let common::Retry::After(d) = dlg.http_error(&err) {
2739                        sleep(d).await;
2740                        continue;
2741                    }
2742                    dlg.finished(false);
2743                    return Err(common::Error::HttpError(err));
2744                }
2745                Ok(res) => {
2746                    let (mut parts, body) = res.into_parts();
2747                    let mut body = common::Body::new(body);
2748                    if !parts.status.is_success() {
2749                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2750                        let error = serde_json::from_str(&common::to_string(&bytes));
2751                        let response = common::to_response(parts, bytes.into());
2752
2753                        if let common::Retry::After(d) =
2754                            dlg.http_failure(&response, error.as_ref().ok())
2755                        {
2756                            sleep(d).await;
2757                            continue;
2758                        }
2759
2760                        dlg.finished(false);
2761
2762                        return Err(match error {
2763                            Ok(value) => common::Error::BadRequest(value),
2764                            _ => common::Error::Failure(response),
2765                        });
2766                    }
2767                    let response = {
2768                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2769                        let encoded = common::to_string(&bytes);
2770                        match serde_json::from_str(&encoded) {
2771                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2772                            Err(error) => {
2773                                dlg.response_json_decode_error(&encoded, &error);
2774                                return Err(common::Error::JsonDecodeError(
2775                                    encoded.to_string(),
2776                                    error,
2777                                ));
2778                            }
2779                        }
2780                    };
2781
2782                    dlg.finished(true);
2783                    return Ok(response);
2784                }
2785            }
2786        }
2787    }
2788
2789    ///
2790    /// Sets the *request* property to the given value.
2791    ///
2792    /// Even though the property as already been set when instantiating this call,
2793    /// we provide this method for API completeness.
2794    pub fn request(
2795        mut self,
2796        new_value: IdentitytoolkitRelyingpartyDeleteAccountRequest,
2797    ) -> RelyingpartyDeleteAccountCall<'a, C> {
2798        self._request = new_value;
2799        self
2800    }
2801    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2802    /// while executing the actual API request.
2803    ///
2804    /// ````text
2805    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2806    /// ````
2807    ///
2808    /// Sets the *delegate* property to the given value.
2809    pub fn delegate(
2810        mut self,
2811        new_value: &'a mut dyn common::Delegate,
2812    ) -> RelyingpartyDeleteAccountCall<'a, C> {
2813        self._delegate = Some(new_value);
2814        self
2815    }
2816
2817    /// Set any additional parameter of the query string used in the request.
2818    /// It should be used to set parameters which are not yet available through their own
2819    /// setters.
2820    ///
2821    /// Please note that this method must not be used to set any of the known parameters
2822    /// which have their own setter method. If done anyway, the request will fail.
2823    ///
2824    /// # Additional Parameters
2825    ///
2826    /// * *alt* (query-string) - Data format for the response.
2827    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2828    /// * *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.
2829    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2830    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2831    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2832    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2833    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyDeleteAccountCall<'a, C>
2834    where
2835        T: AsRef<str>,
2836    {
2837        self._additional_params
2838            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2839        self
2840    }
2841
2842    /// Identifies the authorization scope for the method you are building.
2843    ///
2844    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2845    /// [`Scope::CloudPlatform`].
2846    ///
2847    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2848    /// tokens for more than one scope.
2849    ///
2850    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2851    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2852    /// sufficient, a read-write scope will do as well.
2853    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyDeleteAccountCall<'a, C>
2854    where
2855        St: AsRef<str>,
2856    {
2857        self._scopes.insert(String::from(scope.as_ref()));
2858        self
2859    }
2860    /// Identifies the authorization scope(s) for the method you are building.
2861    ///
2862    /// See [`Self::add_scope()`] for details.
2863    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyDeleteAccountCall<'a, C>
2864    where
2865        I: IntoIterator<Item = St>,
2866        St: AsRef<str>,
2867    {
2868        self._scopes
2869            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2870        self
2871    }
2872
2873    /// Removes all scopes, and no default scope will be used either.
2874    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2875    /// for details).
2876    pub fn clear_scopes(mut self) -> RelyingpartyDeleteAccountCall<'a, C> {
2877        self._scopes.clear();
2878        self
2879    }
2880}
2881
2882/// Batch download user accounts.
2883///
2884/// A builder for the *downloadAccount* method supported by a *relyingparty* resource.
2885/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
2886///
2887/// # Example
2888///
2889/// Instantiate a resource method builder
2890///
2891/// ```test_harness,no_run
2892/// # extern crate hyper;
2893/// # extern crate hyper_rustls;
2894/// # extern crate google_identitytoolkit3 as identitytoolkit3;
2895/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyDownloadAccountRequest;
2896/// # async fn dox() {
2897/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2898///
2899/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2900/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2901/// #     .with_native_roots()
2902/// #     .unwrap()
2903/// #     .https_only()
2904/// #     .enable_http2()
2905/// #     .build();
2906///
2907/// # let executor = hyper_util::rt::TokioExecutor::new();
2908/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2909/// #     secret,
2910/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2911/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2912/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2913/// #     ),
2914/// # ).build().await.unwrap();
2915///
2916/// # let client = hyper_util::client::legacy::Client::builder(
2917/// #     hyper_util::rt::TokioExecutor::new()
2918/// # )
2919/// # .build(
2920/// #     hyper_rustls::HttpsConnectorBuilder::new()
2921/// #         .with_native_roots()
2922/// #         .unwrap()
2923/// #         .https_or_http()
2924/// #         .enable_http2()
2925/// #         .build()
2926/// # );
2927/// # let mut hub = IdentityToolkit::new(client, auth);
2928/// // As the method needs a request, you would usually fill it with the desired information
2929/// // into the respective structure. Some of the parts shown here might not be applicable !
2930/// // Values shown here are possibly random and not representative !
2931/// let mut req = IdentitytoolkitRelyingpartyDownloadAccountRequest::default();
2932///
2933/// // You can configure optional parameters by calling the respective setters at will, and
2934/// // execute the final call using `doit()`.
2935/// // Values shown here are possibly random and not representative !
2936/// let result = hub.relyingparty().download_account(req)
2937///              .doit().await;
2938/// # }
2939/// ```
2940pub struct RelyingpartyDownloadAccountCall<'a, C>
2941where
2942    C: 'a,
2943{
2944    hub: &'a IdentityToolkit<C>,
2945    _request: IdentitytoolkitRelyingpartyDownloadAccountRequest,
2946    _delegate: Option<&'a mut dyn common::Delegate>,
2947    _additional_params: HashMap<String, String>,
2948    _scopes: BTreeSet<String>,
2949}
2950
2951impl<'a, C> common::CallBuilder for RelyingpartyDownloadAccountCall<'a, C> {}
2952
2953impl<'a, C> RelyingpartyDownloadAccountCall<'a, C>
2954where
2955    C: common::Connector,
2956{
2957    /// Perform the operation you have build so far.
2958    pub async fn doit(mut self) -> common::Result<(common::Response, DownloadAccountResponse)> {
2959        use std::borrow::Cow;
2960        use std::io::{Read, Seek};
2961
2962        use common::{url::Params, ToParts};
2963        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2964
2965        let mut dd = common::DefaultDelegate;
2966        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2967        dlg.begin(common::MethodInfo {
2968            id: "identitytoolkit.relyingparty.downloadAccount",
2969            http_method: hyper::Method::POST,
2970        });
2971
2972        for &field in ["alt"].iter() {
2973            if self._additional_params.contains_key(field) {
2974                dlg.finished(false);
2975                return Err(common::Error::FieldClash(field));
2976            }
2977        }
2978
2979        let mut params = Params::with_capacity(3 + self._additional_params.len());
2980
2981        params.extend(self._additional_params.iter());
2982
2983        params.push("alt", "json");
2984        let mut url = self.hub._base_url.clone() + "downloadAccount";
2985        if self._scopes.is_empty() {
2986            self._scopes
2987                .insert(Scope::CloudPlatform.as_ref().to_string());
2988        }
2989
2990        let url = params.parse_with_url(&url);
2991
2992        let mut json_mime_type = mime::APPLICATION_JSON;
2993        let mut request_value_reader = {
2994            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2995            common::remove_json_null_values(&mut value);
2996            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2997            serde_json::to_writer(&mut dst, &value).unwrap();
2998            dst
2999        };
3000        let request_size = request_value_reader
3001            .seek(std::io::SeekFrom::End(0))
3002            .unwrap();
3003        request_value_reader
3004            .seek(std::io::SeekFrom::Start(0))
3005            .unwrap();
3006
3007        loop {
3008            let token = match self
3009                .hub
3010                .auth
3011                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3012                .await
3013            {
3014                Ok(token) => token,
3015                Err(e) => match dlg.token(e) {
3016                    Ok(token) => token,
3017                    Err(e) => {
3018                        dlg.finished(false);
3019                        return Err(common::Error::MissingToken(e));
3020                    }
3021                },
3022            };
3023            request_value_reader
3024                .seek(std::io::SeekFrom::Start(0))
3025                .unwrap();
3026            let mut req_result = {
3027                let client = &self.hub.client;
3028                dlg.pre_request();
3029                let mut req_builder = hyper::Request::builder()
3030                    .method(hyper::Method::POST)
3031                    .uri(url.as_str())
3032                    .header(USER_AGENT, self.hub._user_agent.clone());
3033
3034                if let Some(token) = token.as_ref() {
3035                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3036                }
3037
3038                let request = req_builder
3039                    .header(CONTENT_TYPE, json_mime_type.to_string())
3040                    .header(CONTENT_LENGTH, request_size as u64)
3041                    .body(common::to_body(
3042                        request_value_reader.get_ref().clone().into(),
3043                    ));
3044
3045                client.request(request.unwrap()).await
3046            };
3047
3048            match req_result {
3049                Err(err) => {
3050                    if let common::Retry::After(d) = dlg.http_error(&err) {
3051                        sleep(d).await;
3052                        continue;
3053                    }
3054                    dlg.finished(false);
3055                    return Err(common::Error::HttpError(err));
3056                }
3057                Ok(res) => {
3058                    let (mut parts, body) = res.into_parts();
3059                    let mut body = common::Body::new(body);
3060                    if !parts.status.is_success() {
3061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3062                        let error = serde_json::from_str(&common::to_string(&bytes));
3063                        let response = common::to_response(parts, bytes.into());
3064
3065                        if let common::Retry::After(d) =
3066                            dlg.http_failure(&response, error.as_ref().ok())
3067                        {
3068                            sleep(d).await;
3069                            continue;
3070                        }
3071
3072                        dlg.finished(false);
3073
3074                        return Err(match error {
3075                            Ok(value) => common::Error::BadRequest(value),
3076                            _ => common::Error::Failure(response),
3077                        });
3078                    }
3079                    let response = {
3080                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3081                        let encoded = common::to_string(&bytes);
3082                        match serde_json::from_str(&encoded) {
3083                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3084                            Err(error) => {
3085                                dlg.response_json_decode_error(&encoded, &error);
3086                                return Err(common::Error::JsonDecodeError(
3087                                    encoded.to_string(),
3088                                    error,
3089                                ));
3090                            }
3091                        }
3092                    };
3093
3094                    dlg.finished(true);
3095                    return Ok(response);
3096                }
3097            }
3098        }
3099    }
3100
3101    ///
3102    /// Sets the *request* property to the given value.
3103    ///
3104    /// Even though the property as already been set when instantiating this call,
3105    /// we provide this method for API completeness.
3106    pub fn request(
3107        mut self,
3108        new_value: IdentitytoolkitRelyingpartyDownloadAccountRequest,
3109    ) -> RelyingpartyDownloadAccountCall<'a, C> {
3110        self._request = new_value;
3111        self
3112    }
3113    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3114    /// while executing the actual API request.
3115    ///
3116    /// ````text
3117    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3118    /// ````
3119    ///
3120    /// Sets the *delegate* property to the given value.
3121    pub fn delegate(
3122        mut self,
3123        new_value: &'a mut dyn common::Delegate,
3124    ) -> RelyingpartyDownloadAccountCall<'a, C> {
3125        self._delegate = Some(new_value);
3126        self
3127    }
3128
3129    /// Set any additional parameter of the query string used in the request.
3130    /// It should be used to set parameters which are not yet available through their own
3131    /// setters.
3132    ///
3133    /// Please note that this method must not be used to set any of the known parameters
3134    /// which have their own setter method. If done anyway, the request will fail.
3135    ///
3136    /// # Additional Parameters
3137    ///
3138    /// * *alt* (query-string) - Data format for the response.
3139    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3140    /// * *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.
3141    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3142    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3143    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3144    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3145    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyDownloadAccountCall<'a, C>
3146    where
3147        T: AsRef<str>,
3148    {
3149        self._additional_params
3150            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3151        self
3152    }
3153
3154    /// Identifies the authorization scope for the method you are building.
3155    ///
3156    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3157    /// [`Scope::CloudPlatform`].
3158    ///
3159    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3160    /// tokens for more than one scope.
3161    ///
3162    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3163    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3164    /// sufficient, a read-write scope will do as well.
3165    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyDownloadAccountCall<'a, C>
3166    where
3167        St: AsRef<str>,
3168    {
3169        self._scopes.insert(String::from(scope.as_ref()));
3170        self
3171    }
3172    /// Identifies the authorization scope(s) for the method you are building.
3173    ///
3174    /// See [`Self::add_scope()`] for details.
3175    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyDownloadAccountCall<'a, C>
3176    where
3177        I: IntoIterator<Item = St>,
3178        St: AsRef<str>,
3179    {
3180        self._scopes
3181            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3182        self
3183    }
3184
3185    /// Removes all scopes, and no default scope will be used either.
3186    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3187    /// for details).
3188    pub fn clear_scopes(mut self) -> RelyingpartyDownloadAccountCall<'a, C> {
3189        self._scopes.clear();
3190        self
3191    }
3192}
3193
3194/// Reset password for a user.
3195///
3196/// A builder for the *emailLinkSignin* method supported by a *relyingparty* resource.
3197/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
3198///
3199/// # Example
3200///
3201/// Instantiate a resource method builder
3202///
3203/// ```test_harness,no_run
3204/// # extern crate hyper;
3205/// # extern crate hyper_rustls;
3206/// # extern crate google_identitytoolkit3 as identitytoolkit3;
3207/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyEmailLinkSigninRequest;
3208/// # async fn dox() {
3209/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3210///
3211/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3212/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3213/// #     .with_native_roots()
3214/// #     .unwrap()
3215/// #     .https_only()
3216/// #     .enable_http2()
3217/// #     .build();
3218///
3219/// # let executor = hyper_util::rt::TokioExecutor::new();
3220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3221/// #     secret,
3222/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3223/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3224/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3225/// #     ),
3226/// # ).build().await.unwrap();
3227///
3228/// # let client = hyper_util::client::legacy::Client::builder(
3229/// #     hyper_util::rt::TokioExecutor::new()
3230/// # )
3231/// # .build(
3232/// #     hyper_rustls::HttpsConnectorBuilder::new()
3233/// #         .with_native_roots()
3234/// #         .unwrap()
3235/// #         .https_or_http()
3236/// #         .enable_http2()
3237/// #         .build()
3238/// # );
3239/// # let mut hub = IdentityToolkit::new(client, auth);
3240/// // As the method needs a request, you would usually fill it with the desired information
3241/// // into the respective structure. Some of the parts shown here might not be applicable !
3242/// // Values shown here are possibly random and not representative !
3243/// let mut req = IdentitytoolkitRelyingpartyEmailLinkSigninRequest::default();
3244///
3245/// // You can configure optional parameters by calling the respective setters at will, and
3246/// // execute the final call using `doit()`.
3247/// // Values shown here are possibly random and not representative !
3248/// let result = hub.relyingparty().email_link_signin(req)
3249///              .doit().await;
3250/// # }
3251/// ```
3252pub struct RelyingpartyEmailLinkSigninCall<'a, C>
3253where
3254    C: 'a,
3255{
3256    hub: &'a IdentityToolkit<C>,
3257    _request: IdentitytoolkitRelyingpartyEmailLinkSigninRequest,
3258    _delegate: Option<&'a mut dyn common::Delegate>,
3259    _additional_params: HashMap<String, String>,
3260    _scopes: BTreeSet<String>,
3261}
3262
3263impl<'a, C> common::CallBuilder for RelyingpartyEmailLinkSigninCall<'a, C> {}
3264
3265impl<'a, C> RelyingpartyEmailLinkSigninCall<'a, C>
3266where
3267    C: common::Connector,
3268{
3269    /// Perform the operation you have build so far.
3270    pub async fn doit(mut self) -> common::Result<(common::Response, EmailLinkSigninResponse)> {
3271        use std::borrow::Cow;
3272        use std::io::{Read, Seek};
3273
3274        use common::{url::Params, ToParts};
3275        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3276
3277        let mut dd = common::DefaultDelegate;
3278        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3279        dlg.begin(common::MethodInfo {
3280            id: "identitytoolkit.relyingparty.emailLinkSignin",
3281            http_method: hyper::Method::POST,
3282        });
3283
3284        for &field in ["alt"].iter() {
3285            if self._additional_params.contains_key(field) {
3286                dlg.finished(false);
3287                return Err(common::Error::FieldClash(field));
3288            }
3289        }
3290
3291        let mut params = Params::with_capacity(3 + self._additional_params.len());
3292
3293        params.extend(self._additional_params.iter());
3294
3295        params.push("alt", "json");
3296        let mut url = self.hub._base_url.clone() + "emailLinkSignin";
3297        if self._scopes.is_empty() {
3298            self._scopes
3299                .insert(Scope::CloudPlatform.as_ref().to_string());
3300        }
3301
3302        let url = params.parse_with_url(&url);
3303
3304        let mut json_mime_type = mime::APPLICATION_JSON;
3305        let mut request_value_reader = {
3306            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3307            common::remove_json_null_values(&mut value);
3308            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3309            serde_json::to_writer(&mut dst, &value).unwrap();
3310            dst
3311        };
3312        let request_size = request_value_reader
3313            .seek(std::io::SeekFrom::End(0))
3314            .unwrap();
3315        request_value_reader
3316            .seek(std::io::SeekFrom::Start(0))
3317            .unwrap();
3318
3319        loop {
3320            let token = match self
3321                .hub
3322                .auth
3323                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3324                .await
3325            {
3326                Ok(token) => token,
3327                Err(e) => match dlg.token(e) {
3328                    Ok(token) => token,
3329                    Err(e) => {
3330                        dlg.finished(false);
3331                        return Err(common::Error::MissingToken(e));
3332                    }
3333                },
3334            };
3335            request_value_reader
3336                .seek(std::io::SeekFrom::Start(0))
3337                .unwrap();
3338            let mut req_result = {
3339                let client = &self.hub.client;
3340                dlg.pre_request();
3341                let mut req_builder = hyper::Request::builder()
3342                    .method(hyper::Method::POST)
3343                    .uri(url.as_str())
3344                    .header(USER_AGENT, self.hub._user_agent.clone());
3345
3346                if let Some(token) = token.as_ref() {
3347                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3348                }
3349
3350                let request = req_builder
3351                    .header(CONTENT_TYPE, json_mime_type.to_string())
3352                    .header(CONTENT_LENGTH, request_size as u64)
3353                    .body(common::to_body(
3354                        request_value_reader.get_ref().clone().into(),
3355                    ));
3356
3357                client.request(request.unwrap()).await
3358            };
3359
3360            match req_result {
3361                Err(err) => {
3362                    if let common::Retry::After(d) = dlg.http_error(&err) {
3363                        sleep(d).await;
3364                        continue;
3365                    }
3366                    dlg.finished(false);
3367                    return Err(common::Error::HttpError(err));
3368                }
3369                Ok(res) => {
3370                    let (mut parts, body) = res.into_parts();
3371                    let mut body = common::Body::new(body);
3372                    if !parts.status.is_success() {
3373                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3374                        let error = serde_json::from_str(&common::to_string(&bytes));
3375                        let response = common::to_response(parts, bytes.into());
3376
3377                        if let common::Retry::After(d) =
3378                            dlg.http_failure(&response, error.as_ref().ok())
3379                        {
3380                            sleep(d).await;
3381                            continue;
3382                        }
3383
3384                        dlg.finished(false);
3385
3386                        return Err(match error {
3387                            Ok(value) => common::Error::BadRequest(value),
3388                            _ => common::Error::Failure(response),
3389                        });
3390                    }
3391                    let response = {
3392                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3393                        let encoded = common::to_string(&bytes);
3394                        match serde_json::from_str(&encoded) {
3395                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3396                            Err(error) => {
3397                                dlg.response_json_decode_error(&encoded, &error);
3398                                return Err(common::Error::JsonDecodeError(
3399                                    encoded.to_string(),
3400                                    error,
3401                                ));
3402                            }
3403                        }
3404                    };
3405
3406                    dlg.finished(true);
3407                    return Ok(response);
3408                }
3409            }
3410        }
3411    }
3412
3413    ///
3414    /// Sets the *request* property to the given value.
3415    ///
3416    /// Even though the property as already been set when instantiating this call,
3417    /// we provide this method for API completeness.
3418    pub fn request(
3419        mut self,
3420        new_value: IdentitytoolkitRelyingpartyEmailLinkSigninRequest,
3421    ) -> RelyingpartyEmailLinkSigninCall<'a, C> {
3422        self._request = new_value;
3423        self
3424    }
3425    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3426    /// while executing the actual API request.
3427    ///
3428    /// ````text
3429    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3430    /// ````
3431    ///
3432    /// Sets the *delegate* property to the given value.
3433    pub fn delegate(
3434        mut self,
3435        new_value: &'a mut dyn common::Delegate,
3436    ) -> RelyingpartyEmailLinkSigninCall<'a, C> {
3437        self._delegate = Some(new_value);
3438        self
3439    }
3440
3441    /// Set any additional parameter of the query string used in the request.
3442    /// It should be used to set parameters which are not yet available through their own
3443    /// setters.
3444    ///
3445    /// Please note that this method must not be used to set any of the known parameters
3446    /// which have their own setter method. If done anyway, the request will fail.
3447    ///
3448    /// # Additional Parameters
3449    ///
3450    /// * *alt* (query-string) - Data format for the response.
3451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3452    /// * *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.
3453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3455    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3456    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3457    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyEmailLinkSigninCall<'a, C>
3458    where
3459        T: AsRef<str>,
3460    {
3461        self._additional_params
3462            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3463        self
3464    }
3465
3466    /// Identifies the authorization scope for the method you are building.
3467    ///
3468    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3469    /// [`Scope::CloudPlatform`].
3470    ///
3471    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3472    /// tokens for more than one scope.
3473    ///
3474    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3475    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3476    /// sufficient, a read-write scope will do as well.
3477    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyEmailLinkSigninCall<'a, C>
3478    where
3479        St: AsRef<str>,
3480    {
3481        self._scopes.insert(String::from(scope.as_ref()));
3482        self
3483    }
3484    /// Identifies the authorization scope(s) for the method you are building.
3485    ///
3486    /// See [`Self::add_scope()`] for details.
3487    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyEmailLinkSigninCall<'a, C>
3488    where
3489        I: IntoIterator<Item = St>,
3490        St: AsRef<str>,
3491    {
3492        self._scopes
3493            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3494        self
3495    }
3496
3497    /// Removes all scopes, and no default scope will be used either.
3498    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3499    /// for details).
3500    pub fn clear_scopes(mut self) -> RelyingpartyEmailLinkSigninCall<'a, C> {
3501        self._scopes.clear();
3502        self
3503    }
3504}
3505
3506/// Returns the account info.
3507///
3508/// A builder for the *getAccountInfo* method supported by a *relyingparty* resource.
3509/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
3510///
3511/// # Example
3512///
3513/// Instantiate a resource method builder
3514///
3515/// ```test_harness,no_run
3516/// # extern crate hyper;
3517/// # extern crate hyper_rustls;
3518/// # extern crate google_identitytoolkit3 as identitytoolkit3;
3519/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyGetAccountInfoRequest;
3520/// # async fn dox() {
3521/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3522///
3523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3524/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3525/// #     .with_native_roots()
3526/// #     .unwrap()
3527/// #     .https_only()
3528/// #     .enable_http2()
3529/// #     .build();
3530///
3531/// # let executor = hyper_util::rt::TokioExecutor::new();
3532/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3533/// #     secret,
3534/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3535/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3536/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3537/// #     ),
3538/// # ).build().await.unwrap();
3539///
3540/// # let client = hyper_util::client::legacy::Client::builder(
3541/// #     hyper_util::rt::TokioExecutor::new()
3542/// # )
3543/// # .build(
3544/// #     hyper_rustls::HttpsConnectorBuilder::new()
3545/// #         .with_native_roots()
3546/// #         .unwrap()
3547/// #         .https_or_http()
3548/// #         .enable_http2()
3549/// #         .build()
3550/// # );
3551/// # let mut hub = IdentityToolkit::new(client, auth);
3552/// // As the method needs a request, you would usually fill it with the desired information
3553/// // into the respective structure. Some of the parts shown here might not be applicable !
3554/// // Values shown here are possibly random and not representative !
3555/// let mut req = IdentitytoolkitRelyingpartyGetAccountInfoRequest::default();
3556///
3557/// // You can configure optional parameters by calling the respective setters at will, and
3558/// // execute the final call using `doit()`.
3559/// // Values shown here are possibly random and not representative !
3560/// let result = hub.relyingparty().get_account_info(req)
3561///              .doit().await;
3562/// # }
3563/// ```
3564pub struct RelyingpartyGetAccountInfoCall<'a, C>
3565where
3566    C: 'a,
3567{
3568    hub: &'a IdentityToolkit<C>,
3569    _request: IdentitytoolkitRelyingpartyGetAccountInfoRequest,
3570    _delegate: Option<&'a mut dyn common::Delegate>,
3571    _additional_params: HashMap<String, String>,
3572    _scopes: BTreeSet<String>,
3573}
3574
3575impl<'a, C> common::CallBuilder for RelyingpartyGetAccountInfoCall<'a, C> {}
3576
3577impl<'a, C> RelyingpartyGetAccountInfoCall<'a, C>
3578where
3579    C: common::Connector,
3580{
3581    /// Perform the operation you have build so far.
3582    pub async fn doit(mut self) -> common::Result<(common::Response, GetAccountInfoResponse)> {
3583        use std::borrow::Cow;
3584        use std::io::{Read, Seek};
3585
3586        use common::{url::Params, ToParts};
3587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3588
3589        let mut dd = common::DefaultDelegate;
3590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3591        dlg.begin(common::MethodInfo {
3592            id: "identitytoolkit.relyingparty.getAccountInfo",
3593            http_method: hyper::Method::POST,
3594        });
3595
3596        for &field in ["alt"].iter() {
3597            if self._additional_params.contains_key(field) {
3598                dlg.finished(false);
3599                return Err(common::Error::FieldClash(field));
3600            }
3601        }
3602
3603        let mut params = Params::with_capacity(3 + self._additional_params.len());
3604
3605        params.extend(self._additional_params.iter());
3606
3607        params.push("alt", "json");
3608        let mut url = self.hub._base_url.clone() + "getAccountInfo";
3609        if self._scopes.is_empty() {
3610            self._scopes
3611                .insert(Scope::CloudPlatform.as_ref().to_string());
3612        }
3613
3614        let url = params.parse_with_url(&url);
3615
3616        let mut json_mime_type = mime::APPLICATION_JSON;
3617        let mut request_value_reader = {
3618            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3619            common::remove_json_null_values(&mut value);
3620            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3621            serde_json::to_writer(&mut dst, &value).unwrap();
3622            dst
3623        };
3624        let request_size = request_value_reader
3625            .seek(std::io::SeekFrom::End(0))
3626            .unwrap();
3627        request_value_reader
3628            .seek(std::io::SeekFrom::Start(0))
3629            .unwrap();
3630
3631        loop {
3632            let token = match self
3633                .hub
3634                .auth
3635                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3636                .await
3637            {
3638                Ok(token) => token,
3639                Err(e) => match dlg.token(e) {
3640                    Ok(token) => token,
3641                    Err(e) => {
3642                        dlg.finished(false);
3643                        return Err(common::Error::MissingToken(e));
3644                    }
3645                },
3646            };
3647            request_value_reader
3648                .seek(std::io::SeekFrom::Start(0))
3649                .unwrap();
3650            let mut req_result = {
3651                let client = &self.hub.client;
3652                dlg.pre_request();
3653                let mut req_builder = hyper::Request::builder()
3654                    .method(hyper::Method::POST)
3655                    .uri(url.as_str())
3656                    .header(USER_AGENT, self.hub._user_agent.clone());
3657
3658                if let Some(token) = token.as_ref() {
3659                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3660                }
3661
3662                let request = req_builder
3663                    .header(CONTENT_TYPE, json_mime_type.to_string())
3664                    .header(CONTENT_LENGTH, request_size as u64)
3665                    .body(common::to_body(
3666                        request_value_reader.get_ref().clone().into(),
3667                    ));
3668
3669                client.request(request.unwrap()).await
3670            };
3671
3672            match req_result {
3673                Err(err) => {
3674                    if let common::Retry::After(d) = dlg.http_error(&err) {
3675                        sleep(d).await;
3676                        continue;
3677                    }
3678                    dlg.finished(false);
3679                    return Err(common::Error::HttpError(err));
3680                }
3681                Ok(res) => {
3682                    let (mut parts, body) = res.into_parts();
3683                    let mut body = common::Body::new(body);
3684                    if !parts.status.is_success() {
3685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3686                        let error = serde_json::from_str(&common::to_string(&bytes));
3687                        let response = common::to_response(parts, bytes.into());
3688
3689                        if let common::Retry::After(d) =
3690                            dlg.http_failure(&response, error.as_ref().ok())
3691                        {
3692                            sleep(d).await;
3693                            continue;
3694                        }
3695
3696                        dlg.finished(false);
3697
3698                        return Err(match error {
3699                            Ok(value) => common::Error::BadRequest(value),
3700                            _ => common::Error::Failure(response),
3701                        });
3702                    }
3703                    let response = {
3704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3705                        let encoded = common::to_string(&bytes);
3706                        match serde_json::from_str(&encoded) {
3707                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3708                            Err(error) => {
3709                                dlg.response_json_decode_error(&encoded, &error);
3710                                return Err(common::Error::JsonDecodeError(
3711                                    encoded.to_string(),
3712                                    error,
3713                                ));
3714                            }
3715                        }
3716                    };
3717
3718                    dlg.finished(true);
3719                    return Ok(response);
3720                }
3721            }
3722        }
3723    }
3724
3725    ///
3726    /// Sets the *request* property to the given value.
3727    ///
3728    /// Even though the property as already been set when instantiating this call,
3729    /// we provide this method for API completeness.
3730    pub fn request(
3731        mut self,
3732        new_value: IdentitytoolkitRelyingpartyGetAccountInfoRequest,
3733    ) -> RelyingpartyGetAccountInfoCall<'a, C> {
3734        self._request = new_value;
3735        self
3736    }
3737    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3738    /// while executing the actual API request.
3739    ///
3740    /// ````text
3741    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3742    /// ````
3743    ///
3744    /// Sets the *delegate* property to the given value.
3745    pub fn delegate(
3746        mut self,
3747        new_value: &'a mut dyn common::Delegate,
3748    ) -> RelyingpartyGetAccountInfoCall<'a, C> {
3749        self._delegate = Some(new_value);
3750        self
3751    }
3752
3753    /// Set any additional parameter of the query string used in the request.
3754    /// It should be used to set parameters which are not yet available through their own
3755    /// setters.
3756    ///
3757    /// Please note that this method must not be used to set any of the known parameters
3758    /// which have their own setter method. If done anyway, the request will fail.
3759    ///
3760    /// # Additional Parameters
3761    ///
3762    /// * *alt* (query-string) - Data format for the response.
3763    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3764    /// * *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.
3765    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3766    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3767    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3768    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3769    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyGetAccountInfoCall<'a, C>
3770    where
3771        T: AsRef<str>,
3772    {
3773        self._additional_params
3774            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3775        self
3776    }
3777
3778    /// Identifies the authorization scope for the method you are building.
3779    ///
3780    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3781    /// [`Scope::CloudPlatform`].
3782    ///
3783    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3784    /// tokens for more than one scope.
3785    ///
3786    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3787    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3788    /// sufficient, a read-write scope will do as well.
3789    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyGetAccountInfoCall<'a, C>
3790    where
3791        St: AsRef<str>,
3792    {
3793        self._scopes.insert(String::from(scope.as_ref()));
3794        self
3795    }
3796    /// Identifies the authorization scope(s) for the method you are building.
3797    ///
3798    /// See [`Self::add_scope()`] for details.
3799    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyGetAccountInfoCall<'a, C>
3800    where
3801        I: IntoIterator<Item = St>,
3802        St: AsRef<str>,
3803    {
3804        self._scopes
3805            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3806        self
3807    }
3808
3809    /// Removes all scopes, and no default scope will be used either.
3810    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3811    /// for details).
3812    pub fn clear_scopes(mut self) -> RelyingpartyGetAccountInfoCall<'a, C> {
3813        self._scopes.clear();
3814        self
3815    }
3816}
3817
3818/// Get a code for user action confirmation.
3819///
3820/// A builder for the *getOobConfirmationCode* method supported by a *relyingparty* resource.
3821/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
3822///
3823/// # Example
3824///
3825/// Instantiate a resource method builder
3826///
3827/// ```test_harness,no_run
3828/// # extern crate hyper;
3829/// # extern crate hyper_rustls;
3830/// # extern crate google_identitytoolkit3 as identitytoolkit3;
3831/// use identitytoolkit3::api::Relyingparty;
3832/// # async fn dox() {
3833/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3834///
3835/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3836/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3837/// #     .with_native_roots()
3838/// #     .unwrap()
3839/// #     .https_only()
3840/// #     .enable_http2()
3841/// #     .build();
3842///
3843/// # let executor = hyper_util::rt::TokioExecutor::new();
3844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3845/// #     secret,
3846/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3847/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3848/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3849/// #     ),
3850/// # ).build().await.unwrap();
3851///
3852/// # let client = hyper_util::client::legacy::Client::builder(
3853/// #     hyper_util::rt::TokioExecutor::new()
3854/// # )
3855/// # .build(
3856/// #     hyper_rustls::HttpsConnectorBuilder::new()
3857/// #         .with_native_roots()
3858/// #         .unwrap()
3859/// #         .https_or_http()
3860/// #         .enable_http2()
3861/// #         .build()
3862/// # );
3863/// # let mut hub = IdentityToolkit::new(client, auth);
3864/// // As the method needs a request, you would usually fill it with the desired information
3865/// // into the respective structure. Some of the parts shown here might not be applicable !
3866/// // Values shown here are possibly random and not representative !
3867/// let mut req = Relyingparty::default();
3868///
3869/// // You can configure optional parameters by calling the respective setters at will, and
3870/// // execute the final call using `doit()`.
3871/// // Values shown here are possibly random and not representative !
3872/// let result = hub.relyingparty().get_oob_confirmation_code(req)
3873///              .doit().await;
3874/// # }
3875/// ```
3876pub struct RelyingpartyGetOobConfirmationCodeCall<'a, C>
3877where
3878    C: 'a,
3879{
3880    hub: &'a IdentityToolkit<C>,
3881    _request: Relyingparty,
3882    _delegate: Option<&'a mut dyn common::Delegate>,
3883    _additional_params: HashMap<String, String>,
3884    _scopes: BTreeSet<String>,
3885}
3886
3887impl<'a, C> common::CallBuilder for RelyingpartyGetOobConfirmationCodeCall<'a, C> {}
3888
3889impl<'a, C> RelyingpartyGetOobConfirmationCodeCall<'a, C>
3890where
3891    C: common::Connector,
3892{
3893    /// Perform the operation you have build so far.
3894    pub async fn doit(
3895        mut self,
3896    ) -> common::Result<(common::Response, GetOobConfirmationCodeResponse)> {
3897        use std::borrow::Cow;
3898        use std::io::{Read, Seek};
3899
3900        use common::{url::Params, ToParts};
3901        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3902
3903        let mut dd = common::DefaultDelegate;
3904        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3905        dlg.begin(common::MethodInfo {
3906            id: "identitytoolkit.relyingparty.getOobConfirmationCode",
3907            http_method: hyper::Method::POST,
3908        });
3909
3910        for &field in ["alt"].iter() {
3911            if self._additional_params.contains_key(field) {
3912                dlg.finished(false);
3913                return Err(common::Error::FieldClash(field));
3914            }
3915        }
3916
3917        let mut params = Params::with_capacity(3 + self._additional_params.len());
3918
3919        params.extend(self._additional_params.iter());
3920
3921        params.push("alt", "json");
3922        let mut url = self.hub._base_url.clone() + "getOobConfirmationCode";
3923        if self._scopes.is_empty() {
3924            self._scopes
3925                .insert(Scope::CloudPlatform.as_ref().to_string());
3926        }
3927
3928        let url = params.parse_with_url(&url);
3929
3930        let mut json_mime_type = mime::APPLICATION_JSON;
3931        let mut request_value_reader = {
3932            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3933            common::remove_json_null_values(&mut value);
3934            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3935            serde_json::to_writer(&mut dst, &value).unwrap();
3936            dst
3937        };
3938        let request_size = request_value_reader
3939            .seek(std::io::SeekFrom::End(0))
3940            .unwrap();
3941        request_value_reader
3942            .seek(std::io::SeekFrom::Start(0))
3943            .unwrap();
3944
3945        loop {
3946            let token = match self
3947                .hub
3948                .auth
3949                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3950                .await
3951            {
3952                Ok(token) => token,
3953                Err(e) => match dlg.token(e) {
3954                    Ok(token) => token,
3955                    Err(e) => {
3956                        dlg.finished(false);
3957                        return Err(common::Error::MissingToken(e));
3958                    }
3959                },
3960            };
3961            request_value_reader
3962                .seek(std::io::SeekFrom::Start(0))
3963                .unwrap();
3964            let mut req_result = {
3965                let client = &self.hub.client;
3966                dlg.pre_request();
3967                let mut req_builder = hyper::Request::builder()
3968                    .method(hyper::Method::POST)
3969                    .uri(url.as_str())
3970                    .header(USER_AGENT, self.hub._user_agent.clone());
3971
3972                if let Some(token) = token.as_ref() {
3973                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3974                }
3975
3976                let request = req_builder
3977                    .header(CONTENT_TYPE, json_mime_type.to_string())
3978                    .header(CONTENT_LENGTH, request_size as u64)
3979                    .body(common::to_body(
3980                        request_value_reader.get_ref().clone().into(),
3981                    ));
3982
3983                client.request(request.unwrap()).await
3984            };
3985
3986            match req_result {
3987                Err(err) => {
3988                    if let common::Retry::After(d) = dlg.http_error(&err) {
3989                        sleep(d).await;
3990                        continue;
3991                    }
3992                    dlg.finished(false);
3993                    return Err(common::Error::HttpError(err));
3994                }
3995                Ok(res) => {
3996                    let (mut parts, body) = res.into_parts();
3997                    let mut body = common::Body::new(body);
3998                    if !parts.status.is_success() {
3999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4000                        let error = serde_json::from_str(&common::to_string(&bytes));
4001                        let response = common::to_response(parts, bytes.into());
4002
4003                        if let common::Retry::After(d) =
4004                            dlg.http_failure(&response, error.as_ref().ok())
4005                        {
4006                            sleep(d).await;
4007                            continue;
4008                        }
4009
4010                        dlg.finished(false);
4011
4012                        return Err(match error {
4013                            Ok(value) => common::Error::BadRequest(value),
4014                            _ => common::Error::Failure(response),
4015                        });
4016                    }
4017                    let response = {
4018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4019                        let encoded = common::to_string(&bytes);
4020                        match serde_json::from_str(&encoded) {
4021                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4022                            Err(error) => {
4023                                dlg.response_json_decode_error(&encoded, &error);
4024                                return Err(common::Error::JsonDecodeError(
4025                                    encoded.to_string(),
4026                                    error,
4027                                ));
4028                            }
4029                        }
4030                    };
4031
4032                    dlg.finished(true);
4033                    return Ok(response);
4034                }
4035            }
4036        }
4037    }
4038
4039    ///
4040    /// Sets the *request* property to the given value.
4041    ///
4042    /// Even though the property as already been set when instantiating this call,
4043    /// we provide this method for API completeness.
4044    pub fn request(
4045        mut self,
4046        new_value: Relyingparty,
4047    ) -> RelyingpartyGetOobConfirmationCodeCall<'a, C> {
4048        self._request = new_value;
4049        self
4050    }
4051    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4052    /// while executing the actual API request.
4053    ///
4054    /// ````text
4055    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4056    /// ````
4057    ///
4058    /// Sets the *delegate* property to the given value.
4059    pub fn delegate(
4060        mut self,
4061        new_value: &'a mut dyn common::Delegate,
4062    ) -> RelyingpartyGetOobConfirmationCodeCall<'a, C> {
4063        self._delegate = Some(new_value);
4064        self
4065    }
4066
4067    /// Set any additional parameter of the query string used in the request.
4068    /// It should be used to set parameters which are not yet available through their own
4069    /// setters.
4070    ///
4071    /// Please note that this method must not be used to set any of the known parameters
4072    /// which have their own setter method. If done anyway, the request will fail.
4073    ///
4074    /// # Additional Parameters
4075    ///
4076    /// * *alt* (query-string) - Data format for the response.
4077    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4078    /// * *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.
4079    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4080    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4081    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4082    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4083    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyGetOobConfirmationCodeCall<'a, C>
4084    where
4085        T: AsRef<str>,
4086    {
4087        self._additional_params
4088            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4089        self
4090    }
4091
4092    /// Identifies the authorization scope for the method you are building.
4093    ///
4094    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4095    /// [`Scope::CloudPlatform`].
4096    ///
4097    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4098    /// tokens for more than one scope.
4099    ///
4100    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4101    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4102    /// sufficient, a read-write scope will do as well.
4103    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyGetOobConfirmationCodeCall<'a, C>
4104    where
4105        St: AsRef<str>,
4106    {
4107        self._scopes.insert(String::from(scope.as_ref()));
4108        self
4109    }
4110    /// Identifies the authorization scope(s) for the method you are building.
4111    ///
4112    /// See [`Self::add_scope()`] for details.
4113    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyGetOobConfirmationCodeCall<'a, C>
4114    where
4115        I: IntoIterator<Item = St>,
4116        St: AsRef<str>,
4117    {
4118        self._scopes
4119            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4120        self
4121    }
4122
4123    /// Removes all scopes, and no default scope will be used either.
4124    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4125    /// for details).
4126    pub fn clear_scopes(mut self) -> RelyingpartyGetOobConfirmationCodeCall<'a, C> {
4127        self._scopes.clear();
4128        self
4129    }
4130}
4131
4132/// Get project configuration.
4133///
4134/// A builder for the *getProjectConfig* method supported by a *relyingparty* resource.
4135/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
4136///
4137/// # Example
4138///
4139/// Instantiate a resource method builder
4140///
4141/// ```test_harness,no_run
4142/// # extern crate hyper;
4143/// # extern crate hyper_rustls;
4144/// # extern crate google_identitytoolkit3 as identitytoolkit3;
4145/// # async fn dox() {
4146/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4147///
4148/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4149/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4150/// #     .with_native_roots()
4151/// #     .unwrap()
4152/// #     .https_only()
4153/// #     .enable_http2()
4154/// #     .build();
4155///
4156/// # let executor = hyper_util::rt::TokioExecutor::new();
4157/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4158/// #     secret,
4159/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4160/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4161/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4162/// #     ),
4163/// # ).build().await.unwrap();
4164///
4165/// # let client = hyper_util::client::legacy::Client::builder(
4166/// #     hyper_util::rt::TokioExecutor::new()
4167/// # )
4168/// # .build(
4169/// #     hyper_rustls::HttpsConnectorBuilder::new()
4170/// #         .with_native_roots()
4171/// #         .unwrap()
4172/// #         .https_or_http()
4173/// #         .enable_http2()
4174/// #         .build()
4175/// # );
4176/// # let mut hub = IdentityToolkit::new(client, auth);
4177/// // You can configure optional parameters by calling the respective setters at will, and
4178/// // execute the final call using `doit()`.
4179/// // Values shown here are possibly random and not representative !
4180/// let result = hub.relyingparty().get_project_config()
4181///              .project_number("et")
4182///              .delegated_project_number("magna")
4183///              .doit().await;
4184/// # }
4185/// ```
4186pub struct RelyingpartyGetProjectConfigCall<'a, C>
4187where
4188    C: 'a,
4189{
4190    hub: &'a IdentityToolkit<C>,
4191    _project_number: Option<String>,
4192    _delegated_project_number: Option<String>,
4193    _delegate: Option<&'a mut dyn common::Delegate>,
4194    _additional_params: HashMap<String, String>,
4195    _scopes: BTreeSet<String>,
4196}
4197
4198impl<'a, C> common::CallBuilder for RelyingpartyGetProjectConfigCall<'a, C> {}
4199
4200impl<'a, C> RelyingpartyGetProjectConfigCall<'a, C>
4201where
4202    C: common::Connector,
4203{
4204    /// Perform the operation you have build so far.
4205    pub async fn doit(
4206        mut self,
4207    ) -> common::Result<(
4208        common::Response,
4209        IdentitytoolkitRelyingpartyGetProjectConfigResponse,
4210    )> {
4211        use std::borrow::Cow;
4212        use std::io::{Read, Seek};
4213
4214        use common::{url::Params, ToParts};
4215        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4216
4217        let mut dd = common::DefaultDelegate;
4218        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4219        dlg.begin(common::MethodInfo {
4220            id: "identitytoolkit.relyingparty.getProjectConfig",
4221            http_method: hyper::Method::GET,
4222        });
4223
4224        for &field in ["alt", "projectNumber", "delegatedProjectNumber"].iter() {
4225            if self._additional_params.contains_key(field) {
4226                dlg.finished(false);
4227                return Err(common::Error::FieldClash(field));
4228            }
4229        }
4230
4231        let mut params = Params::with_capacity(4 + self._additional_params.len());
4232        if let Some(value) = self._project_number.as_ref() {
4233            params.push("projectNumber", value);
4234        }
4235        if let Some(value) = self._delegated_project_number.as_ref() {
4236            params.push("delegatedProjectNumber", value);
4237        }
4238
4239        params.extend(self._additional_params.iter());
4240
4241        params.push("alt", "json");
4242        let mut url = self.hub._base_url.clone() + "getProjectConfig";
4243        if self._scopes.is_empty() {
4244            self._scopes
4245                .insert(Scope::CloudPlatform.as_ref().to_string());
4246        }
4247
4248        let url = params.parse_with_url(&url);
4249
4250        loop {
4251            let token = match self
4252                .hub
4253                .auth
4254                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4255                .await
4256            {
4257                Ok(token) => token,
4258                Err(e) => match dlg.token(e) {
4259                    Ok(token) => token,
4260                    Err(e) => {
4261                        dlg.finished(false);
4262                        return Err(common::Error::MissingToken(e));
4263                    }
4264                },
4265            };
4266            let mut req_result = {
4267                let client = &self.hub.client;
4268                dlg.pre_request();
4269                let mut req_builder = hyper::Request::builder()
4270                    .method(hyper::Method::GET)
4271                    .uri(url.as_str())
4272                    .header(USER_AGENT, self.hub._user_agent.clone());
4273
4274                if let Some(token) = token.as_ref() {
4275                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4276                }
4277
4278                let request = req_builder
4279                    .header(CONTENT_LENGTH, 0_u64)
4280                    .body(common::to_body::<String>(None));
4281
4282                client.request(request.unwrap()).await
4283            };
4284
4285            match req_result {
4286                Err(err) => {
4287                    if let common::Retry::After(d) = dlg.http_error(&err) {
4288                        sleep(d).await;
4289                        continue;
4290                    }
4291                    dlg.finished(false);
4292                    return Err(common::Error::HttpError(err));
4293                }
4294                Ok(res) => {
4295                    let (mut parts, body) = res.into_parts();
4296                    let mut body = common::Body::new(body);
4297                    if !parts.status.is_success() {
4298                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4299                        let error = serde_json::from_str(&common::to_string(&bytes));
4300                        let response = common::to_response(parts, bytes.into());
4301
4302                        if let common::Retry::After(d) =
4303                            dlg.http_failure(&response, error.as_ref().ok())
4304                        {
4305                            sleep(d).await;
4306                            continue;
4307                        }
4308
4309                        dlg.finished(false);
4310
4311                        return Err(match error {
4312                            Ok(value) => common::Error::BadRequest(value),
4313                            _ => common::Error::Failure(response),
4314                        });
4315                    }
4316                    let response = {
4317                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4318                        let encoded = common::to_string(&bytes);
4319                        match serde_json::from_str(&encoded) {
4320                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4321                            Err(error) => {
4322                                dlg.response_json_decode_error(&encoded, &error);
4323                                return Err(common::Error::JsonDecodeError(
4324                                    encoded.to_string(),
4325                                    error,
4326                                ));
4327                            }
4328                        }
4329                    };
4330
4331                    dlg.finished(true);
4332                    return Ok(response);
4333                }
4334            }
4335        }
4336    }
4337
4338    /// GCP project number of the request.
4339    ///
4340    /// Sets the *project number* query property to the given value.
4341    pub fn project_number(mut self, new_value: &str) -> RelyingpartyGetProjectConfigCall<'a, C> {
4342        self._project_number = Some(new_value.to_string());
4343        self
4344    }
4345    /// Delegated GCP project number of the request.
4346    ///
4347    /// Sets the *delegated project number* query property to the given value.
4348    pub fn delegated_project_number(
4349        mut self,
4350        new_value: &str,
4351    ) -> RelyingpartyGetProjectConfigCall<'a, C> {
4352        self._delegated_project_number = Some(new_value.to_string());
4353        self
4354    }
4355    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4356    /// while executing the actual API request.
4357    ///
4358    /// ````text
4359    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4360    /// ````
4361    ///
4362    /// Sets the *delegate* property to the given value.
4363    pub fn delegate(
4364        mut self,
4365        new_value: &'a mut dyn common::Delegate,
4366    ) -> RelyingpartyGetProjectConfigCall<'a, C> {
4367        self._delegate = Some(new_value);
4368        self
4369    }
4370
4371    /// Set any additional parameter of the query string used in the request.
4372    /// It should be used to set parameters which are not yet available through their own
4373    /// setters.
4374    ///
4375    /// Please note that this method must not be used to set any of the known parameters
4376    /// which have their own setter method. If done anyway, the request will fail.
4377    ///
4378    /// # Additional Parameters
4379    ///
4380    /// * *alt* (query-string) - Data format for the response.
4381    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4382    /// * *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.
4383    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4384    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4385    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4386    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4387    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyGetProjectConfigCall<'a, C>
4388    where
4389        T: AsRef<str>,
4390    {
4391        self._additional_params
4392            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4393        self
4394    }
4395
4396    /// Identifies the authorization scope for the method you are building.
4397    ///
4398    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4399    /// [`Scope::CloudPlatform`].
4400    ///
4401    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4402    /// tokens for more than one scope.
4403    ///
4404    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4405    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4406    /// sufficient, a read-write scope will do as well.
4407    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyGetProjectConfigCall<'a, C>
4408    where
4409        St: AsRef<str>,
4410    {
4411        self._scopes.insert(String::from(scope.as_ref()));
4412        self
4413    }
4414    /// Identifies the authorization scope(s) for the method you are building.
4415    ///
4416    /// See [`Self::add_scope()`] for details.
4417    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyGetProjectConfigCall<'a, C>
4418    where
4419        I: IntoIterator<Item = St>,
4420        St: AsRef<str>,
4421    {
4422        self._scopes
4423            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4424        self
4425    }
4426
4427    /// Removes all scopes, and no default scope will be used either.
4428    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4429    /// for details).
4430    pub fn clear_scopes(mut self) -> RelyingpartyGetProjectConfigCall<'a, C> {
4431        self._scopes.clear();
4432        self
4433    }
4434}
4435
4436/// Get token signing public key.
4437///
4438/// A builder for the *getPublicKeys* method supported by a *relyingparty* resource.
4439/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
4440///
4441/// # Example
4442///
4443/// Instantiate a resource method builder
4444///
4445/// ```test_harness,no_run
4446/// # extern crate hyper;
4447/// # extern crate hyper_rustls;
4448/// # extern crate google_identitytoolkit3 as identitytoolkit3;
4449/// # async fn dox() {
4450/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4451///
4452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4453/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4454/// #     .with_native_roots()
4455/// #     .unwrap()
4456/// #     .https_only()
4457/// #     .enable_http2()
4458/// #     .build();
4459///
4460/// # let executor = hyper_util::rt::TokioExecutor::new();
4461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4462/// #     secret,
4463/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4464/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4465/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4466/// #     ),
4467/// # ).build().await.unwrap();
4468///
4469/// # let client = hyper_util::client::legacy::Client::builder(
4470/// #     hyper_util::rt::TokioExecutor::new()
4471/// # )
4472/// # .build(
4473/// #     hyper_rustls::HttpsConnectorBuilder::new()
4474/// #         .with_native_roots()
4475/// #         .unwrap()
4476/// #         .https_or_http()
4477/// #         .enable_http2()
4478/// #         .build()
4479/// # );
4480/// # let mut hub = IdentityToolkit::new(client, auth);
4481/// // You can configure optional parameters by calling the respective setters at will, and
4482/// // execute the final call using `doit()`.
4483/// // Values shown here are possibly random and not representative !
4484/// let result = hub.relyingparty().get_public_keys()
4485///              .doit().await;
4486/// # }
4487/// ```
4488pub struct RelyingpartyGetPublicKeyCall<'a, C>
4489where
4490    C: 'a,
4491{
4492    hub: &'a IdentityToolkit<C>,
4493    _delegate: Option<&'a mut dyn common::Delegate>,
4494    _additional_params: HashMap<String, String>,
4495    _scopes: BTreeSet<String>,
4496}
4497
4498impl<'a, C> common::CallBuilder for RelyingpartyGetPublicKeyCall<'a, C> {}
4499
4500impl<'a, C> RelyingpartyGetPublicKeyCall<'a, C>
4501where
4502    C: common::Connector,
4503{
4504    /// Perform the operation you have build so far.
4505    pub async fn doit(
4506        mut self,
4507    ) -> common::Result<(
4508        common::Response,
4509        IdentitytoolkitRelyingpartyGetPublicKeysResponse,
4510    )> {
4511        use std::borrow::Cow;
4512        use std::io::{Read, Seek};
4513
4514        use common::{url::Params, ToParts};
4515        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4516
4517        let mut dd = common::DefaultDelegate;
4518        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4519        dlg.begin(common::MethodInfo {
4520            id: "identitytoolkit.relyingparty.getPublicKeys",
4521            http_method: hyper::Method::GET,
4522        });
4523
4524        for &field in ["alt"].iter() {
4525            if self._additional_params.contains_key(field) {
4526                dlg.finished(false);
4527                return Err(common::Error::FieldClash(field));
4528            }
4529        }
4530
4531        let mut params = Params::with_capacity(2 + self._additional_params.len());
4532
4533        params.extend(self._additional_params.iter());
4534
4535        params.push("alt", "json");
4536        let mut url = self.hub._base_url.clone() + "publicKeys";
4537        if self._scopes.is_empty() {
4538            self._scopes
4539                .insert(Scope::CloudPlatform.as_ref().to_string());
4540        }
4541
4542        let url = params.parse_with_url(&url);
4543
4544        loop {
4545            let token = match self
4546                .hub
4547                .auth
4548                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4549                .await
4550            {
4551                Ok(token) => token,
4552                Err(e) => match dlg.token(e) {
4553                    Ok(token) => token,
4554                    Err(e) => {
4555                        dlg.finished(false);
4556                        return Err(common::Error::MissingToken(e));
4557                    }
4558                },
4559            };
4560            let mut req_result = {
4561                let client = &self.hub.client;
4562                dlg.pre_request();
4563                let mut req_builder = hyper::Request::builder()
4564                    .method(hyper::Method::GET)
4565                    .uri(url.as_str())
4566                    .header(USER_AGENT, self.hub._user_agent.clone());
4567
4568                if let Some(token) = token.as_ref() {
4569                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4570                }
4571
4572                let request = req_builder
4573                    .header(CONTENT_LENGTH, 0_u64)
4574                    .body(common::to_body::<String>(None));
4575
4576                client.request(request.unwrap()).await
4577            };
4578
4579            match req_result {
4580                Err(err) => {
4581                    if let common::Retry::After(d) = dlg.http_error(&err) {
4582                        sleep(d).await;
4583                        continue;
4584                    }
4585                    dlg.finished(false);
4586                    return Err(common::Error::HttpError(err));
4587                }
4588                Ok(res) => {
4589                    let (mut parts, body) = res.into_parts();
4590                    let mut body = common::Body::new(body);
4591                    if !parts.status.is_success() {
4592                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4593                        let error = serde_json::from_str(&common::to_string(&bytes));
4594                        let response = common::to_response(parts, bytes.into());
4595
4596                        if let common::Retry::After(d) =
4597                            dlg.http_failure(&response, error.as_ref().ok())
4598                        {
4599                            sleep(d).await;
4600                            continue;
4601                        }
4602
4603                        dlg.finished(false);
4604
4605                        return Err(match error {
4606                            Ok(value) => common::Error::BadRequest(value),
4607                            _ => common::Error::Failure(response),
4608                        });
4609                    }
4610                    let response = {
4611                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4612                        let encoded = common::to_string(&bytes);
4613                        match serde_json::from_str(&encoded) {
4614                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4615                            Err(error) => {
4616                                dlg.response_json_decode_error(&encoded, &error);
4617                                return Err(common::Error::JsonDecodeError(
4618                                    encoded.to_string(),
4619                                    error,
4620                                ));
4621                            }
4622                        }
4623                    };
4624
4625                    dlg.finished(true);
4626                    return Ok(response);
4627                }
4628            }
4629        }
4630    }
4631
4632    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4633    /// while executing the actual API request.
4634    ///
4635    /// ````text
4636    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4637    /// ````
4638    ///
4639    /// Sets the *delegate* property to the given value.
4640    pub fn delegate(
4641        mut self,
4642        new_value: &'a mut dyn common::Delegate,
4643    ) -> RelyingpartyGetPublicKeyCall<'a, C> {
4644        self._delegate = Some(new_value);
4645        self
4646    }
4647
4648    /// Set any additional parameter of the query string used in the request.
4649    /// It should be used to set parameters which are not yet available through their own
4650    /// setters.
4651    ///
4652    /// Please note that this method must not be used to set any of the known parameters
4653    /// which have their own setter method. If done anyway, the request will fail.
4654    ///
4655    /// # Additional Parameters
4656    ///
4657    /// * *alt* (query-string) - Data format for the response.
4658    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4659    /// * *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.
4660    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4661    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4662    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4663    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4664    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyGetPublicKeyCall<'a, C>
4665    where
4666        T: AsRef<str>,
4667    {
4668        self._additional_params
4669            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4670        self
4671    }
4672
4673    /// Identifies the authorization scope for the method you are building.
4674    ///
4675    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4676    /// [`Scope::CloudPlatform`].
4677    ///
4678    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4679    /// tokens for more than one scope.
4680    ///
4681    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4682    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4683    /// sufficient, a read-write scope will do as well.
4684    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyGetPublicKeyCall<'a, C>
4685    where
4686        St: AsRef<str>,
4687    {
4688        self._scopes.insert(String::from(scope.as_ref()));
4689        self
4690    }
4691    /// Identifies the authorization scope(s) for the method you are building.
4692    ///
4693    /// See [`Self::add_scope()`] for details.
4694    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyGetPublicKeyCall<'a, C>
4695    where
4696        I: IntoIterator<Item = St>,
4697        St: AsRef<str>,
4698    {
4699        self._scopes
4700            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4701        self
4702    }
4703
4704    /// Removes all scopes, and no default scope will be used either.
4705    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4706    /// for details).
4707    pub fn clear_scopes(mut self) -> RelyingpartyGetPublicKeyCall<'a, C> {
4708        self._scopes.clear();
4709        self
4710    }
4711}
4712
4713/// Get recaptcha secure param.
4714///
4715/// A builder for the *getRecaptchaParam* method supported by a *relyingparty* resource.
4716/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
4717///
4718/// # Example
4719///
4720/// Instantiate a resource method builder
4721///
4722/// ```test_harness,no_run
4723/// # extern crate hyper;
4724/// # extern crate hyper_rustls;
4725/// # extern crate google_identitytoolkit3 as identitytoolkit3;
4726/// # async fn dox() {
4727/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4728///
4729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4730/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4731/// #     .with_native_roots()
4732/// #     .unwrap()
4733/// #     .https_only()
4734/// #     .enable_http2()
4735/// #     .build();
4736///
4737/// # let executor = hyper_util::rt::TokioExecutor::new();
4738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4739/// #     secret,
4740/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4741/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4742/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4743/// #     ),
4744/// # ).build().await.unwrap();
4745///
4746/// # let client = hyper_util::client::legacy::Client::builder(
4747/// #     hyper_util::rt::TokioExecutor::new()
4748/// # )
4749/// # .build(
4750/// #     hyper_rustls::HttpsConnectorBuilder::new()
4751/// #         .with_native_roots()
4752/// #         .unwrap()
4753/// #         .https_or_http()
4754/// #         .enable_http2()
4755/// #         .build()
4756/// # );
4757/// # let mut hub = IdentityToolkit::new(client, auth);
4758/// // You can configure optional parameters by calling the respective setters at will, and
4759/// // execute the final call using `doit()`.
4760/// // Values shown here are possibly random and not representative !
4761/// let result = hub.relyingparty().get_recaptcha_param()
4762///              .doit().await;
4763/// # }
4764/// ```
4765pub struct RelyingpartyGetRecaptchaParamCall<'a, C>
4766where
4767    C: 'a,
4768{
4769    hub: &'a IdentityToolkit<C>,
4770    _delegate: Option<&'a mut dyn common::Delegate>,
4771    _additional_params: HashMap<String, String>,
4772    _scopes: BTreeSet<String>,
4773}
4774
4775impl<'a, C> common::CallBuilder for RelyingpartyGetRecaptchaParamCall<'a, C> {}
4776
4777impl<'a, C> RelyingpartyGetRecaptchaParamCall<'a, C>
4778where
4779    C: common::Connector,
4780{
4781    /// Perform the operation you have build so far.
4782    pub async fn doit(mut self) -> common::Result<(common::Response, GetRecaptchaParamResponse)> {
4783        use std::borrow::Cow;
4784        use std::io::{Read, Seek};
4785
4786        use common::{url::Params, ToParts};
4787        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4788
4789        let mut dd = common::DefaultDelegate;
4790        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4791        dlg.begin(common::MethodInfo {
4792            id: "identitytoolkit.relyingparty.getRecaptchaParam",
4793            http_method: hyper::Method::GET,
4794        });
4795
4796        for &field in ["alt"].iter() {
4797            if self._additional_params.contains_key(field) {
4798                dlg.finished(false);
4799                return Err(common::Error::FieldClash(field));
4800            }
4801        }
4802
4803        let mut params = Params::with_capacity(2 + self._additional_params.len());
4804
4805        params.extend(self._additional_params.iter());
4806
4807        params.push("alt", "json");
4808        let mut url = self.hub._base_url.clone() + "getRecaptchaParam";
4809        if self._scopes.is_empty() {
4810            self._scopes
4811                .insert(Scope::CloudPlatform.as_ref().to_string());
4812        }
4813
4814        let url = params.parse_with_url(&url);
4815
4816        loop {
4817            let token = match self
4818                .hub
4819                .auth
4820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4821                .await
4822            {
4823                Ok(token) => token,
4824                Err(e) => match dlg.token(e) {
4825                    Ok(token) => token,
4826                    Err(e) => {
4827                        dlg.finished(false);
4828                        return Err(common::Error::MissingToken(e));
4829                    }
4830                },
4831            };
4832            let mut req_result = {
4833                let client = &self.hub.client;
4834                dlg.pre_request();
4835                let mut req_builder = hyper::Request::builder()
4836                    .method(hyper::Method::GET)
4837                    .uri(url.as_str())
4838                    .header(USER_AGENT, self.hub._user_agent.clone());
4839
4840                if let Some(token) = token.as_ref() {
4841                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4842                }
4843
4844                let request = req_builder
4845                    .header(CONTENT_LENGTH, 0_u64)
4846                    .body(common::to_body::<String>(None));
4847
4848                client.request(request.unwrap()).await
4849            };
4850
4851            match req_result {
4852                Err(err) => {
4853                    if let common::Retry::After(d) = dlg.http_error(&err) {
4854                        sleep(d).await;
4855                        continue;
4856                    }
4857                    dlg.finished(false);
4858                    return Err(common::Error::HttpError(err));
4859                }
4860                Ok(res) => {
4861                    let (mut parts, body) = res.into_parts();
4862                    let mut body = common::Body::new(body);
4863                    if !parts.status.is_success() {
4864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4865                        let error = serde_json::from_str(&common::to_string(&bytes));
4866                        let response = common::to_response(parts, bytes.into());
4867
4868                        if let common::Retry::After(d) =
4869                            dlg.http_failure(&response, error.as_ref().ok())
4870                        {
4871                            sleep(d).await;
4872                            continue;
4873                        }
4874
4875                        dlg.finished(false);
4876
4877                        return Err(match error {
4878                            Ok(value) => common::Error::BadRequest(value),
4879                            _ => common::Error::Failure(response),
4880                        });
4881                    }
4882                    let response = {
4883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4884                        let encoded = common::to_string(&bytes);
4885                        match serde_json::from_str(&encoded) {
4886                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4887                            Err(error) => {
4888                                dlg.response_json_decode_error(&encoded, &error);
4889                                return Err(common::Error::JsonDecodeError(
4890                                    encoded.to_string(),
4891                                    error,
4892                                ));
4893                            }
4894                        }
4895                    };
4896
4897                    dlg.finished(true);
4898                    return Ok(response);
4899                }
4900            }
4901        }
4902    }
4903
4904    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4905    /// while executing the actual API request.
4906    ///
4907    /// ````text
4908    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4909    /// ````
4910    ///
4911    /// Sets the *delegate* property to the given value.
4912    pub fn delegate(
4913        mut self,
4914        new_value: &'a mut dyn common::Delegate,
4915    ) -> RelyingpartyGetRecaptchaParamCall<'a, C> {
4916        self._delegate = Some(new_value);
4917        self
4918    }
4919
4920    /// Set any additional parameter of the query string used in the request.
4921    /// It should be used to set parameters which are not yet available through their own
4922    /// setters.
4923    ///
4924    /// Please note that this method must not be used to set any of the known parameters
4925    /// which have their own setter method. If done anyway, the request will fail.
4926    ///
4927    /// # Additional Parameters
4928    ///
4929    /// * *alt* (query-string) - Data format for the response.
4930    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4931    /// * *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.
4932    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4933    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4934    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
4935    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
4936    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyGetRecaptchaParamCall<'a, C>
4937    where
4938        T: AsRef<str>,
4939    {
4940        self._additional_params
4941            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4942        self
4943    }
4944
4945    /// Identifies the authorization scope for the method you are building.
4946    ///
4947    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4948    /// [`Scope::CloudPlatform`].
4949    ///
4950    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4951    /// tokens for more than one scope.
4952    ///
4953    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4954    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4955    /// sufficient, a read-write scope will do as well.
4956    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyGetRecaptchaParamCall<'a, C>
4957    where
4958        St: AsRef<str>,
4959    {
4960        self._scopes.insert(String::from(scope.as_ref()));
4961        self
4962    }
4963    /// Identifies the authorization scope(s) for the method you are building.
4964    ///
4965    /// See [`Self::add_scope()`] for details.
4966    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyGetRecaptchaParamCall<'a, C>
4967    where
4968        I: IntoIterator<Item = St>,
4969        St: AsRef<str>,
4970    {
4971        self._scopes
4972            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4973        self
4974    }
4975
4976    /// Removes all scopes, and no default scope will be used either.
4977    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4978    /// for details).
4979    pub fn clear_scopes(mut self) -> RelyingpartyGetRecaptchaParamCall<'a, C> {
4980        self._scopes.clear();
4981        self
4982    }
4983}
4984
4985/// Reset password for a user.
4986///
4987/// A builder for the *resetPassword* method supported by a *relyingparty* resource.
4988/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
4989///
4990/// # Example
4991///
4992/// Instantiate a resource method builder
4993///
4994/// ```test_harness,no_run
4995/// # extern crate hyper;
4996/// # extern crate hyper_rustls;
4997/// # extern crate google_identitytoolkit3 as identitytoolkit3;
4998/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyResetPasswordRequest;
4999/// # async fn dox() {
5000/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5001///
5002/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5003/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5004/// #     .with_native_roots()
5005/// #     .unwrap()
5006/// #     .https_only()
5007/// #     .enable_http2()
5008/// #     .build();
5009///
5010/// # let executor = hyper_util::rt::TokioExecutor::new();
5011/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5012/// #     secret,
5013/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5014/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5015/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5016/// #     ),
5017/// # ).build().await.unwrap();
5018///
5019/// # let client = hyper_util::client::legacy::Client::builder(
5020/// #     hyper_util::rt::TokioExecutor::new()
5021/// # )
5022/// # .build(
5023/// #     hyper_rustls::HttpsConnectorBuilder::new()
5024/// #         .with_native_roots()
5025/// #         .unwrap()
5026/// #         .https_or_http()
5027/// #         .enable_http2()
5028/// #         .build()
5029/// # );
5030/// # let mut hub = IdentityToolkit::new(client, auth);
5031/// // As the method needs a request, you would usually fill it with the desired information
5032/// // into the respective structure. Some of the parts shown here might not be applicable !
5033/// // Values shown here are possibly random and not representative !
5034/// let mut req = IdentitytoolkitRelyingpartyResetPasswordRequest::default();
5035///
5036/// // You can configure optional parameters by calling the respective setters at will, and
5037/// // execute the final call using `doit()`.
5038/// // Values shown here are possibly random and not representative !
5039/// let result = hub.relyingparty().reset_password(req)
5040///              .doit().await;
5041/// # }
5042/// ```
5043pub struct RelyingpartyResetPasswordCall<'a, C>
5044where
5045    C: 'a,
5046{
5047    hub: &'a IdentityToolkit<C>,
5048    _request: IdentitytoolkitRelyingpartyResetPasswordRequest,
5049    _delegate: Option<&'a mut dyn common::Delegate>,
5050    _additional_params: HashMap<String, String>,
5051    _scopes: BTreeSet<String>,
5052}
5053
5054impl<'a, C> common::CallBuilder for RelyingpartyResetPasswordCall<'a, C> {}
5055
5056impl<'a, C> RelyingpartyResetPasswordCall<'a, C>
5057where
5058    C: common::Connector,
5059{
5060    /// Perform the operation you have build so far.
5061    pub async fn doit(mut self) -> common::Result<(common::Response, ResetPasswordResponse)> {
5062        use std::borrow::Cow;
5063        use std::io::{Read, Seek};
5064
5065        use common::{url::Params, ToParts};
5066        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5067
5068        let mut dd = common::DefaultDelegate;
5069        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5070        dlg.begin(common::MethodInfo {
5071            id: "identitytoolkit.relyingparty.resetPassword",
5072            http_method: hyper::Method::POST,
5073        });
5074
5075        for &field in ["alt"].iter() {
5076            if self._additional_params.contains_key(field) {
5077                dlg.finished(false);
5078                return Err(common::Error::FieldClash(field));
5079            }
5080        }
5081
5082        let mut params = Params::with_capacity(3 + self._additional_params.len());
5083
5084        params.extend(self._additional_params.iter());
5085
5086        params.push("alt", "json");
5087        let mut url = self.hub._base_url.clone() + "resetPassword";
5088        if self._scopes.is_empty() {
5089            self._scopes
5090                .insert(Scope::CloudPlatform.as_ref().to_string());
5091        }
5092
5093        let url = params.parse_with_url(&url);
5094
5095        let mut json_mime_type = mime::APPLICATION_JSON;
5096        let mut request_value_reader = {
5097            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5098            common::remove_json_null_values(&mut value);
5099            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5100            serde_json::to_writer(&mut dst, &value).unwrap();
5101            dst
5102        };
5103        let request_size = request_value_reader
5104            .seek(std::io::SeekFrom::End(0))
5105            .unwrap();
5106        request_value_reader
5107            .seek(std::io::SeekFrom::Start(0))
5108            .unwrap();
5109
5110        loop {
5111            let token = match self
5112                .hub
5113                .auth
5114                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5115                .await
5116            {
5117                Ok(token) => token,
5118                Err(e) => match dlg.token(e) {
5119                    Ok(token) => token,
5120                    Err(e) => {
5121                        dlg.finished(false);
5122                        return Err(common::Error::MissingToken(e));
5123                    }
5124                },
5125            };
5126            request_value_reader
5127                .seek(std::io::SeekFrom::Start(0))
5128                .unwrap();
5129            let mut req_result = {
5130                let client = &self.hub.client;
5131                dlg.pre_request();
5132                let mut req_builder = hyper::Request::builder()
5133                    .method(hyper::Method::POST)
5134                    .uri(url.as_str())
5135                    .header(USER_AGENT, self.hub._user_agent.clone());
5136
5137                if let Some(token) = token.as_ref() {
5138                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5139                }
5140
5141                let request = req_builder
5142                    .header(CONTENT_TYPE, json_mime_type.to_string())
5143                    .header(CONTENT_LENGTH, request_size as u64)
5144                    .body(common::to_body(
5145                        request_value_reader.get_ref().clone().into(),
5146                    ));
5147
5148                client.request(request.unwrap()).await
5149            };
5150
5151            match req_result {
5152                Err(err) => {
5153                    if let common::Retry::After(d) = dlg.http_error(&err) {
5154                        sleep(d).await;
5155                        continue;
5156                    }
5157                    dlg.finished(false);
5158                    return Err(common::Error::HttpError(err));
5159                }
5160                Ok(res) => {
5161                    let (mut parts, body) = res.into_parts();
5162                    let mut body = common::Body::new(body);
5163                    if !parts.status.is_success() {
5164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5165                        let error = serde_json::from_str(&common::to_string(&bytes));
5166                        let response = common::to_response(parts, bytes.into());
5167
5168                        if let common::Retry::After(d) =
5169                            dlg.http_failure(&response, error.as_ref().ok())
5170                        {
5171                            sleep(d).await;
5172                            continue;
5173                        }
5174
5175                        dlg.finished(false);
5176
5177                        return Err(match error {
5178                            Ok(value) => common::Error::BadRequest(value),
5179                            _ => common::Error::Failure(response),
5180                        });
5181                    }
5182                    let response = {
5183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5184                        let encoded = common::to_string(&bytes);
5185                        match serde_json::from_str(&encoded) {
5186                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5187                            Err(error) => {
5188                                dlg.response_json_decode_error(&encoded, &error);
5189                                return Err(common::Error::JsonDecodeError(
5190                                    encoded.to_string(),
5191                                    error,
5192                                ));
5193                            }
5194                        }
5195                    };
5196
5197                    dlg.finished(true);
5198                    return Ok(response);
5199                }
5200            }
5201        }
5202    }
5203
5204    ///
5205    /// Sets the *request* property to the given value.
5206    ///
5207    /// Even though the property as already been set when instantiating this call,
5208    /// we provide this method for API completeness.
5209    pub fn request(
5210        mut self,
5211        new_value: IdentitytoolkitRelyingpartyResetPasswordRequest,
5212    ) -> RelyingpartyResetPasswordCall<'a, C> {
5213        self._request = new_value;
5214        self
5215    }
5216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5217    /// while executing the actual API request.
5218    ///
5219    /// ````text
5220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5221    /// ````
5222    ///
5223    /// Sets the *delegate* property to the given value.
5224    pub fn delegate(
5225        mut self,
5226        new_value: &'a mut dyn common::Delegate,
5227    ) -> RelyingpartyResetPasswordCall<'a, C> {
5228        self._delegate = Some(new_value);
5229        self
5230    }
5231
5232    /// Set any additional parameter of the query string used in the request.
5233    /// It should be used to set parameters which are not yet available through their own
5234    /// setters.
5235    ///
5236    /// Please note that this method must not be used to set any of the known parameters
5237    /// which have their own setter method. If done anyway, the request will fail.
5238    ///
5239    /// # Additional Parameters
5240    ///
5241    /// * *alt* (query-string) - Data format for the response.
5242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5243    /// * *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.
5244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5246    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
5247    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
5248    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyResetPasswordCall<'a, C>
5249    where
5250        T: AsRef<str>,
5251    {
5252        self._additional_params
5253            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5254        self
5255    }
5256
5257    /// Identifies the authorization scope for the method you are building.
5258    ///
5259    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5260    /// [`Scope::CloudPlatform`].
5261    ///
5262    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5263    /// tokens for more than one scope.
5264    ///
5265    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5266    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5267    /// sufficient, a read-write scope will do as well.
5268    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyResetPasswordCall<'a, C>
5269    where
5270        St: AsRef<str>,
5271    {
5272        self._scopes.insert(String::from(scope.as_ref()));
5273        self
5274    }
5275    /// Identifies the authorization scope(s) for the method you are building.
5276    ///
5277    /// See [`Self::add_scope()`] for details.
5278    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyResetPasswordCall<'a, C>
5279    where
5280        I: IntoIterator<Item = St>,
5281        St: AsRef<str>,
5282    {
5283        self._scopes
5284            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5285        self
5286    }
5287
5288    /// Removes all scopes, and no default scope will be used either.
5289    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5290    /// for details).
5291    pub fn clear_scopes(mut self) -> RelyingpartyResetPasswordCall<'a, C> {
5292        self._scopes.clear();
5293        self
5294    }
5295}
5296
5297/// Send SMS verification code.
5298///
5299/// A builder for the *sendVerificationCode* method supported by a *relyingparty* resource.
5300/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
5301///
5302/// # Example
5303///
5304/// Instantiate a resource method builder
5305///
5306/// ```test_harness,no_run
5307/// # extern crate hyper;
5308/// # extern crate hyper_rustls;
5309/// # extern crate google_identitytoolkit3 as identitytoolkit3;
5310/// use identitytoolkit3::api::IdentitytoolkitRelyingpartySendVerificationCodeRequest;
5311/// # async fn dox() {
5312/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5313///
5314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5315/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5316/// #     .with_native_roots()
5317/// #     .unwrap()
5318/// #     .https_only()
5319/// #     .enable_http2()
5320/// #     .build();
5321///
5322/// # let executor = hyper_util::rt::TokioExecutor::new();
5323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5324/// #     secret,
5325/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5326/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5327/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5328/// #     ),
5329/// # ).build().await.unwrap();
5330///
5331/// # let client = hyper_util::client::legacy::Client::builder(
5332/// #     hyper_util::rt::TokioExecutor::new()
5333/// # )
5334/// # .build(
5335/// #     hyper_rustls::HttpsConnectorBuilder::new()
5336/// #         .with_native_roots()
5337/// #         .unwrap()
5338/// #         .https_or_http()
5339/// #         .enable_http2()
5340/// #         .build()
5341/// # );
5342/// # let mut hub = IdentityToolkit::new(client, auth);
5343/// // As the method needs a request, you would usually fill it with the desired information
5344/// // into the respective structure. Some of the parts shown here might not be applicable !
5345/// // Values shown here are possibly random and not representative !
5346/// let mut req = IdentitytoolkitRelyingpartySendVerificationCodeRequest::default();
5347///
5348/// // You can configure optional parameters by calling the respective setters at will, and
5349/// // execute the final call using `doit()`.
5350/// // Values shown here are possibly random and not representative !
5351/// let result = hub.relyingparty().send_verification_code(req)
5352///              .doit().await;
5353/// # }
5354/// ```
5355pub struct RelyingpartySendVerificationCodeCall<'a, C>
5356where
5357    C: 'a,
5358{
5359    hub: &'a IdentityToolkit<C>,
5360    _request: IdentitytoolkitRelyingpartySendVerificationCodeRequest,
5361    _delegate: Option<&'a mut dyn common::Delegate>,
5362    _additional_params: HashMap<String, String>,
5363    _scopes: BTreeSet<String>,
5364}
5365
5366impl<'a, C> common::CallBuilder for RelyingpartySendVerificationCodeCall<'a, C> {}
5367
5368impl<'a, C> RelyingpartySendVerificationCodeCall<'a, C>
5369where
5370    C: common::Connector,
5371{
5372    /// Perform the operation you have build so far.
5373    pub async fn doit(
5374        mut self,
5375    ) -> common::Result<(
5376        common::Response,
5377        IdentitytoolkitRelyingpartySendVerificationCodeResponse,
5378    )> {
5379        use std::borrow::Cow;
5380        use std::io::{Read, Seek};
5381
5382        use common::{url::Params, ToParts};
5383        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5384
5385        let mut dd = common::DefaultDelegate;
5386        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5387        dlg.begin(common::MethodInfo {
5388            id: "identitytoolkit.relyingparty.sendVerificationCode",
5389            http_method: hyper::Method::POST,
5390        });
5391
5392        for &field in ["alt"].iter() {
5393            if self._additional_params.contains_key(field) {
5394                dlg.finished(false);
5395                return Err(common::Error::FieldClash(field));
5396            }
5397        }
5398
5399        let mut params = Params::with_capacity(3 + self._additional_params.len());
5400
5401        params.extend(self._additional_params.iter());
5402
5403        params.push("alt", "json");
5404        let mut url = self.hub._base_url.clone() + "sendVerificationCode";
5405        if self._scopes.is_empty() {
5406            self._scopes
5407                .insert(Scope::CloudPlatform.as_ref().to_string());
5408        }
5409
5410        let url = params.parse_with_url(&url);
5411
5412        let mut json_mime_type = mime::APPLICATION_JSON;
5413        let mut request_value_reader = {
5414            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5415            common::remove_json_null_values(&mut value);
5416            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5417            serde_json::to_writer(&mut dst, &value).unwrap();
5418            dst
5419        };
5420        let request_size = request_value_reader
5421            .seek(std::io::SeekFrom::End(0))
5422            .unwrap();
5423        request_value_reader
5424            .seek(std::io::SeekFrom::Start(0))
5425            .unwrap();
5426
5427        loop {
5428            let token = match self
5429                .hub
5430                .auth
5431                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5432                .await
5433            {
5434                Ok(token) => token,
5435                Err(e) => match dlg.token(e) {
5436                    Ok(token) => token,
5437                    Err(e) => {
5438                        dlg.finished(false);
5439                        return Err(common::Error::MissingToken(e));
5440                    }
5441                },
5442            };
5443            request_value_reader
5444                .seek(std::io::SeekFrom::Start(0))
5445                .unwrap();
5446            let mut req_result = {
5447                let client = &self.hub.client;
5448                dlg.pre_request();
5449                let mut req_builder = hyper::Request::builder()
5450                    .method(hyper::Method::POST)
5451                    .uri(url.as_str())
5452                    .header(USER_AGENT, self.hub._user_agent.clone());
5453
5454                if let Some(token) = token.as_ref() {
5455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5456                }
5457
5458                let request = req_builder
5459                    .header(CONTENT_TYPE, json_mime_type.to_string())
5460                    .header(CONTENT_LENGTH, request_size as u64)
5461                    .body(common::to_body(
5462                        request_value_reader.get_ref().clone().into(),
5463                    ));
5464
5465                client.request(request.unwrap()).await
5466            };
5467
5468            match req_result {
5469                Err(err) => {
5470                    if let common::Retry::After(d) = dlg.http_error(&err) {
5471                        sleep(d).await;
5472                        continue;
5473                    }
5474                    dlg.finished(false);
5475                    return Err(common::Error::HttpError(err));
5476                }
5477                Ok(res) => {
5478                    let (mut parts, body) = res.into_parts();
5479                    let mut body = common::Body::new(body);
5480                    if !parts.status.is_success() {
5481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5482                        let error = serde_json::from_str(&common::to_string(&bytes));
5483                        let response = common::to_response(parts, bytes.into());
5484
5485                        if let common::Retry::After(d) =
5486                            dlg.http_failure(&response, error.as_ref().ok())
5487                        {
5488                            sleep(d).await;
5489                            continue;
5490                        }
5491
5492                        dlg.finished(false);
5493
5494                        return Err(match error {
5495                            Ok(value) => common::Error::BadRequest(value),
5496                            _ => common::Error::Failure(response),
5497                        });
5498                    }
5499                    let response = {
5500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5501                        let encoded = common::to_string(&bytes);
5502                        match serde_json::from_str(&encoded) {
5503                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5504                            Err(error) => {
5505                                dlg.response_json_decode_error(&encoded, &error);
5506                                return Err(common::Error::JsonDecodeError(
5507                                    encoded.to_string(),
5508                                    error,
5509                                ));
5510                            }
5511                        }
5512                    };
5513
5514                    dlg.finished(true);
5515                    return Ok(response);
5516                }
5517            }
5518        }
5519    }
5520
5521    ///
5522    /// Sets the *request* property to the given value.
5523    ///
5524    /// Even though the property as already been set when instantiating this call,
5525    /// we provide this method for API completeness.
5526    pub fn request(
5527        mut self,
5528        new_value: IdentitytoolkitRelyingpartySendVerificationCodeRequest,
5529    ) -> RelyingpartySendVerificationCodeCall<'a, C> {
5530        self._request = new_value;
5531        self
5532    }
5533    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5534    /// while executing the actual API request.
5535    ///
5536    /// ````text
5537    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5538    /// ````
5539    ///
5540    /// Sets the *delegate* property to the given value.
5541    pub fn delegate(
5542        mut self,
5543        new_value: &'a mut dyn common::Delegate,
5544    ) -> RelyingpartySendVerificationCodeCall<'a, C> {
5545        self._delegate = Some(new_value);
5546        self
5547    }
5548
5549    /// Set any additional parameter of the query string used in the request.
5550    /// It should be used to set parameters which are not yet available through their own
5551    /// setters.
5552    ///
5553    /// Please note that this method must not be used to set any of the known parameters
5554    /// which have their own setter method. If done anyway, the request will fail.
5555    ///
5556    /// # Additional Parameters
5557    ///
5558    /// * *alt* (query-string) - Data format for the response.
5559    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5560    /// * *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.
5561    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5562    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5563    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
5564    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
5565    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartySendVerificationCodeCall<'a, C>
5566    where
5567        T: AsRef<str>,
5568    {
5569        self._additional_params
5570            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5571        self
5572    }
5573
5574    /// Identifies the authorization scope for the method you are building.
5575    ///
5576    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5577    /// [`Scope::CloudPlatform`].
5578    ///
5579    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5580    /// tokens for more than one scope.
5581    ///
5582    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5583    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5584    /// sufficient, a read-write scope will do as well.
5585    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartySendVerificationCodeCall<'a, C>
5586    where
5587        St: AsRef<str>,
5588    {
5589        self._scopes.insert(String::from(scope.as_ref()));
5590        self
5591    }
5592    /// Identifies the authorization scope(s) for the method you are building.
5593    ///
5594    /// See [`Self::add_scope()`] for details.
5595    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartySendVerificationCodeCall<'a, C>
5596    where
5597        I: IntoIterator<Item = St>,
5598        St: AsRef<str>,
5599    {
5600        self._scopes
5601            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5602        self
5603    }
5604
5605    /// Removes all scopes, and no default scope will be used either.
5606    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5607    /// for details).
5608    pub fn clear_scopes(mut self) -> RelyingpartySendVerificationCodeCall<'a, C> {
5609        self._scopes.clear();
5610        self
5611    }
5612}
5613
5614/// Set account info for a user.
5615///
5616/// A builder for the *setAccountInfo* method supported by a *relyingparty* resource.
5617/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
5618///
5619/// # Example
5620///
5621/// Instantiate a resource method builder
5622///
5623/// ```test_harness,no_run
5624/// # extern crate hyper;
5625/// # extern crate hyper_rustls;
5626/// # extern crate google_identitytoolkit3 as identitytoolkit3;
5627/// use identitytoolkit3::api::IdentitytoolkitRelyingpartySetAccountInfoRequest;
5628/// # async fn dox() {
5629/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5630///
5631/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5632/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5633/// #     .with_native_roots()
5634/// #     .unwrap()
5635/// #     .https_only()
5636/// #     .enable_http2()
5637/// #     .build();
5638///
5639/// # let executor = hyper_util::rt::TokioExecutor::new();
5640/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5641/// #     secret,
5642/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5643/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5644/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5645/// #     ),
5646/// # ).build().await.unwrap();
5647///
5648/// # let client = hyper_util::client::legacy::Client::builder(
5649/// #     hyper_util::rt::TokioExecutor::new()
5650/// # )
5651/// # .build(
5652/// #     hyper_rustls::HttpsConnectorBuilder::new()
5653/// #         .with_native_roots()
5654/// #         .unwrap()
5655/// #         .https_or_http()
5656/// #         .enable_http2()
5657/// #         .build()
5658/// # );
5659/// # let mut hub = IdentityToolkit::new(client, auth);
5660/// // As the method needs a request, you would usually fill it with the desired information
5661/// // into the respective structure. Some of the parts shown here might not be applicable !
5662/// // Values shown here are possibly random and not representative !
5663/// let mut req = IdentitytoolkitRelyingpartySetAccountInfoRequest::default();
5664///
5665/// // You can configure optional parameters by calling the respective setters at will, and
5666/// // execute the final call using `doit()`.
5667/// // Values shown here are possibly random and not representative !
5668/// let result = hub.relyingparty().set_account_info(req)
5669///              .doit().await;
5670/// # }
5671/// ```
5672pub struct RelyingpartySetAccountInfoCall<'a, C>
5673where
5674    C: 'a,
5675{
5676    hub: &'a IdentityToolkit<C>,
5677    _request: IdentitytoolkitRelyingpartySetAccountInfoRequest,
5678    _delegate: Option<&'a mut dyn common::Delegate>,
5679    _additional_params: HashMap<String, String>,
5680    _scopes: BTreeSet<String>,
5681}
5682
5683impl<'a, C> common::CallBuilder for RelyingpartySetAccountInfoCall<'a, C> {}
5684
5685impl<'a, C> RelyingpartySetAccountInfoCall<'a, C>
5686where
5687    C: common::Connector,
5688{
5689    /// Perform the operation you have build so far.
5690    pub async fn doit(mut self) -> common::Result<(common::Response, SetAccountInfoResponse)> {
5691        use std::borrow::Cow;
5692        use std::io::{Read, Seek};
5693
5694        use common::{url::Params, ToParts};
5695        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5696
5697        let mut dd = common::DefaultDelegate;
5698        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5699        dlg.begin(common::MethodInfo {
5700            id: "identitytoolkit.relyingparty.setAccountInfo",
5701            http_method: hyper::Method::POST,
5702        });
5703
5704        for &field in ["alt"].iter() {
5705            if self._additional_params.contains_key(field) {
5706                dlg.finished(false);
5707                return Err(common::Error::FieldClash(field));
5708            }
5709        }
5710
5711        let mut params = Params::with_capacity(3 + self._additional_params.len());
5712
5713        params.extend(self._additional_params.iter());
5714
5715        params.push("alt", "json");
5716        let mut url = self.hub._base_url.clone() + "setAccountInfo";
5717        if self._scopes.is_empty() {
5718            self._scopes
5719                .insert(Scope::CloudPlatform.as_ref().to_string());
5720        }
5721
5722        let url = params.parse_with_url(&url);
5723
5724        let mut json_mime_type = mime::APPLICATION_JSON;
5725        let mut request_value_reader = {
5726            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5727            common::remove_json_null_values(&mut value);
5728            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5729            serde_json::to_writer(&mut dst, &value).unwrap();
5730            dst
5731        };
5732        let request_size = request_value_reader
5733            .seek(std::io::SeekFrom::End(0))
5734            .unwrap();
5735        request_value_reader
5736            .seek(std::io::SeekFrom::Start(0))
5737            .unwrap();
5738
5739        loop {
5740            let token = match self
5741                .hub
5742                .auth
5743                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5744                .await
5745            {
5746                Ok(token) => token,
5747                Err(e) => match dlg.token(e) {
5748                    Ok(token) => token,
5749                    Err(e) => {
5750                        dlg.finished(false);
5751                        return Err(common::Error::MissingToken(e));
5752                    }
5753                },
5754            };
5755            request_value_reader
5756                .seek(std::io::SeekFrom::Start(0))
5757                .unwrap();
5758            let mut req_result = {
5759                let client = &self.hub.client;
5760                dlg.pre_request();
5761                let mut req_builder = hyper::Request::builder()
5762                    .method(hyper::Method::POST)
5763                    .uri(url.as_str())
5764                    .header(USER_AGENT, self.hub._user_agent.clone());
5765
5766                if let Some(token) = token.as_ref() {
5767                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5768                }
5769
5770                let request = req_builder
5771                    .header(CONTENT_TYPE, json_mime_type.to_string())
5772                    .header(CONTENT_LENGTH, request_size as u64)
5773                    .body(common::to_body(
5774                        request_value_reader.get_ref().clone().into(),
5775                    ));
5776
5777                client.request(request.unwrap()).await
5778            };
5779
5780            match req_result {
5781                Err(err) => {
5782                    if let common::Retry::After(d) = dlg.http_error(&err) {
5783                        sleep(d).await;
5784                        continue;
5785                    }
5786                    dlg.finished(false);
5787                    return Err(common::Error::HttpError(err));
5788                }
5789                Ok(res) => {
5790                    let (mut parts, body) = res.into_parts();
5791                    let mut body = common::Body::new(body);
5792                    if !parts.status.is_success() {
5793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5794                        let error = serde_json::from_str(&common::to_string(&bytes));
5795                        let response = common::to_response(parts, bytes.into());
5796
5797                        if let common::Retry::After(d) =
5798                            dlg.http_failure(&response, error.as_ref().ok())
5799                        {
5800                            sleep(d).await;
5801                            continue;
5802                        }
5803
5804                        dlg.finished(false);
5805
5806                        return Err(match error {
5807                            Ok(value) => common::Error::BadRequest(value),
5808                            _ => common::Error::Failure(response),
5809                        });
5810                    }
5811                    let response = {
5812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5813                        let encoded = common::to_string(&bytes);
5814                        match serde_json::from_str(&encoded) {
5815                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5816                            Err(error) => {
5817                                dlg.response_json_decode_error(&encoded, &error);
5818                                return Err(common::Error::JsonDecodeError(
5819                                    encoded.to_string(),
5820                                    error,
5821                                ));
5822                            }
5823                        }
5824                    };
5825
5826                    dlg.finished(true);
5827                    return Ok(response);
5828                }
5829            }
5830        }
5831    }
5832
5833    ///
5834    /// Sets the *request* property to the given value.
5835    ///
5836    /// Even though the property as already been set when instantiating this call,
5837    /// we provide this method for API completeness.
5838    pub fn request(
5839        mut self,
5840        new_value: IdentitytoolkitRelyingpartySetAccountInfoRequest,
5841    ) -> RelyingpartySetAccountInfoCall<'a, C> {
5842        self._request = new_value;
5843        self
5844    }
5845    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5846    /// while executing the actual API request.
5847    ///
5848    /// ````text
5849    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5850    /// ````
5851    ///
5852    /// Sets the *delegate* property to the given value.
5853    pub fn delegate(
5854        mut self,
5855        new_value: &'a mut dyn common::Delegate,
5856    ) -> RelyingpartySetAccountInfoCall<'a, C> {
5857        self._delegate = Some(new_value);
5858        self
5859    }
5860
5861    /// Set any additional parameter of the query string used in the request.
5862    /// It should be used to set parameters which are not yet available through their own
5863    /// setters.
5864    ///
5865    /// Please note that this method must not be used to set any of the known parameters
5866    /// which have their own setter method. If done anyway, the request will fail.
5867    ///
5868    /// # Additional Parameters
5869    ///
5870    /// * *alt* (query-string) - Data format for the response.
5871    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5872    /// * *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.
5873    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5874    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5875    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
5876    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
5877    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartySetAccountInfoCall<'a, C>
5878    where
5879        T: AsRef<str>,
5880    {
5881        self._additional_params
5882            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5883        self
5884    }
5885
5886    /// Identifies the authorization scope for the method you are building.
5887    ///
5888    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5889    /// [`Scope::CloudPlatform`].
5890    ///
5891    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5892    /// tokens for more than one scope.
5893    ///
5894    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5895    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5896    /// sufficient, a read-write scope will do as well.
5897    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartySetAccountInfoCall<'a, C>
5898    where
5899        St: AsRef<str>,
5900    {
5901        self._scopes.insert(String::from(scope.as_ref()));
5902        self
5903    }
5904    /// Identifies the authorization scope(s) for the method you are building.
5905    ///
5906    /// See [`Self::add_scope()`] for details.
5907    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartySetAccountInfoCall<'a, C>
5908    where
5909        I: IntoIterator<Item = St>,
5910        St: AsRef<str>,
5911    {
5912        self._scopes
5913            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5914        self
5915    }
5916
5917    /// Removes all scopes, and no default scope will be used either.
5918    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5919    /// for details).
5920    pub fn clear_scopes(mut self) -> RelyingpartySetAccountInfoCall<'a, C> {
5921        self._scopes.clear();
5922        self
5923    }
5924}
5925
5926/// Set project configuration.
5927///
5928/// A builder for the *setProjectConfig* method supported by a *relyingparty* resource.
5929/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
5930///
5931/// # Example
5932///
5933/// Instantiate a resource method builder
5934///
5935/// ```test_harness,no_run
5936/// # extern crate hyper;
5937/// # extern crate hyper_rustls;
5938/// # extern crate google_identitytoolkit3 as identitytoolkit3;
5939/// use identitytoolkit3::api::IdentitytoolkitRelyingpartySetProjectConfigRequest;
5940/// # async fn dox() {
5941/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5942///
5943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5944/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5945/// #     .with_native_roots()
5946/// #     .unwrap()
5947/// #     .https_only()
5948/// #     .enable_http2()
5949/// #     .build();
5950///
5951/// # let executor = hyper_util::rt::TokioExecutor::new();
5952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5953/// #     secret,
5954/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5955/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5956/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5957/// #     ),
5958/// # ).build().await.unwrap();
5959///
5960/// # let client = hyper_util::client::legacy::Client::builder(
5961/// #     hyper_util::rt::TokioExecutor::new()
5962/// # )
5963/// # .build(
5964/// #     hyper_rustls::HttpsConnectorBuilder::new()
5965/// #         .with_native_roots()
5966/// #         .unwrap()
5967/// #         .https_or_http()
5968/// #         .enable_http2()
5969/// #         .build()
5970/// # );
5971/// # let mut hub = IdentityToolkit::new(client, auth);
5972/// // As the method needs a request, you would usually fill it with the desired information
5973/// // into the respective structure. Some of the parts shown here might not be applicable !
5974/// // Values shown here are possibly random and not representative !
5975/// let mut req = IdentitytoolkitRelyingpartySetProjectConfigRequest::default();
5976///
5977/// // You can configure optional parameters by calling the respective setters at will, and
5978/// // execute the final call using `doit()`.
5979/// // Values shown here are possibly random and not representative !
5980/// let result = hub.relyingparty().set_project_config(req)
5981///              .doit().await;
5982/// # }
5983/// ```
5984pub struct RelyingpartySetProjectConfigCall<'a, C>
5985where
5986    C: 'a,
5987{
5988    hub: &'a IdentityToolkit<C>,
5989    _request: IdentitytoolkitRelyingpartySetProjectConfigRequest,
5990    _delegate: Option<&'a mut dyn common::Delegate>,
5991    _additional_params: HashMap<String, String>,
5992    _scopes: BTreeSet<String>,
5993}
5994
5995impl<'a, C> common::CallBuilder for RelyingpartySetProjectConfigCall<'a, C> {}
5996
5997impl<'a, C> RelyingpartySetProjectConfigCall<'a, C>
5998where
5999    C: common::Connector,
6000{
6001    /// Perform the operation you have build so far.
6002    pub async fn doit(
6003        mut self,
6004    ) -> common::Result<(
6005        common::Response,
6006        IdentitytoolkitRelyingpartySetProjectConfigResponse,
6007    )> {
6008        use std::borrow::Cow;
6009        use std::io::{Read, Seek};
6010
6011        use common::{url::Params, ToParts};
6012        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6013
6014        let mut dd = common::DefaultDelegate;
6015        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6016        dlg.begin(common::MethodInfo {
6017            id: "identitytoolkit.relyingparty.setProjectConfig",
6018            http_method: hyper::Method::POST,
6019        });
6020
6021        for &field in ["alt"].iter() {
6022            if self._additional_params.contains_key(field) {
6023                dlg.finished(false);
6024                return Err(common::Error::FieldClash(field));
6025            }
6026        }
6027
6028        let mut params = Params::with_capacity(3 + self._additional_params.len());
6029
6030        params.extend(self._additional_params.iter());
6031
6032        params.push("alt", "json");
6033        let mut url = self.hub._base_url.clone() + "setProjectConfig";
6034        if self._scopes.is_empty() {
6035            self._scopes
6036                .insert(Scope::CloudPlatform.as_ref().to_string());
6037        }
6038
6039        let url = params.parse_with_url(&url);
6040
6041        let mut json_mime_type = mime::APPLICATION_JSON;
6042        let mut request_value_reader = {
6043            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6044            common::remove_json_null_values(&mut value);
6045            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6046            serde_json::to_writer(&mut dst, &value).unwrap();
6047            dst
6048        };
6049        let request_size = request_value_reader
6050            .seek(std::io::SeekFrom::End(0))
6051            .unwrap();
6052        request_value_reader
6053            .seek(std::io::SeekFrom::Start(0))
6054            .unwrap();
6055
6056        loop {
6057            let token = match self
6058                .hub
6059                .auth
6060                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6061                .await
6062            {
6063                Ok(token) => token,
6064                Err(e) => match dlg.token(e) {
6065                    Ok(token) => token,
6066                    Err(e) => {
6067                        dlg.finished(false);
6068                        return Err(common::Error::MissingToken(e));
6069                    }
6070                },
6071            };
6072            request_value_reader
6073                .seek(std::io::SeekFrom::Start(0))
6074                .unwrap();
6075            let mut req_result = {
6076                let client = &self.hub.client;
6077                dlg.pre_request();
6078                let mut req_builder = hyper::Request::builder()
6079                    .method(hyper::Method::POST)
6080                    .uri(url.as_str())
6081                    .header(USER_AGENT, self.hub._user_agent.clone());
6082
6083                if let Some(token) = token.as_ref() {
6084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6085                }
6086
6087                let request = req_builder
6088                    .header(CONTENT_TYPE, json_mime_type.to_string())
6089                    .header(CONTENT_LENGTH, request_size as u64)
6090                    .body(common::to_body(
6091                        request_value_reader.get_ref().clone().into(),
6092                    ));
6093
6094                client.request(request.unwrap()).await
6095            };
6096
6097            match req_result {
6098                Err(err) => {
6099                    if let common::Retry::After(d) = dlg.http_error(&err) {
6100                        sleep(d).await;
6101                        continue;
6102                    }
6103                    dlg.finished(false);
6104                    return Err(common::Error::HttpError(err));
6105                }
6106                Ok(res) => {
6107                    let (mut parts, body) = res.into_parts();
6108                    let mut body = common::Body::new(body);
6109                    if !parts.status.is_success() {
6110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6111                        let error = serde_json::from_str(&common::to_string(&bytes));
6112                        let response = common::to_response(parts, bytes.into());
6113
6114                        if let common::Retry::After(d) =
6115                            dlg.http_failure(&response, error.as_ref().ok())
6116                        {
6117                            sleep(d).await;
6118                            continue;
6119                        }
6120
6121                        dlg.finished(false);
6122
6123                        return Err(match error {
6124                            Ok(value) => common::Error::BadRequest(value),
6125                            _ => common::Error::Failure(response),
6126                        });
6127                    }
6128                    let response = {
6129                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6130                        let encoded = common::to_string(&bytes);
6131                        match serde_json::from_str(&encoded) {
6132                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6133                            Err(error) => {
6134                                dlg.response_json_decode_error(&encoded, &error);
6135                                return Err(common::Error::JsonDecodeError(
6136                                    encoded.to_string(),
6137                                    error,
6138                                ));
6139                            }
6140                        }
6141                    };
6142
6143                    dlg.finished(true);
6144                    return Ok(response);
6145                }
6146            }
6147        }
6148    }
6149
6150    ///
6151    /// Sets the *request* property to the given value.
6152    ///
6153    /// Even though the property as already been set when instantiating this call,
6154    /// we provide this method for API completeness.
6155    pub fn request(
6156        mut self,
6157        new_value: IdentitytoolkitRelyingpartySetProjectConfigRequest,
6158    ) -> RelyingpartySetProjectConfigCall<'a, C> {
6159        self._request = new_value;
6160        self
6161    }
6162    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6163    /// while executing the actual API request.
6164    ///
6165    /// ````text
6166    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6167    /// ````
6168    ///
6169    /// Sets the *delegate* property to the given value.
6170    pub fn delegate(
6171        mut self,
6172        new_value: &'a mut dyn common::Delegate,
6173    ) -> RelyingpartySetProjectConfigCall<'a, C> {
6174        self._delegate = Some(new_value);
6175        self
6176    }
6177
6178    /// Set any additional parameter of the query string used in the request.
6179    /// It should be used to set parameters which are not yet available through their own
6180    /// setters.
6181    ///
6182    /// Please note that this method must not be used to set any of the known parameters
6183    /// which have their own setter method. If done anyway, the request will fail.
6184    ///
6185    /// # Additional Parameters
6186    ///
6187    /// * *alt* (query-string) - Data format for the response.
6188    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6189    /// * *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.
6190    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6191    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6192    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
6193    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
6194    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartySetProjectConfigCall<'a, C>
6195    where
6196        T: AsRef<str>,
6197    {
6198        self._additional_params
6199            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6200        self
6201    }
6202
6203    /// Identifies the authorization scope for the method you are building.
6204    ///
6205    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6206    /// [`Scope::CloudPlatform`].
6207    ///
6208    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6209    /// tokens for more than one scope.
6210    ///
6211    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6212    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6213    /// sufficient, a read-write scope will do as well.
6214    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartySetProjectConfigCall<'a, C>
6215    where
6216        St: AsRef<str>,
6217    {
6218        self._scopes.insert(String::from(scope.as_ref()));
6219        self
6220    }
6221    /// Identifies the authorization scope(s) for the method you are building.
6222    ///
6223    /// See [`Self::add_scope()`] for details.
6224    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartySetProjectConfigCall<'a, C>
6225    where
6226        I: IntoIterator<Item = St>,
6227        St: AsRef<str>,
6228    {
6229        self._scopes
6230            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6231        self
6232    }
6233
6234    /// Removes all scopes, and no default scope will be used either.
6235    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6236    /// for details).
6237    pub fn clear_scopes(mut self) -> RelyingpartySetProjectConfigCall<'a, C> {
6238        self._scopes.clear();
6239        self
6240    }
6241}
6242
6243/// Sign out user.
6244///
6245/// A builder for the *signOutUser* method supported by a *relyingparty* resource.
6246/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
6247///
6248/// # Example
6249///
6250/// Instantiate a resource method builder
6251///
6252/// ```test_harness,no_run
6253/// # extern crate hyper;
6254/// # extern crate hyper_rustls;
6255/// # extern crate google_identitytoolkit3 as identitytoolkit3;
6256/// use identitytoolkit3::api::IdentitytoolkitRelyingpartySignOutUserRequest;
6257/// # async fn dox() {
6258/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6259///
6260/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6261/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6262/// #     .with_native_roots()
6263/// #     .unwrap()
6264/// #     .https_only()
6265/// #     .enable_http2()
6266/// #     .build();
6267///
6268/// # let executor = hyper_util::rt::TokioExecutor::new();
6269/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6270/// #     secret,
6271/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6272/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6273/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6274/// #     ),
6275/// # ).build().await.unwrap();
6276///
6277/// # let client = hyper_util::client::legacy::Client::builder(
6278/// #     hyper_util::rt::TokioExecutor::new()
6279/// # )
6280/// # .build(
6281/// #     hyper_rustls::HttpsConnectorBuilder::new()
6282/// #         .with_native_roots()
6283/// #         .unwrap()
6284/// #         .https_or_http()
6285/// #         .enable_http2()
6286/// #         .build()
6287/// # );
6288/// # let mut hub = IdentityToolkit::new(client, auth);
6289/// // As the method needs a request, you would usually fill it with the desired information
6290/// // into the respective structure. Some of the parts shown here might not be applicable !
6291/// // Values shown here are possibly random and not representative !
6292/// let mut req = IdentitytoolkitRelyingpartySignOutUserRequest::default();
6293///
6294/// // You can configure optional parameters by calling the respective setters at will, and
6295/// // execute the final call using `doit()`.
6296/// // Values shown here are possibly random and not representative !
6297/// let result = hub.relyingparty().sign_out_user(req)
6298///              .doit().await;
6299/// # }
6300/// ```
6301pub struct RelyingpartySignOutUserCall<'a, C>
6302where
6303    C: 'a,
6304{
6305    hub: &'a IdentityToolkit<C>,
6306    _request: IdentitytoolkitRelyingpartySignOutUserRequest,
6307    _delegate: Option<&'a mut dyn common::Delegate>,
6308    _additional_params: HashMap<String, String>,
6309    _scopes: BTreeSet<String>,
6310}
6311
6312impl<'a, C> common::CallBuilder for RelyingpartySignOutUserCall<'a, C> {}
6313
6314impl<'a, C> RelyingpartySignOutUserCall<'a, C>
6315where
6316    C: common::Connector,
6317{
6318    /// Perform the operation you have build so far.
6319    pub async fn doit(
6320        mut self,
6321    ) -> common::Result<(
6322        common::Response,
6323        IdentitytoolkitRelyingpartySignOutUserResponse,
6324    )> {
6325        use std::borrow::Cow;
6326        use std::io::{Read, Seek};
6327
6328        use common::{url::Params, ToParts};
6329        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6330
6331        let mut dd = common::DefaultDelegate;
6332        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6333        dlg.begin(common::MethodInfo {
6334            id: "identitytoolkit.relyingparty.signOutUser",
6335            http_method: hyper::Method::POST,
6336        });
6337
6338        for &field in ["alt"].iter() {
6339            if self._additional_params.contains_key(field) {
6340                dlg.finished(false);
6341                return Err(common::Error::FieldClash(field));
6342            }
6343        }
6344
6345        let mut params = Params::with_capacity(3 + self._additional_params.len());
6346
6347        params.extend(self._additional_params.iter());
6348
6349        params.push("alt", "json");
6350        let mut url = self.hub._base_url.clone() + "signOutUser";
6351        if self._scopes.is_empty() {
6352            self._scopes
6353                .insert(Scope::CloudPlatform.as_ref().to_string());
6354        }
6355
6356        let url = params.parse_with_url(&url);
6357
6358        let mut json_mime_type = mime::APPLICATION_JSON;
6359        let mut request_value_reader = {
6360            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6361            common::remove_json_null_values(&mut value);
6362            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6363            serde_json::to_writer(&mut dst, &value).unwrap();
6364            dst
6365        };
6366        let request_size = request_value_reader
6367            .seek(std::io::SeekFrom::End(0))
6368            .unwrap();
6369        request_value_reader
6370            .seek(std::io::SeekFrom::Start(0))
6371            .unwrap();
6372
6373        loop {
6374            let token = match self
6375                .hub
6376                .auth
6377                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6378                .await
6379            {
6380                Ok(token) => token,
6381                Err(e) => match dlg.token(e) {
6382                    Ok(token) => token,
6383                    Err(e) => {
6384                        dlg.finished(false);
6385                        return Err(common::Error::MissingToken(e));
6386                    }
6387                },
6388            };
6389            request_value_reader
6390                .seek(std::io::SeekFrom::Start(0))
6391                .unwrap();
6392            let mut req_result = {
6393                let client = &self.hub.client;
6394                dlg.pre_request();
6395                let mut req_builder = hyper::Request::builder()
6396                    .method(hyper::Method::POST)
6397                    .uri(url.as_str())
6398                    .header(USER_AGENT, self.hub._user_agent.clone());
6399
6400                if let Some(token) = token.as_ref() {
6401                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6402                }
6403
6404                let request = req_builder
6405                    .header(CONTENT_TYPE, json_mime_type.to_string())
6406                    .header(CONTENT_LENGTH, request_size as u64)
6407                    .body(common::to_body(
6408                        request_value_reader.get_ref().clone().into(),
6409                    ));
6410
6411                client.request(request.unwrap()).await
6412            };
6413
6414            match req_result {
6415                Err(err) => {
6416                    if let common::Retry::After(d) = dlg.http_error(&err) {
6417                        sleep(d).await;
6418                        continue;
6419                    }
6420                    dlg.finished(false);
6421                    return Err(common::Error::HttpError(err));
6422                }
6423                Ok(res) => {
6424                    let (mut parts, body) = res.into_parts();
6425                    let mut body = common::Body::new(body);
6426                    if !parts.status.is_success() {
6427                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6428                        let error = serde_json::from_str(&common::to_string(&bytes));
6429                        let response = common::to_response(parts, bytes.into());
6430
6431                        if let common::Retry::After(d) =
6432                            dlg.http_failure(&response, error.as_ref().ok())
6433                        {
6434                            sleep(d).await;
6435                            continue;
6436                        }
6437
6438                        dlg.finished(false);
6439
6440                        return Err(match error {
6441                            Ok(value) => common::Error::BadRequest(value),
6442                            _ => common::Error::Failure(response),
6443                        });
6444                    }
6445                    let response = {
6446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6447                        let encoded = common::to_string(&bytes);
6448                        match serde_json::from_str(&encoded) {
6449                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6450                            Err(error) => {
6451                                dlg.response_json_decode_error(&encoded, &error);
6452                                return Err(common::Error::JsonDecodeError(
6453                                    encoded.to_string(),
6454                                    error,
6455                                ));
6456                            }
6457                        }
6458                    };
6459
6460                    dlg.finished(true);
6461                    return Ok(response);
6462                }
6463            }
6464        }
6465    }
6466
6467    ///
6468    /// Sets the *request* property to the given value.
6469    ///
6470    /// Even though the property as already been set when instantiating this call,
6471    /// we provide this method for API completeness.
6472    pub fn request(
6473        mut self,
6474        new_value: IdentitytoolkitRelyingpartySignOutUserRequest,
6475    ) -> RelyingpartySignOutUserCall<'a, C> {
6476        self._request = new_value;
6477        self
6478    }
6479    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6480    /// while executing the actual API request.
6481    ///
6482    /// ````text
6483    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6484    /// ````
6485    ///
6486    /// Sets the *delegate* property to the given value.
6487    pub fn delegate(
6488        mut self,
6489        new_value: &'a mut dyn common::Delegate,
6490    ) -> RelyingpartySignOutUserCall<'a, C> {
6491        self._delegate = Some(new_value);
6492        self
6493    }
6494
6495    /// Set any additional parameter of the query string used in the request.
6496    /// It should be used to set parameters which are not yet available through their own
6497    /// setters.
6498    ///
6499    /// Please note that this method must not be used to set any of the known parameters
6500    /// which have their own setter method. If done anyway, the request will fail.
6501    ///
6502    /// # Additional Parameters
6503    ///
6504    /// * *alt* (query-string) - Data format for the response.
6505    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6506    /// * *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.
6507    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6508    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6509    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
6510    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
6511    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartySignOutUserCall<'a, C>
6512    where
6513        T: AsRef<str>,
6514    {
6515        self._additional_params
6516            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6517        self
6518    }
6519
6520    /// Identifies the authorization scope for the method you are building.
6521    ///
6522    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6523    /// [`Scope::CloudPlatform`].
6524    ///
6525    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6526    /// tokens for more than one scope.
6527    ///
6528    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6529    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6530    /// sufficient, a read-write scope will do as well.
6531    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartySignOutUserCall<'a, C>
6532    where
6533        St: AsRef<str>,
6534    {
6535        self._scopes.insert(String::from(scope.as_ref()));
6536        self
6537    }
6538    /// Identifies the authorization scope(s) for the method you are building.
6539    ///
6540    /// See [`Self::add_scope()`] for details.
6541    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartySignOutUserCall<'a, C>
6542    where
6543        I: IntoIterator<Item = St>,
6544        St: AsRef<str>,
6545    {
6546        self._scopes
6547            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6548        self
6549    }
6550
6551    /// Removes all scopes, and no default scope will be used either.
6552    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6553    /// for details).
6554    pub fn clear_scopes(mut self) -> RelyingpartySignOutUserCall<'a, C> {
6555        self._scopes.clear();
6556        self
6557    }
6558}
6559
6560/// Signup new user.
6561///
6562/// A builder for the *signupNewUser* method supported by a *relyingparty* resource.
6563/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
6564///
6565/// # Example
6566///
6567/// Instantiate a resource method builder
6568///
6569/// ```test_harness,no_run
6570/// # extern crate hyper;
6571/// # extern crate hyper_rustls;
6572/// # extern crate google_identitytoolkit3 as identitytoolkit3;
6573/// use identitytoolkit3::api::IdentitytoolkitRelyingpartySignupNewUserRequest;
6574/// # async fn dox() {
6575/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6576///
6577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6578/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6579/// #     .with_native_roots()
6580/// #     .unwrap()
6581/// #     .https_only()
6582/// #     .enable_http2()
6583/// #     .build();
6584///
6585/// # let executor = hyper_util::rt::TokioExecutor::new();
6586/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6587/// #     secret,
6588/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6589/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6590/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6591/// #     ),
6592/// # ).build().await.unwrap();
6593///
6594/// # let client = hyper_util::client::legacy::Client::builder(
6595/// #     hyper_util::rt::TokioExecutor::new()
6596/// # )
6597/// # .build(
6598/// #     hyper_rustls::HttpsConnectorBuilder::new()
6599/// #         .with_native_roots()
6600/// #         .unwrap()
6601/// #         .https_or_http()
6602/// #         .enable_http2()
6603/// #         .build()
6604/// # );
6605/// # let mut hub = IdentityToolkit::new(client, auth);
6606/// // As the method needs a request, you would usually fill it with the desired information
6607/// // into the respective structure. Some of the parts shown here might not be applicable !
6608/// // Values shown here are possibly random and not representative !
6609/// let mut req = IdentitytoolkitRelyingpartySignupNewUserRequest::default();
6610///
6611/// // You can configure optional parameters by calling the respective setters at will, and
6612/// // execute the final call using `doit()`.
6613/// // Values shown here are possibly random and not representative !
6614/// let result = hub.relyingparty().signup_new_user(req)
6615///              .doit().await;
6616/// # }
6617/// ```
6618pub struct RelyingpartySignupNewUserCall<'a, C>
6619where
6620    C: 'a,
6621{
6622    hub: &'a IdentityToolkit<C>,
6623    _request: IdentitytoolkitRelyingpartySignupNewUserRequest,
6624    _delegate: Option<&'a mut dyn common::Delegate>,
6625    _additional_params: HashMap<String, String>,
6626    _scopes: BTreeSet<String>,
6627}
6628
6629impl<'a, C> common::CallBuilder for RelyingpartySignupNewUserCall<'a, C> {}
6630
6631impl<'a, C> RelyingpartySignupNewUserCall<'a, C>
6632where
6633    C: common::Connector,
6634{
6635    /// Perform the operation you have build so far.
6636    pub async fn doit(mut self) -> common::Result<(common::Response, SignupNewUserResponse)> {
6637        use std::borrow::Cow;
6638        use std::io::{Read, Seek};
6639
6640        use common::{url::Params, ToParts};
6641        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6642
6643        let mut dd = common::DefaultDelegate;
6644        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6645        dlg.begin(common::MethodInfo {
6646            id: "identitytoolkit.relyingparty.signupNewUser",
6647            http_method: hyper::Method::POST,
6648        });
6649
6650        for &field in ["alt"].iter() {
6651            if self._additional_params.contains_key(field) {
6652                dlg.finished(false);
6653                return Err(common::Error::FieldClash(field));
6654            }
6655        }
6656
6657        let mut params = Params::with_capacity(3 + self._additional_params.len());
6658
6659        params.extend(self._additional_params.iter());
6660
6661        params.push("alt", "json");
6662        let mut url = self.hub._base_url.clone() + "signupNewUser";
6663        if self._scopes.is_empty() {
6664            self._scopes
6665                .insert(Scope::CloudPlatform.as_ref().to_string());
6666        }
6667
6668        let url = params.parse_with_url(&url);
6669
6670        let mut json_mime_type = mime::APPLICATION_JSON;
6671        let mut request_value_reader = {
6672            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6673            common::remove_json_null_values(&mut value);
6674            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6675            serde_json::to_writer(&mut dst, &value).unwrap();
6676            dst
6677        };
6678        let request_size = request_value_reader
6679            .seek(std::io::SeekFrom::End(0))
6680            .unwrap();
6681        request_value_reader
6682            .seek(std::io::SeekFrom::Start(0))
6683            .unwrap();
6684
6685        loop {
6686            let token = match self
6687                .hub
6688                .auth
6689                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6690                .await
6691            {
6692                Ok(token) => token,
6693                Err(e) => match dlg.token(e) {
6694                    Ok(token) => token,
6695                    Err(e) => {
6696                        dlg.finished(false);
6697                        return Err(common::Error::MissingToken(e));
6698                    }
6699                },
6700            };
6701            request_value_reader
6702                .seek(std::io::SeekFrom::Start(0))
6703                .unwrap();
6704            let mut req_result = {
6705                let client = &self.hub.client;
6706                dlg.pre_request();
6707                let mut req_builder = hyper::Request::builder()
6708                    .method(hyper::Method::POST)
6709                    .uri(url.as_str())
6710                    .header(USER_AGENT, self.hub._user_agent.clone());
6711
6712                if let Some(token) = token.as_ref() {
6713                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6714                }
6715
6716                let request = req_builder
6717                    .header(CONTENT_TYPE, json_mime_type.to_string())
6718                    .header(CONTENT_LENGTH, request_size as u64)
6719                    .body(common::to_body(
6720                        request_value_reader.get_ref().clone().into(),
6721                    ));
6722
6723                client.request(request.unwrap()).await
6724            };
6725
6726            match req_result {
6727                Err(err) => {
6728                    if let common::Retry::After(d) = dlg.http_error(&err) {
6729                        sleep(d).await;
6730                        continue;
6731                    }
6732                    dlg.finished(false);
6733                    return Err(common::Error::HttpError(err));
6734                }
6735                Ok(res) => {
6736                    let (mut parts, body) = res.into_parts();
6737                    let mut body = common::Body::new(body);
6738                    if !parts.status.is_success() {
6739                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6740                        let error = serde_json::from_str(&common::to_string(&bytes));
6741                        let response = common::to_response(parts, bytes.into());
6742
6743                        if let common::Retry::After(d) =
6744                            dlg.http_failure(&response, error.as_ref().ok())
6745                        {
6746                            sleep(d).await;
6747                            continue;
6748                        }
6749
6750                        dlg.finished(false);
6751
6752                        return Err(match error {
6753                            Ok(value) => common::Error::BadRequest(value),
6754                            _ => common::Error::Failure(response),
6755                        });
6756                    }
6757                    let response = {
6758                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6759                        let encoded = common::to_string(&bytes);
6760                        match serde_json::from_str(&encoded) {
6761                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6762                            Err(error) => {
6763                                dlg.response_json_decode_error(&encoded, &error);
6764                                return Err(common::Error::JsonDecodeError(
6765                                    encoded.to_string(),
6766                                    error,
6767                                ));
6768                            }
6769                        }
6770                    };
6771
6772                    dlg.finished(true);
6773                    return Ok(response);
6774                }
6775            }
6776        }
6777    }
6778
6779    ///
6780    /// Sets the *request* property to the given value.
6781    ///
6782    /// Even though the property as already been set when instantiating this call,
6783    /// we provide this method for API completeness.
6784    pub fn request(
6785        mut self,
6786        new_value: IdentitytoolkitRelyingpartySignupNewUserRequest,
6787    ) -> RelyingpartySignupNewUserCall<'a, C> {
6788        self._request = new_value;
6789        self
6790    }
6791    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6792    /// while executing the actual API request.
6793    ///
6794    /// ````text
6795    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6796    /// ````
6797    ///
6798    /// Sets the *delegate* property to the given value.
6799    pub fn delegate(
6800        mut self,
6801        new_value: &'a mut dyn common::Delegate,
6802    ) -> RelyingpartySignupNewUserCall<'a, C> {
6803        self._delegate = Some(new_value);
6804        self
6805    }
6806
6807    /// Set any additional parameter of the query string used in the request.
6808    /// It should be used to set parameters which are not yet available through their own
6809    /// setters.
6810    ///
6811    /// Please note that this method must not be used to set any of the known parameters
6812    /// which have their own setter method. If done anyway, the request will fail.
6813    ///
6814    /// # Additional Parameters
6815    ///
6816    /// * *alt* (query-string) - Data format for the response.
6817    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6818    /// * *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.
6819    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6820    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6821    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
6822    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
6823    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartySignupNewUserCall<'a, C>
6824    where
6825        T: AsRef<str>,
6826    {
6827        self._additional_params
6828            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6829        self
6830    }
6831
6832    /// Identifies the authorization scope for the method you are building.
6833    ///
6834    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6835    /// [`Scope::CloudPlatform`].
6836    ///
6837    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6838    /// tokens for more than one scope.
6839    ///
6840    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6841    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6842    /// sufficient, a read-write scope will do as well.
6843    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartySignupNewUserCall<'a, C>
6844    where
6845        St: AsRef<str>,
6846    {
6847        self._scopes.insert(String::from(scope.as_ref()));
6848        self
6849    }
6850    /// Identifies the authorization scope(s) for the method you are building.
6851    ///
6852    /// See [`Self::add_scope()`] for details.
6853    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartySignupNewUserCall<'a, C>
6854    where
6855        I: IntoIterator<Item = St>,
6856        St: AsRef<str>,
6857    {
6858        self._scopes
6859            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6860        self
6861    }
6862
6863    /// Removes all scopes, and no default scope will be used either.
6864    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6865    /// for details).
6866    pub fn clear_scopes(mut self) -> RelyingpartySignupNewUserCall<'a, C> {
6867        self._scopes.clear();
6868        self
6869    }
6870}
6871
6872/// Batch upload existing user accounts.
6873///
6874/// A builder for the *uploadAccount* method supported by a *relyingparty* resource.
6875/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
6876///
6877/// # Example
6878///
6879/// Instantiate a resource method builder
6880///
6881/// ```test_harness,no_run
6882/// # extern crate hyper;
6883/// # extern crate hyper_rustls;
6884/// # extern crate google_identitytoolkit3 as identitytoolkit3;
6885/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyUploadAccountRequest;
6886/// # async fn dox() {
6887/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6888///
6889/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6890/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6891/// #     .with_native_roots()
6892/// #     .unwrap()
6893/// #     .https_only()
6894/// #     .enable_http2()
6895/// #     .build();
6896///
6897/// # let executor = hyper_util::rt::TokioExecutor::new();
6898/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6899/// #     secret,
6900/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6901/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6902/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6903/// #     ),
6904/// # ).build().await.unwrap();
6905///
6906/// # let client = hyper_util::client::legacy::Client::builder(
6907/// #     hyper_util::rt::TokioExecutor::new()
6908/// # )
6909/// # .build(
6910/// #     hyper_rustls::HttpsConnectorBuilder::new()
6911/// #         .with_native_roots()
6912/// #         .unwrap()
6913/// #         .https_or_http()
6914/// #         .enable_http2()
6915/// #         .build()
6916/// # );
6917/// # let mut hub = IdentityToolkit::new(client, auth);
6918/// // As the method needs a request, you would usually fill it with the desired information
6919/// // into the respective structure. Some of the parts shown here might not be applicable !
6920/// // Values shown here are possibly random and not representative !
6921/// let mut req = IdentitytoolkitRelyingpartyUploadAccountRequest::default();
6922///
6923/// // You can configure optional parameters by calling the respective setters at will, and
6924/// // execute the final call using `doit()`.
6925/// // Values shown here are possibly random and not representative !
6926/// let result = hub.relyingparty().upload_account(req)
6927///              .doit().await;
6928/// # }
6929/// ```
6930pub struct RelyingpartyUploadAccountCall<'a, C>
6931where
6932    C: 'a,
6933{
6934    hub: &'a IdentityToolkit<C>,
6935    _request: IdentitytoolkitRelyingpartyUploadAccountRequest,
6936    _delegate: Option<&'a mut dyn common::Delegate>,
6937    _additional_params: HashMap<String, String>,
6938    _scopes: BTreeSet<String>,
6939}
6940
6941impl<'a, C> common::CallBuilder for RelyingpartyUploadAccountCall<'a, C> {}
6942
6943impl<'a, C> RelyingpartyUploadAccountCall<'a, C>
6944where
6945    C: common::Connector,
6946{
6947    /// Perform the operation you have build so far.
6948    pub async fn doit(mut self) -> common::Result<(common::Response, UploadAccountResponse)> {
6949        use std::borrow::Cow;
6950        use std::io::{Read, Seek};
6951
6952        use common::{url::Params, ToParts};
6953        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6954
6955        let mut dd = common::DefaultDelegate;
6956        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6957        dlg.begin(common::MethodInfo {
6958            id: "identitytoolkit.relyingparty.uploadAccount",
6959            http_method: hyper::Method::POST,
6960        });
6961
6962        for &field in ["alt"].iter() {
6963            if self._additional_params.contains_key(field) {
6964                dlg.finished(false);
6965                return Err(common::Error::FieldClash(field));
6966            }
6967        }
6968
6969        let mut params = Params::with_capacity(3 + self._additional_params.len());
6970
6971        params.extend(self._additional_params.iter());
6972
6973        params.push("alt", "json");
6974        let mut url = self.hub._base_url.clone() + "uploadAccount";
6975        if self._scopes.is_empty() {
6976            self._scopes
6977                .insert(Scope::CloudPlatform.as_ref().to_string());
6978        }
6979
6980        let url = params.parse_with_url(&url);
6981
6982        let mut json_mime_type = mime::APPLICATION_JSON;
6983        let mut request_value_reader = {
6984            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6985            common::remove_json_null_values(&mut value);
6986            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6987            serde_json::to_writer(&mut dst, &value).unwrap();
6988            dst
6989        };
6990        let request_size = request_value_reader
6991            .seek(std::io::SeekFrom::End(0))
6992            .unwrap();
6993        request_value_reader
6994            .seek(std::io::SeekFrom::Start(0))
6995            .unwrap();
6996
6997        loop {
6998            let token = match self
6999                .hub
7000                .auth
7001                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7002                .await
7003            {
7004                Ok(token) => token,
7005                Err(e) => match dlg.token(e) {
7006                    Ok(token) => token,
7007                    Err(e) => {
7008                        dlg.finished(false);
7009                        return Err(common::Error::MissingToken(e));
7010                    }
7011                },
7012            };
7013            request_value_reader
7014                .seek(std::io::SeekFrom::Start(0))
7015                .unwrap();
7016            let mut req_result = {
7017                let client = &self.hub.client;
7018                dlg.pre_request();
7019                let mut req_builder = hyper::Request::builder()
7020                    .method(hyper::Method::POST)
7021                    .uri(url.as_str())
7022                    .header(USER_AGENT, self.hub._user_agent.clone());
7023
7024                if let Some(token) = token.as_ref() {
7025                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7026                }
7027
7028                let request = req_builder
7029                    .header(CONTENT_TYPE, json_mime_type.to_string())
7030                    .header(CONTENT_LENGTH, request_size as u64)
7031                    .body(common::to_body(
7032                        request_value_reader.get_ref().clone().into(),
7033                    ));
7034
7035                client.request(request.unwrap()).await
7036            };
7037
7038            match req_result {
7039                Err(err) => {
7040                    if let common::Retry::After(d) = dlg.http_error(&err) {
7041                        sleep(d).await;
7042                        continue;
7043                    }
7044                    dlg.finished(false);
7045                    return Err(common::Error::HttpError(err));
7046                }
7047                Ok(res) => {
7048                    let (mut parts, body) = res.into_parts();
7049                    let mut body = common::Body::new(body);
7050                    if !parts.status.is_success() {
7051                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7052                        let error = serde_json::from_str(&common::to_string(&bytes));
7053                        let response = common::to_response(parts, bytes.into());
7054
7055                        if let common::Retry::After(d) =
7056                            dlg.http_failure(&response, error.as_ref().ok())
7057                        {
7058                            sleep(d).await;
7059                            continue;
7060                        }
7061
7062                        dlg.finished(false);
7063
7064                        return Err(match error {
7065                            Ok(value) => common::Error::BadRequest(value),
7066                            _ => common::Error::Failure(response),
7067                        });
7068                    }
7069                    let response = {
7070                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7071                        let encoded = common::to_string(&bytes);
7072                        match serde_json::from_str(&encoded) {
7073                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7074                            Err(error) => {
7075                                dlg.response_json_decode_error(&encoded, &error);
7076                                return Err(common::Error::JsonDecodeError(
7077                                    encoded.to_string(),
7078                                    error,
7079                                ));
7080                            }
7081                        }
7082                    };
7083
7084                    dlg.finished(true);
7085                    return Ok(response);
7086                }
7087            }
7088        }
7089    }
7090
7091    ///
7092    /// Sets the *request* property to the given value.
7093    ///
7094    /// Even though the property as already been set when instantiating this call,
7095    /// we provide this method for API completeness.
7096    pub fn request(
7097        mut self,
7098        new_value: IdentitytoolkitRelyingpartyUploadAccountRequest,
7099    ) -> RelyingpartyUploadAccountCall<'a, C> {
7100        self._request = new_value;
7101        self
7102    }
7103    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7104    /// while executing the actual API request.
7105    ///
7106    /// ````text
7107    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7108    /// ````
7109    ///
7110    /// Sets the *delegate* property to the given value.
7111    pub fn delegate(
7112        mut self,
7113        new_value: &'a mut dyn common::Delegate,
7114    ) -> RelyingpartyUploadAccountCall<'a, C> {
7115        self._delegate = Some(new_value);
7116        self
7117    }
7118
7119    /// Set any additional parameter of the query string used in the request.
7120    /// It should be used to set parameters which are not yet available through their own
7121    /// setters.
7122    ///
7123    /// Please note that this method must not be used to set any of the known parameters
7124    /// which have their own setter method. If done anyway, the request will fail.
7125    ///
7126    /// # Additional Parameters
7127    ///
7128    /// * *alt* (query-string) - Data format for the response.
7129    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7130    /// * *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.
7131    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7132    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7133    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
7134    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
7135    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyUploadAccountCall<'a, C>
7136    where
7137        T: AsRef<str>,
7138    {
7139        self._additional_params
7140            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7141        self
7142    }
7143
7144    /// Identifies the authorization scope for the method you are building.
7145    ///
7146    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7147    /// [`Scope::CloudPlatform`].
7148    ///
7149    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7150    /// tokens for more than one scope.
7151    ///
7152    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7153    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7154    /// sufficient, a read-write scope will do as well.
7155    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyUploadAccountCall<'a, C>
7156    where
7157        St: AsRef<str>,
7158    {
7159        self._scopes.insert(String::from(scope.as_ref()));
7160        self
7161    }
7162    /// Identifies the authorization scope(s) for the method you are building.
7163    ///
7164    /// See [`Self::add_scope()`] for details.
7165    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyUploadAccountCall<'a, C>
7166    where
7167        I: IntoIterator<Item = St>,
7168        St: AsRef<str>,
7169    {
7170        self._scopes
7171            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7172        self
7173    }
7174
7175    /// Removes all scopes, and no default scope will be used either.
7176    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7177    /// for details).
7178    pub fn clear_scopes(mut self) -> RelyingpartyUploadAccountCall<'a, C> {
7179        self._scopes.clear();
7180        self
7181    }
7182}
7183
7184/// Verifies the assertion returned by the IdP.
7185///
7186/// A builder for the *verifyAssertion* method supported by a *relyingparty* resource.
7187/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
7188///
7189/// # Example
7190///
7191/// Instantiate a resource method builder
7192///
7193/// ```test_harness,no_run
7194/// # extern crate hyper;
7195/// # extern crate hyper_rustls;
7196/// # extern crate google_identitytoolkit3 as identitytoolkit3;
7197/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyVerifyAssertionRequest;
7198/// # async fn dox() {
7199/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7200///
7201/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7202/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7203/// #     .with_native_roots()
7204/// #     .unwrap()
7205/// #     .https_only()
7206/// #     .enable_http2()
7207/// #     .build();
7208///
7209/// # let executor = hyper_util::rt::TokioExecutor::new();
7210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7211/// #     secret,
7212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7213/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7214/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7215/// #     ),
7216/// # ).build().await.unwrap();
7217///
7218/// # let client = hyper_util::client::legacy::Client::builder(
7219/// #     hyper_util::rt::TokioExecutor::new()
7220/// # )
7221/// # .build(
7222/// #     hyper_rustls::HttpsConnectorBuilder::new()
7223/// #         .with_native_roots()
7224/// #         .unwrap()
7225/// #         .https_or_http()
7226/// #         .enable_http2()
7227/// #         .build()
7228/// # );
7229/// # let mut hub = IdentityToolkit::new(client, auth);
7230/// // As the method needs a request, you would usually fill it with the desired information
7231/// // into the respective structure. Some of the parts shown here might not be applicable !
7232/// // Values shown here are possibly random and not representative !
7233/// let mut req = IdentitytoolkitRelyingpartyVerifyAssertionRequest::default();
7234///
7235/// // You can configure optional parameters by calling the respective setters at will, and
7236/// // execute the final call using `doit()`.
7237/// // Values shown here are possibly random and not representative !
7238/// let result = hub.relyingparty().verify_assertion(req)
7239///              .doit().await;
7240/// # }
7241/// ```
7242pub struct RelyingpartyVerifyAssertionCall<'a, C>
7243where
7244    C: 'a,
7245{
7246    hub: &'a IdentityToolkit<C>,
7247    _request: IdentitytoolkitRelyingpartyVerifyAssertionRequest,
7248    _delegate: Option<&'a mut dyn common::Delegate>,
7249    _additional_params: HashMap<String, String>,
7250    _scopes: BTreeSet<String>,
7251}
7252
7253impl<'a, C> common::CallBuilder for RelyingpartyVerifyAssertionCall<'a, C> {}
7254
7255impl<'a, C> RelyingpartyVerifyAssertionCall<'a, C>
7256where
7257    C: common::Connector,
7258{
7259    /// Perform the operation you have build so far.
7260    pub async fn doit(mut self) -> common::Result<(common::Response, VerifyAssertionResponse)> {
7261        use std::borrow::Cow;
7262        use std::io::{Read, Seek};
7263
7264        use common::{url::Params, ToParts};
7265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7266
7267        let mut dd = common::DefaultDelegate;
7268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7269        dlg.begin(common::MethodInfo {
7270            id: "identitytoolkit.relyingparty.verifyAssertion",
7271            http_method: hyper::Method::POST,
7272        });
7273
7274        for &field in ["alt"].iter() {
7275            if self._additional_params.contains_key(field) {
7276                dlg.finished(false);
7277                return Err(common::Error::FieldClash(field));
7278            }
7279        }
7280
7281        let mut params = Params::with_capacity(3 + self._additional_params.len());
7282
7283        params.extend(self._additional_params.iter());
7284
7285        params.push("alt", "json");
7286        let mut url = self.hub._base_url.clone() + "verifyAssertion";
7287        if self._scopes.is_empty() {
7288            self._scopes
7289                .insert(Scope::CloudPlatform.as_ref().to_string());
7290        }
7291
7292        let url = params.parse_with_url(&url);
7293
7294        let mut json_mime_type = mime::APPLICATION_JSON;
7295        let mut request_value_reader = {
7296            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7297            common::remove_json_null_values(&mut value);
7298            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7299            serde_json::to_writer(&mut dst, &value).unwrap();
7300            dst
7301        };
7302        let request_size = request_value_reader
7303            .seek(std::io::SeekFrom::End(0))
7304            .unwrap();
7305        request_value_reader
7306            .seek(std::io::SeekFrom::Start(0))
7307            .unwrap();
7308
7309        loop {
7310            let token = match self
7311                .hub
7312                .auth
7313                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7314                .await
7315            {
7316                Ok(token) => token,
7317                Err(e) => match dlg.token(e) {
7318                    Ok(token) => token,
7319                    Err(e) => {
7320                        dlg.finished(false);
7321                        return Err(common::Error::MissingToken(e));
7322                    }
7323                },
7324            };
7325            request_value_reader
7326                .seek(std::io::SeekFrom::Start(0))
7327                .unwrap();
7328            let mut req_result = {
7329                let client = &self.hub.client;
7330                dlg.pre_request();
7331                let mut req_builder = hyper::Request::builder()
7332                    .method(hyper::Method::POST)
7333                    .uri(url.as_str())
7334                    .header(USER_AGENT, self.hub._user_agent.clone());
7335
7336                if let Some(token) = token.as_ref() {
7337                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7338                }
7339
7340                let request = req_builder
7341                    .header(CONTENT_TYPE, json_mime_type.to_string())
7342                    .header(CONTENT_LENGTH, request_size as u64)
7343                    .body(common::to_body(
7344                        request_value_reader.get_ref().clone().into(),
7345                    ));
7346
7347                client.request(request.unwrap()).await
7348            };
7349
7350            match req_result {
7351                Err(err) => {
7352                    if let common::Retry::After(d) = dlg.http_error(&err) {
7353                        sleep(d).await;
7354                        continue;
7355                    }
7356                    dlg.finished(false);
7357                    return Err(common::Error::HttpError(err));
7358                }
7359                Ok(res) => {
7360                    let (mut parts, body) = res.into_parts();
7361                    let mut body = common::Body::new(body);
7362                    if !parts.status.is_success() {
7363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7364                        let error = serde_json::from_str(&common::to_string(&bytes));
7365                        let response = common::to_response(parts, bytes.into());
7366
7367                        if let common::Retry::After(d) =
7368                            dlg.http_failure(&response, error.as_ref().ok())
7369                        {
7370                            sleep(d).await;
7371                            continue;
7372                        }
7373
7374                        dlg.finished(false);
7375
7376                        return Err(match error {
7377                            Ok(value) => common::Error::BadRequest(value),
7378                            _ => common::Error::Failure(response),
7379                        });
7380                    }
7381                    let response = {
7382                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7383                        let encoded = common::to_string(&bytes);
7384                        match serde_json::from_str(&encoded) {
7385                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7386                            Err(error) => {
7387                                dlg.response_json_decode_error(&encoded, &error);
7388                                return Err(common::Error::JsonDecodeError(
7389                                    encoded.to_string(),
7390                                    error,
7391                                ));
7392                            }
7393                        }
7394                    };
7395
7396                    dlg.finished(true);
7397                    return Ok(response);
7398                }
7399            }
7400        }
7401    }
7402
7403    ///
7404    /// Sets the *request* property to the given value.
7405    ///
7406    /// Even though the property as already been set when instantiating this call,
7407    /// we provide this method for API completeness.
7408    pub fn request(
7409        mut self,
7410        new_value: IdentitytoolkitRelyingpartyVerifyAssertionRequest,
7411    ) -> RelyingpartyVerifyAssertionCall<'a, C> {
7412        self._request = new_value;
7413        self
7414    }
7415    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7416    /// while executing the actual API request.
7417    ///
7418    /// ````text
7419    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7420    /// ````
7421    ///
7422    /// Sets the *delegate* property to the given value.
7423    pub fn delegate(
7424        mut self,
7425        new_value: &'a mut dyn common::Delegate,
7426    ) -> RelyingpartyVerifyAssertionCall<'a, C> {
7427        self._delegate = Some(new_value);
7428        self
7429    }
7430
7431    /// Set any additional parameter of the query string used in the request.
7432    /// It should be used to set parameters which are not yet available through their own
7433    /// setters.
7434    ///
7435    /// Please note that this method must not be used to set any of the known parameters
7436    /// which have their own setter method. If done anyway, the request will fail.
7437    ///
7438    /// # Additional Parameters
7439    ///
7440    /// * *alt* (query-string) - Data format for the response.
7441    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7442    /// * *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.
7443    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7444    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7445    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
7446    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
7447    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyVerifyAssertionCall<'a, C>
7448    where
7449        T: AsRef<str>,
7450    {
7451        self._additional_params
7452            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7453        self
7454    }
7455
7456    /// Identifies the authorization scope for the method you are building.
7457    ///
7458    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7459    /// [`Scope::CloudPlatform`].
7460    ///
7461    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7462    /// tokens for more than one scope.
7463    ///
7464    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7465    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7466    /// sufficient, a read-write scope will do as well.
7467    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyVerifyAssertionCall<'a, C>
7468    where
7469        St: AsRef<str>,
7470    {
7471        self._scopes.insert(String::from(scope.as_ref()));
7472        self
7473    }
7474    /// Identifies the authorization scope(s) for the method you are building.
7475    ///
7476    /// See [`Self::add_scope()`] for details.
7477    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyVerifyAssertionCall<'a, C>
7478    where
7479        I: IntoIterator<Item = St>,
7480        St: AsRef<str>,
7481    {
7482        self._scopes
7483            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7484        self
7485    }
7486
7487    /// Removes all scopes, and no default scope will be used either.
7488    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7489    /// for details).
7490    pub fn clear_scopes(mut self) -> RelyingpartyVerifyAssertionCall<'a, C> {
7491        self._scopes.clear();
7492        self
7493    }
7494}
7495
7496/// Verifies the developer asserted ID token.
7497///
7498/// A builder for the *verifyCustomToken* method supported by a *relyingparty* resource.
7499/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
7500///
7501/// # Example
7502///
7503/// Instantiate a resource method builder
7504///
7505/// ```test_harness,no_run
7506/// # extern crate hyper;
7507/// # extern crate hyper_rustls;
7508/// # extern crate google_identitytoolkit3 as identitytoolkit3;
7509/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyVerifyCustomTokenRequest;
7510/// # async fn dox() {
7511/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7512///
7513/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7514/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7515/// #     .with_native_roots()
7516/// #     .unwrap()
7517/// #     .https_only()
7518/// #     .enable_http2()
7519/// #     .build();
7520///
7521/// # let executor = hyper_util::rt::TokioExecutor::new();
7522/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7523/// #     secret,
7524/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7525/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7526/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7527/// #     ),
7528/// # ).build().await.unwrap();
7529///
7530/// # let client = hyper_util::client::legacy::Client::builder(
7531/// #     hyper_util::rt::TokioExecutor::new()
7532/// # )
7533/// # .build(
7534/// #     hyper_rustls::HttpsConnectorBuilder::new()
7535/// #         .with_native_roots()
7536/// #         .unwrap()
7537/// #         .https_or_http()
7538/// #         .enable_http2()
7539/// #         .build()
7540/// # );
7541/// # let mut hub = IdentityToolkit::new(client, auth);
7542/// // As the method needs a request, you would usually fill it with the desired information
7543/// // into the respective structure. Some of the parts shown here might not be applicable !
7544/// // Values shown here are possibly random and not representative !
7545/// let mut req = IdentitytoolkitRelyingpartyVerifyCustomTokenRequest::default();
7546///
7547/// // You can configure optional parameters by calling the respective setters at will, and
7548/// // execute the final call using `doit()`.
7549/// // Values shown here are possibly random and not representative !
7550/// let result = hub.relyingparty().verify_custom_token(req)
7551///              .doit().await;
7552/// # }
7553/// ```
7554pub struct RelyingpartyVerifyCustomTokenCall<'a, C>
7555where
7556    C: 'a,
7557{
7558    hub: &'a IdentityToolkit<C>,
7559    _request: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest,
7560    _delegate: Option<&'a mut dyn common::Delegate>,
7561    _additional_params: HashMap<String, String>,
7562    _scopes: BTreeSet<String>,
7563}
7564
7565impl<'a, C> common::CallBuilder for RelyingpartyVerifyCustomTokenCall<'a, C> {}
7566
7567impl<'a, C> RelyingpartyVerifyCustomTokenCall<'a, C>
7568where
7569    C: common::Connector,
7570{
7571    /// Perform the operation you have build so far.
7572    pub async fn doit(mut self) -> common::Result<(common::Response, VerifyCustomTokenResponse)> {
7573        use std::borrow::Cow;
7574        use std::io::{Read, Seek};
7575
7576        use common::{url::Params, ToParts};
7577        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7578
7579        let mut dd = common::DefaultDelegate;
7580        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7581        dlg.begin(common::MethodInfo {
7582            id: "identitytoolkit.relyingparty.verifyCustomToken",
7583            http_method: hyper::Method::POST,
7584        });
7585
7586        for &field in ["alt"].iter() {
7587            if self._additional_params.contains_key(field) {
7588                dlg.finished(false);
7589                return Err(common::Error::FieldClash(field));
7590            }
7591        }
7592
7593        let mut params = Params::with_capacity(3 + self._additional_params.len());
7594
7595        params.extend(self._additional_params.iter());
7596
7597        params.push("alt", "json");
7598        let mut url = self.hub._base_url.clone() + "verifyCustomToken";
7599        if self._scopes.is_empty() {
7600            self._scopes
7601                .insert(Scope::CloudPlatform.as_ref().to_string());
7602        }
7603
7604        let url = params.parse_with_url(&url);
7605
7606        let mut json_mime_type = mime::APPLICATION_JSON;
7607        let mut request_value_reader = {
7608            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7609            common::remove_json_null_values(&mut value);
7610            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7611            serde_json::to_writer(&mut dst, &value).unwrap();
7612            dst
7613        };
7614        let request_size = request_value_reader
7615            .seek(std::io::SeekFrom::End(0))
7616            .unwrap();
7617        request_value_reader
7618            .seek(std::io::SeekFrom::Start(0))
7619            .unwrap();
7620
7621        loop {
7622            let token = match self
7623                .hub
7624                .auth
7625                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7626                .await
7627            {
7628                Ok(token) => token,
7629                Err(e) => match dlg.token(e) {
7630                    Ok(token) => token,
7631                    Err(e) => {
7632                        dlg.finished(false);
7633                        return Err(common::Error::MissingToken(e));
7634                    }
7635                },
7636            };
7637            request_value_reader
7638                .seek(std::io::SeekFrom::Start(0))
7639                .unwrap();
7640            let mut req_result = {
7641                let client = &self.hub.client;
7642                dlg.pre_request();
7643                let mut req_builder = hyper::Request::builder()
7644                    .method(hyper::Method::POST)
7645                    .uri(url.as_str())
7646                    .header(USER_AGENT, self.hub._user_agent.clone());
7647
7648                if let Some(token) = token.as_ref() {
7649                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7650                }
7651
7652                let request = req_builder
7653                    .header(CONTENT_TYPE, json_mime_type.to_string())
7654                    .header(CONTENT_LENGTH, request_size as u64)
7655                    .body(common::to_body(
7656                        request_value_reader.get_ref().clone().into(),
7657                    ));
7658
7659                client.request(request.unwrap()).await
7660            };
7661
7662            match req_result {
7663                Err(err) => {
7664                    if let common::Retry::After(d) = dlg.http_error(&err) {
7665                        sleep(d).await;
7666                        continue;
7667                    }
7668                    dlg.finished(false);
7669                    return Err(common::Error::HttpError(err));
7670                }
7671                Ok(res) => {
7672                    let (mut parts, body) = res.into_parts();
7673                    let mut body = common::Body::new(body);
7674                    if !parts.status.is_success() {
7675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7676                        let error = serde_json::from_str(&common::to_string(&bytes));
7677                        let response = common::to_response(parts, bytes.into());
7678
7679                        if let common::Retry::After(d) =
7680                            dlg.http_failure(&response, error.as_ref().ok())
7681                        {
7682                            sleep(d).await;
7683                            continue;
7684                        }
7685
7686                        dlg.finished(false);
7687
7688                        return Err(match error {
7689                            Ok(value) => common::Error::BadRequest(value),
7690                            _ => common::Error::Failure(response),
7691                        });
7692                    }
7693                    let response = {
7694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7695                        let encoded = common::to_string(&bytes);
7696                        match serde_json::from_str(&encoded) {
7697                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7698                            Err(error) => {
7699                                dlg.response_json_decode_error(&encoded, &error);
7700                                return Err(common::Error::JsonDecodeError(
7701                                    encoded.to_string(),
7702                                    error,
7703                                ));
7704                            }
7705                        }
7706                    };
7707
7708                    dlg.finished(true);
7709                    return Ok(response);
7710                }
7711            }
7712        }
7713    }
7714
7715    ///
7716    /// Sets the *request* property to the given value.
7717    ///
7718    /// Even though the property as already been set when instantiating this call,
7719    /// we provide this method for API completeness.
7720    pub fn request(
7721        mut self,
7722        new_value: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest,
7723    ) -> RelyingpartyVerifyCustomTokenCall<'a, C> {
7724        self._request = new_value;
7725        self
7726    }
7727    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7728    /// while executing the actual API request.
7729    ///
7730    /// ````text
7731    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7732    /// ````
7733    ///
7734    /// Sets the *delegate* property to the given value.
7735    pub fn delegate(
7736        mut self,
7737        new_value: &'a mut dyn common::Delegate,
7738    ) -> RelyingpartyVerifyCustomTokenCall<'a, C> {
7739        self._delegate = Some(new_value);
7740        self
7741    }
7742
7743    /// Set any additional parameter of the query string used in the request.
7744    /// It should be used to set parameters which are not yet available through their own
7745    /// setters.
7746    ///
7747    /// Please note that this method must not be used to set any of the known parameters
7748    /// which have their own setter method. If done anyway, the request will fail.
7749    ///
7750    /// # Additional Parameters
7751    ///
7752    /// * *alt* (query-string) - Data format for the response.
7753    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7754    /// * *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.
7755    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7756    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7757    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
7758    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
7759    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyVerifyCustomTokenCall<'a, C>
7760    where
7761        T: AsRef<str>,
7762    {
7763        self._additional_params
7764            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7765        self
7766    }
7767
7768    /// Identifies the authorization scope for the method you are building.
7769    ///
7770    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7771    /// [`Scope::CloudPlatform`].
7772    ///
7773    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7774    /// tokens for more than one scope.
7775    ///
7776    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7777    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7778    /// sufficient, a read-write scope will do as well.
7779    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyVerifyCustomTokenCall<'a, C>
7780    where
7781        St: AsRef<str>,
7782    {
7783        self._scopes.insert(String::from(scope.as_ref()));
7784        self
7785    }
7786    /// Identifies the authorization scope(s) for the method you are building.
7787    ///
7788    /// See [`Self::add_scope()`] for details.
7789    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyVerifyCustomTokenCall<'a, C>
7790    where
7791        I: IntoIterator<Item = St>,
7792        St: AsRef<str>,
7793    {
7794        self._scopes
7795            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7796        self
7797    }
7798
7799    /// Removes all scopes, and no default scope will be used either.
7800    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7801    /// for details).
7802    pub fn clear_scopes(mut self) -> RelyingpartyVerifyCustomTokenCall<'a, C> {
7803        self._scopes.clear();
7804        self
7805    }
7806}
7807
7808/// Verifies the user entered password.
7809///
7810/// A builder for the *verifyPassword* method supported by a *relyingparty* resource.
7811/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
7812///
7813/// # Example
7814///
7815/// Instantiate a resource method builder
7816///
7817/// ```test_harness,no_run
7818/// # extern crate hyper;
7819/// # extern crate hyper_rustls;
7820/// # extern crate google_identitytoolkit3 as identitytoolkit3;
7821/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyVerifyPasswordRequest;
7822/// # async fn dox() {
7823/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7824///
7825/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7826/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7827/// #     .with_native_roots()
7828/// #     .unwrap()
7829/// #     .https_only()
7830/// #     .enable_http2()
7831/// #     .build();
7832///
7833/// # let executor = hyper_util::rt::TokioExecutor::new();
7834/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7835/// #     secret,
7836/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7837/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7838/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7839/// #     ),
7840/// # ).build().await.unwrap();
7841///
7842/// # let client = hyper_util::client::legacy::Client::builder(
7843/// #     hyper_util::rt::TokioExecutor::new()
7844/// # )
7845/// # .build(
7846/// #     hyper_rustls::HttpsConnectorBuilder::new()
7847/// #         .with_native_roots()
7848/// #         .unwrap()
7849/// #         .https_or_http()
7850/// #         .enable_http2()
7851/// #         .build()
7852/// # );
7853/// # let mut hub = IdentityToolkit::new(client, auth);
7854/// // As the method needs a request, you would usually fill it with the desired information
7855/// // into the respective structure. Some of the parts shown here might not be applicable !
7856/// // Values shown here are possibly random and not representative !
7857/// let mut req = IdentitytoolkitRelyingpartyVerifyPasswordRequest::default();
7858///
7859/// // You can configure optional parameters by calling the respective setters at will, and
7860/// // execute the final call using `doit()`.
7861/// // Values shown here are possibly random and not representative !
7862/// let result = hub.relyingparty().verify_password(req)
7863///              .doit().await;
7864/// # }
7865/// ```
7866pub struct RelyingpartyVerifyPasswordCall<'a, C>
7867where
7868    C: 'a,
7869{
7870    hub: &'a IdentityToolkit<C>,
7871    _request: IdentitytoolkitRelyingpartyVerifyPasswordRequest,
7872    _delegate: Option<&'a mut dyn common::Delegate>,
7873    _additional_params: HashMap<String, String>,
7874    _scopes: BTreeSet<String>,
7875}
7876
7877impl<'a, C> common::CallBuilder for RelyingpartyVerifyPasswordCall<'a, C> {}
7878
7879impl<'a, C> RelyingpartyVerifyPasswordCall<'a, C>
7880where
7881    C: common::Connector,
7882{
7883    /// Perform the operation you have build so far.
7884    pub async fn doit(mut self) -> common::Result<(common::Response, VerifyPasswordResponse)> {
7885        use std::borrow::Cow;
7886        use std::io::{Read, Seek};
7887
7888        use common::{url::Params, ToParts};
7889        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7890
7891        let mut dd = common::DefaultDelegate;
7892        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7893        dlg.begin(common::MethodInfo {
7894            id: "identitytoolkit.relyingparty.verifyPassword",
7895            http_method: hyper::Method::POST,
7896        });
7897
7898        for &field in ["alt"].iter() {
7899            if self._additional_params.contains_key(field) {
7900                dlg.finished(false);
7901                return Err(common::Error::FieldClash(field));
7902            }
7903        }
7904
7905        let mut params = Params::with_capacity(3 + self._additional_params.len());
7906
7907        params.extend(self._additional_params.iter());
7908
7909        params.push("alt", "json");
7910        let mut url = self.hub._base_url.clone() + "verifyPassword";
7911        if self._scopes.is_empty() {
7912            self._scopes
7913                .insert(Scope::CloudPlatform.as_ref().to_string());
7914        }
7915
7916        let url = params.parse_with_url(&url);
7917
7918        let mut json_mime_type = mime::APPLICATION_JSON;
7919        let mut request_value_reader = {
7920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7921            common::remove_json_null_values(&mut value);
7922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7923            serde_json::to_writer(&mut dst, &value).unwrap();
7924            dst
7925        };
7926        let request_size = request_value_reader
7927            .seek(std::io::SeekFrom::End(0))
7928            .unwrap();
7929        request_value_reader
7930            .seek(std::io::SeekFrom::Start(0))
7931            .unwrap();
7932
7933        loop {
7934            let token = match self
7935                .hub
7936                .auth
7937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7938                .await
7939            {
7940                Ok(token) => token,
7941                Err(e) => match dlg.token(e) {
7942                    Ok(token) => token,
7943                    Err(e) => {
7944                        dlg.finished(false);
7945                        return Err(common::Error::MissingToken(e));
7946                    }
7947                },
7948            };
7949            request_value_reader
7950                .seek(std::io::SeekFrom::Start(0))
7951                .unwrap();
7952            let mut req_result = {
7953                let client = &self.hub.client;
7954                dlg.pre_request();
7955                let mut req_builder = hyper::Request::builder()
7956                    .method(hyper::Method::POST)
7957                    .uri(url.as_str())
7958                    .header(USER_AGENT, self.hub._user_agent.clone());
7959
7960                if let Some(token) = token.as_ref() {
7961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7962                }
7963
7964                let request = req_builder
7965                    .header(CONTENT_TYPE, json_mime_type.to_string())
7966                    .header(CONTENT_LENGTH, request_size as u64)
7967                    .body(common::to_body(
7968                        request_value_reader.get_ref().clone().into(),
7969                    ));
7970
7971                client.request(request.unwrap()).await
7972            };
7973
7974            match req_result {
7975                Err(err) => {
7976                    if let common::Retry::After(d) = dlg.http_error(&err) {
7977                        sleep(d).await;
7978                        continue;
7979                    }
7980                    dlg.finished(false);
7981                    return Err(common::Error::HttpError(err));
7982                }
7983                Ok(res) => {
7984                    let (mut parts, body) = res.into_parts();
7985                    let mut body = common::Body::new(body);
7986                    if !parts.status.is_success() {
7987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7988                        let error = serde_json::from_str(&common::to_string(&bytes));
7989                        let response = common::to_response(parts, bytes.into());
7990
7991                        if let common::Retry::After(d) =
7992                            dlg.http_failure(&response, error.as_ref().ok())
7993                        {
7994                            sleep(d).await;
7995                            continue;
7996                        }
7997
7998                        dlg.finished(false);
7999
8000                        return Err(match error {
8001                            Ok(value) => common::Error::BadRequest(value),
8002                            _ => common::Error::Failure(response),
8003                        });
8004                    }
8005                    let response = {
8006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8007                        let encoded = common::to_string(&bytes);
8008                        match serde_json::from_str(&encoded) {
8009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8010                            Err(error) => {
8011                                dlg.response_json_decode_error(&encoded, &error);
8012                                return Err(common::Error::JsonDecodeError(
8013                                    encoded.to_string(),
8014                                    error,
8015                                ));
8016                            }
8017                        }
8018                    };
8019
8020                    dlg.finished(true);
8021                    return Ok(response);
8022                }
8023            }
8024        }
8025    }
8026
8027    ///
8028    /// Sets the *request* property to the given value.
8029    ///
8030    /// Even though the property as already been set when instantiating this call,
8031    /// we provide this method for API completeness.
8032    pub fn request(
8033        mut self,
8034        new_value: IdentitytoolkitRelyingpartyVerifyPasswordRequest,
8035    ) -> RelyingpartyVerifyPasswordCall<'a, C> {
8036        self._request = new_value;
8037        self
8038    }
8039    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8040    /// while executing the actual API request.
8041    ///
8042    /// ````text
8043    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8044    /// ````
8045    ///
8046    /// Sets the *delegate* property to the given value.
8047    pub fn delegate(
8048        mut self,
8049        new_value: &'a mut dyn common::Delegate,
8050    ) -> RelyingpartyVerifyPasswordCall<'a, C> {
8051        self._delegate = Some(new_value);
8052        self
8053    }
8054
8055    /// Set any additional parameter of the query string used in the request.
8056    /// It should be used to set parameters which are not yet available through their own
8057    /// setters.
8058    ///
8059    /// Please note that this method must not be used to set any of the known parameters
8060    /// which have their own setter method. If done anyway, the request will fail.
8061    ///
8062    /// # Additional Parameters
8063    ///
8064    /// * *alt* (query-string) - Data format for the response.
8065    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8066    /// * *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.
8067    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8068    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8069    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
8070    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
8071    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyVerifyPasswordCall<'a, C>
8072    where
8073        T: AsRef<str>,
8074    {
8075        self._additional_params
8076            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8077        self
8078    }
8079
8080    /// Identifies the authorization scope for the method you are building.
8081    ///
8082    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8083    /// [`Scope::CloudPlatform`].
8084    ///
8085    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8086    /// tokens for more than one scope.
8087    ///
8088    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8089    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8090    /// sufficient, a read-write scope will do as well.
8091    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyVerifyPasswordCall<'a, C>
8092    where
8093        St: AsRef<str>,
8094    {
8095        self._scopes.insert(String::from(scope.as_ref()));
8096        self
8097    }
8098    /// Identifies the authorization scope(s) for the method you are building.
8099    ///
8100    /// See [`Self::add_scope()`] for details.
8101    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyVerifyPasswordCall<'a, C>
8102    where
8103        I: IntoIterator<Item = St>,
8104        St: AsRef<str>,
8105    {
8106        self._scopes
8107            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8108        self
8109    }
8110
8111    /// Removes all scopes, and no default scope will be used either.
8112    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8113    /// for details).
8114    pub fn clear_scopes(mut self) -> RelyingpartyVerifyPasswordCall<'a, C> {
8115        self._scopes.clear();
8116        self
8117    }
8118}
8119
8120/// Verifies ownership of a phone number and creates/updates the user account accordingly.
8121///
8122/// A builder for the *verifyPhoneNumber* method supported by a *relyingparty* resource.
8123/// It is not used directly, but through a [`RelyingpartyMethods`] instance.
8124///
8125/// # Example
8126///
8127/// Instantiate a resource method builder
8128///
8129/// ```test_harness,no_run
8130/// # extern crate hyper;
8131/// # extern crate hyper_rustls;
8132/// # extern crate google_identitytoolkit3 as identitytoolkit3;
8133/// use identitytoolkit3::api::IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest;
8134/// # async fn dox() {
8135/// # use identitytoolkit3::{IdentityToolkit, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8136///
8137/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8138/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8139/// #     .with_native_roots()
8140/// #     .unwrap()
8141/// #     .https_only()
8142/// #     .enable_http2()
8143/// #     .build();
8144///
8145/// # let executor = hyper_util::rt::TokioExecutor::new();
8146/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8147/// #     secret,
8148/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8149/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8150/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8151/// #     ),
8152/// # ).build().await.unwrap();
8153///
8154/// # let client = hyper_util::client::legacy::Client::builder(
8155/// #     hyper_util::rt::TokioExecutor::new()
8156/// # )
8157/// # .build(
8158/// #     hyper_rustls::HttpsConnectorBuilder::new()
8159/// #         .with_native_roots()
8160/// #         .unwrap()
8161/// #         .https_or_http()
8162/// #         .enable_http2()
8163/// #         .build()
8164/// # );
8165/// # let mut hub = IdentityToolkit::new(client, auth);
8166/// // As the method needs a request, you would usually fill it with the desired information
8167/// // into the respective structure. Some of the parts shown here might not be applicable !
8168/// // Values shown here are possibly random and not representative !
8169/// let mut req = IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest::default();
8170///
8171/// // You can configure optional parameters by calling the respective setters at will, and
8172/// // execute the final call using `doit()`.
8173/// // Values shown here are possibly random and not representative !
8174/// let result = hub.relyingparty().verify_phone_number(req)
8175///              .doit().await;
8176/// # }
8177/// ```
8178pub struct RelyingpartyVerifyPhoneNumberCall<'a, C>
8179where
8180    C: 'a,
8181{
8182    hub: &'a IdentityToolkit<C>,
8183    _request: IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest,
8184    _delegate: Option<&'a mut dyn common::Delegate>,
8185    _additional_params: HashMap<String, String>,
8186    _scopes: BTreeSet<String>,
8187}
8188
8189impl<'a, C> common::CallBuilder for RelyingpartyVerifyPhoneNumberCall<'a, C> {}
8190
8191impl<'a, C> RelyingpartyVerifyPhoneNumberCall<'a, C>
8192where
8193    C: common::Connector,
8194{
8195    /// Perform the operation you have build so far.
8196    pub async fn doit(
8197        mut self,
8198    ) -> common::Result<(
8199        common::Response,
8200        IdentitytoolkitRelyingpartyVerifyPhoneNumberResponse,
8201    )> {
8202        use std::borrow::Cow;
8203        use std::io::{Read, Seek};
8204
8205        use common::{url::Params, ToParts};
8206        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8207
8208        let mut dd = common::DefaultDelegate;
8209        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8210        dlg.begin(common::MethodInfo {
8211            id: "identitytoolkit.relyingparty.verifyPhoneNumber",
8212            http_method: hyper::Method::POST,
8213        });
8214
8215        for &field in ["alt"].iter() {
8216            if self._additional_params.contains_key(field) {
8217                dlg.finished(false);
8218                return Err(common::Error::FieldClash(field));
8219            }
8220        }
8221
8222        let mut params = Params::with_capacity(3 + self._additional_params.len());
8223
8224        params.extend(self._additional_params.iter());
8225
8226        params.push("alt", "json");
8227        let mut url = self.hub._base_url.clone() + "verifyPhoneNumber";
8228        if self._scopes.is_empty() {
8229            self._scopes
8230                .insert(Scope::CloudPlatform.as_ref().to_string());
8231        }
8232
8233        let url = params.parse_with_url(&url);
8234
8235        let mut json_mime_type = mime::APPLICATION_JSON;
8236        let mut request_value_reader = {
8237            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8238            common::remove_json_null_values(&mut value);
8239            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8240            serde_json::to_writer(&mut dst, &value).unwrap();
8241            dst
8242        };
8243        let request_size = request_value_reader
8244            .seek(std::io::SeekFrom::End(0))
8245            .unwrap();
8246        request_value_reader
8247            .seek(std::io::SeekFrom::Start(0))
8248            .unwrap();
8249
8250        loop {
8251            let token = match self
8252                .hub
8253                .auth
8254                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8255                .await
8256            {
8257                Ok(token) => token,
8258                Err(e) => match dlg.token(e) {
8259                    Ok(token) => token,
8260                    Err(e) => {
8261                        dlg.finished(false);
8262                        return Err(common::Error::MissingToken(e));
8263                    }
8264                },
8265            };
8266            request_value_reader
8267                .seek(std::io::SeekFrom::Start(0))
8268                .unwrap();
8269            let mut req_result = {
8270                let client = &self.hub.client;
8271                dlg.pre_request();
8272                let mut req_builder = hyper::Request::builder()
8273                    .method(hyper::Method::POST)
8274                    .uri(url.as_str())
8275                    .header(USER_AGENT, self.hub._user_agent.clone());
8276
8277                if let Some(token) = token.as_ref() {
8278                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8279                }
8280
8281                let request = req_builder
8282                    .header(CONTENT_TYPE, json_mime_type.to_string())
8283                    .header(CONTENT_LENGTH, request_size as u64)
8284                    .body(common::to_body(
8285                        request_value_reader.get_ref().clone().into(),
8286                    ));
8287
8288                client.request(request.unwrap()).await
8289            };
8290
8291            match req_result {
8292                Err(err) => {
8293                    if let common::Retry::After(d) = dlg.http_error(&err) {
8294                        sleep(d).await;
8295                        continue;
8296                    }
8297                    dlg.finished(false);
8298                    return Err(common::Error::HttpError(err));
8299                }
8300                Ok(res) => {
8301                    let (mut parts, body) = res.into_parts();
8302                    let mut body = common::Body::new(body);
8303                    if !parts.status.is_success() {
8304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8305                        let error = serde_json::from_str(&common::to_string(&bytes));
8306                        let response = common::to_response(parts, bytes.into());
8307
8308                        if let common::Retry::After(d) =
8309                            dlg.http_failure(&response, error.as_ref().ok())
8310                        {
8311                            sleep(d).await;
8312                            continue;
8313                        }
8314
8315                        dlg.finished(false);
8316
8317                        return Err(match error {
8318                            Ok(value) => common::Error::BadRequest(value),
8319                            _ => common::Error::Failure(response),
8320                        });
8321                    }
8322                    let response = {
8323                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8324                        let encoded = common::to_string(&bytes);
8325                        match serde_json::from_str(&encoded) {
8326                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8327                            Err(error) => {
8328                                dlg.response_json_decode_error(&encoded, &error);
8329                                return Err(common::Error::JsonDecodeError(
8330                                    encoded.to_string(),
8331                                    error,
8332                                ));
8333                            }
8334                        }
8335                    };
8336
8337                    dlg.finished(true);
8338                    return Ok(response);
8339                }
8340            }
8341        }
8342    }
8343
8344    ///
8345    /// Sets the *request* property to the given value.
8346    ///
8347    /// Even though the property as already been set when instantiating this call,
8348    /// we provide this method for API completeness.
8349    pub fn request(
8350        mut self,
8351        new_value: IdentitytoolkitRelyingpartyVerifyPhoneNumberRequest,
8352    ) -> RelyingpartyVerifyPhoneNumberCall<'a, C> {
8353        self._request = new_value;
8354        self
8355    }
8356    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8357    /// while executing the actual API request.
8358    ///
8359    /// ````text
8360    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8361    /// ````
8362    ///
8363    /// Sets the *delegate* property to the given value.
8364    pub fn delegate(
8365        mut self,
8366        new_value: &'a mut dyn common::Delegate,
8367    ) -> RelyingpartyVerifyPhoneNumberCall<'a, C> {
8368        self._delegate = Some(new_value);
8369        self
8370    }
8371
8372    /// Set any additional parameter of the query string used in the request.
8373    /// It should be used to set parameters which are not yet available through their own
8374    /// setters.
8375    ///
8376    /// Please note that this method must not be used to set any of the known parameters
8377    /// which have their own setter method. If done anyway, the request will fail.
8378    ///
8379    /// # Additional Parameters
8380    ///
8381    /// * *alt* (query-string) - Data format for the response.
8382    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8383    /// * *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.
8384    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8385    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8386    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
8387    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
8388    pub fn param<T>(mut self, name: T, value: T) -> RelyingpartyVerifyPhoneNumberCall<'a, C>
8389    where
8390        T: AsRef<str>,
8391    {
8392        self._additional_params
8393            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8394        self
8395    }
8396
8397    /// Identifies the authorization scope for the method you are building.
8398    ///
8399    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8400    /// [`Scope::CloudPlatform`].
8401    ///
8402    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8403    /// tokens for more than one scope.
8404    ///
8405    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8406    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8407    /// sufficient, a read-write scope will do as well.
8408    pub fn add_scope<St>(mut self, scope: St) -> RelyingpartyVerifyPhoneNumberCall<'a, C>
8409    where
8410        St: AsRef<str>,
8411    {
8412        self._scopes.insert(String::from(scope.as_ref()));
8413        self
8414    }
8415    /// Identifies the authorization scope(s) for the method you are building.
8416    ///
8417    /// See [`Self::add_scope()`] for details.
8418    pub fn add_scopes<I, St>(mut self, scopes: I) -> RelyingpartyVerifyPhoneNumberCall<'a, C>
8419    where
8420        I: IntoIterator<Item = St>,
8421        St: AsRef<str>,
8422    {
8423        self._scopes
8424            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8425        self
8426    }
8427
8428    /// Removes all scopes, and no default scope will be used either.
8429    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8430    /// for details).
8431    pub fn clear_scopes(mut self) -> RelyingpartyVerifyPhoneNumberCall<'a, C> {
8432        self._scopes.clear();
8433        self
8434    }
8435}