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