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