Skip to main content

windmill_api/apis/
user_api.rs

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