1use crate::Client;
2use crate::ClientResult;
3
4pub struct Applications {
5 pub client: Client,
6}
7
8impl Applications {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 Applications { client }
12 }
13
14 pub async fn list(
31 &self,
32 q: &str,
33 after: &str,
34 limit: i64,
35 filter: &str,
36 expand: &str,
37 include_non_deleted: bool,
38 ) -> ClientResult<crate::Response<Vec<crate::types::Application>>> {
39 let mut query_args: Vec<(String, String)> = Default::default();
40 if !after.is_empty() {
41 query_args.push(("after".to_string(), after.to_string()));
42 }
43 if !expand.is_empty() {
44 query_args.push(("expand".to_string(), expand.to_string()));
45 }
46 if !filter.is_empty() {
47 query_args.push(("filter".to_string(), filter.to_string()));
48 }
49 if include_non_deleted {
50 query_args.push((
51 "includeNonDeleted".to_string(),
52 include_non_deleted.to_string(),
53 ));
54 }
55 if limit > 0 {
56 query_args.push(("limit".to_string(), limit.to_string()));
57 }
58 if !q.is_empty() {
59 query_args.push(("q".to_string(), q.to_string()));
60 }
61 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
62 let url = self.client.url(&format!("/api/v1/apps?{}", query_), None);
63 self.client
64 .get(
65 &url,
66 crate::Message {
67 body: None,
68 content_type: None,
69 },
70 )
71 .await
72 }
73 pub async fn list_all(
83 &self,
84 q: &str,
85 filter: &str,
86 expand: &str,
87 include_non_deleted: bool,
88 ) -> ClientResult<crate::Response<Vec<crate::types::Application>>> {
89 let mut query_args: Vec<(String, String)> = Default::default();
90 if !expand.is_empty() {
91 query_args.push(("expand".to_string(), expand.to_string()));
92 }
93 if !filter.is_empty() {
94 query_args.push(("filter".to_string(), filter.to_string()));
95 }
96 if include_non_deleted {
97 query_args.push((
98 "includeNonDeleted".to_string(),
99 include_non_deleted.to_string(),
100 ));
101 }
102 if !q.is_empty() {
103 query_args.push(("q".to_string(), q.to_string()));
104 }
105 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
106 let url = self.client.url(&format!("/api/v1/apps?{}", query_), None);
107 self.client
108 .get_all_pages(
109 &url,
110 crate::Message {
111 body: None,
112 content_type: None,
113 },
114 )
115 .await
116 }
117 pub async fn create(
130 &self,
131 activate: bool,
132 body: &crate::types::Application,
133 ) -> ClientResult<crate::Response<crate::types::Application>> {
134 let mut query_args: Vec<(String, String)> = Default::default();
135 if activate {
136 query_args.push(("activate".to_string(), activate.to_string()));
137 }
138 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
139 let url = self.client.url(&format!("/api/v1/apps?{}", query_), None);
140 self.client
141 .post(
142 &url,
143 crate::Message {
144 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
145 content_type: None,
146 },
147 )
148 .await
149 }
150 pub async fn get(
163 &self,
164 app_id: &str,
165 expand: &str,
166 ) -> ClientResult<crate::Response<crate::types::Application>> {
167 let mut query_args: Vec<(String, String)> = Default::default();
168 if !expand.is_empty() {
169 query_args.push(("expand".to_string(), expand.to_string()));
170 }
171 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
172 let url = self.client.url(
173 &format!(
174 "/api/v1/apps/{}?{}",
175 crate::progenitor_support::encode_path(app_id),
176 query_
177 ),
178 None,
179 );
180 self.client
181 .get(
182 &url,
183 crate::Message {
184 body: None,
185 content_type: None,
186 },
187 )
188 .await
189 }
190 pub async fn update(
202 &self,
203 app_id: &str,
204 body: &crate::types::Application,
205 ) -> ClientResult<crate::Response<crate::types::Application>> {
206 let url = self.client.url(
207 &format!(
208 "/api/v1/apps/{}",
209 crate::progenitor_support::encode_path(app_id),
210 ),
211 None,
212 );
213 self.client
214 .put(
215 &url,
216 crate::Message {
217 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
218 content_type: None,
219 },
220 )
221 .await
222 }
223 pub async fn delete(&self, app_id: &str) -> ClientResult<crate::Response<()>> {
235 let url = self.client.url(
236 &format!(
237 "/api/v1/apps/{}",
238 crate::progenitor_support::encode_path(app_id),
239 ),
240 None,
241 );
242 self.client
243 .delete(
244 &url,
245 crate::Message {
246 body: None,
247 content_type: None,
248 },
249 )
250 .await
251 }
252 pub async fn list_csrs_fors(
264 &self,
265 app_id: &str,
266 ) -> ClientResult<crate::Response<Vec<crate::types::Csr>>> {
267 let url = self.client.url(
268 &format!(
269 "/api/v1/apps/{}/credentials/csrs",
270 crate::progenitor_support::encode_path(app_id),
271 ),
272 None,
273 );
274 self.client
275 .get(
276 &url,
277 crate::Message {
278 body: None,
279 content_type: None,
280 },
281 )
282 .await
283 }
284 pub async fn list_all_csrs_fors(
294 &self,
295 app_id: &str,
296 ) -> ClientResult<crate::Response<Vec<crate::types::Csr>>> {
297 let url = self.client.url(
298 &format!(
299 "/api/v1/apps/{}/credentials/csrs",
300 crate::progenitor_support::encode_path(app_id),
301 ),
302 None,
303 );
304 self.client
305 .get_all_pages(
306 &url,
307 crate::Message {
308 body: None,
309 content_type: None,
310 },
311 )
312 .await
313 }
314 pub async fn generate_csr_for(
326 &self,
327 app_id: &str,
328 body: &crate::types::CsrMetadata,
329 ) -> ClientResult<crate::Response<crate::types::Csr>> {
330 let url = self.client.url(
331 &format!(
332 "/api/v1/apps/{}/credentials/csrs",
333 crate::progenitor_support::encode_path(app_id),
334 ),
335 None,
336 );
337 self.client
338 .post(
339 &url,
340 crate::Message {
341 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
342 content_type: None,
343 },
344 )
345 .await
346 }
347 pub async fn get_csr_for(
356 &self,
357 app_id: &str,
358 csr_id: &str,
359 ) -> ClientResult<crate::Response<crate::types::Csr>> {
360 let url = self.client.url(
361 &format!(
362 "/api/v1/apps/{}/credentials/csrs/{}",
363 crate::progenitor_support::encode_path(app_id),
364 crate::progenitor_support::encode_path(csr_id),
365 ),
366 None,
367 );
368 self.client
369 .get(
370 &url,
371 crate::Message {
372 body: None,
373 content_type: None,
374 },
375 )
376 .await
377 }
378 pub async fn revoke_csr_from(
387 &self,
388 app_id: &str,
389 csr_id: &str,
390 ) -> ClientResult<crate::Response<()>> {
391 let url = self.client.url(
392 &format!(
393 "/api/v1/apps/{}/credentials/csrs/{}",
394 crate::progenitor_support::encode_path(app_id),
395 crate::progenitor_support::encode_path(csr_id),
396 ),
397 None,
398 );
399 self.client
400 .delete(
401 &url,
402 crate::Message {
403 body: None,
404 content_type: None,
405 },
406 )
407 .await
408 }
409 pub async fn post_app_credentials_csr_lifecycle_publish(
418 &self,
419 app_id: &str,
420 csr_id: &str,
421 ) -> ClientResult<crate::Response<crate::types::JsonWebKey>> {
422 let url = self.client.url(
423 &format!(
424 "/api/v1/apps/{}/credentials/csrs/{}/lifecycle/publish",
425 crate::progenitor_support::encode_path(app_id),
426 crate::progenitor_support::encode_path(csr_id),
427 ),
428 None,
429 );
430 self.client
431 .post(
432 &url,
433 crate::Message {
434 body: None,
435 content_type: None,
436 },
437 )
438 .await
439 }
440 pub async fn list_keys(
452 &self,
453 app_id: &str,
454 ) -> ClientResult<crate::Response<Vec<crate::types::JsonWebKey>>> {
455 let url = self.client.url(
456 &format!(
457 "/api/v1/apps/{}/credentials/keys",
458 crate::progenitor_support::encode_path(app_id),
459 ),
460 None,
461 );
462 self.client
463 .get(
464 &url,
465 crate::Message {
466 body: None,
467 content_type: None,
468 },
469 )
470 .await
471 }
472 pub async fn list_all_keys(
482 &self,
483 app_id: &str,
484 ) -> ClientResult<crate::Response<Vec<crate::types::JsonWebKey>>> {
485 let url = self.client.url(
486 &format!(
487 "/api/v1/apps/{}/credentials/keys",
488 crate::progenitor_support::encode_path(app_id),
489 ),
490 None,
491 );
492 self.client
493 .get_all_pages(
494 &url,
495 crate::Message {
496 body: None,
497 content_type: None,
498 },
499 )
500 .await
501 }
502 pub async fn generate_key(
513 &self,
514 app_id: &str,
515 validity_years: i64,
516 ) -> ClientResult<crate::Response<crate::types::JsonWebKey>> {
517 let mut query_args: Vec<(String, String)> = Default::default();
518 if validity_years > 0 {
519 query_args.push(("validityYears".to_string(), validity_years.to_string()));
520 }
521 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
522 let url = self.client.url(
523 &format!(
524 "/api/v1/apps/{}/credentials/keys/generate?{}",
525 crate::progenitor_support::encode_path(app_id),
526 query_
527 ),
528 None,
529 );
530 self.client
531 .post(
532 &url,
533 crate::Message {
534 body: None,
535 content_type: None,
536 },
537 )
538 .await
539 }
540 pub async fn get_key(
553 &self,
554 app_id: &str,
555 key_id: &str,
556 ) -> ClientResult<crate::Response<crate::types::JsonWebKey>> {
557 let url = self.client.url(
558 &format!(
559 "/api/v1/apps/{}/credentials/keys/{}",
560 crate::progenitor_support::encode_path(app_id),
561 crate::progenitor_support::encode_path(key_id),
562 ),
563 None,
564 );
565 self.client
566 .get(
567 &url,
568 crate::Message {
569 body: None,
570 content_type: None,
571 },
572 )
573 .await
574 }
575 pub async fn clone_key(
589 &self,
590 app_id: &str,
591 key_id: &str,
592 target_aid: &str,
593 ) -> ClientResult<crate::Response<crate::types::JsonWebKey>> {
594 let mut query_args: Vec<(String, String)> = Default::default();
595 if !target_aid.is_empty() {
596 query_args.push(("targetAid".to_string(), target_aid.to_string()));
597 }
598 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
599 let url = self.client.url(
600 &format!(
601 "/api/v1/apps/{}/credentials/keys/{}/clone?{}",
602 crate::progenitor_support::encode_path(app_id),
603 crate::progenitor_support::encode_path(key_id),
604 query_
605 ),
606 None,
607 );
608 self.client
609 .post(
610 &url,
611 crate::Message {
612 body: None,
613 content_type: None,
614 },
615 )
616 .await
617 }
618 pub async fn list_scope_consent_grants(
629 &self,
630 app_id: &str,
631 expand: &str,
632 ) -> ClientResult<crate::Response<Vec<crate::types::OAuth2ScopeConsentGrant>>> {
633 let mut query_args: Vec<(String, String)> = Default::default();
634 if !expand.is_empty() {
635 query_args.push(("expand".to_string(), expand.to_string()));
636 }
637 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
638 let url = self.client.url(
639 &format!(
640 "/api/v1/apps/{}/grants?{}",
641 crate::progenitor_support::encode_path(app_id),
642 query_
643 ),
644 None,
645 );
646 self.client
647 .get(
648 &url,
649 crate::Message {
650 body: None,
651 content_type: None,
652 },
653 )
654 .await
655 }
656 pub async fn list_all_scope_consent_grants(
664 &self,
665 app_id: &str,
666 expand: &str,
667 ) -> ClientResult<crate::Response<Vec<crate::types::OAuth2ScopeConsentGrant>>> {
668 let mut query_args: Vec<(String, String)> = Default::default();
669 if !expand.is_empty() {
670 query_args.push(("expand".to_string(), expand.to_string()));
671 }
672 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
673 let url = self.client.url(
674 &format!(
675 "/api/v1/apps/{}/grants?{}",
676 crate::progenitor_support::encode_path(app_id),
677 query_
678 ),
679 None,
680 );
681 self.client
682 .get_all_pages(
683 &url,
684 crate::Message {
685 body: None,
686 content_type: None,
687 },
688 )
689 .await
690 }
691 pub async fn grant_consent_scope(
701 &self,
702 app_id: &str,
703 body: &crate::types::OAuth2ScopeConsentGrant,
704 ) -> ClientResult<crate::Response<crate::types::OAuth2ScopeConsentGrant>> {
705 let url = self.client.url(
706 &format!(
707 "/api/v1/apps/{}/grants",
708 crate::progenitor_support::encode_path(app_id),
709 ),
710 None,
711 );
712 self.client
713 .post(
714 &url,
715 crate::Message {
716 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
717 content_type: Some("application/json".to_string()),
718 },
719 )
720 .await
721 }
722 pub async fn get_scope_consent_grant(
734 &self,
735 app_id: &str,
736 grant_id: &str,
737 expand: &str,
738 ) -> ClientResult<crate::Response<crate::types::OAuth2ScopeConsentGrant>> {
739 let mut query_args: Vec<(String, String)> = Default::default();
740 if !expand.is_empty() {
741 query_args.push(("expand".to_string(), expand.to_string()));
742 }
743 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
744 let url = self.client.url(
745 &format!(
746 "/api/v1/apps/{}/grants/{}?{}",
747 crate::progenitor_support::encode_path(app_id),
748 crate::progenitor_support::encode_path(grant_id),
749 query_
750 ),
751 None,
752 );
753 self.client
754 .get(
755 &url,
756 crate::Message {
757 body: None,
758 content_type: None,
759 },
760 )
761 .await
762 }
763 pub async fn revoke_scope_consent_grant(
774 &self,
775 app_id: &str,
776 grant_id: &str,
777 ) -> ClientResult<crate::Response<()>> {
778 let url = self.client.url(
779 &format!(
780 "/api/v1/apps/{}/grants/{}",
781 crate::progenitor_support::encode_path(app_id),
782 crate::progenitor_support::encode_path(grant_id),
783 ),
784 None,
785 );
786 self.client
787 .delete(
788 &url,
789 crate::Message {
790 body: None,
791 content_type: None,
792 },
793 )
794 .await
795 }
796 pub async fn list_group_assignments(
812 &self,
813 app_id: &str,
814 q: &str,
815 after: &str,
816 limit: i64,
817 expand: &str,
818 ) -> ClientResult<crate::Response<Vec<crate::types::ApplicationGroupAssignment>>> {
819 let mut query_args: Vec<(String, String)> = Default::default();
820 if !after.is_empty() {
821 query_args.push(("after".to_string(), after.to_string()));
822 }
823 if !expand.is_empty() {
824 query_args.push(("expand".to_string(), expand.to_string()));
825 }
826 if limit > 0 {
827 query_args.push(("limit".to_string(), limit.to_string()));
828 }
829 if !q.is_empty() {
830 query_args.push(("q".to_string(), q.to_string()));
831 }
832 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
833 let url = self.client.url(
834 &format!(
835 "/api/v1/apps/{}/groups?{}",
836 crate::progenitor_support::encode_path(app_id),
837 query_
838 ),
839 None,
840 );
841 self.client
842 .get(
843 &url,
844 crate::Message {
845 body: None,
846 content_type: None,
847 },
848 )
849 .await
850 }
851 pub async fn list_all_group_assignments(
861 &self,
862 app_id: &str,
863 q: &str,
864 expand: &str,
865 ) -> ClientResult<crate::Response<Vec<crate::types::ApplicationGroupAssignment>>> {
866 let mut query_args: Vec<(String, String)> = Default::default();
867 if !expand.is_empty() {
868 query_args.push(("expand".to_string(), expand.to_string()));
869 }
870 if !q.is_empty() {
871 query_args.push(("q".to_string(), q.to_string()));
872 }
873 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
874 let url = self.client.url(
875 &format!(
876 "/api/v1/apps/{}/groups?{}",
877 crate::progenitor_support::encode_path(app_id),
878 query_
879 ),
880 None,
881 );
882 self.client
883 .get_all_pages(
884 &url,
885 crate::Message {
886 body: None,
887 content_type: None,
888 },
889 )
890 .await
891 }
892 pub async fn get_group_assignment(
906 &self,
907 app_id: &str,
908 group_id: &str,
909 expand: &str,
910 ) -> ClientResult<crate::Response<crate::types::ApplicationGroupAssignment>> {
911 let mut query_args: Vec<(String, String)> = Default::default();
912 if !expand.is_empty() {
913 query_args.push(("expand".to_string(), expand.to_string()));
914 }
915 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
916 let url = self.client.url(
917 &format!(
918 "/api/v1/apps/{}/groups/{}?{}",
919 crate::progenitor_support::encode_path(app_id),
920 crate::progenitor_support::encode_path(group_id),
921 query_
922 ),
923 None,
924 );
925 self.client
926 .get(
927 &url,
928 crate::Message {
929 body: None,
930 content_type: None,
931 },
932 )
933 .await
934 }
935 pub async fn create_group_assignment(
948 &self,
949 app_id: &str,
950 group_id: &str,
951 body: &crate::types::ApplicationGroupAssignment,
952 ) -> ClientResult<crate::Response<crate::types::ApplicationGroupAssignment>> {
953 let url = self.client.url(
954 &format!(
955 "/api/v1/apps/{}/groups/{}",
956 crate::progenitor_support::encode_path(app_id),
957 crate::progenitor_support::encode_path(group_id),
958 ),
959 None,
960 );
961 self.client
962 .put(
963 &url,
964 crate::Message {
965 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
966 content_type: Some("application/json".to_string()),
967 },
968 )
969 .await
970 }
971 pub async fn delete_group_assignment(
984 &self,
985 app_id: &str,
986 group_id: &str,
987 ) -> ClientResult<crate::Response<()>> {
988 let url = self.client.url(
989 &format!(
990 "/api/v1/apps/{}/groups/{}",
991 crate::progenitor_support::encode_path(app_id),
992 crate::progenitor_support::encode_path(group_id),
993 ),
994 None,
995 );
996 self.client
997 .delete(
998 &url,
999 crate::Message {
1000 body: None,
1001 content_type: None,
1002 },
1003 )
1004 .await
1005 }
1006 pub async fn activate(&self, app_id: &str) -> ClientResult<crate::Response<()>> {
1018 let url = self.client.url(
1019 &format!(
1020 "/api/v1/apps/{}/lifecycle/activate",
1021 crate::progenitor_support::encode_path(app_id),
1022 ),
1023 None,
1024 );
1025 self.client
1026 .post(
1027 &url,
1028 crate::Message {
1029 body: None,
1030 content_type: None,
1031 },
1032 )
1033 .await
1034 }
1035 pub async fn deactivate(&self, app_id: &str) -> ClientResult<crate::Response<()>> {
1047 let url = self.client.url(
1048 &format!(
1049 "/api/v1/apps/{}/lifecycle/deactivate",
1050 crate::progenitor_support::encode_path(app_id),
1051 ),
1052 None,
1053 );
1054 self.client
1055 .post(
1056 &url,
1057 crate::Message {
1058 body: None,
1059 content_type: None,
1060 },
1061 )
1062 .await
1063 }
1064 pub async fn list_o_auth_2_tokens_fors(
1077 &self,
1078 app_id: &str,
1079 expand: &str,
1080 after: &str,
1081 limit: i64,
1082 ) -> ClientResult<crate::Response<Vec<crate::types::OAuth2Token>>> {
1083 let mut query_args: Vec<(String, String)> = Default::default();
1084 if !after.is_empty() {
1085 query_args.push(("after".to_string(), after.to_string()));
1086 }
1087 if !expand.is_empty() {
1088 query_args.push(("expand".to_string(), expand.to_string()));
1089 }
1090 if limit > 0 {
1091 query_args.push(("limit".to_string(), limit.to_string()));
1092 }
1093 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1094 let url = self.client.url(
1095 &format!(
1096 "/api/v1/apps/{}/tokens?{}",
1097 crate::progenitor_support::encode_path(app_id),
1098 query_
1099 ),
1100 None,
1101 );
1102 self.client
1103 .get(
1104 &url,
1105 crate::Message {
1106 body: None,
1107 content_type: None,
1108 },
1109 )
1110 .await
1111 }
1112 pub async fn list_all_o_auth_2_tokens_fors(
1120 &self,
1121 app_id: &str,
1122 expand: &str,
1123 ) -> ClientResult<crate::Response<Vec<crate::types::OAuth2Token>>> {
1124 let mut query_args: Vec<(String, String)> = Default::default();
1125 if !expand.is_empty() {
1126 query_args.push(("expand".to_string(), expand.to_string()));
1127 }
1128 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1129 let url = self.client.url(
1130 &format!(
1131 "/api/v1/apps/{}/tokens?{}",
1132 crate::progenitor_support::encode_path(app_id),
1133 query_
1134 ),
1135 None,
1136 );
1137 self.client
1138 .get_all_pages(
1139 &url,
1140 crate::Message {
1141 body: None,
1142 content_type: None,
1143 },
1144 )
1145 .await
1146 }
1147 pub async fn revoke_o_auth_2_tokens_for(
1157 &self,
1158 app_id: &str,
1159 ) -> ClientResult<crate::Response<()>> {
1160 let url = self.client.url(
1161 &format!(
1162 "/api/v1/apps/{}/tokens",
1163 crate::progenitor_support::encode_path(app_id),
1164 ),
1165 None,
1166 );
1167 self.client
1168 .delete(
1169 &url,
1170 crate::Message {
1171 body: None,
1172 content_type: None,
1173 },
1174 )
1175 .await
1176 }
1177 pub async fn get_o_auth_2_token_for(
1189 &self,
1190 app_id: &str,
1191 token_id: &str,
1192 expand: &str,
1193 ) -> ClientResult<crate::Response<crate::types::OAuth2Token>> {
1194 let mut query_args: Vec<(String, String)> = Default::default();
1195 if !expand.is_empty() {
1196 query_args.push(("expand".to_string(), expand.to_string()));
1197 }
1198 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1199 let url = self.client.url(
1200 &format!(
1201 "/api/v1/apps/{}/tokens/{}?{}",
1202 crate::progenitor_support::encode_path(app_id),
1203 crate::progenitor_support::encode_path(token_id),
1204 query_
1205 ),
1206 None,
1207 );
1208 self.client
1209 .get(
1210 &url,
1211 crate::Message {
1212 body: None,
1213 content_type: None,
1214 },
1215 )
1216 .await
1217 }
1218 pub async fn revoke_o_auth_2_token_for(
1229 &self,
1230 app_id: &str,
1231 token_id: &str,
1232 ) -> ClientResult<crate::Response<()>> {
1233 let url = self.client.url(
1234 &format!(
1235 "/api/v1/apps/{}/tokens/{}",
1236 crate::progenitor_support::encode_path(app_id),
1237 crate::progenitor_support::encode_path(token_id),
1238 ),
1239 None,
1240 );
1241 self.client
1242 .delete(
1243 &url,
1244 crate::Message {
1245 body: None,
1246 content_type: None,
1247 },
1248 )
1249 .await
1250 }
1251 pub async fn list_users(
1269 &self,
1270 app_id: &str,
1271 q: &str,
1272 query_scope: &str,
1273 after: &str,
1274 limit: i64,
1275 filter: &str,
1276 expand: &str,
1277 ) -> ClientResult<crate::Response<Vec<crate::types::AppUser>>> {
1278 let mut query_args: Vec<(String, String)> = Default::default();
1279 if !after.is_empty() {
1280 query_args.push(("after".to_string(), after.to_string()));
1281 }
1282 if !expand.is_empty() {
1283 query_args.push(("expand".to_string(), expand.to_string()));
1284 }
1285 if !filter.is_empty() {
1286 query_args.push(("filter".to_string(), filter.to_string()));
1287 }
1288 if limit > 0 {
1289 query_args.push(("limit".to_string(), limit.to_string()));
1290 }
1291 if !q.is_empty() {
1292 query_args.push(("q".to_string(), q.to_string()));
1293 }
1294 if !query_scope.is_empty() {
1295 query_args.push(("query_scope".to_string(), query_scope.to_string()));
1296 }
1297 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1298 let url = self.client.url(
1299 &format!(
1300 "/api/v1/apps/{}/users?{}",
1301 crate::progenitor_support::encode_path(app_id),
1302 query_
1303 ),
1304 None,
1305 );
1306 self.client
1307 .get(
1308 &url,
1309 crate::Message {
1310 body: None,
1311 content_type: None,
1312 },
1313 )
1314 .await
1315 }
1316 pub async fn list_all_users(
1326 &self,
1327 app_id: &str,
1328 q: &str,
1329 query_scope: &str,
1330 filter: &str,
1331 expand: &str,
1332 ) -> ClientResult<crate::Response<Vec<crate::types::AppUser>>> {
1333 let mut query_args: Vec<(String, String)> = Default::default();
1334 if !expand.is_empty() {
1335 query_args.push(("expand".to_string(), expand.to_string()));
1336 }
1337 if !filter.is_empty() {
1338 query_args.push(("filter".to_string(), filter.to_string()));
1339 }
1340 if !q.is_empty() {
1341 query_args.push(("q".to_string(), q.to_string()));
1342 }
1343 if !query_scope.is_empty() {
1344 query_args.push(("query_scope".to_string(), query_scope.to_string()));
1345 }
1346 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1347 let url = self.client.url(
1348 &format!(
1349 "/api/v1/apps/{}/users?{}",
1350 crate::progenitor_support::encode_path(app_id),
1351 query_
1352 ),
1353 None,
1354 );
1355 self.client
1356 .get_all_pages(
1357 &url,
1358 crate::Message {
1359 body: None,
1360 content_type: None,
1361 },
1362 )
1363 .await
1364 }
1365 pub async fn assign_user(
1377 &self,
1378 app_id: &str,
1379 body: &crate::types::AppUser,
1380 ) -> ClientResult<crate::Response<crate::types::AppUser>> {
1381 let url = self.client.url(
1382 &format!(
1383 "/api/v1/apps/{}/users",
1384 crate::progenitor_support::encode_path(app_id),
1385 ),
1386 None,
1387 );
1388 self.client
1389 .post(
1390 &url,
1391 crate::Message {
1392 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
1393 content_type: None,
1394 },
1395 )
1396 .await
1397 }
1398 pub async fn get_user(
1412 &self,
1413 app_id: &str,
1414 user_id: &str,
1415 expand: &str,
1416 ) -> ClientResult<crate::Response<crate::types::AppUser>> {
1417 let mut query_args: Vec<(String, String)> = Default::default();
1418 if !expand.is_empty() {
1419 query_args.push(("expand".to_string(), expand.to_string()));
1420 }
1421 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1422 let url = self.client.url(
1423 &format!(
1424 "/api/v1/apps/{}/users/{}?{}",
1425 crate::progenitor_support::encode_path(app_id),
1426 crate::progenitor_support::encode_path(user_id),
1427 query_
1428 ),
1429 None,
1430 );
1431 self.client
1432 .get(
1433 &url,
1434 crate::Message {
1435 body: None,
1436 content_type: None,
1437 },
1438 )
1439 .await
1440 }
1441 pub async fn update_user(
1454 &self,
1455 app_id: &str,
1456 user_id: &str,
1457 body: &crate::types::AppUser,
1458 ) -> ClientResult<crate::Response<crate::types::AppUser>> {
1459 let url = self.client.url(
1460 &format!(
1461 "/api/v1/apps/{}/users/{}",
1462 crate::progenitor_support::encode_path(app_id),
1463 crate::progenitor_support::encode_path(user_id),
1464 ),
1465 None,
1466 );
1467 self.client
1468 .post(
1469 &url,
1470 crate::Message {
1471 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
1472 content_type: None,
1473 },
1474 )
1475 .await
1476 }
1477 pub async fn delete_user(
1491 &self,
1492 app_id: &str,
1493 user_id: &str,
1494 send_email: bool,
1495 ) -> ClientResult<crate::Response<()>> {
1496 let mut query_args: Vec<(String, String)> = Default::default();
1497 if send_email {
1498 query_args.push(("sendEmail".to_string(), send_email.to_string()));
1499 }
1500 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
1501 let url = self.client.url(
1502 &format!(
1503 "/api/v1/apps/{}/users/{}?{}",
1504 crate::progenitor_support::encode_path(app_id),
1505 crate::progenitor_support::encode_path(user_id),
1506 query_
1507 ),
1508 None,
1509 );
1510 self.client
1511 .delete(
1512 &url,
1513 crate::Message {
1514 body: None,
1515 content_type: None,
1516 },
1517 )
1518 .await
1519 }
1520}