Skip to main content

windmill_api/apis/
user_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.887.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`accept_invite`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcceptInviteError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`consume_login_link`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ConsumeLoginLinkError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`convert_user_to_group`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ConvertUserToGroupError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`create_login_link`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateLoginLinkError {
43    Status409(),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`create_token`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum CreateTokenError {
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`create_token_impersonate`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum CreateTokenImpersonateError {
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`create_user_globally`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum CreateUserGloballyError {
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`decline_invite`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum DeclineInviteError {
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`delete_token`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum DeleteTokenError {
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`delete_token_as_super_admin`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum DeleteTokenAsSuperAdminError {
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`delete_user`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum DeleteUserError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`disable_totp`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum DisableTotpError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`enable_totp`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum EnableTotpError {
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`exists_email`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum ExistsEmailError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`exit_impersonation`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ExitImpersonationError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`get_cloud_trial_offer`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum GetCloudTrialOfferError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`get_current_email`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum GetCurrentEmailError {
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`get_onboarding_profile`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum GetOnboardingProfileError {
142    UnknownValue(serde_json::Value),
143}
144
145/// struct for typed errors of method [`get_runnable`]
146#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum GetRunnableError {
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`get_token_risk_counts`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum GetTokenRiskCountsError {
156    UnknownValue(serde_json::Value),
157}
158
159/// struct for typed errors of method [`get_token_risk_counts_as_super_admin`]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum GetTokenRiskCountsAsSuperAdminError {
163    UnknownValue(serde_json::Value),
164}
165
166/// struct for typed errors of method [`get_totp_status`]
167#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum GetTotpStatusError {
170    UnknownValue(serde_json::Value),
171}
172
173/// struct for typed errors of method [`get_tutorial_progress`]
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum GetTutorialProgressError {
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`get_usage`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum GetUsageError {
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`get_user`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetUserError {
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`global_offboard_preview`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum GlobalOffboardPreviewError {
198    UnknownValue(serde_json::Value),
199}
200
201/// struct for typed errors of method [`global_user_change_email`]
202#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum GlobalUserChangeEmailError {
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`global_user_delete`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum GlobalUserDeleteError {
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`global_user_rename`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum GlobalUserRenameError {
219    UnknownValue(serde_json::Value),
220}
221
222/// struct for typed errors of method [`global_user_update`]
223#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum GlobalUserUpdateError {
226    UnknownValue(serde_json::Value),
227}
228
229/// struct for typed errors of method [`global_username_info`]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum GlobalUsernameInfoError {
233    UnknownValue(serde_json::Value),
234}
235
236/// struct for typed errors of method [`global_users_export`]
237#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum GlobalUsersExportError {
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`global_users_overwrite`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum GlobalUsersOverwriteError {
247    UnknownValue(serde_json::Value),
248}
249
250/// struct for typed errors of method [`global_whoami`]
251#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum GlobalWhoamiError {
254    UnknownValue(serde_json::Value),
255}
256
257/// struct for typed errors of method [`go_cloud_trial_offer`]
258#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum GoCloudTrialOfferError {
261    Status403(),
262    Status404(),
263    UnknownValue(serde_json::Value),
264}
265
266/// struct for typed errors of method [`impersonate_service_account`]
267#[derive(Debug, Clone, Serialize, Deserialize)]
268#[serde(untagged)]
269pub enum ImpersonateServiceAccountError {
270    UnknownValue(serde_json::Value),
271}
272
273/// struct for typed errors of method [`is_owner_of_path`]
274#[derive(Debug, Clone, Serialize, Deserialize)]
275#[serde(untagged)]
276pub enum IsOwnerOfPathError {
277    UnknownValue(serde_json::Value),
278}
279
280/// struct for typed errors of method [`is_password_login_disabled`]
281#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum IsPasswordLoginDisabledError {
284    UnknownValue(serde_json::Value),
285}
286
287/// struct for typed errors of method [`is_smtp_configured`]
288#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum IsSmtpConfiguredError {
291    UnknownValue(serde_json::Value),
292}
293
294/// struct for typed errors of method [`leave_instance`]
295#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum LeaveInstanceError {
298    UnknownValue(serde_json::Value),
299}
300
301/// struct for typed errors of method [`list_addable_instance_users`]
302#[derive(Debug, Clone, Serialize, Deserialize)]
303#[serde(untagged)]
304pub enum ListAddableInstanceUsersError {
305    UnknownValue(serde_json::Value),
306}
307
308/// struct for typed errors of method [`list_ext_jwt_tokens`]
309#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum ListExtJwtTokensError {
312    UnknownValue(serde_json::Value),
313}
314
315/// struct for typed errors of method [`list_guests`]
316#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum ListGuestsError {
319    UnknownValue(serde_json::Value),
320}
321
322/// struct for typed errors of method [`list_tokens`]
323#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum ListTokensError {
326    UnknownValue(serde_json::Value),
327}
328
329/// struct for typed errors of method [`list_tokens_as_super_admin`]
330#[derive(Debug, Clone, Serialize, Deserialize)]
331#[serde(untagged)]
332pub enum ListTokensAsSuperAdminError {
333    UnknownValue(serde_json::Value),
334}
335
336/// struct for typed errors of method [`list_usernames`]
337#[derive(Debug, Clone, Serialize, Deserialize)]
338#[serde(untagged)]
339pub enum ListUsernamesError {
340    UnknownValue(serde_json::Value),
341}
342
343/// struct for typed errors of method [`list_users`]
344#[derive(Debug, Clone, Serialize, Deserialize)]
345#[serde(untagged)]
346pub enum ListUsersError {
347    UnknownValue(serde_json::Value),
348}
349
350/// struct for typed errors of method [`list_users_as_super_admin`]
351#[derive(Debug, Clone, Serialize, Deserialize)]
352#[serde(untagged)]
353pub enum ListUsersAsSuperAdminError {
354    UnknownValue(serde_json::Value),
355}
356
357/// struct for typed errors of method [`list_users_usage`]
358#[derive(Debug, Clone, Serialize, Deserialize)]
359#[serde(untagged)]
360pub enum ListUsersUsageError {
361    UnknownValue(serde_json::Value),
362}
363
364/// struct for typed errors of method [`list_workspace_invites`]
365#[derive(Debug, Clone, Serialize, Deserialize)]
366#[serde(untagged)]
367pub enum ListWorkspaceInvitesError {
368    UnknownValue(serde_json::Value),
369}
370
371/// struct for typed errors of method [`login`]
372#[derive(Debug, Clone, Serialize, Deserialize)]
373#[serde(untagged)]
374pub enum LoginError {
375    UnknownValue(serde_json::Value),
376}
377
378/// struct for typed errors of method [`login_with_oauth`]
379#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum LoginWithOauthError {
382    UnknownValue(serde_json::Value),
383}
384
385/// struct for typed errors of method [`logout`]
386#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum LogoutError {
389    UnknownValue(serde_json::Value),
390}
391
392/// struct for typed errors of method [`offboard_global_user`]
393#[derive(Debug, Clone, Serialize, Deserialize)]
394#[serde(untagged)]
395pub enum OffboardGlobalUserError {
396    UnknownValue(serde_json::Value),
397}
398
399/// struct for typed errors of method [`offboard_preview`]
400#[derive(Debug, Clone, Serialize, Deserialize)]
401#[serde(untagged)]
402pub enum OffboardPreviewError {
403    UnknownValue(serde_json::Value),
404}
405
406/// struct for typed errors of method [`offboard_workspace_user`]
407#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum OffboardWorkspaceUserError {
410    UnknownValue(serde_json::Value),
411}
412
413/// struct for typed errors of method [`refresh_user_token`]
414#[derive(Debug, Clone, Serialize, Deserialize)]
415#[serde(untagged)]
416pub enum RefreshUserTokenError {
417    UnknownValue(serde_json::Value),
418}
419
420/// struct for typed errors of method [`regenerate_totp_recovery_codes`]
421#[derive(Debug, Clone, Serialize, Deserialize)]
422#[serde(untagged)]
423pub enum RegenerateTotpRecoveryCodesError {
424    UnknownValue(serde_json::Value),
425}
426
427/// struct for typed errors of method [`request_password_reset`]
428#[derive(Debug, Clone, Serialize, Deserialize)]
429#[serde(untagged)]
430pub enum RequestPasswordResetError {
431    Status400(),
432    UnknownValue(serde_json::Value),
433}
434
435/// struct for typed errors of method [`reset_password`]
436#[derive(Debug, Clone, Serialize, Deserialize)]
437#[serde(untagged)]
438pub enum ResetPasswordError {
439    Status400(),
440    UnknownValue(serde_json::Value),
441}
442
443/// struct for typed errors of method [`reset_totp_of_user`]
444#[derive(Debug, Clone, Serialize, Deserialize)]
445#[serde(untagged)]
446pub enum ResetTotpOfUserError {
447    UnknownValue(serde_json::Value),
448}
449
450/// struct for typed errors of method [`set_cloud_trial_offer`]
451#[derive(Debug, Clone, Serialize, Deserialize)]
452#[serde(untagged)]
453pub enum SetCloudTrialOfferError {
454    UnknownValue(serde_json::Value),
455}
456
457/// struct for typed errors of method [`set_login_type_for_user`]
458#[derive(Debug, Clone, Serialize, Deserialize)]
459#[serde(untagged)]
460pub enum SetLoginTypeForUserError {
461    UnknownValue(serde_json::Value),
462}
463
464/// struct for typed errors of method [`set_onboarding_profile`]
465#[derive(Debug, Clone, Serialize, Deserialize)]
466#[serde(untagged)]
467pub enum SetOnboardingProfileError {
468    UnknownValue(serde_json::Value),
469}
470
471/// struct for typed errors of method [`set_password`]
472#[derive(Debug, Clone, Serialize, Deserialize)]
473#[serde(untagged)]
474pub enum SetPasswordError {
475    UnknownValue(serde_json::Value),
476}
477
478/// struct for typed errors of method [`set_password_for_user`]
479#[derive(Debug, Clone, Serialize, Deserialize)]
480#[serde(untagged)]
481pub enum SetPasswordForUserError {
482    UnknownValue(serde_json::Value),
483}
484
485/// struct for typed errors of method [`setup_totp`]
486#[derive(Debug, Clone, Serialize, Deserialize)]
487#[serde(untagged)]
488pub enum SetupTotpError {
489    UnknownValue(serde_json::Value),
490}
491
492/// struct for typed errors of method [`submit_onboarding_data`]
493#[derive(Debug, Clone, Serialize, Deserialize)]
494#[serde(untagged)]
495pub enum SubmitOnboardingDataError {
496    UnknownValue(serde_json::Value),
497}
498
499/// struct for typed errors of method [`update_token_label`]
500#[derive(Debug, Clone, Serialize, Deserialize)]
501#[serde(untagged)]
502pub enum UpdateTokenLabelError {
503    UnknownValue(serde_json::Value),
504}
505
506/// struct for typed errors of method [`update_token_limits`]
507#[derive(Debug, Clone, Serialize, Deserialize)]
508#[serde(untagged)]
509pub enum UpdateTokenLimitsError {
510    UnknownValue(serde_json::Value),
511}
512
513/// struct for typed errors of method [`update_token_scopes`]
514#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum UpdateTokenScopesError {
517    UnknownValue(serde_json::Value),
518}
519
520/// struct for typed errors of method [`update_tutorial_progress`]
521#[derive(Debug, Clone, Serialize, Deserialize)]
522#[serde(untagged)]
523pub enum UpdateTutorialProgressError {
524    UnknownValue(serde_json::Value),
525}
526
527/// struct for typed errors of method [`update_user`]
528#[derive(Debug, Clone, Serialize, Deserialize)]
529#[serde(untagged)]
530pub enum UpdateUserError {
531    UnknownValue(serde_json::Value),
532}
533
534/// struct for typed errors of method [`username_to_email`]
535#[derive(Debug, Clone, Serialize, Deserialize)]
536#[serde(untagged)]
537pub enum UsernameToEmailError {
538    UnknownValue(serde_json::Value),
539}
540
541/// struct for typed errors of method [`whoami`]
542#[derive(Debug, Clone, Serialize, Deserialize)]
543#[serde(untagged)]
544pub enum WhoamiError {
545    UnknownValue(serde_json::Value),
546}
547
548/// struct for typed errors of method [`whois`]
549#[derive(Debug, Clone, Serialize, Deserialize)]
550#[serde(untagged)]
551pub enum WhoisError {
552    UnknownValue(serde_json::Value),
553}
554
555
556pub async fn accept_invite(configuration: &configuration::Configuration, accept_invite_request: models::AcceptInviteRequest) -> Result<String, Error<AcceptInviteError>> {
557    let local_var_configuration = configuration;
558
559    let local_var_client = &local_var_configuration.client;
560
561    let local_var_uri_str = format!("{}/users/accept_invite", local_var_configuration.base_path);
562    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
563
564    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
565        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
566    }
567    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
568        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
569    };
570    local_var_req_builder = local_var_req_builder.json(&accept_invite_request);
571
572    let local_var_req = local_var_req_builder.build()?;
573    let local_var_resp = local_var_client.execute(local_var_req).await?;
574
575    let local_var_status = local_var_resp.status();
576    let local_var_content = local_var_resp.text().await?;
577
578    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
579        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
580    } else {
581        let local_var_entity: Option<AcceptInviteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
582        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
583        Err(Error::ResponseError(local_var_error))
584    }
585}
586
587pub async fn consume_login_link(configuration: &configuration::Configuration, token: &str, rd: Option<&str>) -> Result<(), Error<ConsumeLoginLinkError>> {
588    let local_var_configuration = configuration;
589
590    let local_var_client = &local_var_configuration.client;
591
592    let local_var_uri_str = format!("{}/auth/login_link/{token}", local_var_configuration.base_path, token=crate::apis::urlencode(token));
593    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
594
595    if let Some(ref local_var_str) = rd {
596        local_var_req_builder = local_var_req_builder.query(&[("rd", &local_var_str.to_string())]);
597    }
598    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
599        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
600    }
601
602    let local_var_req = local_var_req_builder.build()?;
603    let local_var_resp = local_var_client.execute(local_var_req).await?;
604
605    let local_var_status = local_var_resp.status();
606    let local_var_content = local_var_resp.text().await?;
607
608    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
609        Ok(())
610    } else {
611        let local_var_entity: Option<ConsumeLoginLinkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
612        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
613        Err(Error::ResponseError(local_var_error))
614    }
615}
616
617pub async fn convert_user_to_group(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<ConvertUserToGroupError>> {
618    let local_var_configuration = configuration;
619
620    let local_var_client = &local_var_configuration.client;
621
622    let local_var_uri_str = format!("{}/w/{workspace}/users/convert_to_group/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
623    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
624
625    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
626        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
627    }
628    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
629        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
630    };
631
632    let local_var_req = local_var_req_builder.build()?;
633    let local_var_resp = local_var_client.execute(local_var_req).await?;
634
635    let local_var_status = local_var_resp.status();
636    let local_var_content = local_var_resp.text().await?;
637
638    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
639        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
640    } else {
641        let local_var_entity: Option<ConvertUserToGroupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
642        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
643        Err(Error::ResponseError(local_var_error))
644    }
645}
646
647pub async fn create_login_link(configuration: &configuration::Configuration, create_login_link_request: models::CreateLoginLinkRequest) -> Result<models::CreateLoginLink201Response, Error<CreateLoginLinkError>> {
648    let local_var_configuration = configuration;
649
650    let local_var_client = &local_var_configuration.client;
651
652    let local_var_uri_str = format!("{}/users/login_links", local_var_configuration.base_path);
653    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
654
655    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
656        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
657    }
658    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
659        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
660    };
661    local_var_req_builder = local_var_req_builder.json(&create_login_link_request);
662
663    let local_var_req = local_var_req_builder.build()?;
664    let local_var_resp = local_var_client.execute(local_var_req).await?;
665
666    let local_var_status = local_var_resp.status();
667    let local_var_content = local_var_resp.text().await?;
668
669    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
670        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
671    } else {
672        let local_var_entity: Option<CreateLoginLinkError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
673        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
674        Err(Error::ResponseError(local_var_error))
675    }
676}
677
678pub async fn create_token(configuration: &configuration::Configuration, new_token: models::NewToken) -> Result<String, Error<CreateTokenError>> {
679    let local_var_configuration = configuration;
680
681    let local_var_client = &local_var_configuration.client;
682
683    let local_var_uri_str = format!("{}/users/tokens/create", local_var_configuration.base_path);
684    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
685
686    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
687        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
688    }
689    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
690        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
691    };
692    local_var_req_builder = local_var_req_builder.json(&new_token);
693
694    let local_var_req = local_var_req_builder.build()?;
695    let local_var_resp = local_var_client.execute(local_var_req).await?;
696
697    let local_var_status = local_var_resp.status();
698    let local_var_content = local_var_resp.text().await?;
699
700    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
701        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
702    } else {
703        let local_var_entity: Option<CreateTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
704        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
705        Err(Error::ResponseError(local_var_error))
706    }
707}
708
709pub async fn create_token_impersonate(configuration: &configuration::Configuration, new_token_impersonate: models::NewTokenImpersonate) -> Result<String, Error<CreateTokenImpersonateError>> {
710    let local_var_configuration = configuration;
711
712    let local_var_client = &local_var_configuration.client;
713
714    let local_var_uri_str = format!("{}/users/tokens/impersonate", local_var_configuration.base_path);
715    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
716
717    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
718        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
719    }
720    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
721        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
722    };
723    local_var_req_builder = local_var_req_builder.json(&new_token_impersonate);
724
725    let local_var_req = local_var_req_builder.build()?;
726    let local_var_resp = local_var_client.execute(local_var_req).await?;
727
728    let local_var_status = local_var_resp.status();
729    let local_var_content = local_var_resp.text().await?;
730
731    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
732        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
733    } else {
734        let local_var_entity: Option<CreateTokenImpersonateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
735        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
736        Err(Error::ResponseError(local_var_error))
737    }
738}
739
740pub async fn create_user_globally(configuration: &configuration::Configuration, create_user_globally_request: models::CreateUserGloballyRequest) -> Result<String, Error<CreateUserGloballyError>> {
741    let local_var_configuration = configuration;
742
743    let local_var_client = &local_var_configuration.client;
744
745    let local_var_uri_str = format!("{}/users/create", local_var_configuration.base_path);
746    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
747
748    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
749        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
750    }
751    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
752        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
753    };
754    local_var_req_builder = local_var_req_builder.json(&create_user_globally_request);
755
756    let local_var_req = local_var_req_builder.build()?;
757    let local_var_resp = local_var_client.execute(local_var_req).await?;
758
759    let local_var_status = local_var_resp.status();
760    let local_var_content = local_var_resp.text().await?;
761
762    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
763        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
764    } else {
765        let local_var_entity: Option<CreateUserGloballyError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
766        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
767        Err(Error::ResponseError(local_var_error))
768    }
769}
770
771pub async fn decline_invite(configuration: &configuration::Configuration, decline_invite_request: models::DeclineInviteRequest) -> Result<String, Error<DeclineInviteError>> {
772    let local_var_configuration = configuration;
773
774    let local_var_client = &local_var_configuration.client;
775
776    let local_var_uri_str = format!("{}/users/decline_invite", local_var_configuration.base_path);
777    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
778
779    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
780        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
781    }
782    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
783        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
784    };
785    local_var_req_builder = local_var_req_builder.json(&decline_invite_request);
786
787    let local_var_req = local_var_req_builder.build()?;
788    let local_var_resp = local_var_client.execute(local_var_req).await?;
789
790    let local_var_status = local_var_resp.status();
791    let local_var_content = local_var_resp.text().await?;
792
793    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
794        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
795    } else {
796        let local_var_entity: Option<DeclineInviteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
797        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
798        Err(Error::ResponseError(local_var_error))
799    }
800}
801
802pub async fn delete_token(configuration: &configuration::Configuration, token_prefix: &str) -> Result<String, Error<DeleteTokenError>> {
803    let local_var_configuration = configuration;
804
805    let local_var_client = &local_var_configuration.client;
806
807    let local_var_uri_str = format!("{}/users/tokens/delete/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
808    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
809
810    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
811        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
812    }
813    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
814        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
815    };
816
817    let local_var_req = local_var_req_builder.build()?;
818    let local_var_resp = local_var_client.execute(local_var_req).await?;
819
820    let local_var_status = local_var_resp.status();
821    let local_var_content = local_var_resp.text().await?;
822
823    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
824        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
825    } else {
826        let local_var_entity: Option<DeleteTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
827        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
828        Err(Error::ResponseError(local_var_error))
829    }
830}
831
832pub async fn delete_token_as_super_admin(configuration: &configuration::Configuration, email: &str, token_prefix: &str) -> Result<String, Error<DeleteTokenAsSuperAdminError>> {
833    let local_var_configuration = configuration;
834
835    let local_var_client = &local_var_configuration.client;
836
837    let local_var_uri_str = format!("{}/users/tokens/delete_as_super_admin/{email}/{token_prefix}", local_var_configuration.base_path, email=crate::apis::urlencode(email), token_prefix=crate::apis::urlencode(token_prefix));
838    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
839
840    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
841        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
842    }
843    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
844        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
845    };
846
847    let local_var_req = local_var_req_builder.build()?;
848    let local_var_resp = local_var_client.execute(local_var_req).await?;
849
850    let local_var_status = local_var_resp.status();
851    let local_var_content = local_var_resp.text().await?;
852
853    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
854        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
855    } else {
856        let local_var_entity: Option<DeleteTokenAsSuperAdminError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
857        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
858        Err(Error::ResponseError(local_var_error))
859    }
860}
861
862pub async fn delete_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<DeleteUserError>> {
863    let local_var_configuration = configuration;
864
865    let local_var_client = &local_var_configuration.client;
866
867    let local_var_uri_str = format!("{}/w/{workspace}/users/delete/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
868    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
869
870    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
871        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
872    }
873    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
874        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
875    };
876
877    let local_var_req = local_var_req_builder.build()?;
878    let local_var_resp = local_var_client.execute(local_var_req).await?;
879
880    let local_var_status = local_var_resp.status();
881    let local_var_content = local_var_resp.text().await?;
882
883    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
884        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
885    } else {
886        let local_var_entity: Option<DeleteUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
887        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
888        Err(Error::ResponseError(local_var_error))
889    }
890}
891
892pub async fn disable_totp(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<String, Error<DisableTotpError>> {
893    let local_var_configuration = configuration;
894
895    let local_var_client = &local_var_configuration.client;
896
897    let local_var_uri_str = format!("{}/users/totp/disable", local_var_configuration.base_path);
898    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
899
900    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
901        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
902    }
903    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
904        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
905    };
906    local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
907
908    let local_var_req = local_var_req_builder.build()?;
909    let local_var_resp = local_var_client.execute(local_var_req).await?;
910
911    let local_var_status = local_var_resp.status();
912    let local_var_content = local_var_resp.text().await?;
913
914    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
915        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
916    } else {
917        let local_var_entity: Option<DisableTotpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
918        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
919        Err(Error::ResponseError(local_var_error))
920    }
921}
922
923pub async fn enable_totp(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<models::EnableTotp200Response, Error<EnableTotpError>> {
924    let local_var_configuration = configuration;
925
926    let local_var_client = &local_var_configuration.client;
927
928    let local_var_uri_str = format!("{}/users/totp/enable", local_var_configuration.base_path);
929    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
930
931    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
932        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
933    }
934    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
935        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
936    };
937    local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
938
939    let local_var_req = local_var_req_builder.build()?;
940    let local_var_resp = local_var_client.execute(local_var_req).await?;
941
942    let local_var_status = local_var_resp.status();
943    let local_var_content = local_var_resp.text().await?;
944
945    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
946        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
947    } else {
948        let local_var_entity: Option<EnableTotpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
949        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
950        Err(Error::ResponseError(local_var_error))
951    }
952}
953
954pub async fn exists_email(configuration: &configuration::Configuration, email: &str) -> Result<bool, Error<ExistsEmailError>> {
955    let local_var_configuration = configuration;
956
957    let local_var_client = &local_var_configuration.client;
958
959    let local_var_uri_str = format!("{}/users/exists/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
960    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
961
962    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
963        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
964    }
965    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
966        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
967    };
968
969    let local_var_req = local_var_req_builder.build()?;
970    let local_var_resp = local_var_client.execute(local_var_req).await?;
971
972    let local_var_status = local_var_resp.status();
973    let local_var_content = local_var_resp.text().await?;
974
975    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
976        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
977    } else {
978        let local_var_entity: Option<ExistsEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
979        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
980        Err(Error::ResponseError(local_var_error))
981    }
982}
983
984pub async fn exit_impersonation(configuration: &configuration::Configuration, workspace: &str, get_github_app_token200_response: models::GetGithubAppToken200Response) -> Result<String, Error<ExitImpersonationError>> {
985    let local_var_configuration = configuration;
986
987    let local_var_client = &local_var_configuration.client;
988
989    let local_var_uri_str = format!("{}/w/{workspace}/users/exit_impersonation", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
990    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
991
992    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
993        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
994    }
995    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
996        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
997    };
998    local_var_req_builder = local_var_req_builder.json(&get_github_app_token200_response);
999
1000    let local_var_req = local_var_req_builder.build()?;
1001    let local_var_resp = local_var_client.execute(local_var_req).await?;
1002
1003    let local_var_status = local_var_resp.status();
1004    let local_var_content = local_var_resp.text().await?;
1005
1006    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1007        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1008    } else {
1009        let local_var_entity: Option<ExitImpersonationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1010        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1011        Err(Error::ResponseError(local_var_error))
1012    }
1013}
1014
1015pub async fn get_cloud_trial_offer(configuration: &configuration::Configuration, ) -> Result<models::GetCloudTrialOffer200Response, Error<GetCloudTrialOfferError>> {
1016    let local_var_configuration = configuration;
1017
1018    let local_var_client = &local_var_configuration.client;
1019
1020    let local_var_uri_str = format!("{}/users/cloud_trial_offer", local_var_configuration.base_path);
1021    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1022
1023    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1024        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1025    }
1026    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1027        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1028    };
1029
1030    let local_var_req = local_var_req_builder.build()?;
1031    let local_var_resp = local_var_client.execute(local_var_req).await?;
1032
1033    let local_var_status = local_var_resp.status();
1034    let local_var_content = local_var_resp.text().await?;
1035
1036    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1037        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1038    } else {
1039        let local_var_entity: Option<GetCloudTrialOfferError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1040        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1041        Err(Error::ResponseError(local_var_error))
1042    }
1043}
1044
1045pub async fn get_current_email(configuration: &configuration::Configuration, ) -> Result<String, Error<GetCurrentEmailError>> {
1046    let local_var_configuration = configuration;
1047
1048    let local_var_client = &local_var_configuration.client;
1049
1050    let local_var_uri_str = format!("{}/users/email", local_var_configuration.base_path);
1051    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1052
1053    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1054        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1055    }
1056    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1057        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1058    };
1059
1060    let local_var_req = local_var_req_builder.build()?;
1061    let local_var_resp = local_var_client.execute(local_var_req).await?;
1062
1063    let local_var_status = local_var_resp.status();
1064    let local_var_content = local_var_resp.text().await?;
1065
1066    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1067        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1068    } else {
1069        let local_var_entity: Option<GetCurrentEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1070        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1071        Err(Error::ResponseError(local_var_error))
1072    }
1073}
1074
1075pub async fn get_onboarding_profile(configuration: &configuration::Configuration, ) -> Result<models::GetOnboardingProfile200Response, Error<GetOnboardingProfileError>> {
1076    let local_var_configuration = configuration;
1077
1078    let local_var_client = &local_var_configuration.client;
1079
1080    let local_var_uri_str = format!("{}/users/onboarding_profile", local_var_configuration.base_path);
1081    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1082
1083    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1084        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1085    }
1086    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1087        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1088    };
1089
1090    let local_var_req = local_var_req_builder.build()?;
1091    let local_var_resp = local_var_client.execute(local_var_req).await?;
1092
1093    let local_var_status = local_var_resp.status();
1094    let local_var_content = local_var_resp.text().await?;
1095
1096    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1097        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1098    } else {
1099        let local_var_entity: Option<GetOnboardingProfileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1100        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1101        Err(Error::ResponseError(local_var_error))
1102    }
1103}
1104
1105pub async fn get_runnable(configuration: &configuration::Configuration, ) -> Result<models::GetRunnable200Response, Error<GetRunnableError>> {
1106    let local_var_configuration = configuration;
1107
1108    let local_var_client = &local_var_configuration.client;
1109
1110    let local_var_uri_str = format!("{}/users/all_runnables", local_var_configuration.base_path);
1111    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1112
1113    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1114        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1115    }
1116    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1117        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1118    };
1119
1120    let local_var_req = local_var_req_builder.build()?;
1121    let local_var_resp = local_var_client.execute(local_var_req).await?;
1122
1123    let local_var_status = local_var_resp.status();
1124    let local_var_content = local_var_resp.text().await?;
1125
1126    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1127        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1128    } else {
1129        let local_var_entity: Option<GetRunnableError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1130        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1131        Err(Error::ResponseError(local_var_error))
1132    }
1133}
1134
1135pub async fn get_token_risk_counts(configuration: &configuration::Configuration, ) -> Result<models::TokenRiskCounts, Error<GetTokenRiskCountsError>> {
1136    let local_var_configuration = configuration;
1137
1138    let local_var_client = &local_var_configuration.client;
1139
1140    let local_var_uri_str = format!("{}/users/tokens/risk_counts", local_var_configuration.base_path);
1141    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1142
1143    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1144        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1145    }
1146    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1147        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1148    };
1149
1150    let local_var_req = local_var_req_builder.build()?;
1151    let local_var_resp = local_var_client.execute(local_var_req).await?;
1152
1153    let local_var_status = local_var_resp.status();
1154    let local_var_content = local_var_resp.text().await?;
1155
1156    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1157        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1158    } else {
1159        let local_var_entity: Option<GetTokenRiskCountsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1160        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1161        Err(Error::ResponseError(local_var_error))
1162    }
1163}
1164
1165pub async fn get_token_risk_counts_as_super_admin(configuration: &configuration::Configuration, ) -> Result<models::TokenRiskCounts, Error<GetTokenRiskCountsAsSuperAdminError>> {
1166    let local_var_configuration = configuration;
1167
1168    let local_var_client = &local_var_configuration.client;
1169
1170    let local_var_uri_str = format!("{}/users/tokens/risk_counts_as_super_admin", local_var_configuration.base_path);
1171    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1172
1173    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1174        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1175    }
1176    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1177        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1178    };
1179
1180    let local_var_req = local_var_req_builder.build()?;
1181    let local_var_resp = local_var_client.execute(local_var_req).await?;
1182
1183    let local_var_status = local_var_resp.status();
1184    let local_var_content = local_var_resp.text().await?;
1185
1186    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1187        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1188    } else {
1189        let local_var_entity: Option<GetTokenRiskCountsAsSuperAdminError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1190        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1191        Err(Error::ResponseError(local_var_error))
1192    }
1193}
1194
1195pub async fn get_totp_status(configuration: &configuration::Configuration, ) -> Result<models::GetTotpStatus200Response, Error<GetTotpStatusError>> {
1196    let local_var_configuration = configuration;
1197
1198    let local_var_client = &local_var_configuration.client;
1199
1200    let local_var_uri_str = format!("{}/users/totp", local_var_configuration.base_path);
1201    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1202
1203    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1204        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1205    }
1206    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1207        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1208    };
1209
1210    let local_var_req = local_var_req_builder.build()?;
1211    let local_var_resp = local_var_client.execute(local_var_req).await?;
1212
1213    let local_var_status = local_var_resp.status();
1214    let local_var_content = local_var_resp.text().await?;
1215
1216    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1217        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1218    } else {
1219        let local_var_entity: Option<GetTotpStatusError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1220        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1221        Err(Error::ResponseError(local_var_error))
1222    }
1223}
1224
1225pub async fn get_tutorial_progress(configuration: &configuration::Configuration, ) -> Result<models::GetTutorialProgress200Response, Error<GetTutorialProgressError>> {
1226    let local_var_configuration = configuration;
1227
1228    let local_var_client = &local_var_configuration.client;
1229
1230    let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
1231    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1232
1233    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1234        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1235    }
1236    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1237        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1238    };
1239
1240    let local_var_req = local_var_req_builder.build()?;
1241    let local_var_resp = local_var_client.execute(local_var_req).await?;
1242
1243    let local_var_status = local_var_resp.status();
1244    let local_var_content = local_var_resp.text().await?;
1245
1246    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1247        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1248    } else {
1249        let local_var_entity: Option<GetTutorialProgressError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1250        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1251        Err(Error::ResponseError(local_var_error))
1252    }
1253}
1254
1255pub async fn get_usage(configuration: &configuration::Configuration, ) -> Result<f64, Error<GetUsageError>> {
1256    let local_var_configuration = configuration;
1257
1258    let local_var_client = &local_var_configuration.client;
1259
1260    let local_var_uri_str = format!("{}/users/usage", local_var_configuration.base_path);
1261    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1262
1263    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1264        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1265    }
1266    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1267        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1268    };
1269
1270    let local_var_req = local_var_req_builder.build()?;
1271    let local_var_resp = local_var_client.execute(local_var_req).await?;
1272
1273    let local_var_status = local_var_resp.status();
1274    let local_var_content = local_var_resp.text().await?;
1275
1276    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1277        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1278    } else {
1279        let local_var_entity: Option<GetUsageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1280        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1281        Err(Error::ResponseError(local_var_error))
1282    }
1283}
1284
1285pub async fn get_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<GetUserError>> {
1286    let local_var_configuration = configuration;
1287
1288    let local_var_client = &local_var_configuration.client;
1289
1290    let local_var_uri_str = format!("{}/w/{workspace}/users/get/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
1291    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1292
1293    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1294        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1295    }
1296    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1297        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1298    };
1299
1300    let local_var_req = local_var_req_builder.build()?;
1301    let local_var_resp = local_var_client.execute(local_var_req).await?;
1302
1303    let local_var_status = local_var_resp.status();
1304    let local_var_content = local_var_resp.text().await?;
1305
1306    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1307        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1308    } else {
1309        let local_var_entity: Option<GetUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1310        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1311        Err(Error::ResponseError(local_var_error))
1312    }
1313}
1314
1315pub async fn global_offboard_preview(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalOffboardPreview, Error<GlobalOffboardPreviewError>> {
1316    let local_var_configuration = configuration;
1317
1318    let local_var_client = &local_var_configuration.client;
1319
1320    let local_var_uri_str = format!("{}/users/offboard_preview/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1321    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1322
1323    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1324        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1325    }
1326    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1327        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1328    };
1329
1330    let local_var_req = local_var_req_builder.build()?;
1331    let local_var_resp = local_var_client.execute(local_var_req).await?;
1332
1333    let local_var_status = local_var_resp.status();
1334    let local_var_content = local_var_resp.text().await?;
1335
1336    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1337        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1338    } else {
1339        let local_var_entity: Option<GlobalOffboardPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1340        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1341        Err(Error::ResponseError(local_var_error))
1342    }
1343}
1344
1345pub async fn global_user_change_email(configuration: &configuration::Configuration, email: &str, global_user_change_email_request: models::GlobalUserChangeEmailRequest) -> Result<String, Error<GlobalUserChangeEmailError>> {
1346    let local_var_configuration = configuration;
1347
1348    let local_var_client = &local_var_configuration.client;
1349
1350    let local_var_uri_str = format!("{}/users/change_email/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1351    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1352
1353    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1354        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1355    }
1356    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1357        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1358    };
1359    local_var_req_builder = local_var_req_builder.json(&global_user_change_email_request);
1360
1361    let local_var_req = local_var_req_builder.build()?;
1362    let local_var_resp = local_var_client.execute(local_var_req).await?;
1363
1364    let local_var_status = local_var_resp.status();
1365    let local_var_content = local_var_resp.text().await?;
1366
1367    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1368        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1369    } else {
1370        let local_var_entity: Option<GlobalUserChangeEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1371        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1372        Err(Error::ResponseError(local_var_error))
1373    }
1374}
1375
1376pub async fn global_user_delete(configuration: &configuration::Configuration, email: &str) -> Result<String, Error<GlobalUserDeleteError>> {
1377    let local_var_configuration = configuration;
1378
1379    let local_var_client = &local_var_configuration.client;
1380
1381    let local_var_uri_str = format!("{}/users/delete/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1382    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1383
1384    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1385        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1386    }
1387    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1388        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1389    };
1390
1391    let local_var_req = local_var_req_builder.build()?;
1392    let local_var_resp = local_var_client.execute(local_var_req).await?;
1393
1394    let local_var_status = local_var_resp.status();
1395    let local_var_content = local_var_resp.text().await?;
1396
1397    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1398        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1399    } else {
1400        let local_var_entity: Option<GlobalUserDeleteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1401        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1402        Err(Error::ResponseError(local_var_error))
1403    }
1404}
1405
1406pub async fn global_user_rename(configuration: &configuration::Configuration, email: &str, global_user_rename_request: models::GlobalUserRenameRequest) -> Result<String, Error<GlobalUserRenameError>> {
1407    let local_var_configuration = configuration;
1408
1409    let local_var_client = &local_var_configuration.client;
1410
1411    let local_var_uri_str = format!("{}/users/rename/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1412    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1413
1414    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1415        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1416    }
1417    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1418        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1419    };
1420    local_var_req_builder = local_var_req_builder.json(&global_user_rename_request);
1421
1422    let local_var_req = local_var_req_builder.build()?;
1423    let local_var_resp = local_var_client.execute(local_var_req).await?;
1424
1425    let local_var_status = local_var_resp.status();
1426    let local_var_content = local_var_resp.text().await?;
1427
1428    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1429        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1430    } else {
1431        let local_var_entity: Option<GlobalUserRenameError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1432        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1433        Err(Error::ResponseError(local_var_error))
1434    }
1435}
1436
1437pub async fn global_user_update(configuration: &configuration::Configuration, email: &str, global_user_update_request: models::GlobalUserUpdateRequest) -> Result<String, Error<GlobalUserUpdateError>> {
1438    let local_var_configuration = configuration;
1439
1440    let local_var_client = &local_var_configuration.client;
1441
1442    let local_var_uri_str = format!("{}/users/update/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1443    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1444
1445    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1446        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1447    }
1448    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1449        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1450    };
1451    local_var_req_builder = local_var_req_builder.json(&global_user_update_request);
1452
1453    let local_var_req = local_var_req_builder.build()?;
1454    let local_var_resp = local_var_client.execute(local_var_req).await?;
1455
1456    let local_var_status = local_var_resp.status();
1457    let local_var_content = local_var_resp.text().await?;
1458
1459    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1460        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1461    } else {
1462        let local_var_entity: Option<GlobalUserUpdateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1463        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1464        Err(Error::ResponseError(local_var_error))
1465    }
1466}
1467
1468pub async fn global_username_info(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalUsernameInfo200Response, Error<GlobalUsernameInfoError>> {
1469    let local_var_configuration = configuration;
1470
1471    let local_var_client = &local_var_configuration.client;
1472
1473    let local_var_uri_str = format!("{}/users/username_info/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1474    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1475
1476    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1477        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1478    }
1479    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1480        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1481    };
1482
1483    let local_var_req = local_var_req_builder.build()?;
1484    let local_var_resp = local_var_client.execute(local_var_req).await?;
1485
1486    let local_var_status = local_var_resp.status();
1487    let local_var_content = local_var_resp.text().await?;
1488
1489    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1490        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1491    } else {
1492        let local_var_entity: Option<GlobalUsernameInfoError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1493        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1494        Err(Error::ResponseError(local_var_error))
1495    }
1496}
1497
1498pub async fn global_users_export(configuration: &configuration::Configuration, ) -> Result<Vec<models::ExportedUser>, Error<GlobalUsersExportError>> {
1499    let local_var_configuration = configuration;
1500
1501    let local_var_client = &local_var_configuration.client;
1502
1503    let local_var_uri_str = format!("{}/users/export", local_var_configuration.base_path);
1504    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1505
1506    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1507        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1508    }
1509    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1510        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1511    };
1512
1513    let local_var_req = local_var_req_builder.build()?;
1514    let local_var_resp = local_var_client.execute(local_var_req).await?;
1515
1516    let local_var_status = local_var_resp.status();
1517    let local_var_content = local_var_resp.text().await?;
1518
1519    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1520        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1521    } else {
1522        let local_var_entity: Option<GlobalUsersExportError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1523        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1524        Err(Error::ResponseError(local_var_error))
1525    }
1526}
1527
1528pub async fn global_users_overwrite(configuration: &configuration::Configuration, exported_user: Vec<models::ExportedUser>) -> Result<String, Error<GlobalUsersOverwriteError>> {
1529    let local_var_configuration = configuration;
1530
1531    let local_var_client = &local_var_configuration.client;
1532
1533    let local_var_uri_str = format!("{}/users/overwrite", local_var_configuration.base_path);
1534    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1535
1536    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1537        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1538    }
1539    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1540        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1541    };
1542    local_var_req_builder = local_var_req_builder.json(&exported_user);
1543
1544    let local_var_req = local_var_req_builder.build()?;
1545    let local_var_resp = local_var_client.execute(local_var_req).await?;
1546
1547    let local_var_status = local_var_resp.status();
1548    let local_var_content = local_var_resp.text().await?;
1549
1550    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1551        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1552    } else {
1553        let local_var_entity: Option<GlobalUsersOverwriteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1554        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1555        Err(Error::ResponseError(local_var_error))
1556    }
1557}
1558
1559pub async fn global_whoami(configuration: &configuration::Configuration, ) -> Result<models::GlobalUserInfo, Error<GlobalWhoamiError>> {
1560    let local_var_configuration = configuration;
1561
1562    let local_var_client = &local_var_configuration.client;
1563
1564    let local_var_uri_str = format!("{}/users/whoami", local_var_configuration.base_path);
1565    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1566
1567    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1568        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1569    }
1570    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1571        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1572    };
1573
1574    let local_var_req = local_var_req_builder.build()?;
1575    let local_var_resp = local_var_client.execute(local_var_req).await?;
1576
1577    let local_var_status = local_var_resp.status();
1578    let local_var_content = local_var_resp.text().await?;
1579
1580    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1581        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1582    } else {
1583        let local_var_entity: Option<GlobalWhoamiError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1584        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1585        Err(Error::ResponseError(local_var_error))
1586    }
1587}
1588
1589pub async fn go_cloud_trial_offer(configuration: &configuration::Configuration, ) -> Result<models::GoCloudTrialOffer200Response, Error<GoCloudTrialOfferError>> {
1590    let local_var_configuration = configuration;
1591
1592    let local_var_client = &local_var_configuration.client;
1593
1594    let local_var_uri_str = format!("{}/users/cloud_trial_offer/go", local_var_configuration.base_path);
1595    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1596
1597    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1598        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1599    }
1600    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1601        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1602    };
1603
1604    let local_var_req = local_var_req_builder.build()?;
1605    let local_var_resp = local_var_client.execute(local_var_req).await?;
1606
1607    let local_var_status = local_var_resp.status();
1608    let local_var_content = local_var_resp.text().await?;
1609
1610    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1611        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1612    } else {
1613        let local_var_entity: Option<GoCloudTrialOfferError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1614        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1615        Err(Error::ResponseError(local_var_error))
1616    }
1617}
1618
1619pub async fn impersonate_service_account(configuration: &configuration::Configuration, workspace: &str, impersonate_service_account_request: models::ImpersonateServiceAccountRequest) -> Result<String, Error<ImpersonateServiceAccountError>> {
1620    let local_var_configuration = configuration;
1621
1622    let local_var_client = &local_var_configuration.client;
1623
1624    let local_var_uri_str = format!("{}/w/{workspace}/users/impersonate_service_account", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1625    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1626
1627    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1628        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1629    }
1630    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1631        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1632    };
1633    local_var_req_builder = local_var_req_builder.json(&impersonate_service_account_request);
1634
1635    let local_var_req = local_var_req_builder.build()?;
1636    let local_var_resp = local_var_client.execute(local_var_req).await?;
1637
1638    let local_var_status = local_var_resp.status();
1639    let local_var_content = local_var_resp.text().await?;
1640
1641    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1642        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1643    } else {
1644        let local_var_entity: Option<ImpersonateServiceAccountError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1645        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1646        Err(Error::ResponseError(local_var_error))
1647    }
1648}
1649
1650pub async fn is_owner_of_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<IsOwnerOfPathError>> {
1651    let local_var_configuration = configuration;
1652
1653    let local_var_client = &local_var_configuration.client;
1654
1655    let local_var_uri_str = format!("{}/w/{workspace}/users/is_owner/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1656    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1657
1658    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1659        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1660    }
1661    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1662        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1663    };
1664
1665    let local_var_req = local_var_req_builder.build()?;
1666    let local_var_resp = local_var_client.execute(local_var_req).await?;
1667
1668    let local_var_status = local_var_resp.status();
1669    let local_var_content = local_var_resp.text().await?;
1670
1671    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1672        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1673    } else {
1674        let local_var_entity: Option<IsOwnerOfPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1675        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1676        Err(Error::ResponseError(local_var_error))
1677    }
1678}
1679
1680pub async fn is_password_login_disabled(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsPasswordLoginDisabledError>> {
1681    let local_var_configuration = configuration;
1682
1683    let local_var_client = &local_var_configuration.client;
1684
1685    let local_var_uri_str = format!("{}/auth/is_password_login_disabled", local_var_configuration.base_path);
1686    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1687
1688    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1689        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1690    }
1691
1692    let local_var_req = local_var_req_builder.build()?;
1693    let local_var_resp = local_var_client.execute(local_var_req).await?;
1694
1695    let local_var_status = local_var_resp.status();
1696    let local_var_content = local_var_resp.text().await?;
1697
1698    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1699        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1700    } else {
1701        let local_var_entity: Option<IsPasswordLoginDisabledError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1702        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1703        Err(Error::ResponseError(local_var_error))
1704    }
1705}
1706
1707pub async fn is_smtp_configured(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsSmtpConfiguredError>> {
1708    let local_var_configuration = configuration;
1709
1710    let local_var_client = &local_var_configuration.client;
1711
1712    let local_var_uri_str = format!("{}/auth/is_smtp_configured", local_var_configuration.base_path);
1713    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1714
1715    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1716        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1717    }
1718
1719    let local_var_req = local_var_req_builder.build()?;
1720    let local_var_resp = local_var_client.execute(local_var_req).await?;
1721
1722    let local_var_status = local_var_resp.status();
1723    let local_var_content = local_var_resp.text().await?;
1724
1725    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1726        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1727    } else {
1728        let local_var_entity: Option<IsSmtpConfiguredError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1729        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1730        Err(Error::ResponseError(local_var_error))
1731    }
1732}
1733
1734pub async fn leave_instance(configuration: &configuration::Configuration, ) -> Result<String, Error<LeaveInstanceError>> {
1735    let local_var_configuration = configuration;
1736
1737    let local_var_client = &local_var_configuration.client;
1738
1739    let local_var_uri_str = format!("{}/users/leave_instance", local_var_configuration.base_path);
1740    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1741
1742    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1743        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1744    }
1745    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1746        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1747    };
1748
1749    let local_var_req = local_var_req_builder.build()?;
1750    let local_var_resp = local_var_client.execute(local_var_req).await?;
1751
1752    let local_var_status = local_var_resp.status();
1753    let local_var_content = local_var_resp.text().await?;
1754
1755    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1756        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1757    } else {
1758        let local_var_entity: Option<LeaveInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1759        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1760        Err(Error::ResponseError(local_var_error))
1761    }
1762}
1763
1764pub async fn list_addable_instance_users(configuration: &configuration::Configuration, workspace: &str, search: Option<&str>, per_page: Option<i32>) -> Result<Vec<models::ListAddableInstanceUsers200ResponseInner>, Error<ListAddableInstanceUsersError>> {
1765    let local_var_configuration = configuration;
1766
1767    let local_var_client = &local_var_configuration.client;
1768
1769    let local_var_uri_str = format!("{}/w/{workspace}/users/list_addable", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1770    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1771
1772    if let Some(ref local_var_str) = search {
1773        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1774    }
1775    if let Some(ref local_var_str) = per_page {
1776        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1777    }
1778    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1779        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1780    }
1781    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1782        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1783    };
1784
1785    let local_var_req = local_var_req_builder.build()?;
1786    let local_var_resp = local_var_client.execute(local_var_req).await?;
1787
1788    let local_var_status = local_var_resp.status();
1789    let local_var_content = local_var_resp.text().await?;
1790
1791    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1792        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1793    } else {
1794        let local_var_entity: Option<ListAddableInstanceUsersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1795        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1796        Err(Error::ResponseError(local_var_error))
1797    }
1798}
1799
1800pub async fn list_ext_jwt_tokens(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>, active_only: Option<bool>) -> Result<Vec<models::ExternalJwtToken>, Error<ListExtJwtTokensError>> {
1801    let local_var_configuration = configuration;
1802
1803    let local_var_client = &local_var_configuration.client;
1804
1805    let local_var_uri_str = format!("{}/users/ext_jwt_tokens", local_var_configuration.base_path);
1806    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1807
1808    if let Some(ref local_var_str) = page {
1809        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1810    }
1811    if let Some(ref local_var_str) = per_page {
1812        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1813    }
1814    if let Some(ref local_var_str) = active_only {
1815        local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
1816    }
1817    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1818        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1819    }
1820    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1821        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1822    };
1823
1824    let local_var_req = local_var_req_builder.build()?;
1825    let local_var_resp = local_var_client.execute(local_var_req).await?;
1826
1827    let local_var_status = local_var_resp.status();
1828    let local_var_content = local_var_resp.text().await?;
1829
1830    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1831        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1832    } else {
1833        let local_var_entity: Option<ListExtJwtTokensError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1834        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1835        Err(Error::ResponseError(local_var_error))
1836    }
1837}
1838
1839/// The set the guest allowance is counted on: every distinct email that held a guest session in the last `window_days`, with the workspaces it opened and the days it was first and last seen, most recently seen first. `usage` is the instance's standing against the allowance and the meter.
1840pub async fn list_guests(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<models::GuestList, Error<ListGuestsError>> {
1841    let local_var_configuration = configuration;
1842
1843    let local_var_client = &local_var_configuration.client;
1844
1845    let local_var_uri_str = format!("{}/users/guests", local_var_configuration.base_path);
1846    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1847
1848    if let Some(ref local_var_str) = page {
1849        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1850    }
1851    if let Some(ref local_var_str) = per_page {
1852        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1853    }
1854    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1855        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1856    }
1857    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1858        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1859    };
1860
1861    let local_var_req = local_var_req_builder.build()?;
1862    let local_var_resp = local_var_client.execute(local_var_req).await?;
1863
1864    let local_var_status = local_var_resp.status();
1865    let local_var_content = local_var_resp.text().await?;
1866
1867    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1868        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1869    } else {
1870        let local_var_entity: Option<ListGuestsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1871        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1872        Err(Error::ResponseError(local_var_error))
1873    }
1874}
1875
1876pub async fn list_tokens(configuration: &configuration::Configuration, exclude_ephemeral: Option<bool>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::TruncatedToken>, Error<ListTokensError>> {
1877    let local_var_configuration = configuration;
1878
1879    let local_var_client = &local_var_configuration.client;
1880
1881    let local_var_uri_str = format!("{}/users/tokens/list", local_var_configuration.base_path);
1882    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1883
1884    if let Some(ref local_var_str) = exclude_ephemeral {
1885        local_var_req_builder = local_var_req_builder.query(&[("exclude_ephemeral", &local_var_str.to_string())]);
1886    }
1887    if let Some(ref local_var_str) = page {
1888        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1889    }
1890    if let Some(ref local_var_str) = per_page {
1891        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1892    }
1893    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1894        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1895    }
1896    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1897        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1898    };
1899
1900    let local_var_req = local_var_req_builder.build()?;
1901    let local_var_resp = local_var_client.execute(local_var_req).await?;
1902
1903    let local_var_status = local_var_resp.status();
1904    let local_var_content = local_var_resp.text().await?;
1905
1906    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1907        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1908    } else {
1909        let local_var_entity: Option<ListTokensError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1910        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1911        Err(Error::ResponseError(local_var_error))
1912    }
1913}
1914
1915/// Tokens the server expires or renews on its own are left out. Pages are read with a cursor: pass the last row's `last_used_at` and `token_prefix` to get the next page. 
1916pub async fn list_tokens_as_super_admin(configuration: &configuration::Configuration, flag: Option<&str>, search: Option<&str>, per_page: Option<i32>, after_last_used_at: Option<String>, after_token_prefix: Option<&str>) -> Result<Vec<models::TokenForReview>, Error<ListTokensAsSuperAdminError>> {
1917    let local_var_configuration = configuration;
1918
1919    let local_var_client = &local_var_configuration.client;
1920
1921    let local_var_uri_str = format!("{}/users/tokens/list_as_super_admin", local_var_configuration.base_path);
1922    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1923
1924    if let Some(ref local_var_str) = flag {
1925        local_var_req_builder = local_var_req_builder.query(&[("flag", &local_var_str.to_string())]);
1926    }
1927    if let Some(ref local_var_str) = search {
1928        local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1929    }
1930    if let Some(ref local_var_str) = per_page {
1931        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1932    }
1933    if let Some(ref local_var_str) = after_last_used_at {
1934        local_var_req_builder = local_var_req_builder.query(&[("after_last_used_at", &local_var_str.to_string())]);
1935    }
1936    if let Some(ref local_var_str) = after_token_prefix {
1937        local_var_req_builder = local_var_req_builder.query(&[("after_token_prefix", &local_var_str.to_string())]);
1938    }
1939    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1940        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1941    }
1942    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1943        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1944    };
1945
1946    let local_var_req = local_var_req_builder.build()?;
1947    let local_var_resp = local_var_client.execute(local_var_req).await?;
1948
1949    let local_var_status = local_var_resp.status();
1950    let local_var_content = local_var_resp.text().await?;
1951
1952    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1953        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1954    } else {
1955        let local_var_entity: Option<ListTokensAsSuperAdminError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1956        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1957        Err(Error::ResponseError(local_var_error))
1958    }
1959}
1960
1961pub async fn list_usernames(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListUsernamesError>> {
1962    let local_var_configuration = configuration;
1963
1964    let local_var_client = &local_var_configuration.client;
1965
1966    let local_var_uri_str = format!("{}/w/{workspace}/users/list_usernames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1967    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1968
1969    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1970        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1971    }
1972    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1973        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1974    };
1975
1976    let local_var_req = local_var_req_builder.build()?;
1977    let local_var_resp = local_var_client.execute(local_var_req).await?;
1978
1979    let local_var_status = local_var_resp.status();
1980    let local_var_content = local_var_resp.text().await?;
1981
1982    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1983        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1984    } else {
1985        let local_var_entity: Option<ListUsernamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1986        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1987        Err(Error::ResponseError(local_var_error))
1988    }
1989}
1990
1991pub async fn list_users(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::User>, Error<ListUsersError>> {
1992    let local_var_configuration = configuration;
1993
1994    let local_var_client = &local_var_configuration.client;
1995
1996    let local_var_uri_str = format!("{}/w/{workspace}/users/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1997    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1998
1999    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2000        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2001    }
2002    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2003        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2004    };
2005
2006    let local_var_req = local_var_req_builder.build()?;
2007    let local_var_resp = local_var_client.execute(local_var_req).await?;
2008
2009    let local_var_status = local_var_resp.status();
2010    let local_var_content = local_var_resp.text().await?;
2011
2012    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2013        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2014    } else {
2015        let local_var_entity: Option<ListUsersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2016        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2017        Err(Error::ResponseError(local_var_error))
2018    }
2019}
2020
2021pub async fn list_users_as_super_admin(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>, active_only: Option<bool>) -> Result<Vec<models::GlobalUserInfo>, Error<ListUsersAsSuperAdminError>> {
2022    let local_var_configuration = configuration;
2023
2024    let local_var_client = &local_var_configuration.client;
2025
2026    let local_var_uri_str = format!("{}/users/list_as_super_admin", local_var_configuration.base_path);
2027    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2028
2029    if let Some(ref local_var_str) = page {
2030        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2031    }
2032    if let Some(ref local_var_str) = per_page {
2033        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
2034    }
2035    if let Some(ref local_var_str) = active_only {
2036        local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
2037    }
2038    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2039        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2040    }
2041    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2042        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2043    };
2044
2045    let local_var_req = local_var_req_builder.build()?;
2046    let local_var_resp = local_var_client.execute(local_var_req).await?;
2047
2048    let local_var_status = local_var_resp.status();
2049    let local_var_content = local_var_resp.text().await?;
2050
2051    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2052        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2053    } else {
2054        let local_var_entity: Option<ListUsersAsSuperAdminError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2055        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2056        Err(Error::ResponseError(local_var_error))
2057    }
2058}
2059
2060pub async fn list_users_usage(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::UserUsage>, Error<ListUsersUsageError>> {
2061    let local_var_configuration = configuration;
2062
2063    let local_var_client = &local_var_configuration.client;
2064
2065    let local_var_uri_str = format!("{}/w/{workspace}/users/list_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2066    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2067
2068    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2069        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2070    }
2071    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2072        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2073    };
2074
2075    let local_var_req = local_var_req_builder.build()?;
2076    let local_var_resp = local_var_client.execute(local_var_req).await?;
2077
2078    let local_var_status = local_var_resp.status();
2079    let local_var_content = local_var_resp.text().await?;
2080
2081    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2082        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2083    } else {
2084        let local_var_entity: Option<ListUsersUsageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2085        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2086        Err(Error::ResponseError(local_var_error))
2087    }
2088}
2089
2090pub async fn list_workspace_invites(configuration: &configuration::Configuration, ) -> Result<Vec<models::WorkspaceInvite>, Error<ListWorkspaceInvitesError>> {
2091    let local_var_configuration = configuration;
2092
2093    let local_var_client = &local_var_configuration.client;
2094
2095    let local_var_uri_str = format!("{}/users/list_invites", local_var_configuration.base_path);
2096    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2097
2098    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2099        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2100    }
2101    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2102        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2103    };
2104
2105    let local_var_req = local_var_req_builder.build()?;
2106    let local_var_resp = local_var_client.execute(local_var_req).await?;
2107
2108    let local_var_status = local_var_resp.status();
2109    let local_var_content = local_var_resp.text().await?;
2110
2111    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2112        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2113    } else {
2114        let local_var_entity: Option<ListWorkspaceInvitesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2115        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2116        Err(Error::ResponseError(local_var_error))
2117    }
2118}
2119
2120pub async fn login(configuration: &configuration::Configuration, login: models::Login) -> Result<String, Error<LoginError>> {
2121    let local_var_configuration = configuration;
2122
2123    let local_var_client = &local_var_configuration.client;
2124
2125    let local_var_uri_str = format!("{}/auth/login", local_var_configuration.base_path);
2126    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2127
2128    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2129        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2130    }
2131    local_var_req_builder = local_var_req_builder.json(&login);
2132
2133    let local_var_req = local_var_req_builder.build()?;
2134    let local_var_resp = local_var_client.execute(local_var_req).await?;
2135
2136    let local_var_status = local_var_resp.status();
2137    let local_var_content = local_var_resp.text().await?;
2138
2139    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2140        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2141    } else {
2142        let local_var_entity: Option<LoginError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2143        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2144        Err(Error::ResponseError(local_var_error))
2145    }
2146}
2147
2148pub async fn login_with_oauth(configuration: &configuration::Configuration, client_name: &str, login_with_oauth_request: models::LoginWithOauthRequest) -> Result<String, Error<LoginWithOauthError>> {
2149    let local_var_configuration = configuration;
2150
2151    let local_var_client = &local_var_configuration.client;
2152
2153    let local_var_uri_str = format!("{}/oauth/login_callback/{client_name}", local_var_configuration.base_path, client_name=crate::apis::urlencode(client_name));
2154    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2155
2156    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2157        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2158    }
2159    local_var_req_builder = local_var_req_builder.json(&login_with_oauth_request);
2160
2161    let local_var_req = local_var_req_builder.build()?;
2162    let local_var_resp = local_var_client.execute(local_var_req).await?;
2163
2164    let local_var_status = local_var_resp.status();
2165    let local_var_content = local_var_resp.text().await?;
2166
2167    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2168        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2169    } else {
2170        let local_var_entity: Option<LoginWithOauthError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2171        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2172        Err(Error::ResponseError(local_var_error))
2173    }
2174}
2175
2176pub async fn logout(configuration: &configuration::Configuration, ) -> Result<String, Error<LogoutError>> {
2177    let local_var_configuration = configuration;
2178
2179    let local_var_client = &local_var_configuration.client;
2180
2181    let local_var_uri_str = format!("{}/auth/logout", local_var_configuration.base_path);
2182    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2183
2184    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2185        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2186    }
2187
2188    let local_var_req = local_var_req_builder.build()?;
2189    let local_var_resp = local_var_client.execute(local_var_req).await?;
2190
2191    let local_var_status = local_var_resp.status();
2192    let local_var_content = local_var_resp.text().await?;
2193
2194    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2195        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2196    } else {
2197        let local_var_entity: Option<LogoutError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2198        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2199        Err(Error::ResponseError(local_var_error))
2200    }
2201}
2202
2203pub async fn offboard_global_user(configuration: &configuration::Configuration, email: &str, global_offboard_request: models::GlobalOffboardRequest) -> Result<models::OffboardResponse, Error<OffboardGlobalUserError>> {
2204    let local_var_configuration = configuration;
2205
2206    let local_var_client = &local_var_configuration.client;
2207
2208    let local_var_uri_str = format!("{}/users/offboard/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
2209    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2210
2211    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2212        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2213    }
2214    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2215        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2216    };
2217    local_var_req_builder = local_var_req_builder.json(&global_offboard_request);
2218
2219    let local_var_req = local_var_req_builder.build()?;
2220    let local_var_resp = local_var_client.execute(local_var_req).await?;
2221
2222    let local_var_status = local_var_resp.status();
2223    let local_var_content = local_var_resp.text().await?;
2224
2225    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2226        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2227    } else {
2228        let local_var_entity: Option<OffboardGlobalUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2229        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2230        Err(Error::ResponseError(local_var_error))
2231    }
2232}
2233
2234pub async fn offboard_preview(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::OffboardPreview, Error<OffboardPreviewError>> {
2235    let local_var_configuration = configuration;
2236
2237    let local_var_client = &local_var_configuration.client;
2238
2239    let local_var_uri_str = format!("{}/w/{workspace}/users/offboard_preview/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
2240    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2241
2242    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2243        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2244    }
2245    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2246        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2247    };
2248
2249    let local_var_req = local_var_req_builder.build()?;
2250    let local_var_resp = local_var_client.execute(local_var_req).await?;
2251
2252    let local_var_status = local_var_resp.status();
2253    let local_var_content = local_var_resp.text().await?;
2254
2255    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2256        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2257    } else {
2258        let local_var_entity: Option<OffboardPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2259        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2260        Err(Error::ResponseError(local_var_error))
2261    }
2262}
2263
2264pub async fn offboard_workspace_user(configuration: &configuration::Configuration, workspace: &str, username: &str, offboard_request: models::OffboardRequest) -> Result<models::OffboardResponse, Error<OffboardWorkspaceUserError>> {
2265    let local_var_configuration = configuration;
2266
2267    let local_var_client = &local_var_configuration.client;
2268
2269    let local_var_uri_str = format!("{}/w/{workspace}/users/offboard/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
2270    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2271
2272    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2273        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2274    }
2275    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2276        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2277    };
2278    local_var_req_builder = local_var_req_builder.json(&offboard_request);
2279
2280    let local_var_req = local_var_req_builder.build()?;
2281    let local_var_resp = local_var_client.execute(local_var_req).await?;
2282
2283    let local_var_status = local_var_resp.status();
2284    let local_var_content = local_var_resp.text().await?;
2285
2286    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2287        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2288    } else {
2289        let local_var_entity: Option<OffboardWorkspaceUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2290        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2291        Err(Error::ResponseError(local_var_error))
2292    }
2293}
2294
2295pub async fn refresh_user_token(configuration: &configuration::Configuration, if_expiring_in_less_than_s: Option<i32>) -> Result<String, Error<RefreshUserTokenError>> {
2296    let local_var_configuration = configuration;
2297
2298    let local_var_client = &local_var_configuration.client;
2299
2300    let local_var_uri_str = format!("{}/users/refresh_token", local_var_configuration.base_path);
2301    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2302
2303    if let Some(ref local_var_str) = if_expiring_in_less_than_s {
2304        local_var_req_builder = local_var_req_builder.query(&[("if_expiring_in_less_than_s", &local_var_str.to_string())]);
2305    }
2306    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2307        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2308    }
2309    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2310        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2311    };
2312
2313    let local_var_req = local_var_req_builder.build()?;
2314    let local_var_resp = local_var_client.execute(local_var_req).await?;
2315
2316    let local_var_status = local_var_resp.status();
2317    let local_var_content = local_var_resp.text().await?;
2318
2319    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2320        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2321    } else {
2322        let local_var_entity: Option<RefreshUserTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2323        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2324        Err(Error::ResponseError(local_var_error))
2325    }
2326}
2327
2328pub async fn regenerate_totp_recovery_codes(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<models::EnableTotp200Response, Error<RegenerateTotpRecoveryCodesError>> {
2329    let local_var_configuration = configuration;
2330
2331    let local_var_client = &local_var_configuration.client;
2332
2333    let local_var_uri_str = format!("{}/users/totp/recovery_codes", local_var_configuration.base_path);
2334    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2335
2336    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2337        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2338    }
2339    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2340        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2341    };
2342    local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
2343
2344    let local_var_req = local_var_req_builder.build()?;
2345    let local_var_resp = local_var_client.execute(local_var_req).await?;
2346
2347    let local_var_status = local_var_resp.status();
2348    let local_var_content = local_var_resp.text().await?;
2349
2350    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2351        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2352    } else {
2353        let local_var_entity: Option<RegenerateTotpRecoveryCodesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2354        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2355        Err(Error::ResponseError(local_var_error))
2356    }
2357}
2358
2359pub async fn request_password_reset(configuration: &configuration::Configuration, request_password_reset_request: models::RequestPasswordResetRequest) -> Result<models::PasswordResetResponse, Error<RequestPasswordResetError>> {
2360    let local_var_configuration = configuration;
2361
2362    let local_var_client = &local_var_configuration.client;
2363
2364    let local_var_uri_str = format!("{}/auth/request_password_reset", local_var_configuration.base_path);
2365    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2366
2367    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2369    }
2370    local_var_req_builder = local_var_req_builder.json(&request_password_reset_request);
2371
2372    let local_var_req = local_var_req_builder.build()?;
2373    let local_var_resp = local_var_client.execute(local_var_req).await?;
2374
2375    let local_var_status = local_var_resp.status();
2376    let local_var_content = local_var_resp.text().await?;
2377
2378    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2379        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2380    } else {
2381        let local_var_entity: Option<RequestPasswordResetError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2382        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2383        Err(Error::ResponseError(local_var_error))
2384    }
2385}
2386
2387pub async fn reset_password(configuration: &configuration::Configuration, reset_password_request: models::ResetPasswordRequest) -> Result<models::PasswordResetResponse, Error<ResetPasswordError>> {
2388    let local_var_configuration = configuration;
2389
2390    let local_var_client = &local_var_configuration.client;
2391
2392    let local_var_uri_str = format!("{}/auth/reset_password", local_var_configuration.base_path);
2393    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2394
2395    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2396        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2397    }
2398    local_var_req_builder = local_var_req_builder.json(&reset_password_request);
2399
2400    let local_var_req = local_var_req_builder.build()?;
2401    let local_var_resp = local_var_client.execute(local_var_req).await?;
2402
2403    let local_var_status = local_var_resp.status();
2404    let local_var_content = local_var_resp.text().await?;
2405
2406    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2407        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2408    } else {
2409        let local_var_entity: Option<ResetPasswordError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2410        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2411        Err(Error::ResponseError(local_var_error))
2412    }
2413}
2414
2415pub async fn reset_totp_of_user(configuration: &configuration::Configuration, user: &str) -> Result<String, Error<ResetTotpOfUserError>> {
2416    let local_var_configuration = configuration;
2417
2418    let local_var_client = &local_var_configuration.client;
2419
2420    let local_var_uri_str = format!("{}/users/totp/reset/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2421    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2422
2423    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2424        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2425    }
2426    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2427        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2428    };
2429
2430    let local_var_req = local_var_req_builder.build()?;
2431    let local_var_resp = local_var_client.execute(local_var_req).await?;
2432
2433    let local_var_status = local_var_resp.status();
2434    let local_var_content = local_var_resp.text().await?;
2435
2436    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2437        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2438    } else {
2439        let local_var_entity: Option<ResetTotpOfUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2440        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2441        Err(Error::ResponseError(local_var_error))
2442    }
2443}
2444
2445pub async fn set_cloud_trial_offer(configuration: &configuration::Configuration, set_cloud_trial_offer_request: models::SetCloudTrialOfferRequest) -> Result<String, Error<SetCloudTrialOfferError>> {
2446    let local_var_configuration = configuration;
2447
2448    let local_var_client = &local_var_configuration.client;
2449
2450    let local_var_uri_str = format!("{}/users/cloud_trial_offer", local_var_configuration.base_path);
2451    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2452
2453    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2454        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2455    }
2456    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2457        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2458    };
2459    local_var_req_builder = local_var_req_builder.json(&set_cloud_trial_offer_request);
2460
2461    let local_var_req = local_var_req_builder.build()?;
2462    let local_var_resp = local_var_client.execute(local_var_req).await?;
2463
2464    let local_var_status = local_var_resp.status();
2465    let local_var_content = local_var_resp.text().await?;
2466
2467    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2468        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2469    } else {
2470        let local_var_entity: Option<SetCloudTrialOfferError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2471        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2472        Err(Error::ResponseError(local_var_error))
2473    }
2474}
2475
2476pub async fn set_login_type_for_user(configuration: &configuration::Configuration, user: &str, set_login_type_for_user_request: models::SetLoginTypeForUserRequest) -> Result<String, Error<SetLoginTypeForUserError>> {
2477    let local_var_configuration = configuration;
2478
2479    let local_var_client = &local_var_configuration.client;
2480
2481    let local_var_uri_str = format!("{}/users/set_login_type/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2482    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2483
2484    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2485        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2486    }
2487    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2488        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2489    };
2490    local_var_req_builder = local_var_req_builder.json(&set_login_type_for_user_request);
2491
2492    let local_var_req = local_var_req_builder.build()?;
2493    let local_var_resp = local_var_client.execute(local_var_req).await?;
2494
2495    let local_var_status = local_var_resp.status();
2496    let local_var_content = local_var_resp.text().await?;
2497
2498    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2499        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2500    } else {
2501        let local_var_entity: Option<SetLoginTypeForUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2502        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2503        Err(Error::ResponseError(local_var_error))
2504    }
2505}
2506
2507pub async fn set_onboarding_profile(configuration: &configuration::Configuration, set_onboarding_profile_request: models::SetOnboardingProfileRequest) -> Result<String, Error<SetOnboardingProfileError>> {
2508    let local_var_configuration = configuration;
2509
2510    let local_var_client = &local_var_configuration.client;
2511
2512    let local_var_uri_str = format!("{}/users/onboarding_profile", local_var_configuration.base_path);
2513    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2514
2515    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2516        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2517    }
2518    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2519        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2520    };
2521    local_var_req_builder = local_var_req_builder.json(&set_onboarding_profile_request);
2522
2523    let local_var_req = local_var_req_builder.build()?;
2524    let local_var_resp = local_var_client.execute(local_var_req).await?;
2525
2526    let local_var_status = local_var_resp.status();
2527    let local_var_content = local_var_resp.text().await?;
2528
2529    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2530        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2531    } else {
2532        let local_var_entity: Option<SetOnboardingProfileError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2533        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2534        Err(Error::ResponseError(local_var_error))
2535    }
2536}
2537
2538pub async fn set_password(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordError>> {
2539    let local_var_configuration = configuration;
2540
2541    let local_var_client = &local_var_configuration.client;
2542
2543    let local_var_uri_str = format!("{}/users/setpassword", local_var_configuration.base_path);
2544    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2545
2546    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2547        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2548    }
2549    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2550        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2551    };
2552    local_var_req_builder = local_var_req_builder.json(&set_password_request);
2553
2554    let local_var_req = local_var_req_builder.build()?;
2555    let local_var_resp = local_var_client.execute(local_var_req).await?;
2556
2557    let local_var_status = local_var_resp.status();
2558    let local_var_content = local_var_resp.text().await?;
2559
2560    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2561        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2562    } else {
2563        let local_var_entity: Option<SetPasswordError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2564        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2565        Err(Error::ResponseError(local_var_error))
2566    }
2567}
2568
2569pub async fn set_password_for_user(configuration: &configuration::Configuration, user: &str, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordForUserError>> {
2570    let local_var_configuration = configuration;
2571
2572    let local_var_client = &local_var_configuration.client;
2573
2574    let local_var_uri_str = format!("{}/users/set_password_of/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2575    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2576
2577    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2578        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2579    }
2580    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2581        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2582    };
2583    local_var_req_builder = local_var_req_builder.json(&set_password_request);
2584
2585    let local_var_req = local_var_req_builder.build()?;
2586    let local_var_resp = local_var_client.execute(local_var_req).await?;
2587
2588    let local_var_status = local_var_resp.status();
2589    let local_var_content = local_var_resp.text().await?;
2590
2591    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2592        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2593    } else {
2594        let local_var_entity: Option<SetPasswordForUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2595        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2596        Err(Error::ResponseError(local_var_error))
2597    }
2598}
2599
2600pub async fn setup_totp(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<models::SetupTotp200Response, Error<SetupTotpError>> {
2601    let local_var_configuration = configuration;
2602
2603    let local_var_client = &local_var_configuration.client;
2604
2605    let local_var_uri_str = format!("{}/users/totp/setup", local_var_configuration.base_path);
2606    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2607
2608    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2609        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2610    }
2611    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2612        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2613    };
2614    local_var_req_builder = local_var_req_builder.json(&set_password_request);
2615
2616    let local_var_req = local_var_req_builder.build()?;
2617    let local_var_resp = local_var_client.execute(local_var_req).await?;
2618
2619    let local_var_status = local_var_resp.status();
2620    let local_var_content = local_var_resp.text().await?;
2621
2622    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2623        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2624    } else {
2625        let local_var_entity: Option<SetupTotpError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2626        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2627        Err(Error::ResponseError(local_var_error))
2628    }
2629}
2630
2631pub async fn submit_onboarding_data(configuration: &configuration::Configuration, submit_onboarding_data_request: models::SubmitOnboardingDataRequest) -> Result<String, Error<SubmitOnboardingDataError>> {
2632    let local_var_configuration = configuration;
2633
2634    let local_var_client = &local_var_configuration.client;
2635
2636    let local_var_uri_str = format!("{}/users/onboarding", local_var_configuration.base_path);
2637    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2638
2639    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2640        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2641    }
2642    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2643        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2644    };
2645    local_var_req_builder = local_var_req_builder.json(&submit_onboarding_data_request);
2646
2647    let local_var_req = local_var_req_builder.build()?;
2648    let local_var_resp = local_var_client.execute(local_var_req).await?;
2649
2650    let local_var_status = local_var_resp.status();
2651    let local_var_content = local_var_resp.text().await?;
2652
2653    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2654        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2655    } else {
2656        let local_var_entity: Option<SubmitOnboardingDataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2657        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2658        Err(Error::ResponseError(local_var_error))
2659    }
2660}
2661
2662pub async fn update_token_label(configuration: &configuration::Configuration, token_prefix: &str, update_token_label_request: models::UpdateTokenLabelRequest) -> Result<String, Error<UpdateTokenLabelError>> {
2663    let local_var_configuration = configuration;
2664
2665    let local_var_client = &local_var_configuration.client;
2666
2667    let local_var_uri_str = format!("{}/users/tokens/update_label/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2668    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2669
2670    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2671        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2672    }
2673    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2674        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2675    };
2676    local_var_req_builder = local_var_req_builder.json(&update_token_label_request);
2677
2678    let local_var_req = local_var_req_builder.build()?;
2679    let local_var_resp = local_var_client.execute(local_var_req).await?;
2680
2681    let local_var_status = local_var_resp.status();
2682    let local_var_content = local_var_resp.text().await?;
2683
2684    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2685        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2686    } else {
2687        let local_var_entity: Option<UpdateTokenLabelError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2688        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2689        Err(Error::ResponseError(local_var_error))
2690    }
2691}
2692
2693/// Tightening (an earlier expiration, a narrower IP list) is always allowed on a token you created. Widening is allowed only as far as the calling token could mint a new token with the same rights, and a later expiration is capped by `max_token_expiration_days`. 
2694pub async fn update_token_limits(configuration: &configuration::Configuration, token_prefix: &str, update_token_limits_request: models::UpdateTokenLimitsRequest) -> Result<String, Error<UpdateTokenLimitsError>> {
2695    let local_var_configuration = configuration;
2696
2697    let local_var_client = &local_var_configuration.client;
2698
2699    let local_var_uri_str = format!("{}/users/tokens/update_limits/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2700    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2701
2702    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2703        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2704    }
2705    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2706        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2707    };
2708    local_var_req_builder = local_var_req_builder.json(&update_token_limits_request);
2709
2710    let local_var_req = local_var_req_builder.build()?;
2711    let local_var_resp = local_var_client.execute(local_var_req).await?;
2712
2713    let local_var_status = local_var_resp.status();
2714    let local_var_content = local_var_resp.text().await?;
2715
2716    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2717        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2718    } else {
2719        let local_var_entity: Option<UpdateTokenLimitsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2720        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2721        Err(Error::ResponseError(local_var_error))
2722    }
2723}
2724
2725pub async fn update_token_scopes(configuration: &configuration::Configuration, token_prefix: &str, update_token_scopes_request: models::UpdateTokenScopesRequest) -> Result<String, Error<UpdateTokenScopesError>> {
2726    let local_var_configuration = configuration;
2727
2728    let local_var_client = &local_var_configuration.client;
2729
2730    let local_var_uri_str = format!("{}/users/tokens/update_scopes/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2731    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2732
2733    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2734        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2735    }
2736    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2737        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2738    };
2739    local_var_req_builder = local_var_req_builder.json(&update_token_scopes_request);
2740
2741    let local_var_req = local_var_req_builder.build()?;
2742    let local_var_resp = local_var_client.execute(local_var_req).await?;
2743
2744    let local_var_status = local_var_resp.status();
2745    let local_var_content = local_var_resp.text().await?;
2746
2747    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2748        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2749    } else {
2750        let local_var_entity: Option<UpdateTokenScopesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2751        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2752        Err(Error::ResponseError(local_var_error))
2753    }
2754}
2755
2756pub async fn update_tutorial_progress(configuration: &configuration::Configuration, get_tutorial_progress200_response: models::GetTutorialProgress200Response) -> Result<String, Error<UpdateTutorialProgressError>> {
2757    let local_var_configuration = configuration;
2758
2759    let local_var_client = &local_var_configuration.client;
2760
2761    let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
2762    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2763
2764    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2765        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2766    }
2767    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2768        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2769    };
2770    local_var_req_builder = local_var_req_builder.json(&get_tutorial_progress200_response);
2771
2772    let local_var_req = local_var_req_builder.build()?;
2773    let local_var_resp = local_var_client.execute(local_var_req).await?;
2774
2775    let local_var_status = local_var_resp.status();
2776    let local_var_content = local_var_resp.text().await?;
2777
2778    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2779        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2780    } else {
2781        let local_var_entity: Option<UpdateTutorialProgressError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2782        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2783        Err(Error::ResponseError(local_var_error))
2784    }
2785}
2786
2787pub async fn update_user(configuration: &configuration::Configuration, workspace: &str, username: &str, edit_workspace_user: models::EditWorkspaceUser) -> Result<String, Error<UpdateUserError>> {
2788    let local_var_configuration = configuration;
2789
2790    let local_var_client = &local_var_configuration.client;
2791
2792    let local_var_uri_str = format!("{}/w/{workspace}/users/update/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
2793    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2794
2795    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2796        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2797    }
2798    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2799        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2800    };
2801    local_var_req_builder = local_var_req_builder.json(&edit_workspace_user);
2802
2803    let local_var_req = local_var_req_builder.build()?;
2804    let local_var_resp = local_var_client.execute(local_var_req).await?;
2805
2806    let local_var_status = local_var_resp.status();
2807    let local_var_content = local_var_resp.text().await?;
2808
2809    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2810        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2811    } else {
2812        let local_var_entity: Option<UpdateUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2813        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2814        Err(Error::ResponseError(local_var_error))
2815    }
2816}
2817
2818pub async fn username_to_email(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<UsernameToEmailError>> {
2819    let local_var_configuration = configuration;
2820
2821    let local_var_client = &local_var_configuration.client;
2822
2823    let local_var_uri_str = format!("{}/w/{workspace}/users/username_to_email/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
2824    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2825
2826    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2827        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2828    }
2829    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2830        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2831    };
2832
2833    let local_var_req = local_var_req_builder.build()?;
2834    let local_var_resp = local_var_client.execute(local_var_req).await?;
2835
2836    let local_var_status = local_var_resp.status();
2837    let local_var_content = local_var_resp.text().await?;
2838
2839    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2840        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2841    } else {
2842        let local_var_entity: Option<UsernameToEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2843        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2844        Err(Error::ResponseError(local_var_error))
2845    }
2846}
2847
2848pub async fn whoami(configuration: &configuration::Configuration, workspace: &str) -> Result<models::User, Error<WhoamiError>> {
2849    let local_var_configuration = configuration;
2850
2851    let local_var_client = &local_var_configuration.client;
2852
2853    let local_var_uri_str = format!("{}/w/{workspace}/users/whoami", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2854    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2855
2856    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2857        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2858    }
2859    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2860        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2861    };
2862
2863    let local_var_req = local_var_req_builder.build()?;
2864    let local_var_resp = local_var_client.execute(local_var_req).await?;
2865
2866    let local_var_status = local_var_resp.status();
2867    let local_var_content = local_var_resp.text().await?;
2868
2869    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2870        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2871    } else {
2872        let local_var_entity: Option<WhoamiError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2873        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2874        Err(Error::ResponseError(local_var_error))
2875    }
2876}
2877
2878pub async fn whois(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<WhoisError>> {
2879    let local_var_configuration = configuration;
2880
2881    let local_var_client = &local_var_configuration.client;
2882
2883    let local_var_uri_str = format!("{}/w/{workspace}/users/whois/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
2884    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2885
2886    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2887        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2888    }
2889    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2890        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2891    };
2892
2893    let local_var_req = local_var_req_builder.build()?;
2894    let local_var_resp = local_var_client.execute(local_var_req).await?;
2895
2896    let local_var_status = local_var_resp.status();
2897    let local_var_content = local_var_resp.text().await?;
2898
2899    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2900        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2901    } else {
2902        let local_var_entity: Option<WhoisError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2903        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2904        Err(Error::ResponseError(local_var_error))
2905    }
2906}
2907