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