1pub mod delegated;
4pub mod types;
5
6#[allow(unused_imports)]
7use types::*;
8
9#[derive(Clone)]
11pub struct AuthClient {
12 client: crate::client::Client,
13}
14
15impl AuthClient {
16 pub fn new(client: crate::client::Client) -> Self {
17 AuthClient { client }
18 }
19
20 pub async fn create_user_action_signature(
25 &self,
26 body: CreateUserActionSignatureRequest,
27 ) -> Result<CreateUserActionSignatureResponse, crate::error::Error> {
28 let path = String::from("/auth/action");
29 let body = serde_json::to_value(&body)?;
30 self.client
31 .request::<CreateUserActionSignatureResponse>(
32 reqwest::Method::POST,
33 &path,
34 Some(&body),
35 false,
36 )
37 .await
38 }
39
40 pub async fn create_user_action_challenge(
44 &self,
45 body: CreateUserActionChallengeRequest,
46 ) -> Result<CreateUserActionChallengeResponse, crate::error::Error> {
47 let path = String::from("/auth/action/init");
48 let body = serde_json::to_value(&body)?;
49 self.client
50 .request::<CreateUserActionChallengeResponse>(
51 reqwest::Method::POST,
52 &path,
53 Some(&body),
54 false,
55 )
56 .await
57 }
58
59 pub async fn list_audit_logs(
64 &self,
65 query: Option<ListAuditLogsQuery>,
66 ) -> Result<(), crate::error::Error> {
67 let mut path = String::from("/auth/action/logs");
68 if let Some(query) = &query {
69 let mut q: Vec<String> = Vec::new();
70 q.push(format!(
71 "startTime={}",
72 urlencoding::encode(&query.start_time.to_string())
73 ));
74 q.push(format!(
75 "endTime={}",
76 urlencoding::encode(&query.end_time.to_string())
77 ));
78 if let Some(v) = &query.user_id {
79 q.push(format!("userId={}", urlencoding::encode(&v.to_string())));
80 }
81 if !q.is_empty() {
82 path.push('?');
83 path.push_str(&q.join("&"));
84 }
85 }
86 self.client
87 .request_no_content(reqwest::Method::GET, &path, None, false)
88 .await
89 }
90
91 pub async fn get_audit_log(
95 &self,
96 id: String,
97 ) -> Result<GetAuditLogResponse, crate::error::Error> {
98 let path = format!("/auth/action/logs/{}", urlencoding::encode(&id));
99 self.client
100 .request::<GetAuditLogResponse>(reqwest::Method::GET, &path, None, false)
101 .await
102 }
103
104 #[deprecated(note = "This endpoint is deprecated.")]
108 pub async fn list_applications(&self) -> Result<ListApplicationsResponse, crate::error::Error> {
109 let path = String::from("/auth/apps");
110 self.client
111 .request::<ListApplicationsResponse>(reqwest::Method::GET, &path, None, false)
112 .await
113 }
114
115 #[deprecated(note = "This endpoint is deprecated.")]
119 pub async fn get_application(
120 &self,
121 app_id: String,
122 ) -> Result<GetApplicationResponse, crate::error::Error> {
123 let path = format!("/auth/apps/{}", urlencoding::encode(&app_id));
124 self.client
125 .request::<GetApplicationResponse>(reqwest::Method::GET, &path, None, false)
126 .await
127 }
128
129 pub async fn list_credentials(&self) -> Result<ListCredentialsResponse, crate::error::Error> {
131 let path = String::from("/auth/credentials");
132 self.client
133 .request::<ListCredentialsResponse>(reqwest::Method::GET, &path, None, false)
134 .await
135 }
136
137 pub async fn create_credential(
141 &self,
142 body: CreateCredentialRequest,
143 ) -> Result<CreateCredentialResponse, crate::error::Error> {
144 let path = String::from("/auth/credentials");
145 let body = serde_json::to_value(&body)?;
146 self.client
147 .request::<CreateCredentialResponse>(reqwest::Method::POST, &path, Some(&body), true)
148 .await
149 }
150
151 pub async fn create_credential_challenge(
155 &self,
156 body: CreateCredentialChallengeRequest,
157 ) -> Result<serde_json::Value, crate::error::Error> {
158 let path = String::from("/auth/credentials/init");
159 let body = serde_json::to_value(&body)?;
160 self.client
161 .request::<serde_json::Value>(reqwest::Method::POST, &path, Some(&body), false)
162 .await
163 }
164
165 pub async fn activate_credential(
167 &self,
168 body: ActivateCredentialRequest,
169 ) -> Result<ActivateCredentialResponse, crate::error::Error> {
170 let path = String::from("/auth/credentials/activate");
171 let body = serde_json::to_value(&body)?;
172 self.client
173 .request::<ActivateCredentialResponse>(reqwest::Method::PUT, &path, Some(&body), true)
174 .await
175 }
176
177 pub async fn delete_credential(
179 &self,
180 credential_uuid: String,
181 ) -> Result<DeleteCredentialResponse, crate::error::Error> {
182 let path = format!(
183 "/auth/credentials/{}",
184 urlencoding::encode(&credential_uuid)
185 );
186 self.client
187 .request::<DeleteCredentialResponse>(reqwest::Method::DELETE, &path, None, true)
188 .await
189 }
190
191 pub async fn deactivate_credential(
193 &self,
194 body: DeactivateCredentialRequest,
195 ) -> Result<DeactivateCredentialResponse, crate::error::Error> {
196 let path = String::from("/auth/credentials/deactivate");
197 let body = serde_json::to_value(&body)?;
198 self.client
199 .request::<DeactivateCredentialResponse>(reqwest::Method::PUT, &path, Some(&body), true)
200 .await
201 }
202
203 pub async fn create_credential_code(
207 &self,
208 body: CreateCredentialCodeRequest,
209 ) -> Result<CreateCredentialCodeResponse, crate::error::Error> {
210 let path = String::from("/auth/credentials/code");
211 let body = serde_json::to_value(&body)?;
212 self.client
213 .request::<CreateCredentialCodeResponse>(
214 reqwest::Method::POST,
215 &path,
216 Some(&body),
217 true,
218 )
219 .await
220 }
221
222 pub async fn create_credential_challenge_with_code(
226 &self,
227 body: CreateCredentialChallengeWithCodeRequest,
228 ) -> Result<serde_json::Value, crate::error::Error> {
229 let path = String::from("/auth/credentials/code/init");
230 let body = serde_json::to_value(&body)?;
231 self.client
232 .request::<serde_json::Value>(reqwest::Method::POST, &path, Some(&body), false)
233 .await
234 }
235
236 pub async fn create_credential_with_code(
241 &self,
242 body: CreateCredentialWithCodeRequest,
243 ) -> Result<CreateCredentialWithCodeResponse, crate::error::Error> {
244 let path = String::from("/auth/credentials/code/verify");
245 let body = serde_json::to_value(&body)?;
246 self.client
247 .request::<CreateCredentialWithCodeResponse>(
248 reqwest::Method::POST,
249 &path,
250 Some(&body),
251 false,
252 )
253 .await
254 }
255
256 pub async fn create_login_challenge(
261 &self,
262 body: CreateLoginChallengeRequest,
263 ) -> Result<CreateLoginChallengeResponse, crate::error::Error> {
264 let path = String::from("/auth/login/init");
265 let body = serde_json::to_value(&body)?;
266 self.client
267 .request::<CreateLoginChallengeResponse>(
268 reqwest::Method::POST,
269 &path,
270 Some(&body),
271 false,
272 )
273 .await
274 }
275
276 pub async fn delegated_login(
281 &self,
282 body: DelegatedLoginRequest,
283 ) -> Result<DelegatedLoginResponse, crate::error::Error> {
284 let path = String::from("/auth/login/delegated");
285 let body = serde_json::to_value(&body)?;
286 self.client
287 .request::<DelegatedLoginResponse>(reqwest::Method::POST, &path, Some(&body), true)
288 .await
289 }
290
291 pub async fn complete_user_login(
296 &self,
297 body: CompleteUserLoginRequest,
298 ) -> Result<serde_json::Value, crate::error::Error> {
299 let path = String::from("/auth/login");
300 let body = serde_json::to_value(&body)?;
301 self.client
302 .request::<serde_json::Value>(reqwest::Method::POST, &path, Some(&body), false)
303 .await
304 }
305
306 pub async fn logout(&self, body: LogoutRequest) -> Result<LogoutResponse, crate::error::Error> {
308 let path = String::from("/auth/logout");
309 let body = serde_json::to_value(&body)?;
310 self.client
311 .request::<LogoutResponse>(reqwest::Method::PUT, &path, Some(&body), false)
312 .await
313 }
314
315 pub async fn complete_oidc_login(
317 &self,
318 body: CompleteOidcLoginRequest,
319 ) -> Result<serde_json::Value, crate::error::Error> {
320 let path = String::from("/auth/login/oidc");
321 let body = serde_json::to_value(&body)?;
322 self.client
323 .request::<serde_json::Value>(reqwest::Method::POST, &path, Some(&body), false)
324 .await
325 }
326
327 pub async fn initiate_oidc_login(
329 &self,
330 body: InitiateOidcLoginRequest,
331 ) -> Result<InitiateOidcLoginResponse, crate::error::Error> {
332 let path = String::from("/auth/login/oidc/init");
333 let body = serde_json::to_value(&body)?;
334 self.client
335 .request::<InitiateOidcLoginResponse>(reqwest::Method::POST, &path, Some(&body), false)
336 .await
337 }
338
339 pub async fn send_login_code(
343 &self,
344 body: SendLoginCodeRequest,
345 ) -> Result<SendLoginCodeResponse, crate::error::Error> {
346 let path = String::from("/auth/login/code");
347 let body = serde_json::to_value(&body)?;
348 self.client
349 .request::<SendLoginCodeResponse>(reqwest::Method::POST, &path, Some(&body), false)
350 .await
351 }
352
353 pub async fn social_login(
355 &self,
356 body: SocialLoginRequest,
357 ) -> Result<SocialLoginResponse, crate::error::Error> {
358 let path = String::from("/auth/login/social");
359 let body = serde_json::to_value(&body)?;
360 self.client
361 .request::<SocialLoginResponse>(reqwest::Method::POST, &path, Some(&body), false)
362 .await
363 }
364
365 pub async fn complete_sso_login(
367 &self,
368 body: CompleteSsoLoginRequest,
369 ) -> Result<CompleteSsoLoginResponse, crate::error::Error> {
370 let path = String::from("/auth/login/sso");
371 let body = serde_json::to_value(&body)?;
372 self.client
373 .request::<CompleteSsoLoginResponse>(reqwest::Method::POST, &path, Some(&body), false)
374 .await
375 }
376
377 pub async fn initiate_sso_login(
379 &self,
380 body: InitiateSsoLoginRequest,
381 ) -> Result<InitiateSsoLoginResponse, crate::error::Error> {
382 let path = String::from("/auth/login/sso/init");
383 let body = serde_json::to_value(&body)?;
384 self.client
385 .request::<InitiateSsoLoginResponse>(reqwest::Method::POST, &path, Some(&body), false)
386 .await
387 }
388
389 pub async fn exchange_access_token(
391 &self,
392 body: ExchangeAccessTokenRequest,
393 ) -> Result<ExchangeAccessTokenResponse, crate::error::Error> {
394 let path = String::from("/auth/tokens");
395 let body = serde_json::to_value(&body)?;
396 self.client
397 .request::<ExchangeAccessTokenResponse>(
398 reqwest::Method::POST,
399 &path,
400 Some(&body),
401 false,
402 )
403 .await
404 }
405
406 pub async fn list_personal_access_tokens(
408 &self,
409 ) -> Result<ListPersonalAccessTokensResponse, crate::error::Error> {
410 let path = String::from("/auth/pats");
411 self.client
412 .request::<ListPersonalAccessTokensResponse>(reqwest::Method::GET, &path, None, false)
413 .await
414 }
415
416 pub async fn create_personal_access_token(
418 &self,
419 body: CreatePersonalAccessTokenRequest,
420 ) -> Result<CreatePersonalAccessTokenResponse, crate::error::Error> {
421 let path = String::from("/auth/pats");
422 let body = serde_json::to_value(&body)?;
423 self.client
424 .request::<CreatePersonalAccessTokenResponse>(
425 reqwest::Method::POST,
426 &path,
427 Some(&body),
428 true,
429 )
430 .await
431 }
432
433 pub async fn get_personal_access_token(
435 &self,
436 token_id: String,
437 ) -> Result<GetPersonalAccessTokenResponse, crate::error::Error> {
438 let path = format!("/auth/pats/{}", urlencoding::encode(&token_id));
439 self.client
440 .request::<GetPersonalAccessTokenResponse>(reqwest::Method::GET, &path, None, false)
441 .await
442 }
443
444 pub async fn update_personal_access_token(
446 &self,
447 token_id: String,
448 body: UpdatePersonalAccessTokenRequest,
449 ) -> Result<UpdatePersonalAccessTokenResponse, crate::error::Error> {
450 let path = format!("/auth/pats/{}", urlencoding::encode(&token_id));
451 let body = serde_json::to_value(&body)?;
452 self.client
453 .request::<UpdatePersonalAccessTokenResponse>(
454 reqwest::Method::PUT,
455 &path,
456 Some(&body),
457 true,
458 )
459 .await
460 }
461
462 pub async fn delete_personal_access_token(
464 &self,
465 token_id: String,
466 ) -> Result<DeletePersonalAccessTokenResponse, crate::error::Error> {
467 let path = format!("/auth/pats/{}", urlencoding::encode(&token_id));
468 self.client
469 .request::<DeletePersonalAccessTokenResponse>(
470 reqwest::Method::DELETE,
471 &path,
472 None,
473 true,
474 )
475 .await
476 }
477
478 pub async fn activate_personal_access_token(
480 &self,
481 token_id: String,
482 ) -> Result<ActivatePersonalAccessTokenResponse, crate::error::Error> {
483 let path = format!("/auth/pats/{}/activate", urlencoding::encode(&token_id));
484 self.client
485 .request::<ActivatePersonalAccessTokenResponse>(reqwest::Method::PUT, &path, None, true)
486 .await
487 }
488
489 pub async fn deactivate_personal_access_token(
491 &self,
492 token_id: String,
493 ) -> Result<DeactivatePersonalAccessTokenResponse, crate::error::Error> {
494 let path = format!("/auth/pats/{}/deactivate", urlencoding::encode(&token_id));
495 self.client
496 .request::<DeactivatePersonalAccessTokenResponse>(
497 reqwest::Method::PUT,
498 &path,
499 None,
500 true,
501 )
502 .await
503 }
504
505 pub async fn create_delegated_recovery_challenge(
510 &self,
511 body: CreateDelegatedRecoveryChallengeRequest,
512 ) -> Result<CreateDelegatedRecoveryChallengeResponse, crate::error::Error> {
513 let path = String::from("/auth/recover/user/delegated");
514 let body = serde_json::to_value(&body)?;
515 self.client
516 .request::<CreateDelegatedRecoveryChallengeResponse>(
517 reqwest::Method::POST,
518 &path,
519 Some(&body),
520 true,
521 )
522 .await
523 }
524
525 pub async fn recover_user(
530 &self,
531 body: RecoverUserRequest,
532 ) -> Result<RecoverUserResponse, crate::error::Error> {
533 let path = String::from("/auth/recover/user");
534 let body = serde_json::to_value(&body)?;
535 self.client
536 .request::<RecoverUserResponse>(reqwest::Method::POST, &path, Some(&body), false)
537 .await
538 }
539
540 pub async fn create_recovery_challenge(
542 &self,
543 body: CreateRecoveryChallengeRequest,
544 ) -> Result<CreateRecoveryChallengeResponse, crate::error::Error> {
545 let path = String::from("/auth/recover/user/init");
546 let body = serde_json::to_value(&body)?;
547 self.client
548 .request::<CreateRecoveryChallengeResponse>(
549 reqwest::Method::POST,
550 &path,
551 Some(&body),
552 false,
553 )
554 .await
555 }
556
557 pub async fn send_recovery_code_email(
559 &self,
560 body: SendRecoveryCodeEmailRequest,
561 ) -> Result<SendRecoveryCodeEmailResponse, crate::error::Error> {
562 let path = String::from("/auth/recover/user/code");
563 let body = serde_json::to_value(&body)?;
564 self.client
565 .request::<SendRecoveryCodeEmailResponse>(
566 reqwest::Method::POST,
567 &path,
568 Some(&body),
569 false,
570 )
571 .await
572 }
573
574 pub async fn create_delegated_registration_challenge(
579 &self,
580 body: CreateDelegatedRegistrationChallengeRequest,
581 ) -> Result<CreateDelegatedRegistrationChallengeResponse, crate::error::Error> {
582 let path = String::from("/auth/registration/delegated");
583 let body = serde_json::to_value(&body)?;
584 self.client
585 .request::<CreateDelegatedRegistrationChallengeResponse>(
586 reqwest::Method::POST,
587 &path,
588 Some(&body),
589 true,
590 )
591 .await
592 }
593
594 pub async fn create_registration_challenge(
596 &self,
597 body: CreateRegistrationChallengeRequest,
598 ) -> Result<CreateRegistrationChallengeResponse, crate::error::Error> {
599 let path = String::from("/auth/registration/init");
600 let body = serde_json::to_value(&body)?;
601 self.client
602 .request::<CreateRegistrationChallengeResponse>(
603 reqwest::Method::POST,
604 &path,
605 Some(&body),
606 false,
607 )
608 .await
609 }
610
611 pub async fn create_social_registration_challenge(
613 &self,
614 body: CreateSocialRegistrationChallengeRequest,
615 ) -> Result<CreateSocialRegistrationChallengeResponse, crate::error::Error> {
616 let path = String::from("/auth/registration/social");
617 let body = serde_json::to_value(&body)?;
618 self.client
619 .request::<CreateSocialRegistrationChallengeResponse>(
620 reqwest::Method::POST,
621 &path,
622 Some(&body),
623 false,
624 )
625 .await
626 }
627
628 pub async fn complete_user_registration(
633 &self,
634 body: CompleteUserRegistrationRequest,
635 ) -> Result<CompleteUserRegistrationResponse, crate::error::Error> {
636 let path = String::from("/auth/registration");
637 let body = serde_json::to_value(&body)?;
638 self.client
639 .request::<CompleteUserRegistrationResponse>(
640 reqwest::Method::POST,
641 &path,
642 Some(&body),
643 false,
644 )
645 .await
646 }
647
648 pub async fn complete_end_user_registration_with_wallets(
653 &self,
654 body: CompleteEndUserRegistrationWithWalletsRequest,
655 ) -> Result<CompleteEndUserRegistrationWithWalletsResponse, crate::error::Error> {
656 let path = String::from("/auth/registration/enduser");
657 let body = serde_json::to_value(&body)?;
658 self.client
659 .request::<CompleteEndUserRegistrationWithWalletsResponse>(
660 reqwest::Method::POST,
661 &path,
662 Some(&body),
663 false,
664 )
665 .await
666 }
667
668 pub async fn resend_registration_code(
670 &self,
671 body: ResendRegistrationCodeRequest,
672 ) -> Result<ResendRegistrationCodeResponse, crate::error::Error> {
673 let path = String::from("/auth/registration/code");
674 let body = serde_json::to_value(&body)?;
675 self.client
676 .request::<ResendRegistrationCodeResponse>(
677 reqwest::Method::PUT,
678 &path,
679 Some(&body),
680 false,
681 )
682 .await
683 }
684
685 pub async fn list_service_accounts(
687 &self,
688 ) -> Result<ListServiceAccountsResponse, crate::error::Error> {
689 let path = String::from("/auth/service-accounts");
690 self.client
691 .request::<ListServiceAccountsResponse>(reqwest::Method::GET, &path, None, false)
692 .await
693 }
694
695 pub async fn create_service_account(
697 &self,
698 body: CreateServiceAccountRequest,
699 ) -> Result<CreateServiceAccountResponse, crate::error::Error> {
700 let path = String::from("/auth/service-accounts");
701 let body = serde_json::to_value(&body)?;
702 self.client
703 .request::<CreateServiceAccountResponse>(
704 reqwest::Method::POST,
705 &path,
706 Some(&body),
707 true,
708 )
709 .await
710 }
711
712 pub async fn get_service_account(
714 &self,
715 service_account_id: String,
716 ) -> Result<GetServiceAccountResponse, crate::error::Error> {
717 let path = format!(
718 "/auth/service-accounts/{}",
719 urlencoding::encode(&service_account_id)
720 );
721 self.client
722 .request::<GetServiceAccountResponse>(reqwest::Method::GET, &path, None, false)
723 .await
724 }
725
726 pub async fn update_service_account(
728 &self,
729 service_account_id: String,
730 body: UpdateServiceAccountRequest,
731 ) -> Result<UpdateServiceAccountResponse, crate::error::Error> {
732 let path = format!(
733 "/auth/service-accounts/{}",
734 urlencoding::encode(&service_account_id)
735 );
736 let body = serde_json::to_value(&body)?;
737 self.client
738 .request::<UpdateServiceAccountResponse>(reqwest::Method::PUT, &path, Some(&body), true)
739 .await
740 }
741
742 pub async fn delete_service_account(
744 &self,
745 service_account_id: String,
746 query: Option<DeleteServiceAccountQuery>,
747 ) -> Result<DeleteServiceAccountResponse, crate::error::Error> {
748 let mut path = format!(
749 "/auth/service-accounts/{}",
750 urlencoding::encode(&service_account_id)
751 );
752 if let Some(query) = &query {
753 let mut q: Vec<String> = Vec::new();
754 if let Some(v) = &query.force {
755 q.push(format!("force={}", urlencoding::encode(&v.to_string())));
756 }
757 if !q.is_empty() {
758 path.push('?');
759 path.push_str(&q.join("&"));
760 }
761 }
762 self.client
763 .request::<DeleteServiceAccountResponse>(reqwest::Method::DELETE, &path, None, true)
764 .await
765 }
766
767 pub async fn activate_service_account(
769 &self,
770 service_account_id: String,
771 ) -> Result<ActivateServiceAccountResponse, crate::error::Error> {
772 let path = format!(
773 "/auth/service-accounts/{}/activate",
774 urlencoding::encode(&service_account_id)
775 );
776 self.client
777 .request::<ActivateServiceAccountResponse>(reqwest::Method::PUT, &path, None, true)
778 .await
779 }
780
781 pub async fn deactivate_service_account(
783 &self,
784 service_account_id: String,
785 body: DeactivateServiceAccountRequest,
786 ) -> Result<DeactivateServiceAccountResponse, crate::error::Error> {
787 let path = format!(
788 "/auth/service-accounts/{}/deactivate",
789 urlencoding::encode(&service_account_id)
790 );
791 let body = serde_json::to_value(&body)?;
792 self.client
793 .request::<DeactivateServiceAccountResponse>(
794 reqwest::Method::PUT,
795 &path,
796 Some(&body),
797 true,
798 )
799 .await
800 }
801
802 pub async fn activate_user(
804 &self,
805 user_id: String,
806 ) -> Result<ActivateUserResponse, crate::error::Error> {
807 let path = format!("/auth/users/{}/activate", urlencoding::encode(&user_id));
808 self.client
809 .request::<ActivateUserResponse>(reqwest::Method::PUT, &path, None, true)
810 .await
811 }
812
813 pub async fn deactivate_user(
815 &self,
816 user_id: String,
817 ) -> Result<DeactivateUserResponse, crate::error::Error> {
818 let path = format!("/auth/users/{}/deactivate", urlencoding::encode(&user_id));
819 self.client
820 .request::<DeactivateUserResponse>(reqwest::Method::PUT, &path, None, true)
821 .await
822 }
823
824 pub async fn get_user(&self, user_id: String) -> Result<GetUserResponse, crate::error::Error> {
826 let path = format!("/auth/users/{}", urlencoding::encode(&user_id));
827 self.client
828 .request::<GetUserResponse>(reqwest::Method::GET, &path, None, false)
829 .await
830 }
831
832 pub async fn update_user(
834 &self,
835 user_id: String,
836 body: UpdateUserRequest,
837 ) -> Result<UpdateUserResponse, crate::error::Error> {
838 let path = format!("/auth/users/{}", urlencoding::encode(&user_id));
839 let body = serde_json::to_value(&body)?;
840 self.client
841 .request::<UpdateUserResponse>(reqwest::Method::PUT, &path, Some(&body), true)
842 .await
843 }
844
845 pub async fn delete_user(
847 &self,
848 user_id: String,
849 ) -> Result<DeleteUserResponse, crate::error::Error> {
850 let path = format!("/auth/users/{}", urlencoding::encode(&user_id));
851 self.client
852 .request::<DeleteUserResponse>(reqwest::Method::DELETE, &path, None, true)
853 .await
854 }
855
856 pub async fn list_users(
858 &self,
859 query: Option<ListUsersQuery>,
860 ) -> Result<ListUsersResponse, crate::error::Error> {
861 let mut path = String::from("/auth/users");
862 if let Some(query) = &query {
863 let mut q: Vec<String> = Vec::new();
864 if let Some(v) = &query.limit {
865 q.push(format!("limit={}", urlencoding::encode(&v.to_string())));
866 }
867 if let Some(v) = &query.pagination_token {
868 q.push(format!(
869 "paginationToken={}",
870 urlencoding::encode(&v.to_string())
871 ));
872 }
873 if let Some(v) = &query.kind {
874 q.push(format!("kind={}", urlencoding::encode(&v.to_string())));
875 }
876 if !q.is_empty() {
877 path.push('?');
878 path.push_str(&q.join("&"));
879 }
880 }
881 self.client
882 .request::<ListUsersResponse>(reqwest::Method::GET, &path, None, false)
883 .await
884 }
885
886 pub async fn create_user(
891 &self,
892 body: CreateUserRequest,
893 ) -> Result<CreateUserResponse, crate::error::Error> {
894 let path = String::from("/auth/users");
895 let body = serde_json::to_value(&body)?;
896 self.client
897 .request::<CreateUserResponse>(reqwest::Method::POST, &path, Some(&body), true)
898 .await
899 }
900
901 pub async fn invite_tenant_user(
903 &self,
904 body: InviteTenantUserRequest,
905 ) -> Result<InviteTenantUserResponse, crate::error::Error> {
906 let path = String::from("/auth/users/invite");
907 let body = serde_json::to_value(&body)?;
908 self.client
909 .request::<InviteTenantUserResponse>(reqwest::Method::POST, &path, Some(&body), true)
910 .await
911 }
912}