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