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