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