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