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