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