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