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 ConsumeLoginLinkError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ConvertUserToGroupError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateLoginLinkError {
43 Status409(),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum CreateTokenError {
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum CreateTokenImpersonateError {
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum CreateUserGloballyError {
65 UnknownValue(serde_json::Value),
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum DeclineInviteError {
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum DeleteTokenError {
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum DeleteTokenAsSuperAdminError {
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum DeleteUserError {
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum DisableTotpError {
100 UnknownValue(serde_json::Value),
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum EnableTotpError {
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum ExistsEmailError {
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ExitImpersonationError {
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum GetCloudTrialOfferError {
128 UnknownValue(serde_json::Value),
129}
130
131#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum GetCurrentEmailError {
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum GetOnboardingProfileError {
142 UnknownValue(serde_json::Value),
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum GetRunnableError {
149 UnknownValue(serde_json::Value),
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum GetTokenRiskCountsError {
156 UnknownValue(serde_json::Value),
157}
158
159#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum GetTokenRiskCountsAsSuperAdminError {
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum GetTotpStatusError {
170 UnknownValue(serde_json::Value),
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum GetTutorialProgressError {
177 UnknownValue(serde_json::Value),
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum GetUsageError {
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetUserError {
191 UnknownValue(serde_json::Value),
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum GlobalOffboardPreviewError {
198 UnknownValue(serde_json::Value),
199}
200
201#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum GlobalUserChangeEmailError {
205 UnknownValue(serde_json::Value),
206}
207
208#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum GlobalUserDeleteError {
212 UnknownValue(serde_json::Value),
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum GlobalUserRenameError {
219 UnknownValue(serde_json::Value),
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum GlobalUserUpdateError {
226 UnknownValue(serde_json::Value),
227}
228
229#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum GlobalUsernameInfoError {
233 UnknownValue(serde_json::Value),
234}
235
236#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum GlobalUsersExportError {
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum GlobalUsersOverwriteError {
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum GlobalWhoamiError {
254 UnknownValue(serde_json::Value),
255}
256
257#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum GoCloudTrialOfferError {
261 Status403(),
262 Status404(),
263 UnknownValue(serde_json::Value),
264}
265
266#[derive(Debug, Clone, Serialize, Deserialize)]
268#[serde(untagged)]
269pub enum ImpersonateServiceAccountError {
270 UnknownValue(serde_json::Value),
271}
272
273#[derive(Debug, Clone, Serialize, Deserialize)]
275#[serde(untagged)]
276pub enum IsOwnerOfPathError {
277 UnknownValue(serde_json::Value),
278}
279
280#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum IsPasswordLoginDisabledError {
284 UnknownValue(serde_json::Value),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum IsSmtpConfiguredError {
291 UnknownValue(serde_json::Value),
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum LeaveInstanceError {
298 UnknownValue(serde_json::Value),
299}
300
301#[derive(Debug, Clone, Serialize, Deserialize)]
303#[serde(untagged)]
304pub enum ListAddableInstanceUsersError {
305 UnknownValue(serde_json::Value),
306}
307
308#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum ListExtJwtTokensError {
312 UnknownValue(serde_json::Value),
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum ListGuestsError {
319 UnknownValue(serde_json::Value),
320}
321
322#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum ListTokensError {
326 UnknownValue(serde_json::Value),
327}
328
329#[derive(Debug, Clone, Serialize, Deserialize)]
331#[serde(untagged)]
332pub enum ListTokensAsSuperAdminError {
333 UnknownValue(serde_json::Value),
334}
335
336#[derive(Debug, Clone, Serialize, Deserialize)]
338#[serde(untagged)]
339pub enum ListTotpEnabledUsersError {
340 UnknownValue(serde_json::Value),
341}
342
343#[derive(Debug, Clone, Serialize, Deserialize)]
345#[serde(untagged)]
346pub enum ListUsernamesError {
347 UnknownValue(serde_json::Value),
348}
349
350#[derive(Debug, Clone, Serialize, Deserialize)]
352#[serde(untagged)]
353pub enum ListUsersError {
354 UnknownValue(serde_json::Value),
355}
356
357#[derive(Debug, Clone, Serialize, Deserialize)]
359#[serde(untagged)]
360pub enum ListUsersAsSuperAdminError {
361 UnknownValue(serde_json::Value),
362}
363
364#[derive(Debug, Clone, Serialize, Deserialize)]
366#[serde(untagged)]
367pub enum ListUsersUsageError {
368 UnknownValue(serde_json::Value),
369}
370
371#[derive(Debug, Clone, Serialize, Deserialize)]
373#[serde(untagged)]
374pub enum ListWorkspaceInvitesError {
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum LoginError {
382 UnknownValue(serde_json::Value),
383}
384
385#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum LoginTotpEnableError {
389 UnknownValue(serde_json::Value),
390}
391
392#[derive(Debug, Clone, Serialize, Deserialize)]
394#[serde(untagged)]
395pub enum LoginTotpSetupError {
396 UnknownValue(serde_json::Value),
397}
398
399#[derive(Debug, Clone, Serialize, Deserialize)]
401#[serde(untagged)]
402pub enum LoginWithOauthError {
403 UnknownValue(serde_json::Value),
404}
405
406#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum LogoutError {
410 UnknownValue(serde_json::Value),
411}
412
413#[derive(Debug, Clone, Serialize, Deserialize)]
415#[serde(untagged)]
416pub enum OffboardGlobalUserError {
417 UnknownValue(serde_json::Value),
418}
419
420#[derive(Debug, Clone, Serialize, Deserialize)]
422#[serde(untagged)]
423pub enum OffboardPreviewError {
424 UnknownValue(serde_json::Value),
425}
426
427#[derive(Debug, Clone, Serialize, Deserialize)]
429#[serde(untagged)]
430pub enum OffboardWorkspaceUserError {
431 UnknownValue(serde_json::Value),
432}
433
434#[derive(Debug, Clone, Serialize, Deserialize)]
436#[serde(untagged)]
437pub enum RefreshUserTokenError {
438 UnknownValue(serde_json::Value),
439}
440
441#[derive(Debug, Clone, Serialize, Deserialize)]
443#[serde(untagged)]
444pub enum RegenerateTotpRecoveryCodesError {
445 UnknownValue(serde_json::Value),
446}
447
448#[derive(Debug, Clone, Serialize, Deserialize)]
450#[serde(untagged)]
451pub enum RequestPasswordResetError {
452 Status400(),
453 UnknownValue(serde_json::Value),
454}
455
456#[derive(Debug, Clone, Serialize, Deserialize)]
458#[serde(untagged)]
459pub enum ResetPasswordError {
460 Status400(),
461 UnknownValue(serde_json::Value),
462}
463
464#[derive(Debug, Clone, Serialize, Deserialize)]
466#[serde(untagged)]
467pub enum ResetTotpOfUserError {
468 UnknownValue(serde_json::Value),
469}
470
471#[derive(Debug, Clone, Serialize, Deserialize)]
473#[serde(untagged)]
474pub enum SetCloudTrialOfferError {
475 UnknownValue(serde_json::Value),
476}
477
478#[derive(Debug, Clone, Serialize, Deserialize)]
480#[serde(untagged)]
481pub enum SetLoginTypeForUserError {
482 UnknownValue(serde_json::Value),
483}
484
485#[derive(Debug, Clone, Serialize, Deserialize)]
487#[serde(untagged)]
488pub enum SetOnboardingProfileError {
489 UnknownValue(serde_json::Value),
490}
491
492#[derive(Debug, Clone, Serialize, Deserialize)]
494#[serde(untagged)]
495pub enum SetPasswordError {
496 UnknownValue(serde_json::Value),
497}
498
499#[derive(Debug, Clone, Serialize, Deserialize)]
501#[serde(untagged)]
502pub enum SetPasswordForUserError {
503 UnknownValue(serde_json::Value),
504}
505
506#[derive(Debug, Clone, Serialize, Deserialize)]
508#[serde(untagged)]
509pub enum SetupTotpError {
510 UnknownValue(serde_json::Value),
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize)]
515#[serde(untagged)]
516pub enum SubmitOnboardingDataError {
517 UnknownValue(serde_json::Value),
518}
519
520#[derive(Debug, Clone, Serialize, Deserialize)]
522#[serde(untagged)]
523pub enum UpdateTokenLabelError {
524 UnknownValue(serde_json::Value),
525}
526
527#[derive(Debug, Clone, Serialize, Deserialize)]
529#[serde(untagged)]
530pub enum UpdateTokenLimitsError {
531 UnknownValue(serde_json::Value),
532}
533
534#[derive(Debug, Clone, Serialize, Deserialize)]
536#[serde(untagged)]
537pub enum UpdateTokenScopesError {
538 UnknownValue(serde_json::Value),
539}
540
541#[derive(Debug, Clone, Serialize, Deserialize)]
543#[serde(untagged)]
544pub enum UpdateTutorialProgressError {
545 UnknownValue(serde_json::Value),
546}
547
548#[derive(Debug, Clone, Serialize, Deserialize)]
550#[serde(untagged)]
551pub enum UpdateUserError {
552 UnknownValue(serde_json::Value),
553}
554
555#[derive(Debug, Clone, Serialize, Deserialize)]
557#[serde(untagged)]
558pub enum UsernameToEmailError {
559 UnknownValue(serde_json::Value),
560}
561
562#[derive(Debug, Clone, Serialize, Deserialize)]
564#[serde(untagged)]
565pub enum WhoamiError {
566 UnknownValue(serde_json::Value),
567}
568
569#[derive(Debug, Clone, Serialize, Deserialize)]
571#[serde(untagged)]
572pub enum WhoisError {
573 UnknownValue(serde_json::Value),
574}
575
576
577pub async fn accept_invite(configuration: &configuration::Configuration, accept_invite_request: models::AcceptInviteRequest) -> Result<String, Error<AcceptInviteError>> {
578 let local_var_configuration = configuration;
579
580 let local_var_client = &local_var_configuration.client;
581
582 let local_var_uri_str = format!("{}/users/accept_invite", local_var_configuration.base_path);
583 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
584
585 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
586 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
587 }
588 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
589 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
590 };
591 local_var_req_builder = local_var_req_builder.json(&accept_invite_request);
592
593 let local_var_req = local_var_req_builder.build()?;
594 let local_var_resp = local_var_client.execute(local_var_req).await?;
595
596 let local_var_status = local_var_resp.status();
597 let local_var_content = local_var_resp.text().await?;
598
599 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
600 crate::from_str_patched(&local_var_content).map_err(Error::from)
601 } else {
602 let local_var_entity: Option<AcceptInviteError> = crate::from_str_patched(&local_var_content).ok();
603 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
604 Err(Error::ResponseError(local_var_error))
605 }
606}
607
608pub async fn consume_login_link(configuration: &configuration::Configuration, token: &str, rd: Option<&str>) -> Result<(), Error<ConsumeLoginLinkError>> {
609 let local_var_configuration = configuration;
610
611 let local_var_client = &local_var_configuration.client;
612
613 let local_var_uri_str = format!("{}/auth/login_link/{token}", local_var_configuration.base_path, token=crate::apis::urlencode(token));
614 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616 if let Some(ref local_var_str) = rd {
617 local_var_req_builder = local_var_req_builder.query(&[("rd", &local_var_str.to_string())]);
618 }
619 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
620 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
621 }
622
623 let local_var_req = local_var_req_builder.build()?;
624 let local_var_resp = local_var_client.execute(local_var_req).await?;
625
626 let local_var_status = local_var_resp.status();
627 let local_var_content = local_var_resp.text().await?;
628
629 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
630 Ok(())
631 } else {
632 let local_var_entity: Option<ConsumeLoginLinkError> = crate::from_str_patched(&local_var_content).ok();
633 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
634 Err(Error::ResponseError(local_var_error))
635 }
636}
637
638pub async fn convert_user_to_group(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<ConvertUserToGroupError>> {
639 let local_var_configuration = configuration;
640
641 let local_var_client = &local_var_configuration.client;
642
643 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));
644 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
645
646 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
647 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
648 }
649 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
650 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
651 };
652
653 let local_var_req = local_var_req_builder.build()?;
654 let local_var_resp = local_var_client.execute(local_var_req).await?;
655
656 let local_var_status = local_var_resp.status();
657 let local_var_content = local_var_resp.text().await?;
658
659 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
660 crate::from_str_patched(&local_var_content).map_err(Error::from)
661 } else {
662 let local_var_entity: Option<ConvertUserToGroupError> = crate::from_str_patched(&local_var_content).ok();
663 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
664 Err(Error::ResponseError(local_var_error))
665 }
666}
667
668pub async fn create_login_link(configuration: &configuration::Configuration, create_login_link_request: models::CreateLoginLinkRequest) -> Result<models::CreateLoginLink201Response, Error<CreateLoginLinkError>> {
669 let local_var_configuration = configuration;
670
671 let local_var_client = &local_var_configuration.client;
672
673 let local_var_uri_str = format!("{}/users/login_links", local_var_configuration.base_path);
674 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
675
676 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678 }
679 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
680 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
681 };
682 local_var_req_builder = local_var_req_builder.json(&create_login_link_request);
683
684 let local_var_req = local_var_req_builder.build()?;
685 let local_var_resp = local_var_client.execute(local_var_req).await?;
686
687 let local_var_status = local_var_resp.status();
688 let local_var_content = local_var_resp.text().await?;
689
690 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
691 crate::from_str_patched(&local_var_content).map_err(Error::from)
692 } else {
693 let local_var_entity: Option<CreateLoginLinkError> = crate::from_str_patched(&local_var_content).ok();
694 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
695 Err(Error::ResponseError(local_var_error))
696 }
697}
698
699pub async fn create_token(configuration: &configuration::Configuration, new_token: models::NewToken) -> Result<String, Error<CreateTokenError>> {
700 let local_var_configuration = configuration;
701
702 let local_var_client = &local_var_configuration.client;
703
704 let local_var_uri_str = format!("{}/users/tokens/create", local_var_configuration.base_path);
705 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
706
707 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
708 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
709 }
710 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
711 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
712 };
713 local_var_req_builder = local_var_req_builder.json(&new_token);
714
715 let local_var_req = local_var_req_builder.build()?;
716 let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718 let local_var_status = local_var_resp.status();
719 let local_var_content = local_var_resp.text().await?;
720
721 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722 crate::from_str_patched(&local_var_content).map_err(Error::from)
723 } else {
724 let local_var_entity: Option<CreateTokenError> = crate::from_str_patched(&local_var_content).ok();
725 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726 Err(Error::ResponseError(local_var_error))
727 }
728}
729
730pub async fn create_token_impersonate(configuration: &configuration::Configuration, new_token_impersonate: models::NewTokenImpersonate) -> Result<String, Error<CreateTokenImpersonateError>> {
731 let local_var_configuration = configuration;
732
733 let local_var_client = &local_var_configuration.client;
734
735 let local_var_uri_str = format!("{}/users/tokens/impersonate", local_var_configuration.base_path);
736 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
737
738 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
739 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
740 }
741 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
742 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
743 };
744 local_var_req_builder = local_var_req_builder.json(&new_token_impersonate);
745
746 let local_var_req = local_var_req_builder.build()?;
747 let local_var_resp = local_var_client.execute(local_var_req).await?;
748
749 let local_var_status = local_var_resp.status();
750 let local_var_content = local_var_resp.text().await?;
751
752 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
753 crate::from_str_patched(&local_var_content).map_err(Error::from)
754 } else {
755 let local_var_entity: Option<CreateTokenImpersonateError> = crate::from_str_patched(&local_var_content).ok();
756 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
757 Err(Error::ResponseError(local_var_error))
758 }
759}
760
761pub async fn create_user_globally(configuration: &configuration::Configuration, create_user_globally_request: models::CreateUserGloballyRequest) -> Result<String, Error<CreateUserGloballyError>> {
762 let local_var_configuration = configuration;
763
764 let local_var_client = &local_var_configuration.client;
765
766 let local_var_uri_str = format!("{}/users/create", local_var_configuration.base_path);
767 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
768
769 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
770 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
771 }
772 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
773 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
774 };
775 local_var_req_builder = local_var_req_builder.json(&create_user_globally_request);
776
777 let local_var_req = local_var_req_builder.build()?;
778 let local_var_resp = local_var_client.execute(local_var_req).await?;
779
780 let local_var_status = local_var_resp.status();
781 let local_var_content = local_var_resp.text().await?;
782
783 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
784 crate::from_str_patched(&local_var_content).map_err(Error::from)
785 } else {
786 let local_var_entity: Option<CreateUserGloballyError> = crate::from_str_patched(&local_var_content).ok();
787 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
788 Err(Error::ResponseError(local_var_error))
789 }
790}
791
792pub async fn decline_invite(configuration: &configuration::Configuration, decline_invite_request: models::DeclineInviteRequest) -> Result<String, Error<DeclineInviteError>> {
793 let local_var_configuration = configuration;
794
795 let local_var_client = &local_var_configuration.client;
796
797 let local_var_uri_str = format!("{}/users/decline_invite", local_var_configuration.base_path);
798 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
799
800 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
801 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
802 }
803 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
804 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
805 };
806 local_var_req_builder = local_var_req_builder.json(&decline_invite_request);
807
808 let local_var_req = local_var_req_builder.build()?;
809 let local_var_resp = local_var_client.execute(local_var_req).await?;
810
811 let local_var_status = local_var_resp.status();
812 let local_var_content = local_var_resp.text().await?;
813
814 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
815 crate::from_str_patched(&local_var_content).map_err(Error::from)
816 } else {
817 let local_var_entity: Option<DeclineInviteError> = crate::from_str_patched(&local_var_content).ok();
818 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
819 Err(Error::ResponseError(local_var_error))
820 }
821}
822
823pub async fn delete_token(configuration: &configuration::Configuration, token_prefix: &str) -> Result<String, Error<DeleteTokenError>> {
824 let local_var_configuration = configuration;
825
826 let local_var_client = &local_var_configuration.client;
827
828 let local_var_uri_str = format!("{}/users/tokens/delete/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
829 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
830
831 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
832 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
833 }
834 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
835 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
836 };
837
838 let local_var_req = local_var_req_builder.build()?;
839 let local_var_resp = local_var_client.execute(local_var_req).await?;
840
841 let local_var_status = local_var_resp.status();
842 let local_var_content = local_var_resp.text().await?;
843
844 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
845 crate::from_str_patched(&local_var_content).map_err(Error::from)
846 } else {
847 let local_var_entity: Option<DeleteTokenError> = crate::from_str_patched(&local_var_content).ok();
848 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
849 Err(Error::ResponseError(local_var_error))
850 }
851}
852
853pub async fn delete_token_as_super_admin(configuration: &configuration::Configuration, email: &str, token_prefix: &str) -> Result<String, Error<DeleteTokenAsSuperAdminError>> {
854 let local_var_configuration = configuration;
855
856 let local_var_client = &local_var_configuration.client;
857
858 let local_var_uri_str = format!("{}/users/tokens/delete_as_super_admin/{email}/{token_prefix}", local_var_configuration.base_path, email=crate::apis::urlencode(email), token_prefix=crate::apis::urlencode(token_prefix));
859 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
860
861 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
862 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
863 }
864 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
865 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
866 };
867
868 let local_var_req = local_var_req_builder.build()?;
869 let local_var_resp = local_var_client.execute(local_var_req).await?;
870
871 let local_var_status = local_var_resp.status();
872 let local_var_content = local_var_resp.text().await?;
873
874 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
875 crate::from_str_patched(&local_var_content).map_err(Error::from)
876 } else {
877 let local_var_entity: Option<DeleteTokenAsSuperAdminError> = crate::from_str_patched(&local_var_content).ok();
878 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
879 Err(Error::ResponseError(local_var_error))
880 }
881}
882
883pub async fn delete_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<DeleteUserError>> {
884 let local_var_configuration = configuration;
885
886 let local_var_client = &local_var_configuration.client;
887
888 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));
889 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
890
891 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
892 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
893 }
894 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
895 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
896 };
897
898 let local_var_req = local_var_req_builder.build()?;
899 let local_var_resp = local_var_client.execute(local_var_req).await?;
900
901 let local_var_status = local_var_resp.status();
902 let local_var_content = local_var_resp.text().await?;
903
904 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
905 crate::from_str_patched(&local_var_content).map_err(Error::from)
906 } else {
907 let local_var_entity: Option<DeleteUserError> = crate::from_str_patched(&local_var_content).ok();
908 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
909 Err(Error::ResponseError(local_var_error))
910 }
911}
912
913pub async fn disable_totp(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<String, Error<DisableTotpError>> {
914 let local_var_configuration = configuration;
915
916 let local_var_client = &local_var_configuration.client;
917
918 let local_var_uri_str = format!("{}/users/totp/disable", local_var_configuration.base_path);
919 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
920
921 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
922 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
923 }
924 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
925 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
926 };
927 local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
928
929 let local_var_req = local_var_req_builder.build()?;
930 let local_var_resp = local_var_client.execute(local_var_req).await?;
931
932 let local_var_status = local_var_resp.status();
933 let local_var_content = local_var_resp.text().await?;
934
935 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
936 crate::from_str_patched(&local_var_content).map_err(Error::from)
937 } else {
938 let local_var_entity: Option<DisableTotpError> = crate::from_str_patched(&local_var_content).ok();
939 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
940 Err(Error::ResponseError(local_var_error))
941 }
942}
943
944pub async fn enable_totp(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<models::EnableTotp200Response, Error<EnableTotpError>> {
945 let local_var_configuration = configuration;
946
947 let local_var_client = &local_var_configuration.client;
948
949 let local_var_uri_str = format!("{}/users/totp/enable", local_var_configuration.base_path);
950 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
951
952 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
953 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
954 }
955 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
956 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
957 };
958 local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
959
960 let local_var_req = local_var_req_builder.build()?;
961 let local_var_resp = local_var_client.execute(local_var_req).await?;
962
963 let local_var_status = local_var_resp.status();
964 let local_var_content = local_var_resp.text().await?;
965
966 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
967 crate::from_str_patched(&local_var_content).map_err(Error::from)
968 } else {
969 let local_var_entity: Option<EnableTotpError> = crate::from_str_patched(&local_var_content).ok();
970 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
971 Err(Error::ResponseError(local_var_error))
972 }
973}
974
975pub async fn exists_email(configuration: &configuration::Configuration, email: &str) -> Result<bool, Error<ExistsEmailError>> {
976 let local_var_configuration = configuration;
977
978 let local_var_client = &local_var_configuration.client;
979
980 let local_var_uri_str = format!("{}/users/exists/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
981 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
982
983 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
984 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
985 }
986 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
987 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
988 };
989
990 let local_var_req = local_var_req_builder.build()?;
991 let local_var_resp = local_var_client.execute(local_var_req).await?;
992
993 let local_var_status = local_var_resp.status();
994 let local_var_content = local_var_resp.text().await?;
995
996 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
997 crate::from_str_patched(&local_var_content).map_err(Error::from)
998 } else {
999 let local_var_entity: Option<ExistsEmailError> = crate::from_str_patched(&local_var_content).ok();
1000 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1001 Err(Error::ResponseError(local_var_error))
1002 }
1003}
1004
1005pub async fn exit_impersonation(configuration: &configuration::Configuration, workspace: &str, get_github_app_token200_response: models::GetGithubAppToken200Response) -> Result<String, Error<ExitImpersonationError>> {
1006 let local_var_configuration = configuration;
1007
1008 let local_var_client = &local_var_configuration.client;
1009
1010 let local_var_uri_str = format!("{}/w/{workspace}/users/exit_impersonation", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1011 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1012
1013 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1014 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1015 }
1016 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1017 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1018 };
1019 local_var_req_builder = local_var_req_builder.json(&get_github_app_token200_response);
1020
1021 let local_var_req = local_var_req_builder.build()?;
1022 let local_var_resp = local_var_client.execute(local_var_req).await?;
1023
1024 let local_var_status = local_var_resp.status();
1025 let local_var_content = local_var_resp.text().await?;
1026
1027 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1028 crate::from_str_patched(&local_var_content).map_err(Error::from)
1029 } else {
1030 let local_var_entity: Option<ExitImpersonationError> = crate::from_str_patched(&local_var_content).ok();
1031 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1032 Err(Error::ResponseError(local_var_error))
1033 }
1034}
1035
1036pub async fn get_cloud_trial_offer(configuration: &configuration::Configuration, ) -> Result<models::GetCloudTrialOffer200Response, Error<GetCloudTrialOfferError>> {
1037 let local_var_configuration = configuration;
1038
1039 let local_var_client = &local_var_configuration.client;
1040
1041 let local_var_uri_str = format!("{}/users/cloud_trial_offer", local_var_configuration.base_path);
1042 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1043
1044 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1045 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1046 }
1047 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1048 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1049 };
1050
1051 let local_var_req = local_var_req_builder.build()?;
1052 let local_var_resp = local_var_client.execute(local_var_req).await?;
1053
1054 let local_var_status = local_var_resp.status();
1055 let local_var_content = local_var_resp.text().await?;
1056
1057 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1058 crate::from_str_patched(&local_var_content).map_err(Error::from)
1059 } else {
1060 let local_var_entity: Option<GetCloudTrialOfferError> = crate::from_str_patched(&local_var_content).ok();
1061 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1062 Err(Error::ResponseError(local_var_error))
1063 }
1064}
1065
1066pub async fn get_current_email(configuration: &configuration::Configuration, ) -> Result<String, Error<GetCurrentEmailError>> {
1067 let local_var_configuration = configuration;
1068
1069 let local_var_client = &local_var_configuration.client;
1070
1071 let local_var_uri_str = format!("{}/users/email", local_var_configuration.base_path);
1072 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1073
1074 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1075 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1076 }
1077 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1078 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1079 };
1080
1081 let local_var_req = local_var_req_builder.build()?;
1082 let local_var_resp = local_var_client.execute(local_var_req).await?;
1083
1084 let local_var_status = local_var_resp.status();
1085 let local_var_content = local_var_resp.text().await?;
1086
1087 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1088 crate::from_str_patched(&local_var_content).map_err(Error::from)
1089 } else {
1090 let local_var_entity: Option<GetCurrentEmailError> = crate::from_str_patched(&local_var_content).ok();
1091 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1092 Err(Error::ResponseError(local_var_error))
1093 }
1094}
1095
1096pub async fn get_onboarding_profile(configuration: &configuration::Configuration, ) -> Result<models::GetOnboardingProfile200Response, Error<GetOnboardingProfileError>> {
1097 let local_var_configuration = configuration;
1098
1099 let local_var_client = &local_var_configuration.client;
1100
1101 let local_var_uri_str = format!("{}/users/onboarding_profile", local_var_configuration.base_path);
1102 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1103
1104 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1105 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1106 }
1107 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1108 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1109 };
1110
1111 let local_var_req = local_var_req_builder.build()?;
1112 let local_var_resp = local_var_client.execute(local_var_req).await?;
1113
1114 let local_var_status = local_var_resp.status();
1115 let local_var_content = local_var_resp.text().await?;
1116
1117 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1118 crate::from_str_patched(&local_var_content).map_err(Error::from)
1119 } else {
1120 let local_var_entity: Option<GetOnboardingProfileError> = crate::from_str_patched(&local_var_content).ok();
1121 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1122 Err(Error::ResponseError(local_var_error))
1123 }
1124}
1125
1126pub async fn get_runnable(configuration: &configuration::Configuration, ) -> Result<models::GetRunnable200Response, Error<GetRunnableError>> {
1127 let local_var_configuration = configuration;
1128
1129 let local_var_client = &local_var_configuration.client;
1130
1131 let local_var_uri_str = format!("{}/users/all_runnables", local_var_configuration.base_path);
1132 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1133
1134 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1135 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1136 }
1137 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1138 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1139 };
1140
1141 let local_var_req = local_var_req_builder.build()?;
1142 let local_var_resp = local_var_client.execute(local_var_req).await?;
1143
1144 let local_var_status = local_var_resp.status();
1145 let local_var_content = local_var_resp.text().await?;
1146
1147 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1148 crate::from_str_patched(&local_var_content).map_err(Error::from)
1149 } else {
1150 let local_var_entity: Option<GetRunnableError> = crate::from_str_patched(&local_var_content).ok();
1151 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1152 Err(Error::ResponseError(local_var_error))
1153 }
1154}
1155
1156pub async fn get_token_risk_counts(configuration: &configuration::Configuration, ) -> Result<models::TokenRiskCounts, Error<GetTokenRiskCountsError>> {
1157 let local_var_configuration = configuration;
1158
1159 let local_var_client = &local_var_configuration.client;
1160
1161 let local_var_uri_str = format!("{}/users/tokens/risk_counts", local_var_configuration.base_path);
1162 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1163
1164 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1165 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1166 }
1167 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1168 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1169 };
1170
1171 let local_var_req = local_var_req_builder.build()?;
1172 let local_var_resp = local_var_client.execute(local_var_req).await?;
1173
1174 let local_var_status = local_var_resp.status();
1175 let local_var_content = local_var_resp.text().await?;
1176
1177 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1178 crate::from_str_patched(&local_var_content).map_err(Error::from)
1179 } else {
1180 let local_var_entity: Option<GetTokenRiskCountsError> = crate::from_str_patched(&local_var_content).ok();
1181 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1182 Err(Error::ResponseError(local_var_error))
1183 }
1184}
1185
1186pub async fn get_token_risk_counts_as_super_admin(configuration: &configuration::Configuration, ) -> Result<models::TokenRiskCounts, Error<GetTokenRiskCountsAsSuperAdminError>> {
1187 let local_var_configuration = configuration;
1188
1189 let local_var_client = &local_var_configuration.client;
1190
1191 let local_var_uri_str = format!("{}/users/tokens/risk_counts_as_super_admin", local_var_configuration.base_path);
1192 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1193
1194 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1195 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1196 }
1197 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1198 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1199 };
1200
1201 let local_var_req = local_var_req_builder.build()?;
1202 let local_var_resp = local_var_client.execute(local_var_req).await?;
1203
1204 let local_var_status = local_var_resp.status();
1205 let local_var_content = local_var_resp.text().await?;
1206
1207 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1208 crate::from_str_patched(&local_var_content).map_err(Error::from)
1209 } else {
1210 let local_var_entity: Option<GetTokenRiskCountsAsSuperAdminError> = crate::from_str_patched(&local_var_content).ok();
1211 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1212 Err(Error::ResponseError(local_var_error))
1213 }
1214}
1215
1216pub async fn get_totp_status(configuration: &configuration::Configuration, ) -> Result<models::GetTotpStatus200Response, Error<GetTotpStatusError>> {
1217 let local_var_configuration = configuration;
1218
1219 let local_var_client = &local_var_configuration.client;
1220
1221 let local_var_uri_str = format!("{}/users/totp", local_var_configuration.base_path);
1222 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1223
1224 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1225 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1226 }
1227 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1228 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1229 };
1230
1231 let local_var_req = local_var_req_builder.build()?;
1232 let local_var_resp = local_var_client.execute(local_var_req).await?;
1233
1234 let local_var_status = local_var_resp.status();
1235 let local_var_content = local_var_resp.text().await?;
1236
1237 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1238 crate::from_str_patched(&local_var_content).map_err(Error::from)
1239 } else {
1240 let local_var_entity: Option<GetTotpStatusError> = crate::from_str_patched(&local_var_content).ok();
1241 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1242 Err(Error::ResponseError(local_var_error))
1243 }
1244}
1245
1246pub async fn get_tutorial_progress(configuration: &configuration::Configuration, ) -> Result<models::GetTutorialProgress200Response, Error<GetTutorialProgressError>> {
1247 let local_var_configuration = configuration;
1248
1249 let local_var_client = &local_var_configuration.client;
1250
1251 let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
1252 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1253
1254 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1255 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1256 }
1257 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1258 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1259 };
1260
1261 let local_var_req = local_var_req_builder.build()?;
1262 let local_var_resp = local_var_client.execute(local_var_req).await?;
1263
1264 let local_var_status = local_var_resp.status();
1265 let local_var_content = local_var_resp.text().await?;
1266
1267 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1268 crate::from_str_patched(&local_var_content).map_err(Error::from)
1269 } else {
1270 let local_var_entity: Option<GetTutorialProgressError> = crate::from_str_patched(&local_var_content).ok();
1271 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1272 Err(Error::ResponseError(local_var_error))
1273 }
1274}
1275
1276pub async fn get_usage(configuration: &configuration::Configuration, ) -> Result<f64, Error<GetUsageError>> {
1277 let local_var_configuration = configuration;
1278
1279 let local_var_client = &local_var_configuration.client;
1280
1281 let local_var_uri_str = format!("{}/users/usage", local_var_configuration.base_path);
1282 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1283
1284 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1285 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1286 }
1287 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1288 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1289 };
1290
1291 let local_var_req = local_var_req_builder.build()?;
1292 let local_var_resp = local_var_client.execute(local_var_req).await?;
1293
1294 let local_var_status = local_var_resp.status();
1295 let local_var_content = local_var_resp.text().await?;
1296
1297 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1298 crate::from_str_patched(&local_var_content).map_err(Error::from)
1299 } else {
1300 let local_var_entity: Option<GetUsageError> = crate::from_str_patched(&local_var_content).ok();
1301 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1302 Err(Error::ResponseError(local_var_error))
1303 }
1304}
1305
1306pub async fn get_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<GetUserError>> {
1307 let local_var_configuration = configuration;
1308
1309 let local_var_client = &local_var_configuration.client;
1310
1311 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));
1312 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1313
1314 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1315 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1316 }
1317 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1318 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1319 };
1320
1321 let local_var_req = local_var_req_builder.build()?;
1322 let local_var_resp = local_var_client.execute(local_var_req).await?;
1323
1324 let local_var_status = local_var_resp.status();
1325 let local_var_content = local_var_resp.text().await?;
1326
1327 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1328 crate::from_str_patched(&local_var_content).map_err(Error::from)
1329 } else {
1330 let local_var_entity: Option<GetUserError> = crate::from_str_patched(&local_var_content).ok();
1331 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1332 Err(Error::ResponseError(local_var_error))
1333 }
1334}
1335
1336pub async fn global_offboard_preview(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalOffboardPreview, Error<GlobalOffboardPreviewError>> {
1337 let local_var_configuration = configuration;
1338
1339 let local_var_client = &local_var_configuration.client;
1340
1341 let local_var_uri_str = format!("{}/users/offboard_preview/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1342 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1343
1344 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1345 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1346 }
1347 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1348 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1349 };
1350
1351 let local_var_req = local_var_req_builder.build()?;
1352 let local_var_resp = local_var_client.execute(local_var_req).await?;
1353
1354 let local_var_status = local_var_resp.status();
1355 let local_var_content = local_var_resp.text().await?;
1356
1357 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1358 crate::from_str_patched(&local_var_content).map_err(Error::from)
1359 } else {
1360 let local_var_entity: Option<GlobalOffboardPreviewError> = crate::from_str_patched(&local_var_content).ok();
1361 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1362 Err(Error::ResponseError(local_var_error))
1363 }
1364}
1365
1366pub async fn global_user_change_email(configuration: &configuration::Configuration, email: &str, global_user_change_email_request: models::GlobalUserChangeEmailRequest) -> Result<String, Error<GlobalUserChangeEmailError>> {
1367 let local_var_configuration = configuration;
1368
1369 let local_var_client = &local_var_configuration.client;
1370
1371 let local_var_uri_str = format!("{}/users/change_email/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1372 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1373
1374 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1375 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1376 }
1377 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1378 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1379 };
1380 local_var_req_builder = local_var_req_builder.json(&global_user_change_email_request);
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<GlobalUserChangeEmailError> = 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 global_user_delete(configuration: &configuration::Configuration, email: &str) -> Result<String, Error<GlobalUserDeleteError>> {
1398 let local_var_configuration = configuration;
1399
1400 let local_var_client = &local_var_configuration.client;
1401
1402 let local_var_uri_str = format!("{}/users/delete/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1403 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, 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<GlobalUserDeleteError> = 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 global_user_rename(configuration: &configuration::Configuration, email: &str, global_user_rename_request: models::GlobalUserRenameRequest) -> Result<String, Error<GlobalUserRenameError>> {
1428 let local_var_configuration = configuration;
1429
1430 let local_var_client = &local_var_configuration.client;
1431
1432 let local_var_uri_str = format!("{}/users/rename/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1433 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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 local_var_req_builder = local_var_req_builder.json(&global_user_rename_request);
1442
1443 let local_var_req = local_var_req_builder.build()?;
1444 let local_var_resp = local_var_client.execute(local_var_req).await?;
1445
1446 let local_var_status = local_var_resp.status();
1447 let local_var_content = local_var_resp.text().await?;
1448
1449 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1450 crate::from_str_patched(&local_var_content).map_err(Error::from)
1451 } else {
1452 let local_var_entity: Option<GlobalUserRenameError> = crate::from_str_patched(&local_var_content).ok();
1453 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1454 Err(Error::ResponseError(local_var_error))
1455 }
1456}
1457
1458pub async fn global_user_update(configuration: &configuration::Configuration, email: &str, global_user_update_request: models::GlobalUserUpdateRequest) -> Result<String, Error<GlobalUserUpdateError>> {
1459 let local_var_configuration = configuration;
1460
1461 let local_var_client = &local_var_configuration.client;
1462
1463 let local_var_uri_str = format!("{}/users/update/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1464 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1465
1466 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1467 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1468 }
1469 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1470 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1471 };
1472 local_var_req_builder = local_var_req_builder.json(&global_user_update_request);
1473
1474 let local_var_req = local_var_req_builder.build()?;
1475 let local_var_resp = local_var_client.execute(local_var_req).await?;
1476
1477 let local_var_status = local_var_resp.status();
1478 let local_var_content = local_var_resp.text().await?;
1479
1480 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1481 crate::from_str_patched(&local_var_content).map_err(Error::from)
1482 } else {
1483 let local_var_entity: Option<GlobalUserUpdateError> = crate::from_str_patched(&local_var_content).ok();
1484 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1485 Err(Error::ResponseError(local_var_error))
1486 }
1487}
1488
1489pub async fn global_username_info(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalUsernameInfo200Response, Error<GlobalUsernameInfoError>> {
1490 let local_var_configuration = configuration;
1491
1492 let local_var_client = &local_var_configuration.client;
1493
1494 let local_var_uri_str = format!("{}/users/username_info/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
1495 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1496
1497 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1498 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1499 }
1500 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1501 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1502 };
1503
1504 let local_var_req = local_var_req_builder.build()?;
1505 let local_var_resp = local_var_client.execute(local_var_req).await?;
1506
1507 let local_var_status = local_var_resp.status();
1508 let local_var_content = local_var_resp.text().await?;
1509
1510 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1511 crate::from_str_patched(&local_var_content).map_err(Error::from)
1512 } else {
1513 let local_var_entity: Option<GlobalUsernameInfoError> = crate::from_str_patched(&local_var_content).ok();
1514 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1515 Err(Error::ResponseError(local_var_error))
1516 }
1517}
1518
1519pub async fn global_users_export(configuration: &configuration::Configuration, ) -> Result<Vec<models::ExportedUser>, Error<GlobalUsersExportError>> {
1520 let local_var_configuration = configuration;
1521
1522 let local_var_client = &local_var_configuration.client;
1523
1524 let local_var_uri_str = format!("{}/users/export", local_var_configuration.base_path);
1525 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1526
1527 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1528 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1529 }
1530 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1531 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1532 };
1533
1534 let local_var_req = local_var_req_builder.build()?;
1535 let local_var_resp = local_var_client.execute(local_var_req).await?;
1536
1537 let local_var_status = local_var_resp.status();
1538 let local_var_content = local_var_resp.text().await?;
1539
1540 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1541 crate::from_str_patched(&local_var_content).map_err(Error::from)
1542 } else {
1543 let local_var_entity: Option<GlobalUsersExportError> = crate::from_str_patched(&local_var_content).ok();
1544 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1545 Err(Error::ResponseError(local_var_error))
1546 }
1547}
1548
1549pub async fn global_users_overwrite(configuration: &configuration::Configuration, exported_user: Vec<models::ExportedUser>) -> Result<String, Error<GlobalUsersOverwriteError>> {
1550 let local_var_configuration = configuration;
1551
1552 let local_var_client = &local_var_configuration.client;
1553
1554 let local_var_uri_str = format!("{}/users/overwrite", local_var_configuration.base_path);
1555 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1556
1557 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1558 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1559 }
1560 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1561 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1562 };
1563 local_var_req_builder = local_var_req_builder.json(&exported_user);
1564
1565 let local_var_req = local_var_req_builder.build()?;
1566 let local_var_resp = local_var_client.execute(local_var_req).await?;
1567
1568 let local_var_status = local_var_resp.status();
1569 let local_var_content = local_var_resp.text().await?;
1570
1571 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1572 crate::from_str_patched(&local_var_content).map_err(Error::from)
1573 } else {
1574 let local_var_entity: Option<GlobalUsersOverwriteError> = crate::from_str_patched(&local_var_content).ok();
1575 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1576 Err(Error::ResponseError(local_var_error))
1577 }
1578}
1579
1580pub async fn global_whoami(configuration: &configuration::Configuration, ) -> Result<models::GlobalUserInfo, Error<GlobalWhoamiError>> {
1581 let local_var_configuration = configuration;
1582
1583 let local_var_client = &local_var_configuration.client;
1584
1585 let local_var_uri_str = format!("{}/users/whoami", local_var_configuration.base_path);
1586 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1587
1588 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1589 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1590 }
1591 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1592 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1593 };
1594
1595 let local_var_req = local_var_req_builder.build()?;
1596 let local_var_resp = local_var_client.execute(local_var_req).await?;
1597
1598 let local_var_status = local_var_resp.status();
1599 let local_var_content = local_var_resp.text().await?;
1600
1601 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1602 crate::from_str_patched(&local_var_content).map_err(Error::from)
1603 } else {
1604 let local_var_entity: Option<GlobalWhoamiError> = crate::from_str_patched(&local_var_content).ok();
1605 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1606 Err(Error::ResponseError(local_var_error))
1607 }
1608}
1609
1610pub async fn go_cloud_trial_offer(configuration: &configuration::Configuration, ) -> Result<models::GoCloudTrialOffer200Response, Error<GoCloudTrialOfferError>> {
1611 let local_var_configuration = configuration;
1612
1613 let local_var_client = &local_var_configuration.client;
1614
1615 let local_var_uri_str = format!("{}/users/cloud_trial_offer/go", local_var_configuration.base_path);
1616 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1617
1618 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1619 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1620 }
1621 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1622 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1623 };
1624
1625 let local_var_req = local_var_req_builder.build()?;
1626 let local_var_resp = local_var_client.execute(local_var_req).await?;
1627
1628 let local_var_status = local_var_resp.status();
1629 let local_var_content = local_var_resp.text().await?;
1630
1631 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1632 crate::from_str_patched(&local_var_content).map_err(Error::from)
1633 } else {
1634 let local_var_entity: Option<GoCloudTrialOfferError> = crate::from_str_patched(&local_var_content).ok();
1635 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1636 Err(Error::ResponseError(local_var_error))
1637 }
1638}
1639
1640pub async fn impersonate_service_account(configuration: &configuration::Configuration, workspace: &str, impersonate_service_account_request: models::ImpersonateServiceAccountRequest) -> Result<String, Error<ImpersonateServiceAccountError>> {
1641 let local_var_configuration = configuration;
1642
1643 let local_var_client = &local_var_configuration.client;
1644
1645 let local_var_uri_str = format!("{}/w/{workspace}/users/impersonate_service_account", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1646 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1647
1648 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1649 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1650 }
1651 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1652 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1653 };
1654 local_var_req_builder = local_var_req_builder.json(&impersonate_service_account_request);
1655
1656 let local_var_req = local_var_req_builder.build()?;
1657 let local_var_resp = local_var_client.execute(local_var_req).await?;
1658
1659 let local_var_status = local_var_resp.status();
1660 let local_var_content = local_var_resp.text().await?;
1661
1662 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1663 crate::from_str_patched(&local_var_content).map_err(Error::from)
1664 } else {
1665 let local_var_entity: Option<ImpersonateServiceAccountError> = crate::from_str_patched(&local_var_content).ok();
1666 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1667 Err(Error::ResponseError(local_var_error))
1668 }
1669}
1670
1671pub async fn is_owner_of_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<IsOwnerOfPathError>> {
1672 let local_var_configuration = configuration;
1673
1674 let local_var_client = &local_var_configuration.client;
1675
1676 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));
1677 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1678
1679 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1680 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1681 }
1682 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1683 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1684 };
1685
1686 let local_var_req = local_var_req_builder.build()?;
1687 let local_var_resp = local_var_client.execute(local_var_req).await?;
1688
1689 let local_var_status = local_var_resp.status();
1690 let local_var_content = local_var_resp.text().await?;
1691
1692 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1693 crate::from_str_patched(&local_var_content).map_err(Error::from)
1694 } else {
1695 let local_var_entity: Option<IsOwnerOfPathError> = crate::from_str_patched(&local_var_content).ok();
1696 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1697 Err(Error::ResponseError(local_var_error))
1698 }
1699}
1700
1701pub async fn is_password_login_disabled(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsPasswordLoginDisabledError>> {
1702 let local_var_configuration = configuration;
1703
1704 let local_var_client = &local_var_configuration.client;
1705
1706 let local_var_uri_str = format!("{}/auth/is_password_login_disabled", local_var_configuration.base_path);
1707 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1708
1709 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1710 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1711 }
1712
1713 let local_var_req = local_var_req_builder.build()?;
1714 let local_var_resp = local_var_client.execute(local_var_req).await?;
1715
1716 let local_var_status = local_var_resp.status();
1717 let local_var_content = local_var_resp.text().await?;
1718
1719 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1720 crate::from_str_patched(&local_var_content).map_err(Error::from)
1721 } else {
1722 let local_var_entity: Option<IsPasswordLoginDisabledError> = crate::from_str_patched(&local_var_content).ok();
1723 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1724 Err(Error::ResponseError(local_var_error))
1725 }
1726}
1727
1728pub async fn is_smtp_configured(configuration: &configuration::Configuration, ) -> Result<bool, Error<IsSmtpConfiguredError>> {
1729 let local_var_configuration = configuration;
1730
1731 let local_var_client = &local_var_configuration.client;
1732
1733 let local_var_uri_str = format!("{}/auth/is_smtp_configured", local_var_configuration.base_path);
1734 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1735
1736 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1737 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1738 }
1739
1740 let local_var_req = local_var_req_builder.build()?;
1741 let local_var_resp = local_var_client.execute(local_var_req).await?;
1742
1743 let local_var_status = local_var_resp.status();
1744 let local_var_content = local_var_resp.text().await?;
1745
1746 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1747 crate::from_str_patched(&local_var_content).map_err(Error::from)
1748 } else {
1749 let local_var_entity: Option<IsSmtpConfiguredError> = crate::from_str_patched(&local_var_content).ok();
1750 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1751 Err(Error::ResponseError(local_var_error))
1752 }
1753}
1754
1755pub async fn leave_instance(configuration: &configuration::Configuration, ) -> Result<String, Error<LeaveInstanceError>> {
1756 let local_var_configuration = configuration;
1757
1758 let local_var_client = &local_var_configuration.client;
1759
1760 let local_var_uri_str = format!("{}/users/leave_instance", local_var_configuration.base_path);
1761 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1762
1763 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1764 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1765 }
1766 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1767 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1768 };
1769
1770 let local_var_req = local_var_req_builder.build()?;
1771 let local_var_resp = local_var_client.execute(local_var_req).await?;
1772
1773 let local_var_status = local_var_resp.status();
1774 let local_var_content = local_var_resp.text().await?;
1775
1776 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1777 crate::from_str_patched(&local_var_content).map_err(Error::from)
1778 } else {
1779 let local_var_entity: Option<LeaveInstanceError> = crate::from_str_patched(&local_var_content).ok();
1780 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1781 Err(Error::ResponseError(local_var_error))
1782 }
1783}
1784
1785pub async fn list_addable_instance_users(configuration: &configuration::Configuration, workspace: &str, search: Option<&str>, per_page: Option<i32>) -> Result<Vec<models::ListAddableInstanceUsers200ResponseInner>, Error<ListAddableInstanceUsersError>> {
1786 let local_var_configuration = configuration;
1787
1788 let local_var_client = &local_var_configuration.client;
1789
1790 let local_var_uri_str = format!("{}/w/{workspace}/users/list_addable", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1791 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1792
1793 if let Some(ref local_var_str) = search {
1794 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1795 }
1796 if let Some(ref local_var_str) = per_page {
1797 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1798 }
1799 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1800 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1801 }
1802 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1803 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1804 };
1805
1806 let local_var_req = local_var_req_builder.build()?;
1807 let local_var_resp = local_var_client.execute(local_var_req).await?;
1808
1809 let local_var_status = local_var_resp.status();
1810 let local_var_content = local_var_resp.text().await?;
1811
1812 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1813 crate::from_str_patched(&local_var_content).map_err(Error::from)
1814 } else {
1815 let local_var_entity: Option<ListAddableInstanceUsersError> = crate::from_str_patched(&local_var_content).ok();
1816 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1817 Err(Error::ResponseError(local_var_error))
1818 }
1819}
1820
1821pub 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>> {
1822 let local_var_configuration = configuration;
1823
1824 let local_var_client = &local_var_configuration.client;
1825
1826 let local_var_uri_str = format!("{}/users/ext_jwt_tokens", local_var_configuration.base_path);
1827 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1828
1829 if let Some(ref local_var_str) = page {
1830 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1831 }
1832 if let Some(ref local_var_str) = per_page {
1833 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1834 }
1835 if let Some(ref local_var_str) = active_only {
1836 local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
1837 }
1838 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1839 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1840 }
1841 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1842 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1843 };
1844
1845 let local_var_req = local_var_req_builder.build()?;
1846 let local_var_resp = local_var_client.execute(local_var_req).await?;
1847
1848 let local_var_status = local_var_resp.status();
1849 let local_var_content = local_var_resp.text().await?;
1850
1851 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1852 crate::from_str_patched(&local_var_content).map_err(Error::from)
1853 } else {
1854 let local_var_entity: Option<ListExtJwtTokensError> = crate::from_str_patched(&local_var_content).ok();
1855 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1856 Err(Error::ResponseError(local_var_error))
1857 }
1858}
1859
1860pub async fn list_guests(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>) -> Result<models::GuestList, Error<ListGuestsError>> {
1862 let local_var_configuration = configuration;
1863
1864 let local_var_client = &local_var_configuration.client;
1865
1866 let local_var_uri_str = format!("{}/users/guests", local_var_configuration.base_path);
1867 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1868
1869 if let Some(ref local_var_str) = page {
1870 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1871 }
1872 if let Some(ref local_var_str) = per_page {
1873 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1874 }
1875 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1876 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1877 }
1878 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1879 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1880 };
1881
1882 let local_var_req = local_var_req_builder.build()?;
1883 let local_var_resp = local_var_client.execute(local_var_req).await?;
1884
1885 let local_var_status = local_var_resp.status();
1886 let local_var_content = local_var_resp.text().await?;
1887
1888 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1889 crate::from_str_patched(&local_var_content).map_err(Error::from)
1890 } else {
1891 let local_var_entity: Option<ListGuestsError> = crate::from_str_patched(&local_var_content).ok();
1892 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1893 Err(Error::ResponseError(local_var_error))
1894 }
1895}
1896
1897pub async fn list_tokens(configuration: &configuration::Configuration, exclude_ephemeral: Option<bool>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::TruncatedToken>, Error<ListTokensError>> {
1898 let local_var_configuration = configuration;
1899
1900 let local_var_client = &local_var_configuration.client;
1901
1902 let local_var_uri_str = format!("{}/users/tokens/list", local_var_configuration.base_path);
1903 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1904
1905 if let Some(ref local_var_str) = exclude_ephemeral {
1906 local_var_req_builder = local_var_req_builder.query(&[("exclude_ephemeral", &local_var_str.to_string())]);
1907 }
1908 if let Some(ref local_var_str) = page {
1909 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1910 }
1911 if let Some(ref local_var_str) = per_page {
1912 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1913 }
1914 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1915 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1916 }
1917 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1918 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1919 };
1920
1921 let local_var_req = local_var_req_builder.build()?;
1922 let local_var_resp = local_var_client.execute(local_var_req).await?;
1923
1924 let local_var_status = local_var_resp.status();
1925 let local_var_content = local_var_resp.text().await?;
1926
1927 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1928 crate::from_str_patched(&local_var_content).map_err(Error::from)
1929 } else {
1930 let local_var_entity: Option<ListTokensError> = crate::from_str_patched(&local_var_content).ok();
1931 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1932 Err(Error::ResponseError(local_var_error))
1933 }
1934}
1935
1936pub async fn list_tokens_as_super_admin(configuration: &configuration::Configuration, flag: Option<&str>, search: Option<&str>, per_page: Option<i32>, after_last_used_at: Option<String>, after_token_prefix: Option<&str>) -> Result<Vec<models::TokenForReview>, Error<ListTokensAsSuperAdminError>> {
1938 let local_var_configuration = configuration;
1939
1940 let local_var_client = &local_var_configuration.client;
1941
1942 let local_var_uri_str = format!("{}/users/tokens/list_as_super_admin", local_var_configuration.base_path);
1943 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1944
1945 if let Some(ref local_var_str) = flag {
1946 local_var_req_builder = local_var_req_builder.query(&[("flag", &local_var_str.to_string())]);
1947 }
1948 if let Some(ref local_var_str) = search {
1949 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
1950 }
1951 if let Some(ref local_var_str) = per_page {
1952 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1953 }
1954 if let Some(ref local_var_str) = after_last_used_at {
1955 local_var_req_builder = local_var_req_builder.query(&[("after_last_used_at", &local_var_str.to_string())]);
1956 }
1957 if let Some(ref local_var_str) = after_token_prefix {
1958 local_var_req_builder = local_var_req_builder.query(&[("after_token_prefix", &local_var_str.to_string())]);
1959 }
1960 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1961 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1962 }
1963 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1964 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1965 };
1966
1967 let local_var_req = local_var_req_builder.build()?;
1968 let local_var_resp = local_var_client.execute(local_var_req).await?;
1969
1970 let local_var_status = local_var_resp.status();
1971 let local_var_content = local_var_resp.text().await?;
1972
1973 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1974 crate::from_str_patched(&local_var_content).map_err(Error::from)
1975 } else {
1976 let local_var_entity: Option<ListTokensAsSuperAdminError> = crate::from_str_patched(&local_var_content).ok();
1977 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1978 Err(Error::ResponseError(local_var_error))
1979 }
1980}
1981
1982pub async fn list_totp_enabled_users(configuration: &configuration::Configuration, ) -> Result<models::ListTotpEnabledUsers200Response, Error<ListTotpEnabledUsersError>> {
1983 let local_var_configuration = configuration;
1984
1985 let local_var_client = &local_var_configuration.client;
1986
1987 let local_var_uri_str = format!("{}/users/totp/enabled", local_var_configuration.base_path);
1988 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1989
1990 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1991 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1992 }
1993 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1994 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1995 };
1996
1997 let local_var_req = local_var_req_builder.build()?;
1998 let local_var_resp = local_var_client.execute(local_var_req).await?;
1999
2000 let local_var_status = local_var_resp.status();
2001 let local_var_content = local_var_resp.text().await?;
2002
2003 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2004 crate::from_str_patched(&local_var_content).map_err(Error::from)
2005 } else {
2006 let local_var_entity: Option<ListTotpEnabledUsersError> = crate::from_str_patched(&local_var_content).ok();
2007 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2008 Err(Error::ResponseError(local_var_error))
2009 }
2010}
2011
2012pub async fn list_usernames(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListUsernamesError>> {
2013 let local_var_configuration = configuration;
2014
2015 let local_var_client = &local_var_configuration.client;
2016
2017 let local_var_uri_str = format!("{}/w/{workspace}/users/list_usernames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2018 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2019
2020 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2021 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2022 }
2023 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2024 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2025 };
2026
2027 let local_var_req = local_var_req_builder.build()?;
2028 let local_var_resp = local_var_client.execute(local_var_req).await?;
2029
2030 let local_var_status = local_var_resp.status();
2031 let local_var_content = local_var_resp.text().await?;
2032
2033 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2034 crate::from_str_patched(&local_var_content).map_err(Error::from)
2035 } else {
2036 let local_var_entity: Option<ListUsernamesError> = crate::from_str_patched(&local_var_content).ok();
2037 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2038 Err(Error::ResponseError(local_var_error))
2039 }
2040}
2041
2042pub async fn list_users(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::User>, Error<ListUsersError>> {
2043 let local_var_configuration = configuration;
2044
2045 let local_var_client = &local_var_configuration.client;
2046
2047 let local_var_uri_str = format!("{}/w/{workspace}/users/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2048 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2049
2050 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2051 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2052 }
2053 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2054 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2055 };
2056
2057 let local_var_req = local_var_req_builder.build()?;
2058 let local_var_resp = local_var_client.execute(local_var_req).await?;
2059
2060 let local_var_status = local_var_resp.status();
2061 let local_var_content = local_var_resp.text().await?;
2062
2063 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2064 crate::from_str_patched(&local_var_content).map_err(Error::from)
2065 } else {
2066 let local_var_entity: Option<ListUsersError> = crate::from_str_patched(&local_var_content).ok();
2067 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2068 Err(Error::ResponseError(local_var_error))
2069 }
2070}
2071
2072pub 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>> {
2073 let local_var_configuration = configuration;
2074
2075 let local_var_client = &local_var_configuration.client;
2076
2077 let local_var_uri_str = format!("{}/users/list_as_super_admin", local_var_configuration.base_path);
2078 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2079
2080 if let Some(ref local_var_str) = page {
2081 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
2082 }
2083 if let Some(ref local_var_str) = per_page {
2084 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
2085 }
2086 if let Some(ref local_var_str) = active_only {
2087 local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
2088 }
2089 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2090 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2091 }
2092 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2093 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2094 };
2095
2096 let local_var_req = local_var_req_builder.build()?;
2097 let local_var_resp = local_var_client.execute(local_var_req).await?;
2098
2099 let local_var_status = local_var_resp.status();
2100 let local_var_content = local_var_resp.text().await?;
2101
2102 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2103 crate::from_str_patched(&local_var_content).map_err(Error::from)
2104 } else {
2105 let local_var_entity: Option<ListUsersAsSuperAdminError> = crate::from_str_patched(&local_var_content).ok();
2106 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2107 Err(Error::ResponseError(local_var_error))
2108 }
2109}
2110
2111pub async fn list_users_usage(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::UserUsage>, Error<ListUsersUsageError>> {
2112 let local_var_configuration = configuration;
2113
2114 let local_var_client = &local_var_configuration.client;
2115
2116 let local_var_uri_str = format!("{}/w/{workspace}/users/list_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2117 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2118
2119 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2120 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2121 }
2122 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2123 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2124 };
2125
2126 let local_var_req = local_var_req_builder.build()?;
2127 let local_var_resp = local_var_client.execute(local_var_req).await?;
2128
2129 let local_var_status = local_var_resp.status();
2130 let local_var_content = local_var_resp.text().await?;
2131
2132 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2133 crate::from_str_patched(&local_var_content).map_err(Error::from)
2134 } else {
2135 let local_var_entity: Option<ListUsersUsageError> = crate::from_str_patched(&local_var_content).ok();
2136 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2137 Err(Error::ResponseError(local_var_error))
2138 }
2139}
2140
2141pub async fn list_workspace_invites(configuration: &configuration::Configuration, ) -> Result<Vec<models::WorkspaceInvite>, Error<ListWorkspaceInvitesError>> {
2142 let local_var_configuration = configuration;
2143
2144 let local_var_client = &local_var_configuration.client;
2145
2146 let local_var_uri_str = format!("{}/users/list_invites", local_var_configuration.base_path);
2147 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2148
2149 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2150 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2151 }
2152 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2153 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2154 };
2155
2156 let local_var_req = local_var_req_builder.build()?;
2157 let local_var_resp = local_var_client.execute(local_var_req).await?;
2158
2159 let local_var_status = local_var_resp.status();
2160 let local_var_content = local_var_resp.text().await?;
2161
2162 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2163 crate::from_str_patched(&local_var_content).map_err(Error::from)
2164 } else {
2165 let local_var_entity: Option<ListWorkspaceInvitesError> = crate::from_str_patched(&local_var_content).ok();
2166 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2167 Err(Error::ResponseError(local_var_error))
2168 }
2169}
2170
2171pub async fn login(configuration: &configuration::Configuration, login: models::Login) -> Result<String, Error<LoginError>> {
2172 let local_var_configuration = configuration;
2173
2174 let local_var_client = &local_var_configuration.client;
2175
2176 let local_var_uri_str = format!("{}/auth/login", local_var_configuration.base_path);
2177 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2178
2179 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2180 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2181 }
2182 local_var_req_builder = local_var_req_builder.json(&login);
2183
2184 let local_var_req = local_var_req_builder.build()?;
2185 let local_var_resp = local_var_client.execute(local_var_req).await?;
2186
2187 let local_var_status = local_var_resp.status();
2188 let local_var_content = local_var_resp.text().await?;
2189
2190 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2191 crate::from_str_patched(&local_var_content).map_err(Error::from)
2192 } else {
2193 let local_var_entity: Option<LoginError> = crate::from_str_patched(&local_var_content).ok();
2194 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2195 Err(Error::ResponseError(local_var_error))
2196 }
2197}
2198
2199pub async fn login_totp_enable(configuration: &configuration::Configuration, login_totp_enable_request: models::LoginTotpEnableRequest) -> Result<models::LoginTotpEnable200Response, Error<LoginTotpEnableError>> {
2200 let local_var_configuration = configuration;
2201
2202 let local_var_client = &local_var_configuration.client;
2203
2204 let local_var_uri_str = format!("{}/auth/login/totp/enable", local_var_configuration.base_path);
2205 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2206
2207 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2208 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2209 }
2210 local_var_req_builder = local_var_req_builder.json(&login_totp_enable_request);
2211
2212 let local_var_req = local_var_req_builder.build()?;
2213 let local_var_resp = local_var_client.execute(local_var_req).await?;
2214
2215 let local_var_status = local_var_resp.status();
2216 let local_var_content = local_var_resp.text().await?;
2217
2218 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2219 crate::from_str_patched(&local_var_content).map_err(Error::from)
2220 } else {
2221 let local_var_entity: Option<LoginTotpEnableError> = crate::from_str_patched(&local_var_content).ok();
2222 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2223 Err(Error::ResponseError(local_var_error))
2224 }
2225}
2226
2227pub async fn login_totp_setup(configuration: &configuration::Configuration, login_totp_setup_request: models::LoginTotpSetupRequest) -> Result<models::LoginTotpSetup200Response, Error<LoginTotpSetupError>> {
2228 let local_var_configuration = configuration;
2229
2230 let local_var_client = &local_var_configuration.client;
2231
2232 let local_var_uri_str = format!("{}/auth/login/totp/setup", local_var_configuration.base_path);
2233 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2234
2235 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2236 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2237 }
2238 local_var_req_builder = local_var_req_builder.json(&login_totp_setup_request);
2239
2240 let local_var_req = local_var_req_builder.build()?;
2241 let local_var_resp = local_var_client.execute(local_var_req).await?;
2242
2243 let local_var_status = local_var_resp.status();
2244 let local_var_content = local_var_resp.text().await?;
2245
2246 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2247 crate::from_str_patched(&local_var_content).map_err(Error::from)
2248 } else {
2249 let local_var_entity: Option<LoginTotpSetupError> = crate::from_str_patched(&local_var_content).ok();
2250 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2251 Err(Error::ResponseError(local_var_error))
2252 }
2253}
2254
2255pub async fn login_with_oauth(configuration: &configuration::Configuration, client_name: &str, login_with_oauth_request: models::LoginWithOauthRequest) -> Result<String, Error<LoginWithOauthError>> {
2256 let local_var_configuration = configuration;
2257
2258 let local_var_client = &local_var_configuration.client;
2259
2260 let local_var_uri_str = format!("{}/oauth/login_callback/{client_name}", local_var_configuration.base_path, client_name=crate::apis::urlencode(client_name));
2261 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2262
2263 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2264 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2265 }
2266 local_var_req_builder = local_var_req_builder.json(&login_with_oauth_request);
2267
2268 let local_var_req = local_var_req_builder.build()?;
2269 let local_var_resp = local_var_client.execute(local_var_req).await?;
2270
2271 let local_var_status = local_var_resp.status();
2272 let local_var_content = local_var_resp.text().await?;
2273
2274 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2275 crate::from_str_patched(&local_var_content).map_err(Error::from)
2276 } else {
2277 let local_var_entity: Option<LoginWithOauthError> = crate::from_str_patched(&local_var_content).ok();
2278 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2279 Err(Error::ResponseError(local_var_error))
2280 }
2281}
2282
2283pub async fn logout(configuration: &configuration::Configuration, ) -> Result<String, Error<LogoutError>> {
2284 let local_var_configuration = configuration;
2285
2286 let local_var_client = &local_var_configuration.client;
2287
2288 let local_var_uri_str = format!("{}/auth/logout", local_var_configuration.base_path);
2289 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2290
2291 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2292 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2293 }
2294
2295 let local_var_req = local_var_req_builder.build()?;
2296 let local_var_resp = local_var_client.execute(local_var_req).await?;
2297
2298 let local_var_status = local_var_resp.status();
2299 let local_var_content = local_var_resp.text().await?;
2300
2301 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2302 crate::from_str_patched(&local_var_content).map_err(Error::from)
2303 } else {
2304 let local_var_entity: Option<LogoutError> = crate::from_str_patched(&local_var_content).ok();
2305 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2306 Err(Error::ResponseError(local_var_error))
2307 }
2308}
2309
2310pub async fn offboard_global_user(configuration: &configuration::Configuration, email: &str, global_offboard_request: models::GlobalOffboardRequest) -> Result<models::OffboardResponse, Error<OffboardGlobalUserError>> {
2311 let local_var_configuration = configuration;
2312
2313 let local_var_client = &local_var_configuration.client;
2314
2315 let local_var_uri_str = format!("{}/users/offboard/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
2316 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2317
2318 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2319 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2320 }
2321 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2322 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2323 };
2324 local_var_req_builder = local_var_req_builder.json(&global_offboard_request);
2325
2326 let local_var_req = local_var_req_builder.build()?;
2327 let local_var_resp = local_var_client.execute(local_var_req).await?;
2328
2329 let local_var_status = local_var_resp.status();
2330 let local_var_content = local_var_resp.text().await?;
2331
2332 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2333 crate::from_str_patched(&local_var_content).map_err(Error::from)
2334 } else {
2335 let local_var_entity: Option<OffboardGlobalUserError> = crate::from_str_patched(&local_var_content).ok();
2336 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2337 Err(Error::ResponseError(local_var_error))
2338 }
2339}
2340
2341pub async fn offboard_preview(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::OffboardPreview, Error<OffboardPreviewError>> {
2342 let local_var_configuration = configuration;
2343
2344 let local_var_client = &local_var_configuration.client;
2345
2346 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));
2347 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2348
2349 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2350 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2351 }
2352 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2353 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2354 };
2355
2356 let local_var_req = local_var_req_builder.build()?;
2357 let local_var_resp = local_var_client.execute(local_var_req).await?;
2358
2359 let local_var_status = local_var_resp.status();
2360 let local_var_content = local_var_resp.text().await?;
2361
2362 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2363 crate::from_str_patched(&local_var_content).map_err(Error::from)
2364 } else {
2365 let local_var_entity: Option<OffboardPreviewError> = crate::from_str_patched(&local_var_content).ok();
2366 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2367 Err(Error::ResponseError(local_var_error))
2368 }
2369}
2370
2371pub async fn offboard_workspace_user(configuration: &configuration::Configuration, workspace: &str, username: &str, offboard_request: models::OffboardRequest) -> Result<models::OffboardResponse, Error<OffboardWorkspaceUserError>> {
2372 let local_var_configuration = configuration;
2373
2374 let local_var_client = &local_var_configuration.client;
2375
2376 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));
2377 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2378
2379 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2380 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2381 }
2382 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2383 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2384 };
2385 local_var_req_builder = local_var_req_builder.json(&offboard_request);
2386
2387 let local_var_req = local_var_req_builder.build()?;
2388 let local_var_resp = local_var_client.execute(local_var_req).await?;
2389
2390 let local_var_status = local_var_resp.status();
2391 let local_var_content = local_var_resp.text().await?;
2392
2393 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2394 crate::from_str_patched(&local_var_content).map_err(Error::from)
2395 } else {
2396 let local_var_entity: Option<OffboardWorkspaceUserError> = crate::from_str_patched(&local_var_content).ok();
2397 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2398 Err(Error::ResponseError(local_var_error))
2399 }
2400}
2401
2402pub async fn refresh_user_token(configuration: &configuration::Configuration, if_expiring_in_less_than_s: Option<i32>) -> Result<String, Error<RefreshUserTokenError>> {
2403 let local_var_configuration = configuration;
2404
2405 let local_var_client = &local_var_configuration.client;
2406
2407 let local_var_uri_str = format!("{}/users/refresh_token", local_var_configuration.base_path);
2408 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2409
2410 if let Some(ref local_var_str) = if_expiring_in_less_than_s {
2411 local_var_req_builder = local_var_req_builder.query(&[("if_expiring_in_less_than_s", &local_var_str.to_string())]);
2412 }
2413 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2414 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2415 }
2416 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2417 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2418 };
2419
2420 let local_var_req = local_var_req_builder.build()?;
2421 let local_var_resp = local_var_client.execute(local_var_req).await?;
2422
2423 let local_var_status = local_var_resp.status();
2424 let local_var_content = local_var_resp.text().await?;
2425
2426 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2427 crate::from_str_patched(&local_var_content).map_err(Error::from)
2428 } else {
2429 let local_var_entity: Option<RefreshUserTokenError> = crate::from_str_patched(&local_var_content).ok();
2430 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2431 Err(Error::ResponseError(local_var_error))
2432 }
2433}
2434
2435pub async fn regenerate_totp_recovery_codes(configuration: &configuration::Configuration, enable_totp_request: models::EnableTotpRequest) -> Result<models::EnableTotp200Response, Error<RegenerateTotpRecoveryCodesError>> {
2436 let local_var_configuration = configuration;
2437
2438 let local_var_client = &local_var_configuration.client;
2439
2440 let local_var_uri_str = format!("{}/users/totp/recovery_codes", local_var_configuration.base_path);
2441 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2442
2443 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2444 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2445 }
2446 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2447 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2448 };
2449 local_var_req_builder = local_var_req_builder.json(&enable_totp_request);
2450
2451 let local_var_req = local_var_req_builder.build()?;
2452 let local_var_resp = local_var_client.execute(local_var_req).await?;
2453
2454 let local_var_status = local_var_resp.status();
2455 let local_var_content = local_var_resp.text().await?;
2456
2457 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2458 crate::from_str_patched(&local_var_content).map_err(Error::from)
2459 } else {
2460 let local_var_entity: Option<RegenerateTotpRecoveryCodesError> = crate::from_str_patched(&local_var_content).ok();
2461 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2462 Err(Error::ResponseError(local_var_error))
2463 }
2464}
2465
2466pub async fn request_password_reset(configuration: &configuration::Configuration, request_password_reset_request: models::RequestPasswordResetRequest) -> Result<models::PasswordResetResponse, Error<RequestPasswordResetError>> {
2467 let local_var_configuration = configuration;
2468
2469 let local_var_client = &local_var_configuration.client;
2470
2471 let local_var_uri_str = format!("{}/auth/request_password_reset", local_var_configuration.base_path);
2472 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2473
2474 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2475 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2476 }
2477 local_var_req_builder = local_var_req_builder.json(&request_password_reset_request);
2478
2479 let local_var_req = local_var_req_builder.build()?;
2480 let local_var_resp = local_var_client.execute(local_var_req).await?;
2481
2482 let local_var_status = local_var_resp.status();
2483 let local_var_content = local_var_resp.text().await?;
2484
2485 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2486 crate::from_str_patched(&local_var_content).map_err(Error::from)
2487 } else {
2488 let local_var_entity: Option<RequestPasswordResetError> = crate::from_str_patched(&local_var_content).ok();
2489 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2490 Err(Error::ResponseError(local_var_error))
2491 }
2492}
2493
2494pub async fn reset_password(configuration: &configuration::Configuration, reset_password_request: models::ResetPasswordRequest) -> Result<models::PasswordResetResponse, Error<ResetPasswordError>> {
2495 let local_var_configuration = configuration;
2496
2497 let local_var_client = &local_var_configuration.client;
2498
2499 let local_var_uri_str = format!("{}/auth/reset_password", local_var_configuration.base_path);
2500 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2501
2502 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2503 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2504 }
2505 local_var_req_builder = local_var_req_builder.json(&reset_password_request);
2506
2507 let local_var_req = local_var_req_builder.build()?;
2508 let local_var_resp = local_var_client.execute(local_var_req).await?;
2509
2510 let local_var_status = local_var_resp.status();
2511 let local_var_content = local_var_resp.text().await?;
2512
2513 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2514 crate::from_str_patched(&local_var_content).map_err(Error::from)
2515 } else {
2516 let local_var_entity: Option<ResetPasswordError> = crate::from_str_patched(&local_var_content).ok();
2517 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2518 Err(Error::ResponseError(local_var_error))
2519 }
2520}
2521
2522pub async fn reset_totp_of_user(configuration: &configuration::Configuration, user: &str) -> Result<String, Error<ResetTotpOfUserError>> {
2523 let local_var_configuration = configuration;
2524
2525 let local_var_client = &local_var_configuration.client;
2526
2527 let local_var_uri_str = format!("{}/users/totp/reset/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2528 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2529
2530 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2531 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2532 }
2533 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2534 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2535 };
2536
2537 let local_var_req = local_var_req_builder.build()?;
2538 let local_var_resp = local_var_client.execute(local_var_req).await?;
2539
2540 let local_var_status = local_var_resp.status();
2541 let local_var_content = local_var_resp.text().await?;
2542
2543 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2544 crate::from_str_patched(&local_var_content).map_err(Error::from)
2545 } else {
2546 let local_var_entity: Option<ResetTotpOfUserError> = crate::from_str_patched(&local_var_content).ok();
2547 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2548 Err(Error::ResponseError(local_var_error))
2549 }
2550}
2551
2552pub async fn set_cloud_trial_offer(configuration: &configuration::Configuration, set_cloud_trial_offer_request: models::SetCloudTrialOfferRequest) -> Result<String, Error<SetCloudTrialOfferError>> {
2553 let local_var_configuration = configuration;
2554
2555 let local_var_client = &local_var_configuration.client;
2556
2557 let local_var_uri_str = format!("{}/users/cloud_trial_offer", local_var_configuration.base_path);
2558 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2559
2560 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2561 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2562 }
2563 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2564 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2565 };
2566 local_var_req_builder = local_var_req_builder.json(&set_cloud_trial_offer_request);
2567
2568 let local_var_req = local_var_req_builder.build()?;
2569 let local_var_resp = local_var_client.execute(local_var_req).await?;
2570
2571 let local_var_status = local_var_resp.status();
2572 let local_var_content = local_var_resp.text().await?;
2573
2574 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2575 crate::from_str_patched(&local_var_content).map_err(Error::from)
2576 } else {
2577 let local_var_entity: Option<SetCloudTrialOfferError> = crate::from_str_patched(&local_var_content).ok();
2578 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2579 Err(Error::ResponseError(local_var_error))
2580 }
2581}
2582
2583pub async fn set_login_type_for_user(configuration: &configuration::Configuration, user: &str, set_login_type_for_user_request: models::SetLoginTypeForUserRequest) -> Result<String, Error<SetLoginTypeForUserError>> {
2584 let local_var_configuration = configuration;
2585
2586 let local_var_client = &local_var_configuration.client;
2587
2588 let local_var_uri_str = format!("{}/users/set_login_type/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2589 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2590
2591 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2592 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2593 }
2594 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2595 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2596 };
2597 local_var_req_builder = local_var_req_builder.json(&set_login_type_for_user_request);
2598
2599 let local_var_req = local_var_req_builder.build()?;
2600 let local_var_resp = local_var_client.execute(local_var_req).await?;
2601
2602 let local_var_status = local_var_resp.status();
2603 let local_var_content = local_var_resp.text().await?;
2604
2605 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2606 crate::from_str_patched(&local_var_content).map_err(Error::from)
2607 } else {
2608 let local_var_entity: Option<SetLoginTypeForUserError> = crate::from_str_patched(&local_var_content).ok();
2609 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2610 Err(Error::ResponseError(local_var_error))
2611 }
2612}
2613
2614pub async fn set_onboarding_profile(configuration: &configuration::Configuration, set_onboarding_profile_request: models::SetOnboardingProfileRequest) -> Result<String, Error<SetOnboardingProfileError>> {
2615 let local_var_configuration = configuration;
2616
2617 let local_var_client = &local_var_configuration.client;
2618
2619 let local_var_uri_str = format!("{}/users/onboarding_profile", local_var_configuration.base_path);
2620 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2621
2622 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2623 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2624 }
2625 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2626 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2627 };
2628 local_var_req_builder = local_var_req_builder.json(&set_onboarding_profile_request);
2629
2630 let local_var_req = local_var_req_builder.build()?;
2631 let local_var_resp = local_var_client.execute(local_var_req).await?;
2632
2633 let local_var_status = local_var_resp.status();
2634 let local_var_content = local_var_resp.text().await?;
2635
2636 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2637 crate::from_str_patched(&local_var_content).map_err(Error::from)
2638 } else {
2639 let local_var_entity: Option<SetOnboardingProfileError> = crate::from_str_patched(&local_var_content).ok();
2640 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2641 Err(Error::ResponseError(local_var_error))
2642 }
2643}
2644
2645pub async fn set_password(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordError>> {
2646 let local_var_configuration = configuration;
2647
2648 let local_var_client = &local_var_configuration.client;
2649
2650 let local_var_uri_str = format!("{}/users/setpassword", local_var_configuration.base_path);
2651 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2652
2653 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2654 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2655 }
2656 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2657 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2658 };
2659 local_var_req_builder = local_var_req_builder.json(&set_password_request);
2660
2661 let local_var_req = local_var_req_builder.build()?;
2662 let local_var_resp = local_var_client.execute(local_var_req).await?;
2663
2664 let local_var_status = local_var_resp.status();
2665 let local_var_content = local_var_resp.text().await?;
2666
2667 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2668 crate::from_str_patched(&local_var_content).map_err(Error::from)
2669 } else {
2670 let local_var_entity: Option<SetPasswordError> = crate::from_str_patched(&local_var_content).ok();
2671 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2672 Err(Error::ResponseError(local_var_error))
2673 }
2674}
2675
2676pub async fn set_password_for_user(configuration: &configuration::Configuration, user: &str, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordForUserError>> {
2677 let local_var_configuration = configuration;
2678
2679 let local_var_client = &local_var_configuration.client;
2680
2681 let local_var_uri_str = format!("{}/users/set_password_of/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
2682 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2683
2684 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2685 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2686 }
2687 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2688 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2689 };
2690 local_var_req_builder = local_var_req_builder.json(&set_password_request);
2691
2692 let local_var_req = local_var_req_builder.build()?;
2693 let local_var_resp = local_var_client.execute(local_var_req).await?;
2694
2695 let local_var_status = local_var_resp.status();
2696 let local_var_content = local_var_resp.text().await?;
2697
2698 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2699 crate::from_str_patched(&local_var_content).map_err(Error::from)
2700 } else {
2701 let local_var_entity: Option<SetPasswordForUserError> = crate::from_str_patched(&local_var_content).ok();
2702 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2703 Err(Error::ResponseError(local_var_error))
2704 }
2705}
2706
2707pub async fn setup_totp(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<models::LoginTotpSetup200Response, Error<SetupTotpError>> {
2708 let local_var_configuration = configuration;
2709
2710 let local_var_client = &local_var_configuration.client;
2711
2712 let local_var_uri_str = format!("{}/users/totp/setup", local_var_configuration.base_path);
2713 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2714
2715 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2716 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2717 }
2718 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2719 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2720 };
2721 local_var_req_builder = local_var_req_builder.json(&set_password_request);
2722
2723 let local_var_req = local_var_req_builder.build()?;
2724 let local_var_resp = local_var_client.execute(local_var_req).await?;
2725
2726 let local_var_status = local_var_resp.status();
2727 let local_var_content = local_var_resp.text().await?;
2728
2729 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2730 crate::from_str_patched(&local_var_content).map_err(Error::from)
2731 } else {
2732 let local_var_entity: Option<SetupTotpError> = crate::from_str_patched(&local_var_content).ok();
2733 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2734 Err(Error::ResponseError(local_var_error))
2735 }
2736}
2737
2738pub async fn submit_onboarding_data(configuration: &configuration::Configuration, submit_onboarding_data_request: models::SubmitOnboardingDataRequest) -> Result<String, Error<SubmitOnboardingDataError>> {
2739 let local_var_configuration = configuration;
2740
2741 let local_var_client = &local_var_configuration.client;
2742
2743 let local_var_uri_str = format!("{}/users/onboarding", local_var_configuration.base_path);
2744 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2745
2746 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2747 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2748 }
2749 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2750 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2751 };
2752 local_var_req_builder = local_var_req_builder.json(&submit_onboarding_data_request);
2753
2754 let local_var_req = local_var_req_builder.build()?;
2755 let local_var_resp = local_var_client.execute(local_var_req).await?;
2756
2757 let local_var_status = local_var_resp.status();
2758 let local_var_content = local_var_resp.text().await?;
2759
2760 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2761 crate::from_str_patched(&local_var_content).map_err(Error::from)
2762 } else {
2763 let local_var_entity: Option<SubmitOnboardingDataError> = crate::from_str_patched(&local_var_content).ok();
2764 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2765 Err(Error::ResponseError(local_var_error))
2766 }
2767}
2768
2769pub async fn update_token_label(configuration: &configuration::Configuration, token_prefix: &str, update_token_label_request: models::UpdateTokenLabelRequest) -> Result<String, Error<UpdateTokenLabelError>> {
2770 let local_var_configuration = configuration;
2771
2772 let local_var_client = &local_var_configuration.client;
2773
2774 let local_var_uri_str = format!("{}/users/tokens/update_label/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2775 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2776
2777 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2778 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2779 }
2780 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2781 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2782 };
2783 local_var_req_builder = local_var_req_builder.json(&update_token_label_request);
2784
2785 let local_var_req = local_var_req_builder.build()?;
2786 let local_var_resp = local_var_client.execute(local_var_req).await?;
2787
2788 let local_var_status = local_var_resp.status();
2789 let local_var_content = local_var_resp.text().await?;
2790
2791 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2792 crate::from_str_patched(&local_var_content).map_err(Error::from)
2793 } else {
2794 let local_var_entity: Option<UpdateTokenLabelError> = crate::from_str_patched(&local_var_content).ok();
2795 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2796 Err(Error::ResponseError(local_var_error))
2797 }
2798}
2799
2800pub async fn update_token_limits(configuration: &configuration::Configuration, token_prefix: &str, update_token_limits_request: models::UpdateTokenLimitsRequest) -> Result<String, Error<UpdateTokenLimitsError>> {
2802 let local_var_configuration = configuration;
2803
2804 let local_var_client = &local_var_configuration.client;
2805
2806 let local_var_uri_str = format!("{}/users/tokens/update_limits/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2807 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2808
2809 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2810 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2811 }
2812 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2813 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2814 };
2815 local_var_req_builder = local_var_req_builder.json(&update_token_limits_request);
2816
2817 let local_var_req = local_var_req_builder.build()?;
2818 let local_var_resp = local_var_client.execute(local_var_req).await?;
2819
2820 let local_var_status = local_var_resp.status();
2821 let local_var_content = local_var_resp.text().await?;
2822
2823 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2824 crate::from_str_patched(&local_var_content).map_err(Error::from)
2825 } else {
2826 let local_var_entity: Option<UpdateTokenLimitsError> = crate::from_str_patched(&local_var_content).ok();
2827 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2828 Err(Error::ResponseError(local_var_error))
2829 }
2830}
2831
2832pub async fn update_token_scopes(configuration: &configuration::Configuration, token_prefix: &str, update_token_scopes_request: models::UpdateTokenScopesRequest) -> Result<String, Error<UpdateTokenScopesError>> {
2833 let local_var_configuration = configuration;
2834
2835 let local_var_client = &local_var_configuration.client;
2836
2837 let local_var_uri_str = format!("{}/users/tokens/update_scopes/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
2838 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2839
2840 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2841 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2842 }
2843 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2844 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2845 };
2846 local_var_req_builder = local_var_req_builder.json(&update_token_scopes_request);
2847
2848 let local_var_req = local_var_req_builder.build()?;
2849 let local_var_resp = local_var_client.execute(local_var_req).await?;
2850
2851 let local_var_status = local_var_resp.status();
2852 let local_var_content = local_var_resp.text().await?;
2853
2854 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2855 crate::from_str_patched(&local_var_content).map_err(Error::from)
2856 } else {
2857 let local_var_entity: Option<UpdateTokenScopesError> = crate::from_str_patched(&local_var_content).ok();
2858 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2859 Err(Error::ResponseError(local_var_error))
2860 }
2861}
2862
2863pub async fn update_tutorial_progress(configuration: &configuration::Configuration, get_tutorial_progress200_response: models::GetTutorialProgress200Response) -> Result<String, Error<UpdateTutorialProgressError>> {
2864 let local_var_configuration = configuration;
2865
2866 let local_var_client = &local_var_configuration.client;
2867
2868 let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
2869 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2870
2871 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2872 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2873 }
2874 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2875 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2876 };
2877 local_var_req_builder = local_var_req_builder.json(&get_tutorial_progress200_response);
2878
2879 let local_var_req = local_var_req_builder.build()?;
2880 let local_var_resp = local_var_client.execute(local_var_req).await?;
2881
2882 let local_var_status = local_var_resp.status();
2883 let local_var_content = local_var_resp.text().await?;
2884
2885 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2886 crate::from_str_patched(&local_var_content).map_err(Error::from)
2887 } else {
2888 let local_var_entity: Option<UpdateTutorialProgressError> = crate::from_str_patched(&local_var_content).ok();
2889 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2890 Err(Error::ResponseError(local_var_error))
2891 }
2892}
2893
2894pub async fn update_user(configuration: &configuration::Configuration, workspace: &str, username: &str, edit_workspace_user: models::EditWorkspaceUser) -> Result<String, Error<UpdateUserError>> {
2895 let local_var_configuration = configuration;
2896
2897 let local_var_client = &local_var_configuration.client;
2898
2899 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));
2900 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2901
2902 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2903 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2904 }
2905 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2906 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2907 };
2908 local_var_req_builder = local_var_req_builder.json(&edit_workspace_user);
2909
2910 let local_var_req = local_var_req_builder.build()?;
2911 let local_var_resp = local_var_client.execute(local_var_req).await?;
2912
2913 let local_var_status = local_var_resp.status();
2914 let local_var_content = local_var_resp.text().await?;
2915
2916 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2917 crate::from_str_patched(&local_var_content).map_err(Error::from)
2918 } else {
2919 let local_var_entity: Option<UpdateUserError> = crate::from_str_patched(&local_var_content).ok();
2920 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2921 Err(Error::ResponseError(local_var_error))
2922 }
2923}
2924
2925pub async fn username_to_email(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<UsernameToEmailError>> {
2926 let local_var_configuration = configuration;
2927
2928 let local_var_client = &local_var_configuration.client;
2929
2930 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));
2931 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2932
2933 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2934 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2935 }
2936 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2937 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2938 };
2939
2940 let local_var_req = local_var_req_builder.build()?;
2941 let local_var_resp = local_var_client.execute(local_var_req).await?;
2942
2943 let local_var_status = local_var_resp.status();
2944 let local_var_content = local_var_resp.text().await?;
2945
2946 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2947 crate::from_str_patched(&local_var_content).map_err(Error::from)
2948 } else {
2949 let local_var_entity: Option<UsernameToEmailError> = crate::from_str_patched(&local_var_content).ok();
2950 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2951 Err(Error::ResponseError(local_var_error))
2952 }
2953}
2954
2955pub async fn whoami(configuration: &configuration::Configuration, workspace: &str) -> Result<models::User, Error<WhoamiError>> {
2956 let local_var_configuration = configuration;
2957
2958 let local_var_client = &local_var_configuration.client;
2959
2960 let local_var_uri_str = format!("{}/w/{workspace}/users/whoami", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
2961 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2962
2963 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2964 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2965 }
2966 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2967 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2968 };
2969
2970 let local_var_req = local_var_req_builder.build()?;
2971 let local_var_resp = local_var_client.execute(local_var_req).await?;
2972
2973 let local_var_status = local_var_resp.status();
2974 let local_var_content = local_var_resp.text().await?;
2975
2976 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2977 crate::from_str_patched(&local_var_content).map_err(Error::from)
2978 } else {
2979 let local_var_entity: Option<WhoamiError> = crate::from_str_patched(&local_var_content).ok();
2980 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
2981 Err(Error::ResponseError(local_var_error))
2982 }
2983}
2984
2985pub async fn whois(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<WhoisError>> {
2986 let local_var_configuration = configuration;
2987
2988 let local_var_client = &local_var_configuration.client;
2989
2990 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));
2991 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2992
2993 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2994 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2995 }
2996 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
2997 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
2998 };
2999
3000 let local_var_req = local_var_req_builder.build()?;
3001 let local_var_resp = local_var_client.execute(local_var_req).await?;
3002
3003 let local_var_status = local_var_resp.status();
3004 let local_var_content = local_var_resp.text().await?;
3005
3006 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3007 crate::from_str_patched(&local_var_content).map_err(Error::from)
3008 } else {
3009 let local_var_entity: Option<WhoisError> = crate::from_str_patched(&local_var_content).ok();
3010 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
3011 Err(Error::ResponseError(local_var_error))
3012 }
3013}
3014