Skip to main content

windmill_api/apis/
user_api.rs

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