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