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