Skip to main content

orvanta_api/apis/
user_api.rs

1/*
2 * Orvanta 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.6.0
7 * Contact: contact@orvanta.cloud
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 [`convert_user_to_group`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ConvertUserToGroupError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`create_token`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateTokenError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`create_token_impersonate`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateTokenImpersonateError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`create_user_globally`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateUserGloballyError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`decline_invite`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeclineInviteError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`delete_token`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteTokenError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`delete_user`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteUserError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`exists_email`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ExistsEmailError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`exit_impersonation`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ExitImpersonationError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_current_email`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetCurrentEmailError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_runnable`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetRunnableError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_tutorial_progress`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetTutorialProgressError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_usage`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetUsageError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_user`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetUserError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_user_seats`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetUserSeatsError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`global_offboard_preview`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GlobalOffboardPreviewError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`global_user_delete`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GlobalUserDeleteError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`global_user_rename`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GlobalUserRenameError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`global_user_update`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GlobalUserUpdateError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`global_username_info`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GlobalUsernameInfoError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`global_users_export`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum GlobalUsersExportError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`global_users_overwrite`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum GlobalUsersOverwriteError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`global_whoami`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum GlobalWhoamiError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`impersonate_service_account`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ImpersonateServiceAccountError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`is_owner_of_path`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum IsOwnerOfPathError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`is_password_login_disabled`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum IsPasswordLoginDisabledError {
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`is_smtp_configured`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum IsSmtpConfiguredError {
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`leave_instance`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum LeaveInstanceError {
218    UnknownValue(serde_json::Value),
219}
220
221/// struct for typed errors of method [`list_ext_jwt_tokens`]
222#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum ListExtJwtTokensError {
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`list_tokens`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ListTokensError {
232    UnknownValue(serde_json::Value),
233}
234
235/// struct for typed errors of method [`list_usernames`]
236#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum ListUsernamesError {
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`list_users`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum ListUsersError {
246    UnknownValue(serde_json::Value),
247}
248
249/// struct for typed errors of method [`list_users_as_super_admin`]
250#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum ListUsersAsSuperAdminError {
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`list_users_usage`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ListUsersUsageError {
260    UnknownValue(serde_json::Value),
261}
262
263/// struct for typed errors of method [`list_workspace_invites`]
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum ListWorkspaceInvitesError {
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`login`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum LoginError {
274    UnknownValue(serde_json::Value),
275}
276
277/// struct for typed errors of method [`login_with_oauth`]
278#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum LoginWithOauthError {
281    UnknownValue(serde_json::Value),
282}
283
284/// struct for typed errors of method [`logout`]
285#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum LogoutError {
288    UnknownValue(serde_json::Value),
289}
290
291/// struct for typed errors of method [`offboard_global_user`]
292#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum OffboardGlobalUserError {
295    UnknownValue(serde_json::Value),
296}
297
298/// struct for typed errors of method [`offboard_preview`]
299#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum OffboardPreviewError {
302    UnknownValue(serde_json::Value),
303}
304
305/// struct for typed errors of method [`offboard_workspace_user`]
306#[derive(Debug, Clone, Serialize, Deserialize)]
307#[serde(untagged)]
308pub enum OffboardWorkspaceUserError {
309    UnknownValue(serde_json::Value),
310}
311
312/// struct for typed errors of method [`refresh_user_token`]
313#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum RefreshUserTokenError {
316    UnknownValue(serde_json::Value),
317}
318
319/// struct for typed errors of method [`request_password_reset`]
320#[derive(Debug, Clone, Serialize, Deserialize)]
321#[serde(untagged)]
322pub enum RequestPasswordResetError {
323    Status400(),
324    UnknownValue(serde_json::Value),
325}
326
327/// struct for typed errors of method [`reset_password`]
328#[derive(Debug, Clone, Serialize, Deserialize)]
329#[serde(untagged)]
330pub enum ResetPasswordError {
331    Status400(),
332    UnknownValue(serde_json::Value),
333}
334
335/// struct for typed errors of method [`set_login_type_for_user`]
336#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum SetLoginTypeForUserError {
339    UnknownValue(serde_json::Value),
340}
341
342/// struct for typed errors of method [`set_password`]
343#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum SetPasswordError {
346    UnknownValue(serde_json::Value),
347}
348
349/// struct for typed errors of method [`set_password_for_user`]
350#[derive(Debug, Clone, Serialize, Deserialize)]
351#[serde(untagged)]
352pub enum SetPasswordForUserError {
353    UnknownValue(serde_json::Value),
354}
355
356/// struct for typed errors of method [`submit_onboarding_data`]
357#[derive(Debug, Clone, Serialize, Deserialize)]
358#[serde(untagged)]
359pub enum SubmitOnboardingDataError {
360    UnknownValue(serde_json::Value),
361}
362
363/// struct for typed errors of method [`update_token_scopes`]
364#[derive(Debug, Clone, Serialize, Deserialize)]
365#[serde(untagged)]
366pub enum UpdateTokenScopesError {
367    UnknownValue(serde_json::Value),
368}
369
370/// struct for typed errors of method [`update_tutorial_progress`]
371#[derive(Debug, Clone, Serialize, Deserialize)]
372#[serde(untagged)]
373pub enum UpdateTutorialProgressError {
374    UnknownValue(serde_json::Value),
375}
376
377/// struct for typed errors of method [`update_user`]
378#[derive(Debug, Clone, Serialize, Deserialize)]
379#[serde(untagged)]
380pub enum UpdateUserError {
381    UnknownValue(serde_json::Value),
382}
383
384/// struct for typed errors of method [`username_to_email`]
385#[derive(Debug, Clone, Serialize, Deserialize)]
386#[serde(untagged)]
387pub enum UsernameToEmailError {
388    UnknownValue(serde_json::Value),
389}
390
391/// struct for typed errors of method [`whoami`]
392#[derive(Debug, Clone, Serialize, Deserialize)]
393#[serde(untagged)]
394pub enum WhoamiError {
395    UnknownValue(serde_json::Value),
396}
397
398/// struct for typed errors of method [`whois`]
399#[derive(Debug, Clone, Serialize, Deserialize)]
400#[serde(untagged)]
401pub enum WhoisError {
402    UnknownValue(serde_json::Value),
403}
404
405
406pub async fn accept_invite(configuration: &configuration::Configuration, accept_invite_request: models::AcceptInviteRequest) -> Result<String, Error<AcceptInviteError>> {
407    let local_var_configuration = configuration;
408
409    let local_var_client = &local_var_configuration.client;
410
411    let local_var_uri_str = format!("{}/users/accept_invite", local_var_configuration.base_path);
412    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
413
414    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
415        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
416    }
417    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
418        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
419    };
420    local_var_req_builder = local_var_req_builder.json(&accept_invite_request);
421
422    let local_var_req = local_var_req_builder.build()?;
423    let local_var_resp = local_var_client.execute(local_var_req).await?;
424
425    let local_var_status = local_var_resp.status();
426    let local_var_content = local_var_resp.text().await?;
427
428    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
429        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
430    } else {
431        let local_var_entity: Option<AcceptInviteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
432        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
433        Err(Error::ResponseError(local_var_error))
434    }
435}
436
437pub async fn convert_user_to_group(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<ConvertUserToGroupError>> {
438    let local_var_configuration = configuration;
439
440    let local_var_client = &local_var_configuration.client;
441
442    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));
443    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
444
445    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
446        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
447    }
448    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
449        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
450    };
451
452    let local_var_req = local_var_req_builder.build()?;
453    let local_var_resp = local_var_client.execute(local_var_req).await?;
454
455    let local_var_status = local_var_resp.status();
456    let local_var_content = local_var_resp.text().await?;
457
458    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
459        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
460    } else {
461        let local_var_entity: Option<ConvertUserToGroupError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
462        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
463        Err(Error::ResponseError(local_var_error))
464    }
465}
466
467pub async fn create_token(configuration: &configuration::Configuration, new_token: models::NewToken) -> Result<String, Error<CreateTokenError>> {
468    let local_var_configuration = configuration;
469
470    let local_var_client = &local_var_configuration.client;
471
472    let local_var_uri_str = format!("{}/users/tokens/create", local_var_configuration.base_path);
473    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
474
475    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
476        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
477    }
478    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
479        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
480    };
481    local_var_req_builder = local_var_req_builder.json(&new_token);
482
483    let local_var_req = local_var_req_builder.build()?;
484    let local_var_resp = local_var_client.execute(local_var_req).await?;
485
486    let local_var_status = local_var_resp.status();
487    let local_var_content = local_var_resp.text().await?;
488
489    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
490        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
491    } else {
492        let local_var_entity: Option<CreateTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
493        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
494        Err(Error::ResponseError(local_var_error))
495    }
496}
497
498pub async fn create_token_impersonate(configuration: &configuration::Configuration, new_token_impersonate: models::NewTokenImpersonate) -> Result<String, Error<CreateTokenImpersonateError>> {
499    let local_var_configuration = configuration;
500
501    let local_var_client = &local_var_configuration.client;
502
503    let local_var_uri_str = format!("{}/users/tokens/impersonate", local_var_configuration.base_path);
504    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
505
506    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
507        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
508    }
509    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
510        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
511    };
512    local_var_req_builder = local_var_req_builder.json(&new_token_impersonate);
513
514    let local_var_req = local_var_req_builder.build()?;
515    let local_var_resp = local_var_client.execute(local_var_req).await?;
516
517    let local_var_status = local_var_resp.status();
518    let local_var_content = local_var_resp.text().await?;
519
520    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
521        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
522    } else {
523        let local_var_entity: Option<CreateTokenImpersonateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
524        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
525        Err(Error::ResponseError(local_var_error))
526    }
527}
528
529pub async fn create_user_globally(configuration: &configuration::Configuration, create_user_globally_request: models::CreateUserGloballyRequest) -> Result<String, Error<CreateUserGloballyError>> {
530    let local_var_configuration = configuration;
531
532    let local_var_client = &local_var_configuration.client;
533
534    let local_var_uri_str = format!("{}/users/create", local_var_configuration.base_path);
535    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
536
537    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
538        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
539    }
540    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
541        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
542    };
543    local_var_req_builder = local_var_req_builder.json(&create_user_globally_request);
544
545    let local_var_req = local_var_req_builder.build()?;
546    let local_var_resp = local_var_client.execute(local_var_req).await?;
547
548    let local_var_status = local_var_resp.status();
549    let local_var_content = local_var_resp.text().await?;
550
551    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
552        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
553    } else {
554        let local_var_entity: Option<CreateUserGloballyError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
555        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560pub async fn decline_invite(configuration: &configuration::Configuration, decline_invite_request: models::DeclineInviteRequest) -> Result<String, Error<DeclineInviteError>> {
561    let local_var_configuration = configuration;
562
563    let local_var_client = &local_var_configuration.client;
564
565    let local_var_uri_str = format!("{}/users/decline_invite", local_var_configuration.base_path);
566    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
567
568    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
569        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
570    }
571    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
572        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
573    };
574    local_var_req_builder = local_var_req_builder.json(&decline_invite_request);
575
576    let local_var_req = local_var_req_builder.build()?;
577    let local_var_resp = local_var_client.execute(local_var_req).await?;
578
579    let local_var_status = local_var_resp.status();
580    let local_var_content = local_var_resp.text().await?;
581
582    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
583        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
584    } else {
585        let local_var_entity: Option<DeclineInviteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
586        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
587        Err(Error::ResponseError(local_var_error))
588    }
589}
590
591pub async fn delete_token(configuration: &configuration::Configuration, token_prefix: &str) -> Result<String, Error<DeleteTokenError>> {
592    let local_var_configuration = configuration;
593
594    let local_var_client = &local_var_configuration.client;
595
596    let local_var_uri_str = format!("{}/users/tokens/delete/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
597    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
598
599    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
600        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
601    }
602    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
603        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
604    };
605
606    let local_var_req = local_var_req_builder.build()?;
607    let local_var_resp = local_var_client.execute(local_var_req).await?;
608
609    let local_var_status = local_var_resp.status();
610    let local_var_content = local_var_resp.text().await?;
611
612    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
613        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
614    } else {
615        let local_var_entity: Option<DeleteTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
616        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
617        Err(Error::ResponseError(local_var_error))
618    }
619}
620
621pub async fn delete_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<DeleteUserError>> {
622    let local_var_configuration = configuration;
623
624    let local_var_client = &local_var_configuration.client;
625
626    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));
627    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
628
629    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
630        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
631    }
632    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
633        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
634    };
635
636    let local_var_req = local_var_req_builder.build()?;
637    let local_var_resp = local_var_client.execute(local_var_req).await?;
638
639    let local_var_status = local_var_resp.status();
640    let local_var_content = local_var_resp.text().await?;
641
642    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
643        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
644    } else {
645        let local_var_entity: Option<DeleteUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
646        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
647        Err(Error::ResponseError(local_var_error))
648    }
649}
650
651pub async fn exists_email(configuration: &configuration::Configuration, email: &str) -> Result<bool, Error<ExistsEmailError>> {
652    let local_var_configuration = configuration;
653
654    let local_var_client = &local_var_configuration.client;
655
656    let local_var_uri_str = format!("{}/users/exists/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
657    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
658
659    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
660        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
661    }
662    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
663        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
664    };
665
666    let local_var_req = local_var_req_builder.build()?;
667    let local_var_resp = local_var_client.execute(local_var_req).await?;
668
669    let local_var_status = local_var_resp.status();
670    let local_var_content = local_var_resp.text().await?;
671
672    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
673        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
674    } else {
675        let local_var_entity: Option<ExistsEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
676        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
677        Err(Error::ResponseError(local_var_error))
678    }
679}
680
681pub async fn exit_impersonation(configuration: &configuration::Configuration, workspace: &str, get_github_app_token200_response: models::GetGithubAppToken200Response) -> Result<String, Error<ExitImpersonationError>> {
682    let local_var_configuration = configuration;
683
684    let local_var_client = &local_var_configuration.client;
685
686    let local_var_uri_str = format!("{}/w/{workspace}/users/exit_impersonation", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
687    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
688
689    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
690        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
691    }
692    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
693        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
694    };
695    local_var_req_builder = local_var_req_builder.json(&get_github_app_token200_response);
696
697    let local_var_req = local_var_req_builder.build()?;
698    let local_var_resp = local_var_client.execute(local_var_req).await?;
699
700    let local_var_status = local_var_resp.status();
701    let local_var_content = local_var_resp.text().await?;
702
703    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
704        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
705    } else {
706        let local_var_entity: Option<ExitImpersonationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
707        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
708        Err(Error::ResponseError(local_var_error))
709    }
710}
711
712pub async fn get_current_email(configuration: &configuration::Configuration, ) -> Result<String, Error<GetCurrentEmailError>> {
713    let local_var_configuration = configuration;
714
715    let local_var_client = &local_var_configuration.client;
716
717    let local_var_uri_str = format!("{}/users/email", local_var_configuration.base_path);
718    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
719
720    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
721        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
722    }
723    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
724        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
725    };
726
727    let local_var_req = local_var_req_builder.build()?;
728    let local_var_resp = local_var_client.execute(local_var_req).await?;
729
730    let local_var_status = local_var_resp.status();
731    let local_var_content = local_var_resp.text().await?;
732
733    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
734        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
735    } else {
736        let local_var_entity: Option<GetCurrentEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
737        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
738        Err(Error::ResponseError(local_var_error))
739    }
740}
741
742pub async fn get_runnable(configuration: &configuration::Configuration, ) -> Result<models::GetRunnable200Response, Error<GetRunnableError>> {
743    let local_var_configuration = configuration;
744
745    let local_var_client = &local_var_configuration.client;
746
747    let local_var_uri_str = format!("{}/users/all_runnables", local_var_configuration.base_path);
748    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
749
750    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
751        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
752    }
753    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
754        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
755    };
756
757    let local_var_req = local_var_req_builder.build()?;
758    let local_var_resp = local_var_client.execute(local_var_req).await?;
759
760    let local_var_status = local_var_resp.status();
761    let local_var_content = local_var_resp.text().await?;
762
763    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
764        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
765    } else {
766        let local_var_entity: Option<GetRunnableError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
767        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
768        Err(Error::ResponseError(local_var_error))
769    }
770}
771
772pub async fn get_tutorial_progress(configuration: &configuration::Configuration, ) -> Result<models::GetTutorialProgress200Response, Error<GetTutorialProgressError>> {
773    let local_var_configuration = configuration;
774
775    let local_var_client = &local_var_configuration.client;
776
777    let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
778    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
779
780    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
781        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
782    }
783    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
784        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
785    };
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<GetTutorialProgressError> = 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 get_usage(configuration: &configuration::Configuration, ) -> Result<f64, Error<GetUsageError>> {
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/usage", local_var_configuration.base_path);
808    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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<GetUsageError> = 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 get_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<GetUserError>> {
833    let local_var_configuration = configuration;
834
835    let local_var_client = &local_var_configuration.client;
836
837    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));
838    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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<GetUserError> = 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 get_user_seats(configuration: &configuration::Configuration, ) -> Result<models::GetUserSeats200Response, Error<GetUserSeatsError>> {
863    let local_var_configuration = configuration;
864
865    let local_var_client = &local_var_configuration.client;
866
867    let local_var_uri_str = format!("{}/users/seats", local_var_configuration.base_path);
868    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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<GetUserSeatsError> = 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 global_offboard_preview(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalOffboardPreview, Error<GlobalOffboardPreviewError>> {
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/offboard_preview/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
898    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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
907    let local_var_req = local_var_req_builder.build()?;
908    let local_var_resp = local_var_client.execute(local_var_req).await?;
909
910    let local_var_status = local_var_resp.status();
911    let local_var_content = local_var_resp.text().await?;
912
913    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
914        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
915    } else {
916        let local_var_entity: Option<GlobalOffboardPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
917        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
918        Err(Error::ResponseError(local_var_error))
919    }
920}
921
922pub async fn global_user_delete(configuration: &configuration::Configuration, email: &str) -> Result<String, Error<GlobalUserDeleteError>> {
923    let local_var_configuration = configuration;
924
925    let local_var_client = &local_var_configuration.client;
926
927    let local_var_uri_str = format!("{}/users/delete/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
928    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
929
930    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
931        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
932    }
933    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
934        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
935    };
936
937    let local_var_req = local_var_req_builder.build()?;
938    let local_var_resp = local_var_client.execute(local_var_req).await?;
939
940    let local_var_status = local_var_resp.status();
941    let local_var_content = local_var_resp.text().await?;
942
943    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
944        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
945    } else {
946        let local_var_entity: Option<GlobalUserDeleteError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
947        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
948        Err(Error::ResponseError(local_var_error))
949    }
950}
951
952pub async fn global_user_rename(configuration: &configuration::Configuration, email: &str, global_user_rename_request: models::GlobalUserRenameRequest) -> Result<String, Error<GlobalUserRenameError>> {
953    let local_var_configuration = configuration;
954
955    let local_var_client = &local_var_configuration.client;
956
957    let local_var_uri_str = format!("{}/users/rename/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
958    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
959
960    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
961        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
962    }
963    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
964        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
965    };
966    local_var_req_builder = local_var_req_builder.json(&global_user_rename_request);
967
968    let local_var_req = local_var_req_builder.build()?;
969    let local_var_resp = local_var_client.execute(local_var_req).await?;
970
971    let local_var_status = local_var_resp.status();
972    let local_var_content = local_var_resp.text().await?;
973
974    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
975        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
976    } else {
977        let local_var_entity: Option<GlobalUserRenameError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
978        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
979        Err(Error::ResponseError(local_var_error))
980    }
981}
982
983pub async fn global_user_update(configuration: &configuration::Configuration, email: &str, global_user_update_request: models::GlobalUserUpdateRequest) -> Result<String, Error<GlobalUserUpdateError>> {
984    let local_var_configuration = configuration;
985
986    let local_var_client = &local_var_configuration.client;
987
988    let local_var_uri_str = format!("{}/users/update/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
989    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
990
991    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
992        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
993    }
994    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
995        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
996    };
997    local_var_req_builder = local_var_req_builder.json(&global_user_update_request);
998
999    let local_var_req = local_var_req_builder.build()?;
1000    let local_var_resp = local_var_client.execute(local_var_req).await?;
1001
1002    let local_var_status = local_var_resp.status();
1003    let local_var_content = local_var_resp.text().await?;
1004
1005    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1006        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1007    } else {
1008        let local_var_entity: Option<GlobalUserUpdateError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1009        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1010        Err(Error::ResponseError(local_var_error))
1011    }
1012}
1013
1014pub async fn global_username_info(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalUsernameInfo200Response, Error<GlobalUsernameInfoError>> {
1015    let local_var_configuration = configuration;
1016
1017    let local_var_client = &local_var_configuration.client;
1018
1019    let local_var_uri_str = format!("{}/users/username_info/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1020    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1021
1022    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1023        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1024    }
1025    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1026        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1027    };
1028
1029    let local_var_req = local_var_req_builder.build()?;
1030    let local_var_resp = local_var_client.execute(local_var_req).await?;
1031
1032    let local_var_status = local_var_resp.status();
1033    let local_var_content = local_var_resp.text().await?;
1034
1035    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1036        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1037    } else {
1038        let local_var_entity: Option<GlobalUsernameInfoError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1039        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1040        Err(Error::ResponseError(local_var_error))
1041    }
1042}
1043
1044pub async fn global_users_export(configuration: &configuration::Configuration, ) -> Result<Vec<models::ExportedUser>, Error<GlobalUsersExportError>> {
1045    let local_var_configuration = configuration;
1046
1047    let local_var_client = &local_var_configuration.client;
1048
1049    let local_var_uri_str = format!("{}/users/export", local_var_configuration.base_path);
1050    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1051
1052    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1053        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1054    }
1055    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1056        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1057    };
1058
1059    let local_var_req = local_var_req_builder.build()?;
1060    let local_var_resp = local_var_client.execute(local_var_req).await?;
1061
1062    let local_var_status = local_var_resp.status();
1063    let local_var_content = local_var_resp.text().await?;
1064
1065    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1066        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1067    } else {
1068        let local_var_entity: Option<GlobalUsersExportError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1069        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1070        Err(Error::ResponseError(local_var_error))
1071    }
1072}
1073
1074pub async fn global_users_overwrite(configuration: &configuration::Configuration, exported_user: Vec<models::ExportedUser>) -> Result<String, Error<GlobalUsersOverwriteError>> {
1075    let local_var_configuration = configuration;
1076
1077    let local_var_client = &local_var_configuration.client;
1078
1079    let local_var_uri_str = format!("{}/users/overwrite", local_var_configuration.base_path);
1080    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1081
1082    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1083        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1084    }
1085    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1086        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1087    };
1088    local_var_req_builder = local_var_req_builder.json(&exported_user);
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<GlobalUsersOverwriteError> = 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 global_whoami(configuration: &configuration::Configuration, ) -> Result<models::GlobalUserInfo, Error<GlobalWhoamiError>> {
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/whoami", 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<GlobalWhoamiError> = 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 impersonate_service_account(configuration: &configuration::Configuration, workspace: &str, create_service_account_request: models::CreateServiceAccountRequest) -> Result<String, Error<ImpersonateServiceAccountError>> {
1136    let local_var_configuration = configuration;
1137
1138    let local_var_client = &local_var_configuration.client;
1139
1140    let local_var_uri_str = format!("{}/w/{workspace}/users/impersonate_service_account", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1141    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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    local_var_req_builder = local_var_req_builder.json(&create_service_account_request);
1150
1151    let local_var_req = local_var_req_builder.build()?;
1152    let local_var_resp = local_var_client.execute(local_var_req).await?;
1153
1154    let local_var_status = local_var_resp.status();
1155    let local_var_content = local_var_resp.text().await?;
1156
1157    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1158        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1159    } else {
1160        let local_var_entity: Option<ImpersonateServiceAccountError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1161        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1162        Err(Error::ResponseError(local_var_error))
1163    }
1164}
1165
1166pub async fn is_owner_of_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<IsOwnerOfPathError>> {
1167    let local_var_configuration = configuration;
1168
1169    let local_var_client = &local_var_configuration.client;
1170
1171    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));
1172    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1173
1174    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1175        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1176    }
1177    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1178        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1179    };
1180
1181    let local_var_req = local_var_req_builder.build()?;
1182    let local_var_resp = local_var_client.execute(local_var_req).await?;
1183
1184    let local_var_status = local_var_resp.status();
1185    let local_var_content = local_var_resp.text().await?;
1186
1187    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1188        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1189    } else {
1190        let local_var_entity: Option<IsOwnerOfPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1191        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1192        Err(Error::ResponseError(local_var_error))
1193    }
1194}
1195
1196pub async fn is_password_login_disabled(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsPasswordLoginDisabledError>> {
1197    let local_var_configuration = configuration;
1198
1199    let local_var_client = &local_var_configuration.client;
1200
1201    let local_var_uri_str = format!("{}/auth/is_password_login_disabled", local_var_configuration.base_path);
1202    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1203
1204    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1205        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1206    }
1207
1208    let local_var_req = local_var_req_builder.build()?;
1209    let local_var_resp = local_var_client.execute(local_var_req).await?;
1210
1211    let local_var_status = local_var_resp.status();
1212    let local_var_content = local_var_resp.text().await?;
1213
1214    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1215        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1216    } else {
1217        let local_var_entity: Option<IsPasswordLoginDisabledError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1218        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1219        Err(Error::ResponseError(local_var_error))
1220    }
1221}
1222
1223pub async fn is_smtp_configured(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsSmtpConfiguredError>> {
1224    let local_var_configuration = configuration;
1225
1226    let local_var_client = &local_var_configuration.client;
1227
1228    let local_var_uri_str = format!("{}/auth/is_smtp_configured", local_var_configuration.base_path);
1229    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1230
1231    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1232        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1233    }
1234
1235    let local_var_req = local_var_req_builder.build()?;
1236    let local_var_resp = local_var_client.execute(local_var_req).await?;
1237
1238    let local_var_status = local_var_resp.status();
1239    let local_var_content = local_var_resp.text().await?;
1240
1241    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1242        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1243    } else {
1244        let local_var_entity: Option<IsSmtpConfiguredError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1245        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1246        Err(Error::ResponseError(local_var_error))
1247    }
1248}
1249
1250pub async fn leave_instance(configuration: &configuration::Configuration, ) -> Result<String, Error<LeaveInstanceError>> {
1251    let local_var_configuration = configuration;
1252
1253    let local_var_client = &local_var_configuration.client;
1254
1255    let local_var_uri_str = format!("{}/users/leave_instance", local_var_configuration.base_path);
1256    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1257
1258    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1259        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1260    }
1261    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1262        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1263    };
1264
1265    let local_var_req = local_var_req_builder.build()?;
1266    let local_var_resp = local_var_client.execute(local_var_req).await?;
1267
1268    let local_var_status = local_var_resp.status();
1269    let local_var_content = local_var_resp.text().await?;
1270
1271    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1272        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1273    } else {
1274        let local_var_entity: Option<LeaveInstanceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1275        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1276        Err(Error::ResponseError(local_var_error))
1277    }
1278}
1279
1280pub 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>> {
1281    let local_var_configuration = configuration;
1282
1283    let local_var_client = &local_var_configuration.client;
1284
1285    let local_var_uri_str = format!("{}/users/ext_jwt_tokens", local_var_configuration.base_path);
1286    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1287
1288    if let Some(ref local_var_str) = page {
1289        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1290    }
1291    if let Some(ref local_var_str) = per_page {
1292        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1293    }
1294    if let Some(ref local_var_str) = active_only {
1295        local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
1296    }
1297    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1298        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1299    }
1300    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1301        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1302    };
1303
1304    let local_var_req = local_var_req_builder.build()?;
1305    let local_var_resp = local_var_client.execute(local_var_req).await?;
1306
1307    let local_var_status = local_var_resp.status();
1308    let local_var_content = local_var_resp.text().await?;
1309
1310    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1311        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1312    } else {
1313        let local_var_entity: Option<ListExtJwtTokensError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1314        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1315        Err(Error::ResponseError(local_var_error))
1316    }
1317}
1318
1319pub async fn list_tokens(configuration: &configuration::Configuration, exclude_ephemeral: Option<bool>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::TruncatedToken>, Error<ListTokensError>> {
1320    let local_var_configuration = configuration;
1321
1322    let local_var_client = &local_var_configuration.client;
1323
1324    let local_var_uri_str = format!("{}/users/tokens/list", local_var_configuration.base_path);
1325    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1326
1327    if let Some(ref local_var_str) = exclude_ephemeral {
1328        local_var_req_builder = local_var_req_builder.query(&[("exclude_ephemeral", &local_var_str.to_string())]);
1329    }
1330    if let Some(ref local_var_str) = page {
1331        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1332    }
1333    if let Some(ref local_var_str) = per_page {
1334        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1335    }
1336    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1337        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1338    }
1339    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1340        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1341    };
1342
1343    let local_var_req = local_var_req_builder.build()?;
1344    let local_var_resp = local_var_client.execute(local_var_req).await?;
1345
1346    let local_var_status = local_var_resp.status();
1347    let local_var_content = local_var_resp.text().await?;
1348
1349    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1350        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1351    } else {
1352        let local_var_entity: Option<ListTokensError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1353        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1354        Err(Error::ResponseError(local_var_error))
1355    }
1356}
1357
1358pub async fn list_usernames(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListUsernamesError>> {
1359    let local_var_configuration = configuration;
1360
1361    let local_var_client = &local_var_configuration.client;
1362
1363    let local_var_uri_str = format!("{}/w/{workspace}/users/list_usernames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1364    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1365
1366    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1367        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1368    }
1369    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1370        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1371    };
1372
1373    let local_var_req = local_var_req_builder.build()?;
1374    let local_var_resp = local_var_client.execute(local_var_req).await?;
1375
1376    let local_var_status = local_var_resp.status();
1377    let local_var_content = local_var_resp.text().await?;
1378
1379    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1380        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1381    } else {
1382        let local_var_entity: Option<ListUsernamesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1383        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1384        Err(Error::ResponseError(local_var_error))
1385    }
1386}
1387
1388pub async fn list_users(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::User>, Error<ListUsersError>> {
1389    let local_var_configuration = configuration;
1390
1391    let local_var_client = &local_var_configuration.client;
1392
1393    let local_var_uri_str = format!("{}/w/{workspace}/users/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1394    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1395
1396    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1397        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1398    }
1399    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1400        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1401    };
1402
1403    let local_var_req = local_var_req_builder.build()?;
1404    let local_var_resp = local_var_client.execute(local_var_req).await?;
1405
1406    let local_var_status = local_var_resp.status();
1407    let local_var_content = local_var_resp.text().await?;
1408
1409    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1410        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1411    } else {
1412        let local_var_entity: Option<ListUsersError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1413        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1414        Err(Error::ResponseError(local_var_error))
1415    }
1416}
1417
1418pub 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>> {
1419    let local_var_configuration = configuration;
1420
1421    let local_var_client = &local_var_configuration.client;
1422
1423    let local_var_uri_str = format!("{}/users/list_as_super_admin", local_var_configuration.base_path);
1424    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1425
1426    if let Some(ref local_var_str) = page {
1427        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1428    }
1429    if let Some(ref local_var_str) = per_page {
1430        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1431    }
1432    if let Some(ref local_var_str) = active_only {
1433        local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
1434    }
1435    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1436        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1437    }
1438    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1439        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1440    };
1441
1442    let local_var_req = local_var_req_builder.build()?;
1443    let local_var_resp = local_var_client.execute(local_var_req).await?;
1444
1445    let local_var_status = local_var_resp.status();
1446    let local_var_content = local_var_resp.text().await?;
1447
1448    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1449        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1450    } else {
1451        let local_var_entity: Option<ListUsersAsSuperAdminError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1452        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1453        Err(Error::ResponseError(local_var_error))
1454    }
1455}
1456
1457pub async fn list_users_usage(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::UserUsage>, Error<ListUsersUsageError>> {
1458    let local_var_configuration = configuration;
1459
1460    let local_var_client = &local_var_configuration.client;
1461
1462    let local_var_uri_str = format!("{}/w/{workspace}/users/list_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1463    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1464
1465    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1466        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1467    }
1468    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1469        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1470    };
1471
1472    let local_var_req = local_var_req_builder.build()?;
1473    let local_var_resp = local_var_client.execute(local_var_req).await?;
1474
1475    let local_var_status = local_var_resp.status();
1476    let local_var_content = local_var_resp.text().await?;
1477
1478    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1479        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1480    } else {
1481        let local_var_entity: Option<ListUsersUsageError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1482        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1483        Err(Error::ResponseError(local_var_error))
1484    }
1485}
1486
1487pub async fn list_workspace_invites(configuration: &configuration::Configuration, ) -> Result<Vec<models::WorkspaceInvite>, Error<ListWorkspaceInvitesError>> {
1488    let local_var_configuration = configuration;
1489
1490    let local_var_client = &local_var_configuration.client;
1491
1492    let local_var_uri_str = format!("{}/users/list_invites", local_var_configuration.base_path);
1493    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1494
1495    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1496        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1497    }
1498    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1499        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1500    };
1501
1502    let local_var_req = local_var_req_builder.build()?;
1503    let local_var_resp = local_var_client.execute(local_var_req).await?;
1504
1505    let local_var_status = local_var_resp.status();
1506    let local_var_content = local_var_resp.text().await?;
1507
1508    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1509        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1510    } else {
1511        let local_var_entity: Option<ListWorkspaceInvitesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1512        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1513        Err(Error::ResponseError(local_var_error))
1514    }
1515}
1516
1517pub async fn login(configuration: &configuration::Configuration, login: models::Login) -> Result<String, Error<LoginError>> {
1518    let local_var_configuration = configuration;
1519
1520    let local_var_client = &local_var_configuration.client;
1521
1522    let local_var_uri_str = format!("{}/auth/login", local_var_configuration.base_path);
1523    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1524
1525    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1526        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1527    }
1528    local_var_req_builder = local_var_req_builder.json(&login);
1529
1530    let local_var_req = local_var_req_builder.build()?;
1531    let local_var_resp = local_var_client.execute(local_var_req).await?;
1532
1533    let local_var_status = local_var_resp.status();
1534    let local_var_content = local_var_resp.text().await?;
1535
1536    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1537        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1538    } else {
1539        let local_var_entity: Option<LoginError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1540        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1541        Err(Error::ResponseError(local_var_error))
1542    }
1543}
1544
1545pub async fn login_with_oauth(configuration: &configuration::Configuration, client_name: &str, login_with_oauth_request: models::LoginWithOauthRequest) -> Result<String, Error<LoginWithOauthError>> {
1546    let local_var_configuration = configuration;
1547
1548    let local_var_client = &local_var_configuration.client;
1549
1550    let local_var_uri_str = format!("{}/oauth/login_callback/{client_name}", local_var_configuration.base_path, client_name=crate::apis::urlencode(client_name));
1551    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1552
1553    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1554        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1555    }
1556    local_var_req_builder = local_var_req_builder.json(&login_with_oauth_request);
1557
1558    let local_var_req = local_var_req_builder.build()?;
1559    let local_var_resp = local_var_client.execute(local_var_req).await?;
1560
1561    let local_var_status = local_var_resp.status();
1562    let local_var_content = local_var_resp.text().await?;
1563
1564    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1565        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1566    } else {
1567        let local_var_entity: Option<LoginWithOauthError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1568        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1569        Err(Error::ResponseError(local_var_error))
1570    }
1571}
1572
1573pub async fn logout(configuration: &configuration::Configuration, ) -> Result<String, Error<LogoutError>> {
1574    let local_var_configuration = configuration;
1575
1576    let local_var_client = &local_var_configuration.client;
1577
1578    let local_var_uri_str = format!("{}/auth/logout", local_var_configuration.base_path);
1579    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1580
1581    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1582        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1583    }
1584
1585    let local_var_req = local_var_req_builder.build()?;
1586    let local_var_resp = local_var_client.execute(local_var_req).await?;
1587
1588    let local_var_status = local_var_resp.status();
1589    let local_var_content = local_var_resp.text().await?;
1590
1591    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1592        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1593    } else {
1594        let local_var_entity: Option<LogoutError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1595        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1596        Err(Error::ResponseError(local_var_error))
1597    }
1598}
1599
1600pub async fn offboard_global_user(configuration: &configuration::Configuration, email: &str, global_offboard_request: models::GlobalOffboardRequest) -> Result<models::OffboardResponse, Error<OffboardGlobalUserError>> {
1601    let local_var_configuration = configuration;
1602
1603    let local_var_client = &local_var_configuration.client;
1604
1605    let local_var_uri_str = format!("{}/users/offboard/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1606    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1607
1608    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1609        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1610    }
1611    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1612        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1613    };
1614    local_var_req_builder = local_var_req_builder.json(&global_offboard_request);
1615
1616    let local_var_req = local_var_req_builder.build()?;
1617    let local_var_resp = local_var_client.execute(local_var_req).await?;
1618
1619    let local_var_status = local_var_resp.status();
1620    let local_var_content = local_var_resp.text().await?;
1621
1622    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1623        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1624    } else {
1625        let local_var_entity: Option<OffboardGlobalUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1626        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1627        Err(Error::ResponseError(local_var_error))
1628    }
1629}
1630
1631pub async fn offboard_preview(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::OffboardPreview, Error<OffboardPreviewError>> {
1632    let local_var_configuration = configuration;
1633
1634    let local_var_client = &local_var_configuration.client;
1635
1636    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));
1637    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1638
1639    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1640        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1641    }
1642    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1643        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1644    };
1645
1646    let local_var_req = local_var_req_builder.build()?;
1647    let local_var_resp = local_var_client.execute(local_var_req).await?;
1648
1649    let local_var_status = local_var_resp.status();
1650    let local_var_content = local_var_resp.text().await?;
1651
1652    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1653        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1654    } else {
1655        let local_var_entity: Option<OffboardPreviewError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1656        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1657        Err(Error::ResponseError(local_var_error))
1658    }
1659}
1660
1661pub async fn offboard_workspace_user(configuration: &configuration::Configuration, workspace: &str, username: &str, offboard_request: models::OffboardRequest) -> Result<models::OffboardResponse, Error<OffboardWorkspaceUserError>> {
1662    let local_var_configuration = configuration;
1663
1664    let local_var_client = &local_var_configuration.client;
1665
1666    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));
1667    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1668
1669    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1670        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1671    }
1672    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1673        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1674    };
1675    local_var_req_builder = local_var_req_builder.json(&offboard_request);
1676
1677    let local_var_req = local_var_req_builder.build()?;
1678    let local_var_resp = local_var_client.execute(local_var_req).await?;
1679
1680    let local_var_status = local_var_resp.status();
1681    let local_var_content = local_var_resp.text().await?;
1682
1683    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1684        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1685    } else {
1686        let local_var_entity: Option<OffboardWorkspaceUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1687        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1688        Err(Error::ResponseError(local_var_error))
1689    }
1690}
1691
1692pub async fn refresh_user_token(configuration: &configuration::Configuration, if_expiring_in_less_than_s: Option<i32>) -> Result<String, Error<RefreshUserTokenError>> {
1693    let local_var_configuration = configuration;
1694
1695    let local_var_client = &local_var_configuration.client;
1696
1697    let local_var_uri_str = format!("{}/users/refresh_token", local_var_configuration.base_path);
1698    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1699
1700    if let Some(ref local_var_str) = if_expiring_in_less_than_s {
1701        local_var_req_builder = local_var_req_builder.query(&[("if_expiring_in_less_than_s", &local_var_str.to_string())]);
1702    }
1703    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1704        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1705    }
1706    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1707        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1708    };
1709
1710    let local_var_req = local_var_req_builder.build()?;
1711    let local_var_resp = local_var_client.execute(local_var_req).await?;
1712
1713    let local_var_status = local_var_resp.status();
1714    let local_var_content = local_var_resp.text().await?;
1715
1716    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1717        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1718    } else {
1719        let local_var_entity: Option<RefreshUserTokenError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1720        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1721        Err(Error::ResponseError(local_var_error))
1722    }
1723}
1724
1725pub async fn request_password_reset(configuration: &configuration::Configuration, request_password_reset_request: models::RequestPasswordResetRequest) -> Result<models::PasswordResetResponse, Error<RequestPasswordResetError>> {
1726    let local_var_configuration = configuration;
1727
1728    let local_var_client = &local_var_configuration.client;
1729
1730    let local_var_uri_str = format!("{}/auth/request_password_reset", local_var_configuration.base_path);
1731    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1732
1733    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1734        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1735    }
1736    local_var_req_builder = local_var_req_builder.json(&request_password_reset_request);
1737
1738    let local_var_req = local_var_req_builder.build()?;
1739    let local_var_resp = local_var_client.execute(local_var_req).await?;
1740
1741    let local_var_status = local_var_resp.status();
1742    let local_var_content = local_var_resp.text().await?;
1743
1744    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1745        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1746    } else {
1747        let local_var_entity: Option<RequestPasswordResetError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1748        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1749        Err(Error::ResponseError(local_var_error))
1750    }
1751}
1752
1753pub async fn reset_password(configuration: &configuration::Configuration, reset_password_request: models::ResetPasswordRequest) -> Result<models::PasswordResetResponse, Error<ResetPasswordError>> {
1754    let local_var_configuration = configuration;
1755
1756    let local_var_client = &local_var_configuration.client;
1757
1758    let local_var_uri_str = format!("{}/auth/reset_password", local_var_configuration.base_path);
1759    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1760
1761    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1762        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1763    }
1764    local_var_req_builder = local_var_req_builder.json(&reset_password_request);
1765
1766    let local_var_req = local_var_req_builder.build()?;
1767    let local_var_resp = local_var_client.execute(local_var_req).await?;
1768
1769    let local_var_status = local_var_resp.status();
1770    let local_var_content = local_var_resp.text().await?;
1771
1772    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1773        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1774    } else {
1775        let local_var_entity: Option<ResetPasswordError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1776        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1777        Err(Error::ResponseError(local_var_error))
1778    }
1779}
1780
1781pub async fn set_login_type_for_user(configuration: &configuration::Configuration, user: &str, set_login_type_for_user_request: models::SetLoginTypeForUserRequest) -> Result<String, Error<SetLoginTypeForUserError>> {
1782    let local_var_configuration = configuration;
1783
1784    let local_var_client = &local_var_configuration.client;
1785
1786    let local_var_uri_str = format!("{}/users/set_login_type/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
1787    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1788
1789    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1790        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1791    }
1792    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1793        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1794    };
1795    local_var_req_builder = local_var_req_builder.json(&set_login_type_for_user_request);
1796
1797    let local_var_req = local_var_req_builder.build()?;
1798    let local_var_resp = local_var_client.execute(local_var_req).await?;
1799
1800    let local_var_status = local_var_resp.status();
1801    let local_var_content = local_var_resp.text().await?;
1802
1803    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1804        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1805    } else {
1806        let local_var_entity: Option<SetLoginTypeForUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1807        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1808        Err(Error::ResponseError(local_var_error))
1809    }
1810}
1811
1812pub async fn set_password(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordError>> {
1813    let local_var_configuration = configuration;
1814
1815    let local_var_client = &local_var_configuration.client;
1816
1817    let local_var_uri_str = format!("{}/users/setpassword", local_var_configuration.base_path);
1818    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1819
1820    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1821        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1822    }
1823    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1824        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1825    };
1826    local_var_req_builder = local_var_req_builder.json(&set_password_request);
1827
1828    let local_var_req = local_var_req_builder.build()?;
1829    let local_var_resp = local_var_client.execute(local_var_req).await?;
1830
1831    let local_var_status = local_var_resp.status();
1832    let local_var_content = local_var_resp.text().await?;
1833
1834    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1835        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1836    } else {
1837        let local_var_entity: Option<SetPasswordError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1838        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1839        Err(Error::ResponseError(local_var_error))
1840    }
1841}
1842
1843pub async fn set_password_for_user(configuration: &configuration::Configuration, user: &str, set_password_for_user_request: models::SetPasswordForUserRequest) -> Result<String, Error<SetPasswordForUserError>> {
1844    let local_var_configuration = configuration;
1845
1846    let local_var_client = &local_var_configuration.client;
1847
1848    let local_var_uri_str = format!("{}/users/set_password_of/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
1849    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1850
1851    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1852        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1853    }
1854    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1855        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1856    };
1857    local_var_req_builder = local_var_req_builder.json(&set_password_for_user_request);
1858
1859    let local_var_req = local_var_req_builder.build()?;
1860    let local_var_resp = local_var_client.execute(local_var_req).await?;
1861
1862    let local_var_status = local_var_resp.status();
1863    let local_var_content = local_var_resp.text().await?;
1864
1865    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1866        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1867    } else {
1868        let local_var_entity: Option<SetPasswordForUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1869        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1870        Err(Error::ResponseError(local_var_error))
1871    }
1872}
1873
1874pub async fn submit_onboarding_data(configuration: &configuration::Configuration, submit_onboarding_data_request: models::SubmitOnboardingDataRequest) -> Result<String, Error<SubmitOnboardingDataError>> {
1875    let local_var_configuration = configuration;
1876
1877    let local_var_client = &local_var_configuration.client;
1878
1879    let local_var_uri_str = format!("{}/users/onboarding", local_var_configuration.base_path);
1880    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1881
1882    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1883        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1884    }
1885    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1886        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1887    };
1888    local_var_req_builder = local_var_req_builder.json(&submit_onboarding_data_request);
1889
1890    let local_var_req = local_var_req_builder.build()?;
1891    let local_var_resp = local_var_client.execute(local_var_req).await?;
1892
1893    let local_var_status = local_var_resp.status();
1894    let local_var_content = local_var_resp.text().await?;
1895
1896    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1897        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1898    } else {
1899        let local_var_entity: Option<SubmitOnboardingDataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1900        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1901        Err(Error::ResponseError(local_var_error))
1902    }
1903}
1904
1905pub async fn update_token_scopes(configuration: &configuration::Configuration, token_prefix: &str, update_token_scopes_request: models::UpdateTokenScopesRequest) -> Result<String, Error<UpdateTokenScopesError>> {
1906    let local_var_configuration = configuration;
1907
1908    let local_var_client = &local_var_configuration.client;
1909
1910    let local_var_uri_str = format!("{}/users/tokens/update_scopes/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
1911    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1912
1913    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1914        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1915    }
1916    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1917        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1918    };
1919    local_var_req_builder = local_var_req_builder.json(&update_token_scopes_request);
1920
1921    let local_var_req = local_var_req_builder.build()?;
1922    let local_var_resp = local_var_client.execute(local_var_req).await?;
1923
1924    let local_var_status = local_var_resp.status();
1925    let local_var_content = local_var_resp.text().await?;
1926
1927    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1928        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1929    } else {
1930        let local_var_entity: Option<UpdateTokenScopesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1931        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1932        Err(Error::ResponseError(local_var_error))
1933    }
1934}
1935
1936pub async fn update_tutorial_progress(configuration: &configuration::Configuration, get_tutorial_progress200_response: models::GetTutorialProgress200Response) -> Result<String, Error<UpdateTutorialProgressError>> {
1937    let local_var_configuration = configuration;
1938
1939    let local_var_client = &local_var_configuration.client;
1940
1941    let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
1942    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1943
1944    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1945        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1946    }
1947    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1948        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1949    };
1950    local_var_req_builder = local_var_req_builder.json(&get_tutorial_progress200_response);
1951
1952    let local_var_req = local_var_req_builder.build()?;
1953    let local_var_resp = local_var_client.execute(local_var_req).await?;
1954
1955    let local_var_status = local_var_resp.status();
1956    let local_var_content = local_var_resp.text().await?;
1957
1958    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1959        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1960    } else {
1961        let local_var_entity: Option<UpdateTutorialProgressError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1962        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1963        Err(Error::ResponseError(local_var_error))
1964    }
1965}
1966
1967pub async fn update_user(configuration: &configuration::Configuration, workspace: &str, username: &str, edit_workspace_user: models::EditWorkspaceUser) -> Result<String, Error<UpdateUserError>> {
1968    let local_var_configuration = configuration;
1969
1970    let local_var_client = &local_var_configuration.client;
1971
1972    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));
1973    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1974
1975    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1976        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1977    }
1978    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1979        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1980    };
1981    local_var_req_builder = local_var_req_builder.json(&edit_workspace_user);
1982
1983    let local_var_req = local_var_req_builder.build()?;
1984    let local_var_resp = local_var_client.execute(local_var_req).await?;
1985
1986    let local_var_status = local_var_resp.status();
1987    let local_var_content = local_var_resp.text().await?;
1988
1989    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1990        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1991    } else {
1992        let local_var_entity: Option<UpdateUserError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1993        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1994        Err(Error::ResponseError(local_var_error))
1995    }
1996}
1997
1998pub async fn username_to_email(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<UsernameToEmailError>> {
1999    let local_var_configuration = configuration;
2000
2001    let local_var_client = &local_var_configuration.client;
2002
2003    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));
2004    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2005
2006    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2007        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2008    }
2009    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2010        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2011    };
2012
2013    let local_var_req = local_var_req_builder.build()?;
2014    let local_var_resp = local_var_client.execute(local_var_req).await?;
2015
2016    let local_var_status = local_var_resp.status();
2017    let local_var_content = local_var_resp.text().await?;
2018
2019    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2020        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2021    } else {
2022        let local_var_entity: Option<UsernameToEmailError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2023        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2024        Err(Error::ResponseError(local_var_error))
2025    }
2026}
2027
2028pub async fn whoami(configuration: &configuration::Configuration, workspace: &str) -> Result<models::User, Error<WhoamiError>> {
2029    let local_var_configuration = configuration;
2030
2031    let local_var_client = &local_var_configuration.client;
2032
2033    let local_var_uri_str = format!("{}/w/{workspace}/users/whoami", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2034    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2035
2036    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2037        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2038    }
2039    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2040        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2041    };
2042
2043    let local_var_req = local_var_req_builder.build()?;
2044    let local_var_resp = local_var_client.execute(local_var_req).await?;
2045
2046    let local_var_status = local_var_resp.status();
2047    let local_var_content = local_var_resp.text().await?;
2048
2049    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2050        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2051    } else {
2052        let local_var_entity: Option<WhoamiError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2053        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2054        Err(Error::ResponseError(local_var_error))
2055    }
2056}
2057
2058pub async fn whois(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<WhoisError>> {
2059    let local_var_configuration = configuration;
2060
2061    let local_var_client = &local_var_configuration.client;
2062
2063    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));
2064    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2065
2066    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2067        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2068    }
2069    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2070        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2071    };
2072
2073    let local_var_req = local_var_req_builder.build()?;
2074    let local_var_resp = local_var_client.execute(local_var_req).await?;
2075
2076    let local_var_status = local_var_resp.status();
2077    let local_var_content = local_var_resp.text().await?;
2078
2079    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2080        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
2081    } else {
2082        let local_var_entity: Option<WhoisError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
2083        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2084        Err(Error::ResponseError(local_var_error))
2085    }
2086}
2087