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