keycloak/rest/
generated_rest.rs

1use reqwest::header::CONTENT_LENGTH;
2use serde_json::Value;
3
4use super::{url_enc::encode_url_param as p, *};
5
6impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
7    // <h4>Attack Detection</h4>
8
9    /// Clear any user login failures for all users This can release temporary disabled users
10    ///
11    /// Parameters:
12    ///
13    /// - `realm`: realm name (not id!)
14    ///
15    /// Resource: `Attack Detection`
16    ///
17    /// `DELETE /admin/realms/{realm}/attack-detection/brute-force/users`
18    ///
19    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmattack_detectionbrute_forceusers>
20    #[cfg(feature = "tag-attack-detection")]
21    pub async fn realm_attack_detection_brute_force_users_delete(
22        &self,
23        realm: &str,
24    ) -> Result<(), KeycloakError> {
25        let realm = p(realm);
26        let builder = self
27            .client
28            .delete(format!(
29                "{}/admin/realms/{realm}/attack-detection/brute-force/users",
30                self.url
31            ))
32            .bearer_auth(self.token_supplier.get(&self.url).await?);
33        let response = builder.send().await?;
34        error_check(response).await?;
35        Ok(())
36    }
37
38    /// Get status of a username in brute force detection
39    ///
40    /// Parameters:
41    ///
42    /// - `realm`: realm name (not id!)
43    /// - `user_id`
44    ///
45    /// Resource: `Attack Detection`
46    ///
47    /// `GET /admin/realms/{realm}/attack-detection/brute-force/users/{user_id}`
48    ///
49    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmattack_detectionbrute_forceusersuserid>
50    ///
51    /// REST method: `GET /admin/realms/{realm}/attack-detection/brute-force/users/{userId}`
52    #[cfg(feature = "tag-attack-detection")]
53    pub async fn realm_attack_detection_brute_force_users_with_user_id_get(
54        &self,
55        realm: &str,
56        user_id: &str,
57    ) -> Result<TypeMap<String, Value>, KeycloakError> {
58        let realm = p(realm);
59        let user_id = p(user_id);
60        let builder = self
61            .client
62            .get(format!(
63                "{}/admin/realms/{realm}/attack-detection/brute-force/users/{user_id}",
64                self.url
65            ))
66            .bearer_auth(self.token_supplier.get(&self.url).await?);
67        let response = builder.send().await?;
68        Ok(error_check(response).await?.json().await?)
69    }
70
71    /// Clear any user login failures for the user This can release temporary disabled user
72    ///
73    /// Parameters:
74    ///
75    /// - `realm`: realm name (not id!)
76    /// - `user_id`
77    ///
78    /// Resource: `Attack Detection`
79    ///
80    /// `DELETE /admin/realms/{realm}/attack-detection/brute-force/users/{user_id}`
81    ///
82    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmattack_detectionbrute_forceusersuserid>
83    ///
84    /// REST method: `DELETE /admin/realms/{realm}/attack-detection/brute-force/users/{userId}`
85    #[cfg(feature = "tag-attack-detection")]
86    pub async fn realm_attack_detection_brute_force_users_with_user_id_delete(
87        &self,
88        realm: &str,
89        user_id: &str,
90    ) -> Result<(), KeycloakError> {
91        let realm = p(realm);
92        let user_id = p(user_id);
93        let builder = self
94            .client
95            .delete(format!(
96                "{}/admin/realms/{realm}/attack-detection/brute-force/users/{user_id}",
97                self.url
98            ))
99            .bearer_auth(self.token_supplier.get(&self.url).await?);
100        let response = builder.send().await?;
101        error_check(response).await?;
102        Ok(())
103    }
104
105    // <h4>Authentication Management</h4>
106
107    /// Get authenticator providers Returns a stream of authenticator providers.
108    ///
109    /// Parameters:
110    ///
111    /// - `realm`: realm name (not id!)
112    ///
113    /// Resource: `Authentication Management`
114    ///
115    /// `GET /admin/realms/{realm}/authentication/authenticator-providers`
116    ///
117    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationauthenticator_providers>
118    #[cfg(feature = "tag-authentication-management")]
119    pub async fn realm_authentication_authenticator_providers_get(
120        &self,
121        realm: &str,
122    ) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
123        let realm = p(realm);
124        let builder = self
125            .client
126            .get(format!(
127                "{}/admin/realms/{realm}/authentication/authenticator-providers",
128                self.url
129            ))
130            .bearer_auth(self.token_supplier.get(&self.url).await?);
131        let response = builder.send().await?;
132        Ok(error_check(response).await?.json().await?)
133    }
134
135    /// Get client authenticator providers Returns a stream of client authenticator providers.
136    ///
137    /// Parameters:
138    ///
139    /// - `realm`: realm name (not id!)
140    ///
141    /// Resource: `Authentication Management`
142    ///
143    /// `GET /admin/realms/{realm}/authentication/client-authenticator-providers`
144    ///
145    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationclient_authenticator_providers>
146    #[cfg(feature = "tag-authentication-management")]
147    pub async fn realm_authentication_client_authenticator_providers_get(
148        &self,
149        realm: &str,
150    ) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
151        let realm = p(realm);
152        let builder = self
153            .client
154            .get(format!(
155                "{}/admin/realms/{realm}/authentication/client-authenticator-providers",
156                self.url
157            ))
158            .bearer_auth(self.token_supplier.get(&self.url).await?);
159        let response = builder.send().await?;
160        Ok(error_check(response).await?.json().await?)
161    }
162
163    /// Create new authenticator configuration
164    ///
165    /// Parameters:
166    ///
167    /// - `realm`: realm name (not id!)
168    /// - `body`
169    ///
170    /// Returns id of created resource
171    ///
172    /// Resource: `Authentication Management`
173    ///
174    /// `POST /admin/realms/{realm}/authentication/config`
175    ///
176    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationconfig>
177    #[cfg(feature = "tag-authentication-management")]
178    #[deprecated]
179    pub async fn realm_authentication_config_post(
180        &self,
181        realm: &str,
182        body: AuthenticatorConfigRepresentation,
183    ) -> Result<Option<TypeString>, KeycloakError> {
184        let realm = p(realm);
185        let builder = self
186            .client
187            .post(format!(
188                "{}/admin/realms/{realm}/authentication/config",
189                self.url
190            ))
191            .json(&body)
192            .bearer_auth(self.token_supplier.get(&self.url).await?);
193        let response = builder.send().await?;
194        error_check(response).await.map(to_id)
195    }
196
197    /// Get authenticator provider's configuration description
198    ///
199    /// Parameters:
200    ///
201    /// - `realm`: realm name (not id!)
202    /// - `provider_id`
203    ///
204    /// Resource: `Authentication Management`
205    ///
206    /// `GET /admin/realms/{realm}/authentication/config-description/{provider_id}`
207    ///
208    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationconfig_descriptionproviderid>
209    ///
210    /// REST method: `GET /admin/realms/{realm}/authentication/config-description/{providerId}`
211    #[cfg(feature = "tag-authentication-management")]
212    pub async fn realm_authentication_config_description_with_provider_id_get(
213        &self,
214        realm: &str,
215        provider_id: &str,
216    ) -> Result<AuthenticatorConfigInfoRepresentation, KeycloakError> {
217        let realm = p(realm);
218        let provider_id = p(provider_id);
219        let builder = self
220            .client
221            .get(format!(
222                "{}/admin/realms/{realm}/authentication/config-description/{provider_id}",
223                self.url
224            ))
225            .bearer_auth(self.token_supplier.get(&self.url).await?);
226        let response = builder.send().await?;
227        Ok(error_check(response).await?.json().await?)
228    }
229
230    /// Get authenticator configuration
231    ///
232    /// Parameters:
233    ///
234    /// - `realm`: realm name (not id!)
235    /// - `id`: Configuration id
236    ///
237    /// Resource: `Authentication Management`
238    ///
239    /// `GET /admin/realms/{realm}/authentication/config/{id}`
240    ///
241    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationconfigid>
242    #[cfg(feature = "tag-authentication-management")]
243    pub async fn realm_authentication_config_with_id_get(
244        &self,
245        realm: &str,
246        id: &str,
247    ) -> Result<AuthenticatorConfigRepresentation, KeycloakError> {
248        let realm = p(realm);
249        let id = p(id);
250        let builder = self
251            .client
252            .get(format!(
253                "{}/admin/realms/{realm}/authentication/config/{id}",
254                self.url
255            ))
256            .bearer_auth(self.token_supplier.get(&self.url).await?);
257        let response = builder.send().await?;
258        Ok(error_check(response).await?.json().await?)
259    }
260
261    /// Update authenticator configuration
262    ///
263    /// Parameters:
264    ///
265    /// - `realm`: realm name (not id!)
266    /// - `id`: Configuration id
267    /// - `body`
268    ///
269    /// Resource: `Authentication Management`
270    ///
271    /// `PUT /admin/realms/{realm}/authentication/config/{id}`
272    ///
273    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmauthenticationconfigid>
274    #[cfg(feature = "tag-authentication-management")]
275    pub async fn realm_authentication_config_with_id_put(
276        &self,
277        realm: &str,
278        id: &str,
279        body: AuthenticatorConfigRepresentation,
280    ) -> Result<(), KeycloakError> {
281        let realm = p(realm);
282        let id = p(id);
283        let builder = self
284            .client
285            .put(format!(
286                "{}/admin/realms/{realm}/authentication/config/{id}",
287                self.url
288            ))
289            .json(&body)
290            .bearer_auth(self.token_supplier.get(&self.url).await?);
291        let response = builder.send().await?;
292        error_check(response).await?;
293        Ok(())
294    }
295
296    /// Delete authenticator configuration
297    ///
298    /// Parameters:
299    ///
300    /// - `realm`: realm name (not id!)
301    /// - `id`: Configuration id
302    ///
303    /// Resource: `Authentication Management`
304    ///
305    /// `DELETE /admin/realms/{realm}/authentication/config/{id}`
306    ///
307    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmauthenticationconfigid>
308    #[cfg(feature = "tag-authentication-management")]
309    pub async fn realm_authentication_config_with_id_delete(
310        &self,
311        realm: &str,
312        id: &str,
313    ) -> Result<(), KeycloakError> {
314        let realm = p(realm);
315        let id = p(id);
316        let builder = self
317            .client
318            .delete(format!(
319                "{}/admin/realms/{realm}/authentication/config/{id}",
320                self.url
321            ))
322            .bearer_auth(self.token_supplier.get(&self.url).await?);
323        let response = builder.send().await?;
324        error_check(response).await?;
325        Ok(())
326    }
327
328    /// Add new authentication execution
329    ///
330    /// Parameters:
331    ///
332    /// - `realm`: realm name (not id!)
333    /// - `body`
334    ///
335    /// Returns id of created resource
336    ///
337    /// Resource: `Authentication Management`
338    ///
339    /// `POST /admin/realms/{realm}/authentication/executions`
340    ///
341    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationexecutions>
342    #[cfg(feature = "tag-authentication-management")]
343    pub async fn realm_authentication_executions_post(
344        &self,
345        realm: &str,
346        body: AuthenticationExecutionRepresentation,
347    ) -> Result<Option<TypeString>, KeycloakError> {
348        let realm = p(realm);
349        let builder = self
350            .client
351            .post(format!(
352                "{}/admin/realms/{realm}/authentication/executions",
353                self.url
354            ))
355            .json(&body)
356            .bearer_auth(self.token_supplier.get(&self.url).await?);
357        let response = builder.send().await?;
358        error_check(response).await.map(to_id)
359    }
360
361    /// Get Single Execution
362    ///
363    /// Parameters:
364    ///
365    /// - `realm`: realm name (not id!)
366    /// - `execution_id`
367    ///
368    /// Resource: `Authentication Management`
369    ///
370    /// `GET /admin/realms/{realm}/authentication/executions/{execution_id}`
371    ///
372    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationexecutionsexecutionid>
373    ///
374    /// REST method: `GET /admin/realms/{realm}/authentication/executions/{executionId}`
375    #[cfg(feature = "tag-authentication-management")]
376    pub async fn realm_authentication_executions_with_execution_id_get(
377        &self,
378        realm: &str,
379        execution_id: &str,
380    ) -> Result<AuthenticationExecutionRepresentation, KeycloakError> {
381        let realm = p(realm);
382        let execution_id = p(execution_id);
383        let builder = self
384            .client
385            .get(format!(
386                "{}/admin/realms/{realm}/authentication/executions/{execution_id}",
387                self.url
388            ))
389            .bearer_auth(self.token_supplier.get(&self.url).await?);
390        let response = builder.send().await?;
391        Ok(error_check(response).await?.json().await?)
392    }
393
394    /// Delete execution
395    ///
396    /// Parameters:
397    ///
398    /// - `realm`: realm name (not id!)
399    /// - `execution_id`: Execution id
400    ///
401    /// Resource: `Authentication Management`
402    ///
403    /// `DELETE /admin/realms/{realm}/authentication/executions/{execution_id}`
404    ///
405    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmauthenticationexecutionsexecutionid>
406    ///
407    /// REST method: `DELETE /admin/realms/{realm}/authentication/executions/{executionId}`
408    #[cfg(feature = "tag-authentication-management")]
409    pub async fn realm_authentication_executions_with_execution_id_delete(
410        &self,
411        realm: &str,
412        execution_id: &str,
413    ) -> Result<(), KeycloakError> {
414        let realm = p(realm);
415        let execution_id = p(execution_id);
416        let builder = self
417            .client
418            .delete(format!(
419                "{}/admin/realms/{realm}/authentication/executions/{execution_id}",
420                self.url
421            ))
422            .bearer_auth(self.token_supplier.get(&self.url).await?);
423        let response = builder.send().await?;
424        error_check(response).await?;
425        Ok(())
426    }
427
428    /// Update execution with new configuration
429    ///
430    /// Parameters:
431    ///
432    /// - `realm`: realm name (not id!)
433    /// - `execution_id`: Execution id
434    /// - `body`
435    ///
436    /// Returns id of created resource
437    ///
438    /// Resource: `Authentication Management`
439    ///
440    /// `POST /admin/realms/{realm}/authentication/executions/{execution_id}/config`
441    ///
442    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationexecutionsexecutionidconfig>
443    ///
444    /// REST method: `POST /admin/realms/{realm}/authentication/executions/{executionId}/config`
445    #[cfg(feature = "tag-authentication-management")]
446    pub async fn realm_authentication_executions_with_execution_id_config_post(
447        &self,
448        realm: &str,
449        execution_id: &str,
450        body: AuthenticatorConfigRepresentation,
451    ) -> Result<Option<TypeString>, KeycloakError> {
452        let realm = p(realm);
453        let execution_id = p(execution_id);
454        let builder = self
455            .client
456            .post(format!(
457                "{}/admin/realms/{realm}/authentication/executions/{execution_id}/config",
458                self.url
459            ))
460            .json(&body)
461            .bearer_auth(self.token_supplier.get(&self.url).await?);
462        let response = builder.send().await?;
463        error_check(response).await.map(to_id)
464    }
465
466    /// Get execution's configuration
467    ///
468    /// Parameters:
469    ///
470    /// - `realm`: realm name (not id!)
471    /// - `execution_id`: Execution id
472    /// - `id`: Configuration id
473    ///
474    /// Resource: `Authentication Management`
475    ///
476    /// `GET /admin/realms/{realm}/authentication/executions/{execution_id}/config/{id}`
477    ///
478    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationexecutionsexecutionidconfigid>
479    ///
480    /// REST method: `GET /admin/realms/{realm}/authentication/executions/{executionId}/config/{id}`
481    #[cfg(feature = "tag-authentication-management")]
482    #[deprecated]
483    pub async fn realm_authentication_executions_with_execution_id_config_with_id_get(
484        &self,
485        realm: &str,
486        execution_id: &str,
487        id: &str,
488    ) -> Result<AuthenticatorConfigRepresentation, KeycloakError> {
489        let realm = p(realm);
490        let execution_id = p(execution_id);
491        let id = p(id);
492        let builder = self
493            .client
494            .get(format!(
495                "{}/admin/realms/{realm}/authentication/executions/{execution_id}/config/{id}",
496                self.url
497            ))
498            .bearer_auth(self.token_supplier.get(&self.url).await?);
499        let response = builder.send().await?;
500        Ok(error_check(response).await?.json().await?)
501    }
502
503    /// Lower execution's priority
504    ///
505    /// Parameters:
506    ///
507    /// - `realm`: realm name (not id!)
508    /// - `execution_id`: Execution id
509    ///
510    /// Returns id of created resource
511    ///
512    /// Resource: `Authentication Management`
513    ///
514    /// `POST /admin/realms/{realm}/authentication/executions/{execution_id}/lower-priority`
515    ///
516    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationexecutionsexecutionidlower_priority>
517    ///
518    /// REST method: `POST /admin/realms/{realm}/authentication/executions/{executionId}/lower-priority`
519    #[cfg(feature = "tag-authentication-management")]
520    pub async fn realm_authentication_executions_with_execution_id_lower_priority_post(
521        &self,
522        realm: &str,
523        execution_id: &str,
524    ) -> Result<Option<TypeString>, KeycloakError> {
525        let realm = p(realm);
526        let execution_id = p(execution_id);
527        let builder = self
528            .client
529            .post(format!(
530                "{}/admin/realms/{realm}/authentication/executions/{execution_id}/lower-priority",
531                self.url
532            ))
533            .bearer_auth(self.token_supplier.get(&self.url).await?);
534        let response = builder.send().await?;
535        error_check(response).await.map(to_id)
536    }
537
538    /// Raise execution's priority
539    ///
540    /// Parameters:
541    ///
542    /// - `realm`: realm name (not id!)
543    /// - `execution_id`: Execution id
544    ///
545    /// Returns id of created resource
546    ///
547    /// Resource: `Authentication Management`
548    ///
549    /// `POST /admin/realms/{realm}/authentication/executions/{execution_id}/raise-priority`
550    ///
551    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationexecutionsexecutionidraise_priority>
552    ///
553    /// REST method: `POST /admin/realms/{realm}/authentication/executions/{executionId}/raise-priority`
554    #[cfg(feature = "tag-authentication-management")]
555    pub async fn realm_authentication_executions_with_execution_id_raise_priority_post(
556        &self,
557        realm: &str,
558        execution_id: &str,
559    ) -> Result<Option<TypeString>, KeycloakError> {
560        let realm = p(realm);
561        let execution_id = p(execution_id);
562        let builder = self
563            .client
564            .post(format!(
565                "{}/admin/realms/{realm}/authentication/executions/{execution_id}/raise-priority",
566                self.url
567            ))
568            .bearer_auth(self.token_supplier.get(&self.url).await?);
569        let response = builder.send().await?;
570        error_check(response).await.map(to_id)
571    }
572
573    /// Get authentication flows Returns a stream of authentication flows.
574    ///
575    /// Parameters:
576    ///
577    /// - `realm`: realm name (not id!)
578    ///
579    /// Resource: `Authentication Management`
580    ///
581    /// `GET /admin/realms/{realm}/authentication/flows`
582    ///
583    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationflows>
584    #[cfg(feature = "tag-authentication-management")]
585    pub async fn realm_authentication_flows_get(
586        &self,
587        realm: &str,
588    ) -> Result<TypeVec<AuthenticationFlowRepresentation>, KeycloakError> {
589        let realm = p(realm);
590        let builder = self
591            .client
592            .get(format!(
593                "{}/admin/realms/{realm}/authentication/flows",
594                self.url
595            ))
596            .bearer_auth(self.token_supplier.get(&self.url).await?);
597        let response = builder.send().await?;
598        Ok(error_check(response).await?.json().await?)
599    }
600
601    /// Create a new authentication flow
602    ///
603    /// Parameters:
604    ///
605    /// - `realm`: realm name (not id!)
606    /// - `body`
607    ///
608    /// Returns id of created resource
609    ///
610    /// Resource: `Authentication Management`
611    ///
612    /// `POST /admin/realms/{realm}/authentication/flows`
613    ///
614    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationflows>
615    #[cfg(feature = "tag-authentication-management")]
616    pub async fn realm_authentication_flows_post(
617        &self,
618        realm: &str,
619        body: AuthenticationFlowRepresentation,
620    ) -> Result<Option<TypeString>, KeycloakError> {
621        let realm = p(realm);
622        let builder = self
623            .client
624            .post(format!(
625                "{}/admin/realms/{realm}/authentication/flows",
626                self.url
627            ))
628            .json(&body)
629            .bearer_auth(self.token_supplier.get(&self.url).await?);
630        let response = builder.send().await?;
631        error_check(response).await.map(to_id)
632    }
633
634    /// Copy existing authentication flow under a new name The new name is given as 'newName' attribute of the passed JSON object
635    ///
636    /// Parameters:
637    ///
638    /// - `realm`: realm name (not id!)
639    /// - `flow_alias`: name of the existing authentication flow
640    /// - `body`
641    ///
642    /// Returns id of created resource
643    ///
644    /// Resource: `Authentication Management`
645    ///
646    /// `POST /admin/realms/{realm}/authentication/flows/{flow_alias}/copy`
647    ///
648    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationflowsflowaliascopy>
649    ///
650    /// REST method: `POST /admin/realms/{realm}/authentication/flows/{flowAlias}/copy`
651    #[cfg(feature = "tag-authentication-management")]
652    pub async fn realm_authentication_flows_with_flow_alias_copy_post(
653        &self,
654        realm: &str,
655        flow_alias: &str,
656        body: TypeMap<String, String>,
657    ) -> Result<Option<TypeString>, KeycloakError> {
658        let realm = p(realm);
659        let flow_alias = p(flow_alias);
660        let builder = self
661            .client
662            .post(format!(
663                "{}/admin/realms/{realm}/authentication/flows/{flow_alias}/copy",
664                self.url
665            ))
666            .json(&body)
667            .bearer_auth(self.token_supplier.get(&self.url).await?);
668        let response = builder.send().await?;
669        error_check(response).await.map(to_id)
670    }
671
672    /// Get authentication executions for a flow
673    ///
674    /// Parameters:
675    ///
676    /// - `realm`: realm name (not id!)
677    /// - `flow_alias`: Flow alias
678    ///
679    /// Resource: `Authentication Management`
680    ///
681    /// `GET /admin/realms/{realm}/authentication/flows/{flow_alias}/executions`
682    ///
683    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationflowsflowaliasexecutions>
684    ///
685    /// REST method: `GET /admin/realms/{realm}/authentication/flows/{flowAlias}/executions`
686    #[cfg(feature = "tag-authentication-management")]
687    pub async fn realm_authentication_flows_with_flow_alias_executions_get(
688        &self,
689        realm: &str,
690        flow_alias: &str,
691    ) -> Result<TypeVec<AuthenticationExecutionInfoRepresentation>, KeycloakError> {
692        let realm = p(realm);
693        let flow_alias = p(flow_alias);
694        let builder = self
695            .client
696            .get(format!(
697                "{}/admin/realms/{realm}/authentication/flows/{flow_alias}/executions",
698                self.url
699            ))
700            .bearer_auth(self.token_supplier.get(&self.url).await?);
701        let response = builder.send().await?;
702        Ok(error_check(response).await?.json().await?)
703    }
704
705    /// Update authentication executions of a Flow
706    ///
707    /// Parameters:
708    ///
709    /// - `realm`: realm name (not id!)
710    /// - `flow_alias`: Flow alias
711    /// - `body`
712    ///
713    /// Resource: `Authentication Management`
714    ///
715    /// `PUT /admin/realms/{realm}/authentication/flows/{flow_alias}/executions`
716    ///
717    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmauthenticationflowsflowaliasexecutions>
718    ///
719    /// REST method: `PUT /admin/realms/{realm}/authentication/flows/{flowAlias}/executions`
720    #[cfg(feature = "tag-authentication-management")]
721    pub async fn realm_authentication_flows_with_flow_alias_executions_put(
722        &self,
723        realm: &str,
724        flow_alias: &str,
725        body: AuthenticationExecutionInfoRepresentation,
726    ) -> Result<(), KeycloakError> {
727        let realm = p(realm);
728        let flow_alias = p(flow_alias);
729        let builder = self
730            .client
731            .put(format!(
732                "{}/admin/realms/{realm}/authentication/flows/{flow_alias}/executions",
733                self.url
734            ))
735            .json(&body)
736            .bearer_auth(self.token_supplier.get(&self.url).await?);
737        let response = builder.send().await?;
738        error_check(response).await?;
739        Ok(())
740    }
741
742    /// Add new authentication execution to a flow
743    ///
744    /// Parameters:
745    ///
746    /// - `realm`: realm name (not id!)
747    /// - `flow_alias`: Alias of parent flow
748    /// - `body`
749    ///
750    /// Returns id of created resource
751    ///
752    /// Resource: `Authentication Management`
753    ///
754    /// `POST /admin/realms/{realm}/authentication/flows/{flow_alias}/executions/execution`
755    ///
756    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationflowsflowaliasexecutionsexecution>
757    ///
758    /// REST method: `POST /admin/realms/{realm}/authentication/flows/{flowAlias}/executions/execution`
759    #[cfg(feature = "tag-authentication-management")]
760    pub async fn realm_authentication_flows_with_flow_alias_executions_execution_post(
761        &self,
762        realm: &str,
763        flow_alias: &str,
764        body: TypeMap<String, Value>,
765    ) -> Result<Option<TypeString>, KeycloakError> {
766        let realm = p(realm);
767        let flow_alias = p(flow_alias);
768        let builder = self
769            .client
770            .post(format!(
771                "{}/admin/realms/{realm}/authentication/flows/{flow_alias}/executions/execution",
772                self.url
773            ))
774            .json(&body)
775            .bearer_auth(self.token_supplier.get(&self.url).await?);
776        let response = builder.send().await?;
777        error_check(response).await.map(to_id)
778    }
779
780    /// Add new flow with new execution to existing flow
781    ///
782    /// Parameters:
783    ///
784    /// - `realm`: realm name (not id!)
785    /// - `flow_alias`: Alias of parent authentication flow
786    /// - `body`
787    ///
788    /// Returns id of created resource
789    ///
790    /// Resource: `Authentication Management`
791    ///
792    /// `POST /admin/realms/{realm}/authentication/flows/{flow_alias}/executions/flow`
793    ///
794    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationflowsflowaliasexecutionsflow>
795    ///
796    /// REST method: `POST /admin/realms/{realm}/authentication/flows/{flowAlias}/executions/flow`
797    #[cfg(feature = "tag-authentication-management")]
798    pub async fn realm_authentication_flows_with_flow_alias_executions_flow_post(
799        &self,
800        realm: &str,
801        flow_alias: &str,
802        body: TypeMap<String, Value>,
803    ) -> Result<Option<TypeString>, KeycloakError> {
804        let realm = p(realm);
805        let flow_alias = p(flow_alias);
806        let builder = self
807            .client
808            .post(format!(
809                "{}/admin/realms/{realm}/authentication/flows/{flow_alias}/executions/flow",
810                self.url
811            ))
812            .json(&body)
813            .bearer_auth(self.token_supplier.get(&self.url).await?);
814        let response = builder.send().await?;
815        error_check(response).await.map(to_id)
816    }
817
818    /// Get authentication flow for id
819    ///
820    /// Parameters:
821    ///
822    /// - `realm`: realm name (not id!)
823    /// - `id`: Flow id
824    ///
825    /// Resource: `Authentication Management`
826    ///
827    /// `GET /admin/realms/{realm}/authentication/flows/{id}`
828    ///
829    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationflowsid>
830    #[cfg(feature = "tag-authentication-management")]
831    pub async fn realm_authentication_flows_with_id_get(
832        &self,
833        realm: &str,
834        id: &str,
835    ) -> Result<AuthenticationFlowRepresentation, KeycloakError> {
836        let realm = p(realm);
837        let id = p(id);
838        let builder = self
839            .client
840            .get(format!(
841                "{}/admin/realms/{realm}/authentication/flows/{id}",
842                self.url
843            ))
844            .bearer_auth(self.token_supplier.get(&self.url).await?);
845        let response = builder.send().await?;
846        Ok(error_check(response).await?.json().await?)
847    }
848
849    /// Update an authentication flow
850    ///
851    /// Parameters:
852    ///
853    /// - `realm`: realm name (not id!)
854    /// - `id`
855    /// - `body`
856    ///
857    /// Resource: `Authentication Management`
858    ///
859    /// `PUT /admin/realms/{realm}/authentication/flows/{id}`
860    ///
861    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmauthenticationflowsid>
862    #[cfg(feature = "tag-authentication-management")]
863    pub async fn realm_authentication_flows_with_id_put(
864        &self,
865        realm: &str,
866        id: &str,
867        body: AuthenticationFlowRepresentation,
868    ) -> Result<(), KeycloakError> {
869        let realm = p(realm);
870        let id = p(id);
871        let builder = self
872            .client
873            .put(format!(
874                "{}/admin/realms/{realm}/authentication/flows/{id}",
875                self.url
876            ))
877            .json(&body)
878            .bearer_auth(self.token_supplier.get(&self.url).await?);
879        let response = builder.send().await?;
880        error_check(response).await?;
881        Ok(())
882    }
883
884    /// Delete an authentication flow
885    ///
886    /// Parameters:
887    ///
888    /// - `realm`: realm name (not id!)
889    /// - `id`: Flow id
890    ///
891    /// Resource: `Authentication Management`
892    ///
893    /// `DELETE /admin/realms/{realm}/authentication/flows/{id}`
894    ///
895    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmauthenticationflowsid>
896    #[cfg(feature = "tag-authentication-management")]
897    pub async fn realm_authentication_flows_with_id_delete(
898        &self,
899        realm: &str,
900        id: &str,
901    ) -> Result<(), KeycloakError> {
902        let realm = p(realm);
903        let id = p(id);
904        let builder = self
905            .client
906            .delete(format!(
907                "{}/admin/realms/{realm}/authentication/flows/{id}",
908                self.url
909            ))
910            .bearer_auth(self.token_supplier.get(&self.url).await?);
911        let response = builder.send().await?;
912        error_check(response).await?;
913        Ok(())
914    }
915
916    /// Get form action providers Returns a stream of form action providers.
917    ///
918    /// Parameters:
919    ///
920    /// - `realm`: realm name (not id!)
921    ///
922    /// Resource: `Authentication Management`
923    ///
924    /// `GET /admin/realms/{realm}/authentication/form-action-providers`
925    ///
926    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationform_action_providers>
927    #[cfg(feature = "tag-authentication-management")]
928    pub async fn realm_authentication_form_action_providers_get(
929        &self,
930        realm: &str,
931    ) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
932        let realm = p(realm);
933        let builder = self
934            .client
935            .get(format!(
936                "{}/admin/realms/{realm}/authentication/form-action-providers",
937                self.url
938            ))
939            .bearer_auth(self.token_supplier.get(&self.url).await?);
940        let response = builder.send().await?;
941        Ok(error_check(response).await?.json().await?)
942    }
943
944    /// Get form providers Returns a stream of form providers.
945    ///
946    /// Parameters:
947    ///
948    /// - `realm`: realm name (not id!)
949    ///
950    /// Resource: `Authentication Management`
951    ///
952    /// `GET /admin/realms/{realm}/authentication/form-providers`
953    ///
954    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationform_providers>
955    #[cfg(feature = "tag-authentication-management")]
956    pub async fn realm_authentication_form_providers_get(
957        &self,
958        realm: &str,
959    ) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
960        let realm = p(realm);
961        let builder = self
962            .client
963            .get(format!(
964                "{}/admin/realms/{realm}/authentication/form-providers",
965                self.url
966            ))
967            .bearer_auth(self.token_supplier.get(&self.url).await?);
968        let response = builder.send().await?;
969        Ok(error_check(response).await?.json().await?)
970    }
971
972    /// Get configuration descriptions for all clients
973    ///
974    /// Parameters:
975    ///
976    /// - `realm`: realm name (not id!)
977    ///
978    /// Resource: `Authentication Management`
979    ///
980    /// `GET /admin/realms/{realm}/authentication/per-client-config-description`
981    ///
982    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationper_client_config_description>
983    #[cfg(feature = "tag-authentication-management")]
984    pub async fn realm_authentication_per_client_config_description_get(
985        &self,
986        realm: &str,
987    ) -> Result<TypeMap<String, TypeVec<ConfigPropertyRepresentation>>, KeycloakError> {
988        let realm = p(realm);
989        let builder = self
990            .client
991            .get(format!(
992                "{}/admin/realms/{realm}/authentication/per-client-config-description",
993                self.url
994            ))
995            .bearer_auth(self.token_supplier.get(&self.url).await?);
996        let response = builder.send().await?;
997        Ok(error_check(response).await?.json().await?)
998    }
999
1000    /// Register a new required actions
1001    ///
1002    /// Parameters:
1003    ///
1004    /// - `realm`: realm name (not id!)
1005    /// - `body`
1006    ///
1007    /// Returns id of created resource
1008    ///
1009    /// Resource: `Authentication Management`
1010    ///
1011    /// `POST /admin/realms/{realm}/authentication/register-required-action`
1012    ///
1013    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationregister_required_action>
1014    #[cfg(feature = "tag-authentication-management")]
1015    pub async fn realm_authentication_register_required_action_post(
1016        &self,
1017        realm: &str,
1018        body: RequiredActionProviderRepresentation,
1019    ) -> Result<Option<TypeString>, KeycloakError> {
1020        let realm = p(realm);
1021        let builder = self
1022            .client
1023            .post(format!(
1024                "{}/admin/realms/{realm}/authentication/register-required-action",
1025                self.url
1026            ))
1027            .json(&body)
1028            .bearer_auth(self.token_supplier.get(&self.url).await?);
1029        let response = builder.send().await?;
1030        error_check(response).await.map(to_id)
1031    }
1032
1033    /// Get required actions Returns a stream of required actions.
1034    ///
1035    /// Parameters:
1036    ///
1037    /// - `realm`: realm name (not id!)
1038    ///
1039    /// Resource: `Authentication Management`
1040    ///
1041    /// `GET /admin/realms/{realm}/authentication/required-actions`
1042    ///
1043    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationrequired_actions>
1044    #[cfg(feature = "tag-authentication-management")]
1045    pub async fn realm_authentication_required_actions_get(
1046        &self,
1047        realm: &str,
1048    ) -> Result<TypeVec<RequiredActionProviderRepresentation>, KeycloakError> {
1049        let realm = p(realm);
1050        let builder = self
1051            .client
1052            .get(format!(
1053                "{}/admin/realms/{realm}/authentication/required-actions",
1054                self.url
1055            ))
1056            .bearer_auth(self.token_supplier.get(&self.url).await?);
1057        let response = builder.send().await?;
1058        Ok(error_check(response).await?.json().await?)
1059    }
1060
1061    /// Get required action for alias
1062    ///
1063    /// Parameters:
1064    ///
1065    /// - `realm`: realm name (not id!)
1066    /// - `alias`: Alias of required action
1067    ///
1068    /// Resource: `Authentication Management`
1069    ///
1070    /// `GET /admin/realms/{realm}/authentication/required-actions/{alias}`
1071    ///
1072    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationrequired_actionsalias>
1073    #[cfg(feature = "tag-authentication-management")]
1074    pub async fn realm_authentication_required_actions_with_alias_get(
1075        &self,
1076        realm: &str,
1077        alias: &str,
1078    ) -> Result<RequiredActionProviderRepresentation, KeycloakError> {
1079        let realm = p(realm);
1080        let alias = p(alias);
1081        let builder = self
1082            .client
1083            .get(format!(
1084                "{}/admin/realms/{realm}/authentication/required-actions/{alias}",
1085                self.url
1086            ))
1087            .bearer_auth(self.token_supplier.get(&self.url).await?);
1088        let response = builder.send().await?;
1089        Ok(error_check(response).await?.json().await?)
1090    }
1091
1092    /// Update required action
1093    ///
1094    /// Parameters:
1095    ///
1096    /// - `realm`: realm name (not id!)
1097    /// - `alias`: Alias of required action
1098    /// - `body`
1099    ///
1100    /// Resource: `Authentication Management`
1101    ///
1102    /// `PUT /admin/realms/{realm}/authentication/required-actions/{alias}`
1103    ///
1104    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmauthenticationrequired_actionsalias>
1105    #[cfg(feature = "tag-authentication-management")]
1106    pub async fn realm_authentication_required_actions_with_alias_put(
1107        &self,
1108        realm: &str,
1109        alias: &str,
1110        body: RequiredActionProviderRepresentation,
1111    ) -> Result<(), KeycloakError> {
1112        let realm = p(realm);
1113        let alias = p(alias);
1114        let builder = self
1115            .client
1116            .put(format!(
1117                "{}/admin/realms/{realm}/authentication/required-actions/{alias}",
1118                self.url
1119            ))
1120            .json(&body)
1121            .bearer_auth(self.token_supplier.get(&self.url).await?);
1122        let response = builder.send().await?;
1123        error_check(response).await?;
1124        Ok(())
1125    }
1126
1127    /// Delete required action
1128    ///
1129    /// Parameters:
1130    ///
1131    /// - `realm`: realm name (not id!)
1132    /// - `alias`: Alias of required action
1133    ///
1134    /// Resource: `Authentication Management`
1135    ///
1136    /// `DELETE /admin/realms/{realm}/authentication/required-actions/{alias}`
1137    ///
1138    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmauthenticationrequired_actionsalias>
1139    #[cfg(feature = "tag-authentication-management")]
1140    pub async fn realm_authentication_required_actions_with_alias_delete(
1141        &self,
1142        realm: &str,
1143        alias: &str,
1144    ) -> Result<(), KeycloakError> {
1145        let realm = p(realm);
1146        let alias = p(alias);
1147        let builder = self
1148            .client
1149            .delete(format!(
1150                "{}/admin/realms/{realm}/authentication/required-actions/{alias}",
1151                self.url
1152            ))
1153            .bearer_auth(self.token_supplier.get(&self.url).await?);
1154        let response = builder.send().await?;
1155        error_check(response).await?;
1156        Ok(())
1157    }
1158
1159    /// Get RequiredAction configuration
1160    ///
1161    /// Parameters:
1162    ///
1163    /// - `realm`: realm name (not id!)
1164    /// - `alias`: Alias of required action
1165    ///
1166    /// Resource: `Authentication Management`
1167    ///
1168    /// `GET /admin/realms/{realm}/authentication/required-actions/{alias}/config`
1169    ///
1170    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationrequired_actionsaliasconfig>
1171    #[cfg(feature = "tag-authentication-management")]
1172    pub async fn realm_authentication_required_actions_with_alias_config_get(
1173        &self,
1174        realm: &str,
1175        alias: &str,
1176    ) -> Result<RequiredActionConfigRepresentation, KeycloakError> {
1177        let realm = p(realm);
1178        let alias = p(alias);
1179        let builder = self
1180            .client
1181            .get(format!(
1182                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/config",
1183                self.url
1184            ))
1185            .bearer_auth(self.token_supplier.get(&self.url).await?);
1186        let response = builder.send().await?;
1187        Ok(error_check(response).await?.json().await?)
1188    }
1189
1190    /// Update RequiredAction configuration
1191    ///
1192    /// Parameters:
1193    ///
1194    /// - `realm`: realm name (not id!)
1195    /// - `alias`: Alias of required action
1196    /// - `body`
1197    ///
1198    /// Resource: `Authentication Management`
1199    ///
1200    /// `PUT /admin/realms/{realm}/authentication/required-actions/{alias}/config`
1201    ///
1202    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmauthenticationrequired_actionsaliasconfig>
1203    #[cfg(feature = "tag-authentication-management")]
1204    pub async fn realm_authentication_required_actions_with_alias_config_put(
1205        &self,
1206        realm: &str,
1207        alias: &str,
1208        body: RequiredActionConfigRepresentation,
1209    ) -> Result<(), KeycloakError> {
1210        let realm = p(realm);
1211        let alias = p(alias);
1212        let builder = self
1213            .client
1214            .put(format!(
1215                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/config",
1216                self.url
1217            ))
1218            .json(&body)
1219            .bearer_auth(self.token_supplier.get(&self.url).await?);
1220        let response = builder.send().await?;
1221        error_check(response).await?;
1222        Ok(())
1223    }
1224
1225    /// Delete RequiredAction configuration
1226    ///
1227    /// Parameters:
1228    ///
1229    /// - `realm`: realm name (not id!)
1230    /// - `alias`: Alias of required action
1231    ///
1232    /// Resource: `Authentication Management`
1233    ///
1234    /// `DELETE /admin/realms/{realm}/authentication/required-actions/{alias}/config`
1235    ///
1236    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmauthenticationrequired_actionsaliasconfig>
1237    #[cfg(feature = "tag-authentication-management")]
1238    pub async fn realm_authentication_required_actions_with_alias_config_delete(
1239        &self,
1240        realm: &str,
1241        alias: &str,
1242    ) -> Result<(), KeycloakError> {
1243        let realm = p(realm);
1244        let alias = p(alias);
1245        let builder = self
1246            .client
1247            .delete(format!(
1248                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/config",
1249                self.url
1250            ))
1251            .bearer_auth(self.token_supplier.get(&self.url).await?);
1252        let response = builder.send().await?;
1253        error_check(response).await?;
1254        Ok(())
1255    }
1256
1257    /// Get RequiredAction provider configuration description
1258    ///
1259    /// Parameters:
1260    ///
1261    /// - `realm`: realm name (not id!)
1262    /// - `alias`: Alias of required action
1263    ///
1264    /// Resource: `Authentication Management`
1265    ///
1266    /// `GET /admin/realms/{realm}/authentication/required-actions/{alias}/config-description`
1267    ///
1268    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationrequired_actionsaliasconfig_description>
1269    #[cfg(feature = "tag-authentication-management")]
1270    pub async fn realm_authentication_required_actions_with_alias_config_description_get(
1271        &self,
1272        realm: &str,
1273        alias: &str,
1274    ) -> Result<RequiredActionConfigInfoRepresentation, KeycloakError> {
1275        let realm = p(realm);
1276        let alias = p(alias);
1277        let builder = self
1278            .client
1279            .get(format!(
1280                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/config-description",
1281                self.url
1282            ))
1283            .bearer_auth(self.token_supplier.get(&self.url).await?);
1284        let response = builder.send().await?;
1285        Ok(error_check(response).await?.json().await?)
1286    }
1287
1288    /// Lower required action's priority
1289    ///
1290    /// Parameters:
1291    ///
1292    /// - `realm`: realm name (not id!)
1293    /// - `alias`: Alias of required action
1294    ///
1295    /// Returns id of created resource
1296    ///
1297    /// Resource: `Authentication Management`
1298    ///
1299    /// `POST /admin/realms/{realm}/authentication/required-actions/{alias}/lower-priority`
1300    ///
1301    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationrequired_actionsaliaslower_priority>
1302    #[cfg(feature = "tag-authentication-management")]
1303    pub async fn realm_authentication_required_actions_with_alias_lower_priority_post(
1304        &self,
1305        realm: &str,
1306        alias: &str,
1307    ) -> Result<Option<TypeString>, KeycloakError> {
1308        let realm = p(realm);
1309        let alias = p(alias);
1310        let builder = self
1311            .client
1312            .post(format!(
1313                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/lower-priority",
1314                self.url
1315            ))
1316            .bearer_auth(self.token_supplier.get(&self.url).await?);
1317        let response = builder.send().await?;
1318        error_check(response).await.map(to_id)
1319    }
1320
1321    /// Raise required action's priority
1322    ///
1323    /// Parameters:
1324    ///
1325    /// - `realm`: realm name (not id!)
1326    /// - `alias`: Alias of required action
1327    ///
1328    /// Returns id of created resource
1329    ///
1330    /// Resource: `Authentication Management`
1331    ///
1332    /// `POST /admin/realms/{realm}/authentication/required-actions/{alias}/raise-priority`
1333    ///
1334    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmauthenticationrequired_actionsaliasraise_priority>
1335    #[cfg(feature = "tag-authentication-management")]
1336    pub async fn realm_authentication_required_actions_with_alias_raise_priority_post(
1337        &self,
1338        realm: &str,
1339        alias: &str,
1340    ) -> Result<Option<TypeString>, KeycloakError> {
1341        let realm = p(realm);
1342        let alias = p(alias);
1343        let builder = self
1344            .client
1345            .post(format!(
1346                "{}/admin/realms/{realm}/authentication/required-actions/{alias}/raise-priority",
1347                self.url
1348            ))
1349            .bearer_auth(self.token_supplier.get(&self.url).await?);
1350        let response = builder.send().await?;
1351        error_check(response).await.map(to_id)
1352    }
1353
1354    /// Get unregistered required actions Returns a stream of unregistered required actions.
1355    ///
1356    /// Parameters:
1357    ///
1358    /// - `realm`: realm name (not id!)
1359    ///
1360    /// Resource: `Authentication Management`
1361    ///
1362    /// `GET /admin/realms/{realm}/authentication/unregistered-required-actions`
1363    ///
1364    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmauthenticationunregistered_required_actions>
1365    #[cfg(feature = "tag-authentication-management")]
1366    pub async fn realm_authentication_unregistered_required_actions_get(
1367        &self,
1368        realm: &str,
1369    ) -> Result<TypeVec<RequiredActionProviderRepresentation>, KeycloakError> {
1370        let realm = p(realm);
1371        let builder = self
1372            .client
1373            .get(format!(
1374                "{}/admin/realms/{realm}/authentication/unregistered-required-actions",
1375                self.url
1376            ))
1377            .bearer_auth(self.token_supplier.get(&self.url).await?);
1378        let response = builder.send().await?;
1379        Ok(error_check(response).await?.json().await?)
1380    }
1381
1382    // <h4>Client Attribute Certificate</h4>
1383
1384    /// Get key info
1385    ///
1386    /// Parameters:
1387    ///
1388    /// - `realm`: realm name (not id!)
1389    /// - `client_uuid`: id of client (not client-id!)
1390    /// - `attr`
1391    ///
1392    /// Resource: `Client Attribute Certificate`
1393    ///
1394    /// `GET /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}`
1395    ///
1396    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidcertificatesattr>
1397    ///
1398    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}`
1399    #[cfg(feature = "tag-client-attribute-certificate")]
1400    pub async fn realm_clients_with_client_uuid_certificates_with_attr_get(
1401        &self,
1402        realm: &str,
1403        client_uuid: &str,
1404        attr: &str,
1405    ) -> Result<CertificateRepresentation, KeycloakError> {
1406        let realm = p(realm);
1407        let client_uuid = p(client_uuid);
1408        let attr = p(attr);
1409        let builder = self
1410            .client
1411            .get(format!(
1412                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}",
1413                self.url
1414            ))
1415            .bearer_auth(self.token_supplier.get(&self.url).await?);
1416        let response = builder.send().await?;
1417        Ok(error_check(response).await?.json().await?)
1418    }
1419
1420    /// Get a keystore file for the client, containing private key and public certificate
1421    ///
1422    /// Parameters:
1423    ///
1424    /// - `realm`: realm name (not id!)
1425    /// - `client_uuid`: id of client (not client-id!)
1426    /// - `attr`
1427    /// - `body`
1428    ///
1429    /// Resource: `Client Attribute Certificate`
1430    ///
1431    /// `POST /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/download`
1432    ///
1433    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidcertificatesattrdownload>
1434    ///
1435    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}/download`
1436    #[cfg(feature = "tag-client-attribute-certificate")]
1437    pub async fn realm_clients_with_client_uuid_certificates_with_attr_download_post(
1438        &self,
1439        realm: &str,
1440        client_uuid: &str,
1441        attr: &str,
1442        body: KeyStoreConfig,
1443    ) -> Result<TypeString, KeycloakError> {
1444        let realm = p(realm);
1445        let client_uuid = p(client_uuid);
1446        let attr = p(attr);
1447        let builder = self
1448            .client
1449            .post(format!(
1450                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/download",
1451                self.url
1452            ))
1453            .json(&body)
1454            .bearer_auth(self.token_supplier.get(&self.url).await?);
1455        let response = builder.send().await?;
1456        Ok(error_check(response).await?.text().await.map(From::from)?)
1457    }
1458
1459    /// Generate a new certificate with new key pair
1460    ///
1461    /// Parameters:
1462    ///
1463    /// - `realm`: realm name (not id!)
1464    /// - `client_uuid`: id of client (not client-id!)
1465    /// - `attr`
1466    ///
1467    /// Resource: `Client Attribute Certificate`
1468    ///
1469    /// `POST /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/generate`
1470    ///
1471    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidcertificatesattrgenerate>
1472    ///
1473    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}/generate`
1474    #[cfg(feature = "tag-client-attribute-certificate")]
1475    pub async fn realm_clients_with_client_uuid_certificates_with_attr_generate_post(
1476        &self,
1477        realm: &str,
1478        client_uuid: &str,
1479        attr: &str,
1480    ) -> Result<CertificateRepresentation, KeycloakError> {
1481        let realm = p(realm);
1482        let client_uuid = p(client_uuid);
1483        let attr = p(attr);
1484        let builder = self
1485            .client
1486            .post(format!(
1487                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/generate",
1488                self.url
1489            ))
1490            .bearer_auth(self.token_supplier.get(&self.url).await?);
1491        let response = builder.send().await?;
1492        Ok(error_check(response).await?.json().await?)
1493    }
1494
1495    /// Generate a new keypair and certificate, and get the private key file
1496    ///
1497    /// Generates a keypair and certificate and serves the private key in a specified keystore format.
1498    /// Only generated public certificate is saved in Keycloak DB - the private key is not.
1499    ///
1500    /// Parameters:
1501    ///
1502    /// - `realm`: realm name (not id!)
1503    /// - `client_uuid`: id of client (not client-id!)
1504    /// - `attr`
1505    /// - `body`
1506    ///
1507    /// Resource: `Client Attribute Certificate`
1508    ///
1509    /// `POST /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/generate-and-download`
1510    ///
1511    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidcertificatesattrgenerate_and_download>
1512    ///
1513    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}/generate-and-download`
1514    #[cfg(feature = "tag-client-attribute-certificate")]
1515    pub async fn realm_clients_with_client_uuid_certificates_with_attr_generate_and_download_post(
1516        &self,
1517        realm: &str,
1518        client_uuid: &str,
1519        attr: &str,
1520        body: KeyStoreConfig,
1521    ) -> Result<TypeString, KeycloakError> {
1522        let realm = p(realm);
1523        let client_uuid = p(client_uuid);
1524        let attr = p(attr);
1525        let builder = self
1526            .client
1527            .post(format!(
1528                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/generate-and-download",
1529                self.url
1530            ))
1531            .json(&body)
1532            .bearer_auth(self.token_supplier.get(&self.url).await?);
1533        let response = builder.send().await?;
1534        Ok(error_check(response).await?.text().await.map(From::from)?)
1535    }
1536
1537    /// Upload certificate and eventually private key
1538    ///
1539    /// Parameters:
1540    ///
1541    /// - `realm`: realm name (not id!)
1542    /// - `client_uuid`: id of client (not client-id!)
1543    /// - `attr`
1544    ///
1545    /// Resource: `Client Attribute Certificate`
1546    ///
1547    /// `POST /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/upload`
1548    ///
1549    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidcertificatesattrupload>
1550    ///
1551    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}/upload`
1552    #[cfg(feature = "tag-client-attribute-certificate")]
1553    pub async fn realm_clients_with_client_uuid_certificates_with_attr_upload_post(
1554        &self,
1555        realm: &str,
1556        client_uuid: &str,
1557        attr: &str,
1558    ) -> Result<CertificateRepresentation, KeycloakError> {
1559        let realm = p(realm);
1560        let client_uuid = p(client_uuid);
1561        let attr = p(attr);
1562        let builder = self
1563            .client
1564            .post(format!(
1565                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/upload",
1566                self.url
1567            ))
1568            .bearer_auth(self.token_supplier.get(&self.url).await?);
1569        let response = builder.send().await?;
1570        Ok(error_check(response).await?.json().await?)
1571    }
1572
1573    /// Upload only certificate, not private key
1574    ///
1575    /// Parameters:
1576    ///
1577    /// - `realm`: realm name (not id!)
1578    /// - `client_uuid`: id of client (not client-id!)
1579    /// - `attr`
1580    ///
1581    /// Resource: `Client Attribute Certificate`
1582    ///
1583    /// `POST /admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/upload-certificate`
1584    ///
1585    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidcertificatesattrupload_certificate>
1586    ///
1587    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/certificates/{attr}/upload-certificate`
1588    #[cfg(feature = "tag-client-attribute-certificate")]
1589    pub async fn realm_clients_with_client_uuid_certificates_with_attr_upload_certificate_post(
1590        &self,
1591        realm: &str,
1592        client_uuid: &str,
1593        attr: &str,
1594    ) -> Result<CertificateRepresentation, KeycloakError> {
1595        let realm = p(realm);
1596        let client_uuid = p(client_uuid);
1597        let attr = p(attr);
1598        let builder = self
1599            .client
1600            .post(format!(
1601                "{}/admin/realms/{realm}/clients/{client_uuid}/certificates/{attr}/upload-certificate",
1602                self.url
1603            ))
1604            .bearer_auth(self.token_supplier.get(&self.url).await?);
1605        let response = builder.send().await?;
1606        Ok(error_check(response).await?.json().await?)
1607    }
1608
1609    // <h4>Client Initial Access</h4>
1610
1611    /// Parameters:
1612    ///
1613    /// - `realm`: realm name (not id!)
1614    ///
1615    /// Resource: `Client Initial Access`
1616    ///
1617    /// `GET /admin/realms/{realm}/clients-initial-access`
1618    ///
1619    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclients_initial_access>
1620    #[cfg(feature = "tag-client-initial-access")]
1621    pub async fn realm_clients_initial_access_get(
1622        &self,
1623        realm: &str,
1624    ) -> Result<TypeVec<ClientInitialAccessPresentation>, KeycloakError> {
1625        let realm = p(realm);
1626        let builder = self
1627            .client
1628            .get(format!(
1629                "{}/admin/realms/{realm}/clients-initial-access",
1630                self.url
1631            ))
1632            .bearer_auth(self.token_supplier.get(&self.url).await?);
1633        let response = builder.send().await?;
1634        Ok(error_check(response).await?.json().await?)
1635    }
1636
1637    /// Create a new initial access token.
1638    ///
1639    /// Parameters:
1640    ///
1641    /// - `realm`: realm name (not id!)
1642    /// - `body`
1643    ///
1644    /// Resource: `Client Initial Access`
1645    ///
1646    /// `POST /admin/realms/{realm}/clients-initial-access`
1647    ///
1648    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclients_initial_access>
1649    #[cfg(feature = "tag-client-initial-access")]
1650    pub async fn realm_clients_initial_access_post(
1651        &self,
1652        realm: &str,
1653        body: ClientInitialAccessCreatePresentation,
1654    ) -> Result<ClientInitialAccessCreatePresentation, KeycloakError> {
1655        let realm = p(realm);
1656        let builder = self
1657            .client
1658            .post(format!(
1659                "{}/admin/realms/{realm}/clients-initial-access",
1660                self.url
1661            ))
1662            .json(&body)
1663            .bearer_auth(self.token_supplier.get(&self.url).await?);
1664        let response = builder.send().await?;
1665        Ok(error_check(response).await?.json().await?)
1666    }
1667
1668    /// Parameters:
1669    ///
1670    /// - `realm`: realm name (not id!)
1671    /// - `id`
1672    ///
1673    /// Resource: `Client Initial Access`
1674    ///
1675    /// `DELETE /admin/realms/{realm}/clients-initial-access/{id}`
1676    ///
1677    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclients_initial_accessid>
1678    #[cfg(feature = "tag-client-initial-access")]
1679    pub async fn realm_clients_initial_access_with_id_delete(
1680        &self,
1681        realm: &str,
1682        id: &str,
1683    ) -> Result<(), KeycloakError> {
1684        let realm = p(realm);
1685        let id = p(id);
1686        let builder = self
1687            .client
1688            .delete(format!(
1689                "{}/admin/realms/{realm}/clients-initial-access/{id}",
1690                self.url
1691            ))
1692            .bearer_auth(self.token_supplier.get(&self.url).await?);
1693        let response = builder.send().await?;
1694        error_check(response).await?;
1695        Ok(())
1696    }
1697
1698    // <h4>Client Registration Policy</h4>
1699
1700    /// Base path for retrieve providers with the configProperties properly filled
1701    ///
1702    /// Parameters:
1703    ///
1704    /// - `realm`: realm name (not id!)
1705    ///
1706    /// Resource: `Client Registration Policy`
1707    ///
1708    /// `GET /admin/realms/{realm}/client-registration-policy/providers`
1709    ///
1710    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_registration_policyproviders>
1711    #[cfg(feature = "tag-client-registration-policy")]
1712    pub async fn realm_client_registration_policy_providers_get(
1713        &self,
1714        realm: &str,
1715    ) -> Result<TypeVec<ComponentTypeRepresentation>, KeycloakError> {
1716        let realm = p(realm);
1717        let builder = self
1718            .client
1719            .get(format!(
1720                "{}/admin/realms/{realm}/client-registration-policy/providers",
1721                self.url
1722            ))
1723            .bearer_auth(self.token_supplier.get(&self.url).await?);
1724        let response = builder.send().await?;
1725        Ok(error_check(response).await?.json().await?)
1726    }
1727
1728    // <h4>Client Role Mappings</h4>
1729
1730    /// Get client-level role mappings for the user or group, and the app
1731    ///
1732    /// Parameters:
1733    ///
1734    /// - `realm`: realm name (not id!)
1735    /// - `group_id`
1736    /// - `client_id`: client id (not clientId!)
1737    ///
1738    /// Resource: `Client Role Mappings`
1739    ///
1740    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}`
1741    ///
1742    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsclientsclient_id>
1743    ///
1744    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/clients/{client-id}`
1745    #[cfg(feature = "tag-client-role-mappings")]
1746    pub async fn realm_groups_with_group_id_role_mappings_clients_with_client_id_get(
1747        &self,
1748        realm: &str,
1749        group_id: &str,
1750        client_id: &str,
1751    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
1752        let realm = p(realm);
1753        let group_id = p(group_id);
1754        let client_id = p(client_id);
1755        let builder = self
1756            .client
1757            .get(format!(
1758                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}",
1759                self.url
1760            ))
1761            .bearer_auth(self.token_supplier.get(&self.url).await?);
1762        let response = builder.send().await?;
1763        Ok(error_check(response).await?.json().await?)
1764    }
1765
1766    /// Add client-level roles to the user or group role mapping
1767    ///
1768    /// Parameters:
1769    ///
1770    /// - `realm`: realm name (not id!)
1771    /// - `group_id`
1772    /// - `client_id`: client id (not clientId!)
1773    /// - `body`
1774    ///
1775    /// Returns id of created resource
1776    ///
1777    /// Resource: `Client Role Mappings`
1778    ///
1779    /// `POST /admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}`
1780    ///
1781    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmgroupsgroup_idrole_mappingsclientsclient_id>
1782    ///
1783    /// REST method: `POST /admin/realms/{realm}/groups/{group-id}/role-mappings/clients/{client-id}`
1784    #[cfg(feature = "tag-client-role-mappings")]
1785    pub async fn realm_groups_with_group_id_role_mappings_clients_with_client_id_post(
1786        &self,
1787        realm: &str,
1788        group_id: &str,
1789        client_id: &str,
1790        body: Vec<RoleRepresentation>,
1791    ) -> Result<Option<TypeString>, KeycloakError> {
1792        let realm = p(realm);
1793        let group_id = p(group_id);
1794        let client_id = p(client_id);
1795        let builder = self
1796            .client
1797            .post(format!(
1798                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}",
1799                self.url
1800            ))
1801            .json(&body)
1802            .bearer_auth(self.token_supplier.get(&self.url).await?);
1803        let response = builder.send().await?;
1804        error_check(response).await.map(to_id)
1805    }
1806
1807    /// Delete client-level roles from user or group role mapping
1808    ///
1809    /// Parameters:
1810    ///
1811    /// - `realm`: realm name (not id!)
1812    /// - `group_id`
1813    /// - `client_id`: client id (not clientId!)
1814    /// - `body`
1815    ///
1816    /// Resource: `Client Role Mappings`
1817    ///
1818    /// `DELETE /admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}`
1819    ///
1820    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmgroupsgroup_idrole_mappingsclientsclient_id>
1821    ///
1822    /// REST method: `DELETE /admin/realms/{realm}/groups/{group-id}/role-mappings/clients/{client-id}`
1823    #[cfg(feature = "tag-client-role-mappings")]
1824    pub async fn realm_groups_with_group_id_role_mappings_clients_with_client_id_delete(
1825        &self,
1826        realm: &str,
1827        group_id: &str,
1828        client_id: &str,
1829        body: Vec<RoleRepresentation>,
1830    ) -> Result<(), KeycloakError> {
1831        let realm = p(realm);
1832        let group_id = p(group_id);
1833        let client_id = p(client_id);
1834        let builder = self
1835            .client
1836            .delete(format!(
1837                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}",
1838                self.url
1839            ))
1840            .json(&body)
1841            .bearer_auth(self.token_supplier.get(&self.url).await?);
1842        let response = builder.send().await?;
1843        error_check(response).await?;
1844        Ok(())
1845    }
1846
1847    /// Get available client-level roles that can be mapped to the user or group
1848    ///
1849    /// Parameters:
1850    ///
1851    /// - `realm`: realm name (not id!)
1852    /// - `group_id`
1853    /// - `client_id`: client id (not clientId!)
1854    ///
1855    /// Resource: `Client Role Mappings`
1856    ///
1857    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}/available`
1858    ///
1859    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsclientsclient_idavailable>
1860    ///
1861    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/clients/{client-id}/available`
1862    #[cfg(feature = "tag-client-role-mappings")]
1863    pub async fn realm_groups_with_group_id_role_mappings_clients_with_client_id_available_get(
1864        &self,
1865        realm: &str,
1866        group_id: &str,
1867        client_id: &str,
1868    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
1869        let realm = p(realm);
1870        let group_id = p(group_id);
1871        let client_id = p(client_id);
1872        let builder = self
1873            .client
1874            .get(format!(
1875                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}/available",
1876                self.url
1877            ))
1878            .bearer_auth(self.token_supplier.get(&self.url).await?);
1879        let response = builder.send().await?;
1880        Ok(error_check(response).await?.json().await?)
1881    }
1882
1883    /// Get effective client-level role mappings This recurses any composite roles
1884    ///
1885    /// Parameters:
1886    ///
1887    /// - `realm`: realm name (not id!)
1888    /// - `group_id`
1889    /// - `client_id`: client id (not clientId!)
1890    /// - `brief_representation`: if false, return roles with their attributes
1891    ///
1892    /// Resource: `Client Role Mappings`
1893    ///
1894    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}/composite`
1895    ///
1896    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsclientsclient_idcomposite>
1897    ///
1898    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/clients/{client-id}/composite`
1899    #[cfg(feature = "tag-client-role-mappings")]
1900    pub async fn realm_groups_with_group_id_role_mappings_clients_with_client_id_composite_get(
1901        &self,
1902        realm: &str,
1903        group_id: &str,
1904        client_id: &str,
1905        brief_representation: Option<bool>,
1906    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
1907        let realm = p(realm);
1908        let group_id = p(group_id);
1909        let client_id = p(client_id);
1910        let mut builder = self
1911            .client
1912            .get(format!(
1913                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/clients/{client_id}/composite",
1914                self.url
1915            ))
1916            .bearer_auth(self.token_supplier.get(&self.url).await?);
1917        if let Some(v) = brief_representation {
1918            builder = builder.query(&[("briefRepresentation", v)]);
1919        }
1920        let response = builder.send().await?;
1921        Ok(error_check(response).await?.json().await?)
1922    }
1923
1924    /// Get client-level role mappings for the user or group, and the app
1925    ///
1926    /// Parameters:
1927    ///
1928    /// - `realm`: realm name (not id!)
1929    /// - `user_id`
1930    /// - `client_id`: client id (not clientId!)
1931    ///
1932    /// Resource: `Client Role Mappings`
1933    ///
1934    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}`
1935    ///
1936    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsclientsclient_id>
1937    ///
1938    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/clients/{client-id}`
1939    #[cfg(feature = "tag-client-role-mappings")]
1940    pub async fn realm_users_with_user_id_role_mappings_clients_with_client_id_get(
1941        &self,
1942        realm: &str,
1943        user_id: &str,
1944        client_id: &str,
1945    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
1946        let realm = p(realm);
1947        let user_id = p(user_id);
1948        let client_id = p(client_id);
1949        let builder = self
1950            .client
1951            .get(format!(
1952                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}",
1953                self.url
1954            ))
1955            .bearer_auth(self.token_supplier.get(&self.url).await?);
1956        let response = builder.send().await?;
1957        Ok(error_check(response).await?.json().await?)
1958    }
1959
1960    /// Add client-level roles to the user or group role mapping
1961    ///
1962    /// Parameters:
1963    ///
1964    /// - `realm`: realm name (not id!)
1965    /// - `user_id`
1966    /// - `client_id`: client id (not clientId!)
1967    /// - `body`
1968    ///
1969    /// Returns id of created resource
1970    ///
1971    /// Resource: `Client Role Mappings`
1972    ///
1973    /// `POST /admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}`
1974    ///
1975    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idrole_mappingsclientsclient_id>
1976    ///
1977    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/role-mappings/clients/{client-id}`
1978    #[cfg(feature = "tag-client-role-mappings")]
1979    pub async fn realm_users_with_user_id_role_mappings_clients_with_client_id_post(
1980        &self,
1981        realm: &str,
1982        user_id: &str,
1983        client_id: &str,
1984        body: Vec<RoleRepresentation>,
1985    ) -> Result<Option<TypeString>, KeycloakError> {
1986        let realm = p(realm);
1987        let user_id = p(user_id);
1988        let client_id = p(client_id);
1989        let builder = self
1990            .client
1991            .post(format!(
1992                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}",
1993                self.url
1994            ))
1995            .json(&body)
1996            .bearer_auth(self.token_supplier.get(&self.url).await?);
1997        let response = builder.send().await?;
1998        error_check(response).await.map(to_id)
1999    }
2000
2001    /// Delete client-level roles from user or group role mapping
2002    ///
2003    /// Parameters:
2004    ///
2005    /// - `realm`: realm name (not id!)
2006    /// - `user_id`
2007    /// - `client_id`: client id (not clientId!)
2008    /// - `body`
2009    ///
2010    /// Resource: `Client Role Mappings`
2011    ///
2012    /// `DELETE /admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}`
2013    ///
2014    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idrole_mappingsclientsclient_id>
2015    ///
2016    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/role-mappings/clients/{client-id}`
2017    #[cfg(feature = "tag-client-role-mappings")]
2018    pub async fn realm_users_with_user_id_role_mappings_clients_with_client_id_delete(
2019        &self,
2020        realm: &str,
2021        user_id: &str,
2022        client_id: &str,
2023        body: Vec<RoleRepresentation>,
2024    ) -> Result<(), KeycloakError> {
2025        let realm = p(realm);
2026        let user_id = p(user_id);
2027        let client_id = p(client_id);
2028        let builder = self
2029            .client
2030            .delete(format!(
2031                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}",
2032                self.url
2033            ))
2034            .json(&body)
2035            .bearer_auth(self.token_supplier.get(&self.url).await?);
2036        let response = builder.send().await?;
2037        error_check(response).await?;
2038        Ok(())
2039    }
2040
2041    /// Get available client-level roles that can be mapped to the user or group
2042    ///
2043    /// Parameters:
2044    ///
2045    /// - `realm`: realm name (not id!)
2046    /// - `user_id`
2047    /// - `client_id`: client id (not clientId!)
2048    ///
2049    /// Resource: `Client Role Mappings`
2050    ///
2051    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}/available`
2052    ///
2053    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsclientsclient_idavailable>
2054    ///
2055    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/clients/{client-id}/available`
2056    #[cfg(feature = "tag-client-role-mappings")]
2057    pub async fn realm_users_with_user_id_role_mappings_clients_with_client_id_available_get(
2058        &self,
2059        realm: &str,
2060        user_id: &str,
2061        client_id: &str,
2062    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
2063        let realm = p(realm);
2064        let user_id = p(user_id);
2065        let client_id = p(client_id);
2066        let builder = self
2067            .client
2068            .get(format!(
2069                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}/available",
2070                self.url
2071            ))
2072            .bearer_auth(self.token_supplier.get(&self.url).await?);
2073        let response = builder.send().await?;
2074        Ok(error_check(response).await?.json().await?)
2075    }
2076
2077    /// Get effective client-level role mappings This recurses any composite roles
2078    ///
2079    /// Parameters:
2080    ///
2081    /// - `realm`: realm name (not id!)
2082    /// - `user_id`
2083    /// - `client_id`: client id (not clientId!)
2084    /// - `brief_representation`: if false, return roles with their attributes
2085    ///
2086    /// Resource: `Client Role Mappings`
2087    ///
2088    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}/composite`
2089    ///
2090    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsclientsclient_idcomposite>
2091    ///
2092    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/clients/{client-id}/composite`
2093    #[cfg(feature = "tag-client-role-mappings")]
2094    pub async fn realm_users_with_user_id_role_mappings_clients_with_client_id_composite_get(
2095        &self,
2096        realm: &str,
2097        user_id: &str,
2098        client_id: &str,
2099        brief_representation: Option<bool>,
2100    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
2101        let realm = p(realm);
2102        let user_id = p(user_id);
2103        let client_id = p(client_id);
2104        let mut builder = self
2105            .client
2106            .get(format!(
2107                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/clients/{client_id}/composite",
2108                self.url
2109            ))
2110            .bearer_auth(self.token_supplier.get(&self.url).await?);
2111        if let Some(v) = brief_representation {
2112            builder = builder.query(&[("briefRepresentation", v)]);
2113        }
2114        let response = builder.send().await?;
2115        Ok(error_check(response).await?.json().await?)
2116    }
2117
2118    // <h4>Client Scopes</h4>
2119
2120    /// Get client scopes belonging to the realm Returns a list of client scopes belonging to the realm
2121    ///
2122    /// Parameters:
2123    ///
2124    /// - `realm`: realm name (not id!)
2125    ///
2126    /// Resource: `Client Scopes`
2127    ///
2128    /// `GET /admin/realms/{realm}/client-scopes`
2129    ///
2130    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopes>
2131    #[cfg(feature = "tag-client-scopes")]
2132    pub async fn realm_client_scopes_get(
2133        &self,
2134        realm: &str,
2135    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
2136        let realm = p(realm);
2137        let builder = self
2138            .client
2139            .get(format!("{}/admin/realms/{realm}/client-scopes", self.url))
2140            .bearer_auth(self.token_supplier.get(&self.url).await?);
2141        let response = builder.send().await?;
2142        Ok(error_check(response).await?.json().await?)
2143    }
2144
2145    /// Create a new client scope Client Scope’s name must be unique!
2146    ///
2147    /// Parameters:
2148    ///
2149    /// - `realm`: realm name (not id!)
2150    /// - `body`
2151    ///
2152    /// Returns id of created resource
2153    ///
2154    /// Resource: `Client Scopes`
2155    ///
2156    /// `POST /admin/realms/{realm}/client-scopes`
2157    ///
2158    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_scopes>
2159    #[cfg(feature = "tag-client-scopes")]
2160    pub async fn realm_client_scopes_post(
2161        &self,
2162        realm: &str,
2163        body: ClientScopeRepresentation,
2164    ) -> Result<Option<TypeString>, KeycloakError> {
2165        let realm = p(realm);
2166        let builder = self
2167            .client
2168            .post(format!("{}/admin/realms/{realm}/client-scopes", self.url))
2169            .json(&body)
2170            .bearer_auth(self.token_supplier.get(&self.url).await?);
2171        let response = builder.send().await?;
2172        error_check(response).await.map(to_id)
2173    }
2174
2175    /// Get representation of the client scope
2176    ///
2177    /// Parameters:
2178    ///
2179    /// - `realm`: realm name (not id!)
2180    /// - `client_scope_id`
2181    ///
2182    /// Resource: `Client Scopes`
2183    ///
2184    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}`
2185    ///
2186    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_id>
2187    ///
2188    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}`
2189    #[cfg(feature = "tag-client-scopes")]
2190    pub async fn realm_client_scopes_with_client_scope_id_get(
2191        &self,
2192        realm: &str,
2193        client_scope_id: &str,
2194    ) -> Result<ClientScopeRepresentation, KeycloakError> {
2195        let realm = p(realm);
2196        let client_scope_id = p(client_scope_id);
2197        let builder = self
2198            .client
2199            .get(format!(
2200                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}",
2201                self.url
2202            ))
2203            .bearer_auth(self.token_supplier.get(&self.url).await?);
2204        let response = builder.send().await?;
2205        Ok(error_check(response).await?.json().await?)
2206    }
2207
2208    /// Update the client scope
2209    ///
2210    /// Parameters:
2211    ///
2212    /// - `realm`: realm name (not id!)
2213    /// - `client_scope_id`
2214    /// - `body`
2215    ///
2216    /// Resource: `Client Scopes`
2217    ///
2218    /// `PUT /admin/realms/{realm}/client-scopes/{client_scope_id}`
2219    ///
2220    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_scopesclient_scope_id>
2221    ///
2222    /// REST method: `PUT /admin/realms/{realm}/client-scopes/{client-scope-id}`
2223    #[cfg(feature = "tag-client-scopes")]
2224    pub async fn realm_client_scopes_with_client_scope_id_put(
2225        &self,
2226        realm: &str,
2227        client_scope_id: &str,
2228        body: ClientScopeRepresentation,
2229    ) -> Result<(), KeycloakError> {
2230        let realm = p(realm);
2231        let client_scope_id = p(client_scope_id);
2232        let builder = self
2233            .client
2234            .put(format!(
2235                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}",
2236                self.url
2237            ))
2238            .json(&body)
2239            .bearer_auth(self.token_supplier.get(&self.url).await?);
2240        let response = builder.send().await?;
2241        error_check(response).await?;
2242        Ok(())
2243    }
2244
2245    /// Delete the client scope
2246    ///
2247    /// Parameters:
2248    ///
2249    /// - `realm`: realm name (not id!)
2250    /// - `client_scope_id`
2251    ///
2252    /// Resource: `Client Scopes`
2253    ///
2254    /// `DELETE /admin/realms/{realm}/client-scopes/{client_scope_id}`
2255    ///
2256    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_scopesclient_scope_id>
2257    ///
2258    /// REST method: `DELETE /admin/realms/{realm}/client-scopes/{client-scope-id}`
2259    #[cfg(feature = "tag-client-scopes")]
2260    pub async fn realm_client_scopes_with_client_scope_id_delete(
2261        &self,
2262        realm: &str,
2263        client_scope_id: &str,
2264    ) -> Result<(), KeycloakError> {
2265        let realm = p(realm);
2266        let client_scope_id = p(client_scope_id);
2267        let builder = self
2268            .client
2269            .delete(format!(
2270                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}",
2271                self.url
2272            ))
2273            .bearer_auth(self.token_supplier.get(&self.url).await?);
2274        let response = builder.send().await?;
2275        error_check(response).await?;
2276        Ok(())
2277    }
2278
2279    /// Get client scopes belonging to the realm Returns a list of client scopes belonging to the realm
2280    ///
2281    /// Parameters:
2282    ///
2283    /// - `realm`: realm name (not id!)
2284    ///
2285    /// Resource: `Client Scopes`
2286    ///
2287    /// `GET /admin/realms/{realm}/client-templates`
2288    ///
2289    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templates>
2290    #[cfg(feature = "tag-client-scopes")]
2291    pub async fn realm_client_templates_get(
2292        &self,
2293        realm: &str,
2294    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
2295        let realm = p(realm);
2296        let builder = self
2297            .client
2298            .get(format!(
2299                "{}/admin/realms/{realm}/client-templates",
2300                self.url
2301            ))
2302            .bearer_auth(self.token_supplier.get(&self.url).await?);
2303        let response = builder.send().await?;
2304        Ok(error_check(response).await?.json().await?)
2305    }
2306
2307    /// Create a new client scope Client Scope’s name must be unique!
2308    ///
2309    /// Parameters:
2310    ///
2311    /// - `realm`: realm name (not id!)
2312    /// - `body`
2313    ///
2314    /// Returns id of created resource
2315    ///
2316    /// Resource: `Client Scopes`
2317    ///
2318    /// `POST /admin/realms/{realm}/client-templates`
2319    ///
2320    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_templates>
2321    #[cfg(feature = "tag-client-scopes")]
2322    pub async fn realm_client_templates_post(
2323        &self,
2324        realm: &str,
2325        body: ClientScopeRepresentation,
2326    ) -> Result<Option<TypeString>, KeycloakError> {
2327        let realm = p(realm);
2328        let builder = self
2329            .client
2330            .post(format!(
2331                "{}/admin/realms/{realm}/client-templates",
2332                self.url
2333            ))
2334            .json(&body)
2335            .bearer_auth(self.token_supplier.get(&self.url).await?);
2336        let response = builder.send().await?;
2337        error_check(response).await.map(to_id)
2338    }
2339
2340    /// Get representation of the client scope
2341    ///
2342    /// Parameters:
2343    ///
2344    /// - `realm`: realm name (not id!)
2345    /// - `client_scope_id`
2346    ///
2347    /// Resource: `Client Scopes`
2348    ///
2349    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}`
2350    ///
2351    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_id>
2352    ///
2353    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}`
2354    #[cfg(feature = "tag-client-scopes")]
2355    pub async fn realm_client_templates_with_client_scope_id_get(
2356        &self,
2357        realm: &str,
2358        client_scope_id: &str,
2359    ) -> Result<ClientScopeRepresentation, KeycloakError> {
2360        let realm = p(realm);
2361        let client_scope_id = p(client_scope_id);
2362        let builder = self
2363            .client
2364            .get(format!(
2365                "{}/admin/realms/{realm}/client-templates/{client_scope_id}",
2366                self.url
2367            ))
2368            .bearer_auth(self.token_supplier.get(&self.url).await?);
2369        let response = builder.send().await?;
2370        Ok(error_check(response).await?.json().await?)
2371    }
2372
2373    /// Update the client scope
2374    ///
2375    /// Parameters:
2376    ///
2377    /// - `realm`: realm name (not id!)
2378    /// - `client_scope_id`
2379    /// - `body`
2380    ///
2381    /// Resource: `Client Scopes`
2382    ///
2383    /// `PUT /admin/realms/{realm}/client-templates/{client_scope_id}`
2384    ///
2385    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_templatesclient_scope_id>
2386    ///
2387    /// REST method: `PUT /admin/realms/{realm}/client-templates/{client-scope-id}`
2388    #[cfg(feature = "tag-client-scopes")]
2389    pub async fn realm_client_templates_with_client_scope_id_put(
2390        &self,
2391        realm: &str,
2392        client_scope_id: &str,
2393        body: ClientScopeRepresentation,
2394    ) -> Result<(), KeycloakError> {
2395        let realm = p(realm);
2396        let client_scope_id = p(client_scope_id);
2397        let builder = self
2398            .client
2399            .put(format!(
2400                "{}/admin/realms/{realm}/client-templates/{client_scope_id}",
2401                self.url
2402            ))
2403            .json(&body)
2404            .bearer_auth(self.token_supplier.get(&self.url).await?);
2405        let response = builder.send().await?;
2406        error_check(response).await?;
2407        Ok(())
2408    }
2409
2410    /// Delete the client scope
2411    ///
2412    /// Parameters:
2413    ///
2414    /// - `realm`: realm name (not id!)
2415    /// - `client_scope_id`
2416    ///
2417    /// Resource: `Client Scopes`
2418    ///
2419    /// `DELETE /admin/realms/{realm}/client-templates/{client_scope_id}`
2420    ///
2421    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_templatesclient_scope_id>
2422    ///
2423    /// REST method: `DELETE /admin/realms/{realm}/client-templates/{client-scope-id}`
2424    #[cfg(feature = "tag-client-scopes")]
2425    pub async fn realm_client_templates_with_client_scope_id_delete(
2426        &self,
2427        realm: &str,
2428        client_scope_id: &str,
2429    ) -> Result<(), KeycloakError> {
2430        let realm = p(realm);
2431        let client_scope_id = p(client_scope_id);
2432        let builder = self
2433            .client
2434            .delete(format!(
2435                "{}/admin/realms/{realm}/client-templates/{client_scope_id}",
2436                self.url
2437            ))
2438            .bearer_auth(self.token_supplier.get(&self.url).await?);
2439        let response = builder.send().await?;
2440        error_check(response).await?;
2441        Ok(())
2442    }
2443
2444    // <h4>Clients</h4>
2445
2446    /// Get clients belonging to the realm.
2447    ///
2448    /// Parameters:
2449    ///
2450    /// - `realm`: realm name (not id!)
2451    /// - `client_id`: filter by clientId
2452    /// - `first`: the first result
2453    /// - `max`: the max results to return
2454    /// - `q`
2455    /// - `search`: whether this is a search query or a getClientById query
2456    /// - `viewable_only`: filter clients that cannot be viewed in full by admin
2457    ///
2458    /// Resource: `Clients`
2459    ///
2460    /// `GET /admin/realms/{realm}/clients`
2461    ///
2462    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclients>
2463    #[cfg(feature = "tag-clients")]
2464    #[allow(clippy::too_many_arguments)]
2465    pub async fn realm_clients_get(
2466        &self,
2467        realm: &str,
2468        client_id: Option<String>,
2469        first: Option<i32>,
2470        max: Option<i32>,
2471        q: Option<String>,
2472        search: Option<bool>,
2473        viewable_only: Option<bool>,
2474    ) -> Result<TypeVec<ClientRepresentation>, KeycloakError> {
2475        let realm = p(realm);
2476        let mut builder = self
2477            .client
2478            .get(format!("{}/admin/realms/{realm}/clients", self.url))
2479            .bearer_auth(self.token_supplier.get(&self.url).await?);
2480        if let Some(v) = client_id {
2481            builder = builder.query(&[("clientId", v)]);
2482        }
2483        if let Some(v) = first {
2484            builder = builder.query(&[("first", v)]);
2485        }
2486        if let Some(v) = max {
2487            builder = builder.query(&[("max", v)]);
2488        }
2489        if let Some(v) = q {
2490            builder = builder.query(&[("q", v)]);
2491        }
2492        if let Some(v) = search {
2493            builder = builder.query(&[("search", v)]);
2494        }
2495        if let Some(v) = viewable_only {
2496            builder = builder.query(&[("viewableOnly", v)]);
2497        }
2498        let response = builder.send().await?;
2499        Ok(error_check(response).await?.json().await?)
2500    }
2501
2502    /// Create a new client Client’s client_id must be unique!
2503    ///
2504    /// Parameters:
2505    ///
2506    /// - `realm`: realm name (not id!)
2507    /// - `body`
2508    ///
2509    /// Returns id of created resource
2510    ///
2511    /// Resource: `Clients`
2512    ///
2513    /// `POST /admin/realms/{realm}/clients`
2514    ///
2515    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclients>
2516    #[cfg(feature = "tag-clients")]
2517    pub async fn realm_clients_post(
2518        &self,
2519        realm: &str,
2520        body: ClientRepresentation,
2521    ) -> Result<Option<TypeString>, KeycloakError> {
2522        let realm = p(realm);
2523        let builder = self
2524            .client
2525            .post(format!("{}/admin/realms/{realm}/clients", self.url))
2526            .json(&body)
2527            .bearer_auth(self.token_supplier.get(&self.url).await?);
2528        let response = builder.send().await?;
2529        error_check(response).await.map(to_id)
2530    }
2531
2532    /// Get representation of the client
2533    ///
2534    /// Parameters:
2535    ///
2536    /// - `realm`: realm name (not id!)
2537    /// - `client_uuid`: id of client (not client-id!)
2538    ///
2539    /// Resource: `Clients`
2540    ///
2541    /// `GET /admin/realms/{realm}/clients/{client_uuid}`
2542    ///
2543    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuid>
2544    ///
2545    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}`
2546    #[cfg(feature = "tag-clients")]
2547    pub async fn realm_clients_with_client_uuid_get(
2548        &self,
2549        realm: &str,
2550        client_uuid: &str,
2551    ) -> Result<ClientRepresentation, KeycloakError> {
2552        let realm = p(realm);
2553        let client_uuid = p(client_uuid);
2554        let builder = self
2555            .client
2556            .get(format!(
2557                "{}/admin/realms/{realm}/clients/{client_uuid}",
2558                self.url
2559            ))
2560            .bearer_auth(self.token_supplier.get(&self.url).await?);
2561        let response = builder.send().await?;
2562        Ok(error_check(response).await?.json().await?)
2563    }
2564
2565    /// Update the client
2566    ///
2567    /// Parameters:
2568    ///
2569    /// - `realm`: realm name (not id!)
2570    /// - `client_uuid`: id of client (not client-id!)
2571    /// - `body`
2572    ///
2573    /// Resource: `Clients`
2574    ///
2575    /// `PUT /admin/realms/{realm}/clients/{client_uuid}`
2576    ///
2577    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuid>
2578    ///
2579    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}`
2580    #[cfg(feature = "tag-clients")]
2581    pub async fn realm_clients_with_client_uuid_put(
2582        &self,
2583        realm: &str,
2584        client_uuid: &str,
2585        body: ClientRepresentation,
2586    ) -> Result<(), KeycloakError> {
2587        let realm = p(realm);
2588        let client_uuid = p(client_uuid);
2589        let builder = self
2590            .client
2591            .put(format!(
2592                "{}/admin/realms/{realm}/clients/{client_uuid}",
2593                self.url
2594            ))
2595            .json(&body)
2596            .bearer_auth(self.token_supplier.get(&self.url).await?);
2597        let response = builder.send().await?;
2598        error_check(response).await?;
2599        Ok(())
2600    }
2601
2602    /// Delete the client
2603    ///
2604    /// Parameters:
2605    ///
2606    /// - `realm`: realm name (not id!)
2607    /// - `client_uuid`: id of client (not client-id!)
2608    ///
2609    /// Resource: `Clients`
2610    ///
2611    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}`
2612    ///
2613    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuid>
2614    ///
2615    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}`
2616    #[cfg(feature = "tag-clients")]
2617    pub async fn realm_clients_with_client_uuid_delete(
2618        &self,
2619        realm: &str,
2620        client_uuid: &str,
2621    ) -> Result<(), KeycloakError> {
2622        let realm = p(realm);
2623        let client_uuid = p(client_uuid);
2624        let builder = self
2625            .client
2626            .delete(format!(
2627                "{}/admin/realms/{realm}/clients/{client_uuid}",
2628                self.url
2629            ))
2630            .bearer_auth(self.token_supplier.get(&self.url).await?);
2631        let response = builder.send().await?;
2632        error_check(response).await?;
2633        Ok(())
2634    }
2635
2636    /// Get the client secret
2637    ///
2638    /// Parameters:
2639    ///
2640    /// - `realm`: realm name (not id!)
2641    /// - `client_uuid`: id of client (not client-id!)
2642    ///
2643    /// Resource: `Clients`
2644    ///
2645    /// `GET /admin/realms/{realm}/clients/{client_uuid}/client-secret`
2646    ///
2647    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidclient_secret>
2648    ///
2649    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/client-secret`
2650    #[cfg(feature = "tag-clients")]
2651    pub async fn realm_clients_with_client_uuid_client_secret_get(
2652        &self,
2653        realm: &str,
2654        client_uuid: &str,
2655    ) -> Result<CredentialRepresentation, KeycloakError> {
2656        let realm = p(realm);
2657        let client_uuid = p(client_uuid);
2658        let builder = self
2659            .client
2660            .get(format!(
2661                "{}/admin/realms/{realm}/clients/{client_uuid}/client-secret",
2662                self.url
2663            ))
2664            .bearer_auth(self.token_supplier.get(&self.url).await?);
2665        let response = builder.send().await?;
2666        Ok(error_check(response).await?.json().await?)
2667    }
2668
2669    /// Generate a new secret for the client
2670    ///
2671    /// Parameters:
2672    ///
2673    /// - `realm`: realm name (not id!)
2674    /// - `client_uuid`: id of client (not client-id!)
2675    ///
2676    /// Resource: `Clients`
2677    ///
2678    /// `POST /admin/realms/{realm}/clients/{client_uuid}/client-secret`
2679    ///
2680    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidclient_secret>
2681    ///
2682    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/client-secret`
2683    #[cfg(feature = "tag-clients")]
2684    pub async fn realm_clients_with_client_uuid_client_secret_post(
2685        &self,
2686        realm: &str,
2687        client_uuid: &str,
2688    ) -> Result<CredentialRepresentation, KeycloakError> {
2689        let realm = p(realm);
2690        let client_uuid = p(client_uuid);
2691        let builder = self
2692            .client
2693            .post(format!(
2694                "{}/admin/realms/{realm}/clients/{client_uuid}/client-secret",
2695                self.url
2696            ))
2697            .bearer_auth(self.token_supplier.get(&self.url).await?);
2698        let response = builder.send().await?;
2699        Ok(error_check(response).await?.json().await?)
2700    }
2701
2702    /// Get the rotated client secret
2703    ///
2704    /// Parameters:
2705    ///
2706    /// - `realm`: realm name (not id!)
2707    /// - `client_uuid`: id of client (not client-id!)
2708    ///
2709    /// Resource: `Clients`
2710    ///
2711    /// `GET /admin/realms/{realm}/clients/{client_uuid}/client-secret/rotated`
2712    ///
2713    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidclient_secretrotated>
2714    ///
2715    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/client-secret/rotated`
2716    #[cfg(feature = "tag-clients")]
2717    pub async fn realm_clients_with_client_uuid_client_secret_rotated_get(
2718        &self,
2719        realm: &str,
2720        client_uuid: &str,
2721    ) -> Result<CredentialRepresentation, KeycloakError> {
2722        let realm = p(realm);
2723        let client_uuid = p(client_uuid);
2724        let builder = self
2725            .client
2726            .get(format!(
2727                "{}/admin/realms/{realm}/clients/{client_uuid}/client-secret/rotated",
2728                self.url
2729            ))
2730            .bearer_auth(self.token_supplier.get(&self.url).await?);
2731        let response = builder.send().await?;
2732        Ok(error_check(response).await?.json().await?)
2733    }
2734
2735    /// Invalidate the rotated secret for the client
2736    ///
2737    /// Parameters:
2738    ///
2739    /// - `realm`: realm name (not id!)
2740    /// - `client_uuid`: id of client (not client-id!)
2741    ///
2742    /// Resource: `Clients`
2743    ///
2744    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/client-secret/rotated`
2745    ///
2746    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidclient_secretrotated>
2747    ///
2748    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/client-secret/rotated`
2749    #[cfg(feature = "tag-clients")]
2750    pub async fn realm_clients_with_client_uuid_client_secret_rotated_delete(
2751        &self,
2752        realm: &str,
2753        client_uuid: &str,
2754    ) -> Result<(), KeycloakError> {
2755        let realm = p(realm);
2756        let client_uuid = p(client_uuid);
2757        let builder = self
2758            .client
2759            .delete(format!(
2760                "{}/admin/realms/{realm}/clients/{client_uuid}/client-secret/rotated",
2761                self.url
2762            ))
2763            .bearer_auth(self.token_supplier.get(&self.url).await?);
2764        let response = builder.send().await?;
2765        error_check(response).await?;
2766        Ok(())
2767    }
2768
2769    /// Get default client scopes.  Only name and ids are returned.
2770    ///
2771    /// Parameters:
2772    ///
2773    /// - `realm`: realm name (not id!)
2774    /// - `client_uuid`: id of client (not client-id!)
2775    ///
2776    /// Resource: `Clients`
2777    ///
2778    /// `GET /admin/realms/{realm}/clients/{client_uuid}/default-client-scopes`
2779    ///
2780    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuiddefault_client_scopes>
2781    ///
2782    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/default-client-scopes`
2783    #[cfg(feature = "tag-clients")]
2784    pub async fn realm_clients_with_client_uuid_default_client_scopes_get(
2785        &self,
2786        realm: &str,
2787        client_uuid: &str,
2788    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
2789        let realm = p(realm);
2790        let client_uuid = p(client_uuid);
2791        let builder = self
2792            .client
2793            .get(format!(
2794                "{}/admin/realms/{realm}/clients/{client_uuid}/default-client-scopes",
2795                self.url
2796            ))
2797            .bearer_auth(self.token_supplier.get(&self.url).await?);
2798        let response = builder.send().await?;
2799        Ok(error_check(response).await?.json().await?)
2800    }
2801
2802    /// Parameters:
2803    ///
2804    /// - `realm`: realm name (not id!)
2805    /// - `client_uuid`: id of client (not client-id!)
2806    /// - `client_scope_id`
2807    ///
2808    /// Resource: `Clients`
2809    ///
2810    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/default-client-scopes/{client_scope_id}`
2811    ///
2812    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuiddefault_client_scopesclientscopeid>
2813    ///
2814    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/default-client-scopes/{clientScopeId}`
2815    #[cfg(feature = "tag-clients")]
2816    pub async fn realm_clients_with_client_uuid_default_client_scopes_with_client_scope_id_put(
2817        &self,
2818        realm: &str,
2819        client_uuid: &str,
2820        client_scope_id: &str,
2821    ) -> Result<(), KeycloakError> {
2822        let realm = p(realm);
2823        let client_uuid = p(client_uuid);
2824        let client_scope_id = p(client_scope_id);
2825        let builder = self
2826            .client
2827            .put(format!(
2828                "{}/admin/realms/{realm}/clients/{client_uuid}/default-client-scopes/{client_scope_id}",
2829                self.url
2830            ))
2831            .header(CONTENT_LENGTH, "0")
2832            .bearer_auth(self.token_supplier.get(&self.url).await?);
2833        let response = builder.send().await?;
2834        error_check(response).await?;
2835        Ok(())
2836    }
2837
2838    /// Parameters:
2839    ///
2840    /// - `realm`: realm name (not id!)
2841    /// - `client_uuid`: id of client (not client-id!)
2842    /// - `client_scope_id`
2843    ///
2844    /// Resource: `Clients`
2845    ///
2846    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/default-client-scopes/{client_scope_id}`
2847    ///
2848    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuiddefault_client_scopesclientscopeid>
2849    ///
2850    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/default-client-scopes/{clientScopeId}`
2851    #[cfg(feature = "tag-clients")]
2852    pub async fn realm_clients_with_client_uuid_default_client_scopes_with_client_scope_id_delete(
2853        &self,
2854        realm: &str,
2855        client_uuid: &str,
2856        client_scope_id: &str,
2857    ) -> Result<(), KeycloakError> {
2858        let realm = p(realm);
2859        let client_uuid = p(client_uuid);
2860        let client_scope_id = p(client_scope_id);
2861        let builder = self
2862            .client
2863            .delete(format!(
2864                "{}/admin/realms/{realm}/clients/{client_uuid}/default-client-scopes/{client_scope_id}",
2865                self.url
2866            ))
2867            .bearer_auth(self.token_supplier.get(&self.url).await?);
2868        let response = builder.send().await?;
2869        error_check(response).await?;
2870        Ok(())
2871    }
2872
2873    /// Create JSON with payload of example access token
2874    ///
2875    /// Parameters:
2876    ///
2877    /// - `realm`: realm name (not id!)
2878    /// - `client_uuid`: id of client (not client-id!)
2879    /// - `scope`
2880    /// - `user_id`
2881    ///
2882    /// Resource: `Clients`
2883    ///
2884    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-access-token`
2885    ///
2886    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesgenerate_example_access_token>
2887    ///
2888    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-access-token`
2889    #[cfg(feature = "tag-clients")]
2890    pub async fn realm_clients_with_client_uuid_evaluate_scopes_generate_example_access_token_get(
2891        &self,
2892        realm: &str,
2893        client_uuid: &str,
2894        scope: Option<String>,
2895        user_id: Option<String>,
2896    ) -> Result<AccessToken, KeycloakError> {
2897        let realm = p(realm);
2898        let client_uuid = p(client_uuid);
2899        let mut builder = self
2900            .client
2901            .get(format!(
2902                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-access-token",
2903                self.url
2904            ))
2905            .bearer_auth(self.token_supplier.get(&self.url).await?);
2906        if let Some(v) = scope {
2907            builder = builder.query(&[("scope", v)]);
2908        }
2909        if let Some(v) = user_id {
2910            builder = builder.query(&[("userId", v)]);
2911        }
2912        let response = builder.send().await?;
2913        Ok(error_check(response).await?.json().await?)
2914    }
2915
2916    /// Create JSON with payload of example id token
2917    ///
2918    /// Parameters:
2919    ///
2920    /// - `realm`: realm name (not id!)
2921    /// - `client_uuid`: id of client (not client-id!)
2922    /// - `scope`
2923    /// - `user_id`
2924    ///
2925    /// Resource: `Clients`
2926    ///
2927    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-id-token`
2928    ///
2929    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesgenerate_example_id_token>
2930    ///
2931    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-id-token`
2932    #[cfg(feature = "tag-clients")]
2933    pub async fn realm_clients_with_client_uuid_evaluate_scopes_generate_example_id_token_get(
2934        &self,
2935        realm: &str,
2936        client_uuid: &str,
2937        scope: Option<String>,
2938        user_id: Option<String>,
2939    ) -> Result<IDToken, KeycloakError> {
2940        let realm = p(realm);
2941        let client_uuid = p(client_uuid);
2942        let mut builder = self
2943            .client
2944            .get(format!(
2945                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-id-token",
2946                self.url
2947            ))
2948            .bearer_auth(self.token_supplier.get(&self.url).await?);
2949        if let Some(v) = scope {
2950            builder = builder.query(&[("scope", v)]);
2951        }
2952        if let Some(v) = user_id {
2953            builder = builder.query(&[("userId", v)]);
2954        }
2955        let response = builder.send().await?;
2956        Ok(error_check(response).await?.json().await?)
2957    }
2958
2959    /// Create JSON with payload of example user info
2960    ///
2961    /// Parameters:
2962    ///
2963    /// - `realm`: realm name (not id!)
2964    /// - `client_uuid`: id of client (not client-id!)
2965    /// - `scope`
2966    /// - `user_id`
2967    ///
2968    /// Resource: `Clients`
2969    ///
2970    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-userinfo`
2971    ///
2972    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesgenerate_example_userinfo>
2973    ///
2974    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-userinfo`
2975    #[cfg(feature = "tag-clients")]
2976    pub async fn realm_clients_with_client_uuid_evaluate_scopes_generate_example_userinfo_get(
2977        &self,
2978        realm: &str,
2979        client_uuid: &str,
2980        scope: Option<String>,
2981        user_id: Option<String>,
2982    ) -> Result<TypeMap<String, Value>, KeycloakError> {
2983        let realm = p(realm);
2984        let client_uuid = p(client_uuid);
2985        let mut builder = self
2986            .client
2987            .get(format!(
2988                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/generate-example-userinfo",
2989                self.url
2990            ))
2991            .bearer_auth(self.token_supplier.get(&self.url).await?);
2992        if let Some(v) = scope {
2993            builder = builder.query(&[("scope", v)]);
2994        }
2995        if let Some(v) = user_id {
2996            builder = builder.query(&[("userId", v)]);
2997        }
2998        let response = builder.send().await?;
2999        Ok(error_check(response).await?.json().await?)
3000    }
3001
3002    /// Return list of all protocol mappers, which will be used when generating tokens issued for particular client.
3003    ///
3004    /// Parameters:
3005    ///
3006    /// - `realm`: realm name (not id!)
3007    /// - `client_uuid`: id of client (not client-id!)
3008    /// - `scope`
3009    ///
3010    /// Resource: `Clients`
3011    ///
3012    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/protocol-mappers`
3013    ///
3014    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesprotocol_mappers>
3015    ///
3016    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/protocol-mappers`
3017    #[cfg(feature = "tag-clients")]
3018    pub async fn realm_clients_with_client_uuid_evaluate_scopes_protocol_mappers_get(
3019        &self,
3020        realm: &str,
3021        client_uuid: &str,
3022        scope: Option<String>,
3023    ) -> Result<TypeVec<ProtocolMapperEvaluationRepresentation>, KeycloakError> {
3024        let realm = p(realm);
3025        let client_uuid = p(client_uuid);
3026        let mut builder = self
3027            .client
3028            .get(format!(
3029                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/protocol-mappers",
3030                self.url
3031            ))
3032            .bearer_auth(self.token_supplier.get(&self.url).await?);
3033        if let Some(v) = scope {
3034            builder = builder.query(&[("scope", v)]);
3035        }
3036        let response = builder.send().await?;
3037        Ok(error_check(response).await?.json().await?)
3038    }
3039
3040    /// Get effective scope mapping of all roles of particular role container, which this client is defacto allowed to have in the accessToken issued for him.
3041    ///
3042    /// Parameters:
3043    ///
3044    /// - `realm`: realm name (not id!)
3045    /// - `client_uuid`: id of client (not client-id!)
3046    /// - `role_container_id`: either realm name OR client UUID
3047    /// - `scope`
3048    ///
3049    /// Resource: `Clients`
3050    ///
3051    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/scope-mappings/{role_container_id}/granted`
3052    ///
3053    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesscope_mappingsrolecontaineridgranted>
3054    ///
3055    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/scope-mappings/{roleContainerId}/granted`
3056    #[cfg(feature = "tag-clients")]
3057    pub async fn realm_clients_with_client_uuid_evaluate_scopes_scope_mappings_with_role_container_id_granted_get(
3058        &self,
3059        realm: &str,
3060        client_uuid: &str,
3061        role_container_id: &str,
3062        scope: Option<String>,
3063    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
3064        let realm = p(realm);
3065        let client_uuid = p(client_uuid);
3066        let role_container_id = p(role_container_id);
3067        let mut builder = self
3068            .client
3069            .get(format!(
3070                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/scope-mappings/{role_container_id}/granted",
3071                self.url
3072            ))
3073            .bearer_auth(self.token_supplier.get(&self.url).await?);
3074        if let Some(v) = scope {
3075            builder = builder.query(&[("scope", v)]);
3076        }
3077        let response = builder.send().await?;
3078        Ok(error_check(response).await?.json().await?)
3079    }
3080
3081    /// Get roles, which this client doesn't have scope for and can't have them in the accessToken issued for him.
3082    ///
3083    /// Parameters:
3084    ///
3085    /// - `realm`: realm name (not id!)
3086    /// - `client_uuid`: id of client (not client-id!)
3087    /// - `role_container_id`: either realm name OR client UUID
3088    /// - `scope`
3089    ///
3090    /// Resource: `Clients`
3091    ///
3092    /// `GET /admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/scope-mappings/{role_container_id}/not-granted`
3093    ///
3094    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidevaluate_scopesscope_mappingsrolecontaineridnot_granted>
3095    ///
3096    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/scope-mappings/{roleContainerId}/not-granted`
3097    #[cfg(feature = "tag-clients")]
3098    pub async fn realm_clients_with_client_uuid_evaluate_scopes_scope_mappings_with_role_container_id_not_granted_get(
3099        &self,
3100        realm: &str,
3101        client_uuid: &str,
3102        role_container_id: &str,
3103        scope: Option<String>,
3104    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
3105        let realm = p(realm);
3106        let client_uuid = p(client_uuid);
3107        let role_container_id = p(role_container_id);
3108        let mut builder = self
3109            .client
3110            .get(format!(
3111                "{}/admin/realms/{realm}/clients/{client_uuid}/evaluate-scopes/scope-mappings/{role_container_id}/not-granted",
3112                self.url
3113            ))
3114            .bearer_auth(self.token_supplier.get(&self.url).await?);
3115        if let Some(v) = scope {
3116            builder = builder.query(&[("scope", v)]);
3117        }
3118        let response = builder.send().await?;
3119        Ok(error_check(response).await?.json().await?)
3120    }
3121
3122    /// Parameters:
3123    ///
3124    /// - `realm`: realm name (not id!)
3125    /// - `client_uuid`: id of client (not client-id!)
3126    /// - `provider_id`
3127    ///
3128    /// Resource: `Clients`
3129    ///
3130    /// `GET /admin/realms/{realm}/clients/{client_uuid}/installation/providers/{provider_id}`
3131    ///
3132    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidinstallationprovidersproviderid>
3133    ///
3134    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}`
3135    #[cfg(feature = "tag-clients")]
3136    pub async fn realm_clients_with_client_uuid_installation_providers_with_provider_id_get(
3137        &self,
3138        realm: &str,
3139        client_uuid: &str,
3140        provider_id: &str,
3141    ) -> Result<(), KeycloakError> {
3142        let realm = p(realm);
3143        let client_uuid = p(client_uuid);
3144        let provider_id = p(provider_id);
3145        let builder = self
3146            .client
3147            .get(format!(
3148                "{}/admin/realms/{realm}/clients/{client_uuid}/installation/providers/{provider_id}",
3149                self.url
3150            ))
3151            .bearer_auth(self.token_supplier.get(&self.url).await?);
3152        let response = builder.send().await?;
3153        error_check(response).await?;
3154        Ok(())
3155    }
3156
3157    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
3158    ///
3159    /// Parameters:
3160    ///
3161    /// - `realm`: realm name (not id!)
3162    /// - `client_uuid`: id of client (not client-id!)
3163    ///
3164    /// Resource: `Clients`
3165    ///
3166    /// `GET /admin/realms/{realm}/clients/{client_uuid}/management/permissions`
3167    ///
3168    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidmanagementpermissions>
3169    ///
3170    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/management/permissions`
3171    #[cfg(feature = "tag-clients")]
3172    pub async fn realm_clients_with_client_uuid_management_permissions_get(
3173        &self,
3174        realm: &str,
3175        client_uuid: &str,
3176    ) -> Result<ManagementPermissionReference, KeycloakError> {
3177        let realm = p(realm);
3178        let client_uuid = p(client_uuid);
3179        let builder = self
3180            .client
3181            .get(format!(
3182                "{}/admin/realms/{realm}/clients/{client_uuid}/management/permissions",
3183                self.url
3184            ))
3185            .bearer_auth(self.token_supplier.get(&self.url).await?);
3186        let response = builder.send().await?;
3187        Ok(error_check(response).await?.json().await?)
3188    }
3189
3190    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
3191    ///
3192    /// Parameters:
3193    ///
3194    /// - `realm`: realm name (not id!)
3195    /// - `client_uuid`: id of client (not client-id!)
3196    /// - `body`
3197    ///
3198    /// Resource: `Clients`
3199    ///
3200    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/management/permissions`
3201    ///
3202    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidmanagementpermissions>
3203    ///
3204    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/management/permissions`
3205    #[cfg(feature = "tag-clients")]
3206    pub async fn realm_clients_with_client_uuid_management_permissions_put(
3207        &self,
3208        realm: &str,
3209        client_uuid: &str,
3210        body: ManagementPermissionReference,
3211    ) -> Result<ManagementPermissionReference, KeycloakError> {
3212        let realm = p(realm);
3213        let client_uuid = p(client_uuid);
3214        let builder = self
3215            .client
3216            .put(format!(
3217                "{}/admin/realms/{realm}/clients/{client_uuid}/management/permissions",
3218                self.url
3219            ))
3220            .json(&body)
3221            .bearer_auth(self.token_supplier.get(&self.url).await?);
3222        let response = builder.send().await?;
3223        Ok(error_check(response).await?.json().await?)
3224    }
3225
3226    /// Register a cluster node with the client Manually register cluster node to this client - usually it’s not needed to call this directly as adapter should handle by sending registration request to Keycloak
3227    ///
3228    /// Parameters:
3229    ///
3230    /// - `realm`: realm name (not id!)
3231    /// - `client_uuid`: id of client (not client-id!)
3232    /// - `body`
3233    ///
3234    /// Returns id of created resource
3235    ///
3236    /// Resource: `Clients`
3237    ///
3238    /// `POST /admin/realms/{realm}/clients/{client_uuid}/nodes`
3239    ///
3240    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidnodes>
3241    ///
3242    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/nodes`
3243    #[cfg(feature = "tag-clients")]
3244    pub async fn realm_clients_with_client_uuid_nodes_post(
3245        &self,
3246        realm: &str,
3247        client_uuid: &str,
3248        body: TypeMap<String, String>,
3249    ) -> Result<Option<TypeString>, KeycloakError> {
3250        let realm = p(realm);
3251        let client_uuid = p(client_uuid);
3252        let builder = self
3253            .client
3254            .post(format!(
3255                "{}/admin/realms/{realm}/clients/{client_uuid}/nodes",
3256                self.url
3257            ))
3258            .json(&body)
3259            .bearer_auth(self.token_supplier.get(&self.url).await?);
3260        let response = builder.send().await?;
3261        error_check(response).await.map(to_id)
3262    }
3263
3264    /// Unregister a cluster node from the client
3265    ///
3266    /// Parameters:
3267    ///
3268    /// - `realm`: realm name (not id!)
3269    /// - `client_uuid`: id of client (not client-id!)
3270    /// - `node`
3271    ///
3272    /// Resource: `Clients`
3273    ///
3274    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/nodes/{node}`
3275    ///
3276    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidnodesnode>
3277    ///
3278    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/nodes/{node}`
3279    #[cfg(feature = "tag-clients")]
3280    pub async fn realm_clients_with_client_uuid_nodes_with_node_delete(
3281        &self,
3282        realm: &str,
3283        client_uuid: &str,
3284        node: &str,
3285    ) -> Result<(), KeycloakError> {
3286        let realm = p(realm);
3287        let client_uuid = p(client_uuid);
3288        let node = p(node);
3289        let builder = self
3290            .client
3291            .delete(format!(
3292                "{}/admin/realms/{realm}/clients/{client_uuid}/nodes/{node}",
3293                self.url
3294            ))
3295            .bearer_auth(self.token_supplier.get(&self.url).await?);
3296        let response = builder.send().await?;
3297        error_check(response).await?;
3298        Ok(())
3299    }
3300
3301    /// Get application offline session count Returns a number of offline user sessions associated with this client { "count": number }
3302    ///
3303    /// Parameters:
3304    ///
3305    /// - `realm`: realm name (not id!)
3306    /// - `client_uuid`: id of client (not client-id!)
3307    ///
3308    /// Resource: `Clients`
3309    ///
3310    /// `GET /admin/realms/{realm}/clients/{client_uuid}/offline-session-count`
3311    ///
3312    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidoffline_session_count>
3313    ///
3314    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/offline-session-count`
3315    #[cfg(feature = "tag-clients")]
3316    pub async fn realm_clients_with_client_uuid_offline_session_count_get(
3317        &self,
3318        realm: &str,
3319        client_uuid: &str,
3320    ) -> Result<TypeMap<String, i64>, KeycloakError> {
3321        let realm = p(realm);
3322        let client_uuid = p(client_uuid);
3323        let builder = self
3324            .client
3325            .get(format!(
3326                "{}/admin/realms/{realm}/clients/{client_uuid}/offline-session-count",
3327                self.url
3328            ))
3329            .bearer_auth(self.token_supplier.get(&self.url).await?);
3330        let response = builder.send().await?;
3331        Ok(error_check(response).await?.json().await?)
3332    }
3333
3334    /// Get offline sessions for client Returns a list of offline user sessions associated with this client
3335    ///
3336    /// Parameters:
3337    ///
3338    /// - `realm`: realm name (not id!)
3339    /// - `client_uuid`: id of client (not client-id!)
3340    /// - `first`: Paging offset
3341    /// - `max`: Maximum results size (defaults to 100)
3342    ///
3343    /// Resource: `Clients`
3344    ///
3345    /// `GET /admin/realms/{realm}/clients/{client_uuid}/offline-sessions`
3346    ///
3347    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidoffline_sessions>
3348    ///
3349    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/offline-sessions`
3350    #[cfg(feature = "tag-clients")]
3351    pub async fn realm_clients_with_client_uuid_offline_sessions_get(
3352        &self,
3353        realm: &str,
3354        client_uuid: &str,
3355        first: Option<i32>,
3356        max: Option<i32>,
3357    ) -> Result<TypeVec<UserSessionRepresentation>, KeycloakError> {
3358        let realm = p(realm);
3359        let client_uuid = p(client_uuid);
3360        let mut builder = self
3361            .client
3362            .get(format!(
3363                "{}/admin/realms/{realm}/clients/{client_uuid}/offline-sessions",
3364                self.url
3365            ))
3366            .bearer_auth(self.token_supplier.get(&self.url).await?);
3367        if let Some(v) = first {
3368            builder = builder.query(&[("first", v)]);
3369        }
3370        if let Some(v) = max {
3371            builder = builder.query(&[("max", v)]);
3372        }
3373        let response = builder.send().await?;
3374        Ok(error_check(response).await?.json().await?)
3375    }
3376
3377    /// Get optional client scopes.  Only name and ids are returned.
3378    ///
3379    /// Parameters:
3380    ///
3381    /// - `realm`: realm name (not id!)
3382    /// - `client_uuid`: id of client (not client-id!)
3383    ///
3384    /// Resource: `Clients`
3385    ///
3386    /// `GET /admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes`
3387    ///
3388    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidoptional_client_scopes>
3389    ///
3390    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/optional-client-scopes`
3391    #[cfg(feature = "tag-clients")]
3392    pub async fn realm_clients_with_client_uuid_optional_client_scopes_get(
3393        &self,
3394        realm: &str,
3395        client_uuid: &str,
3396    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
3397        let realm = p(realm);
3398        let client_uuid = p(client_uuid);
3399        let builder = self
3400            .client
3401            .get(format!(
3402                "{}/admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes",
3403                self.url
3404            ))
3405            .bearer_auth(self.token_supplier.get(&self.url).await?);
3406        let response = builder.send().await?;
3407        Ok(error_check(response).await?.json().await?)
3408    }
3409
3410    /// Parameters:
3411    ///
3412    /// - `realm`: realm name (not id!)
3413    /// - `client_uuid`: id of client (not client-id!)
3414    /// - `client_scope_id`
3415    ///
3416    /// Resource: `Clients`
3417    ///
3418    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes/{client_scope_id}`
3419    ///
3420    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidoptional_client_scopesclientscopeid>
3421    ///
3422    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/optional-client-scopes/{clientScopeId}`
3423    #[cfg(feature = "tag-clients")]
3424    pub async fn realm_clients_with_client_uuid_optional_client_scopes_with_client_scope_id_put(
3425        &self,
3426        realm: &str,
3427        client_uuid: &str,
3428        client_scope_id: &str,
3429    ) -> Result<(), KeycloakError> {
3430        let realm = p(realm);
3431        let client_uuid = p(client_uuid);
3432        let client_scope_id = p(client_scope_id);
3433        let builder = self
3434            .client
3435            .put(format!(
3436                "{}/admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes/{client_scope_id}",
3437                self.url
3438            ))
3439            .header(CONTENT_LENGTH, "0")
3440            .bearer_auth(self.token_supplier.get(&self.url).await?);
3441        let response = builder.send().await?;
3442        error_check(response).await?;
3443        Ok(())
3444    }
3445
3446    /// Parameters:
3447    ///
3448    /// - `realm`: realm name (not id!)
3449    /// - `client_uuid`: id of client (not client-id!)
3450    /// - `client_scope_id`
3451    ///
3452    /// Resource: `Clients`
3453    ///
3454    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes/{client_scope_id}`
3455    ///
3456    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidoptional_client_scopesclientscopeid>
3457    ///
3458    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/optional-client-scopes/{clientScopeId}`
3459    #[cfg(feature = "tag-clients")]
3460    pub async fn realm_clients_with_client_uuid_optional_client_scopes_with_client_scope_id_delete(
3461        &self,
3462        realm: &str,
3463        client_uuid: &str,
3464        client_scope_id: &str,
3465    ) -> Result<(), KeycloakError> {
3466        let realm = p(realm);
3467        let client_uuid = p(client_uuid);
3468        let client_scope_id = p(client_scope_id);
3469        let builder = self
3470            .client
3471            .delete(format!(
3472                "{}/admin/realms/{realm}/clients/{client_uuid}/optional-client-scopes/{client_scope_id}",
3473                self.url
3474            ))
3475            .bearer_auth(self.token_supplier.get(&self.url).await?);
3476        let response = builder.send().await?;
3477        error_check(response).await?;
3478        Ok(())
3479    }
3480
3481    /// Push the client's revocation policy to its admin URL If the client has an admin URL, push revocation policy to it.
3482    ///
3483    /// Parameters:
3484    ///
3485    /// - `realm`: realm name (not id!)
3486    /// - `client_uuid`: id of client (not client-id!)
3487    ///
3488    /// Resource: `Clients`
3489    ///
3490    /// `POST /admin/realms/{realm}/clients/{client_uuid}/push-revocation`
3491    ///
3492    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidpush_revocation>
3493    ///
3494    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/push-revocation`
3495    #[cfg(feature = "tag-clients")]
3496    pub async fn realm_clients_with_client_uuid_push_revocation_post(
3497        &self,
3498        realm: &str,
3499        client_uuid: &str,
3500    ) -> Result<GlobalRequestResult, KeycloakError> {
3501        let realm = p(realm);
3502        let client_uuid = p(client_uuid);
3503        let builder = self
3504            .client
3505            .post(format!(
3506                "{}/admin/realms/{realm}/clients/{client_uuid}/push-revocation",
3507                self.url
3508            ))
3509            .bearer_auth(self.token_supplier.get(&self.url).await?);
3510        let response = builder.send().await?;
3511        Ok(error_check(response).await?.json().await?)
3512    }
3513
3514    /// Generate a new registration access token for the client
3515    ///
3516    /// Parameters:
3517    ///
3518    /// - `realm`: realm name (not id!)
3519    /// - `client_uuid`: id of client (not client-id!)
3520    ///
3521    /// Resource: `Clients`
3522    ///
3523    /// `POST /admin/realms/{realm}/clients/{client_uuid}/registration-access-token`
3524    ///
3525    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidregistration_access_token>
3526    ///
3527    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/registration-access-token`
3528    #[cfg(feature = "tag-clients")]
3529    pub async fn realm_clients_with_client_uuid_registration_access_token_post(
3530        &self,
3531        realm: &str,
3532        client_uuid: &str,
3533    ) -> Result<ClientRepresentation, KeycloakError> {
3534        let realm = p(realm);
3535        let client_uuid = p(client_uuid);
3536        let builder = self
3537            .client
3538            .post(format!(
3539                "{}/admin/realms/{realm}/clients/{client_uuid}/registration-access-token",
3540                self.url
3541            ))
3542            .bearer_auth(self.token_supplier.get(&self.url).await?);
3543        let response = builder.send().await?;
3544        Ok(error_check(response).await?.json().await?)
3545    }
3546
3547    /// Get a user dedicated to the service account
3548    ///
3549    /// Parameters:
3550    ///
3551    /// - `realm`: realm name (not id!)
3552    /// - `client_uuid`: id of client (not client-id!)
3553    ///
3554    /// Resource: `Clients`
3555    ///
3556    /// `GET /admin/realms/{realm}/clients/{client_uuid}/service-account-user`
3557    ///
3558    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidservice_account_user>
3559    ///
3560    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/service-account-user`
3561    #[cfg(feature = "tag-clients")]
3562    pub async fn realm_clients_with_client_uuid_service_account_user_get(
3563        &self,
3564        realm: &str,
3565        client_uuid: &str,
3566    ) -> Result<UserRepresentation, KeycloakError> {
3567        let realm = p(realm);
3568        let client_uuid = p(client_uuid);
3569        let builder = self
3570            .client
3571            .get(format!(
3572                "{}/admin/realms/{realm}/clients/{client_uuid}/service-account-user",
3573                self.url
3574            ))
3575            .bearer_auth(self.token_supplier.get(&self.url).await?);
3576        let response = builder.send().await?;
3577        Ok(error_check(response).await?.json().await?)
3578    }
3579
3580    /// Get application session count Returns a number of user sessions associated with this client { "count": number }
3581    ///
3582    /// Parameters:
3583    ///
3584    /// - `realm`: realm name (not id!)
3585    /// - `client_uuid`: id of client (not client-id!)
3586    ///
3587    /// Resource: `Clients`
3588    ///
3589    /// `GET /admin/realms/{realm}/clients/{client_uuid}/session-count`
3590    ///
3591    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidsession_count>
3592    ///
3593    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/session-count`
3594    #[cfg(feature = "tag-clients")]
3595    pub async fn realm_clients_with_client_uuid_session_count_get(
3596        &self,
3597        realm: &str,
3598        client_uuid: &str,
3599    ) -> Result<TypeMap<String, i64>, KeycloakError> {
3600        let realm = p(realm);
3601        let client_uuid = p(client_uuid);
3602        let builder = self
3603            .client
3604            .get(format!(
3605                "{}/admin/realms/{realm}/clients/{client_uuid}/session-count",
3606                self.url
3607            ))
3608            .bearer_auth(self.token_supplier.get(&self.url).await?);
3609        let response = builder.send().await?;
3610        Ok(error_check(response).await?.json().await?)
3611    }
3612
3613    /// Test if registered cluster nodes are available Tests availability by sending 'ping' request to all cluster nodes.
3614    ///
3615    /// Parameters:
3616    ///
3617    /// - `realm`: realm name (not id!)
3618    /// - `client_uuid`: id of client (not client-id!)
3619    ///
3620    /// Resource: `Clients`
3621    ///
3622    /// `GET /admin/realms/{realm}/clients/{client_uuid}/test-nodes-available`
3623    ///
3624    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidtest_nodes_available>
3625    ///
3626    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/test-nodes-available`
3627    #[cfg(feature = "tag-clients")]
3628    pub async fn realm_clients_with_client_uuid_test_nodes_available_get(
3629        &self,
3630        realm: &str,
3631        client_uuid: &str,
3632    ) -> Result<GlobalRequestResult, KeycloakError> {
3633        let realm = p(realm);
3634        let client_uuid = p(client_uuid);
3635        let builder = self
3636            .client
3637            .get(format!(
3638                "{}/admin/realms/{realm}/clients/{client_uuid}/test-nodes-available",
3639                self.url
3640            ))
3641            .bearer_auth(self.token_supplier.get(&self.url).await?);
3642        let response = builder.send().await?;
3643        Ok(error_check(response).await?.json().await?)
3644    }
3645
3646    /// Get user sessions for client Returns a list of user sessions associated with this client
3647    ///
3648    /// Parameters:
3649    ///
3650    /// - `realm`: realm name (not id!)
3651    /// - `client_uuid`: id of client (not client-id!)
3652    /// - `first`: Paging offset
3653    /// - `max`: Maximum results size (defaults to 100)
3654    ///
3655    /// Resource: `Clients`
3656    ///
3657    /// `GET /admin/realms/{realm}/clients/{client_uuid}/user-sessions`
3658    ///
3659    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuiduser_sessions>
3660    ///
3661    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/user-sessions`
3662    #[cfg(feature = "tag-clients")]
3663    pub async fn realm_clients_with_client_uuid_user_sessions_get(
3664        &self,
3665        realm: &str,
3666        client_uuid: &str,
3667        first: Option<i32>,
3668        max: Option<i32>,
3669    ) -> Result<TypeVec<UserSessionRepresentation>, KeycloakError> {
3670        let realm = p(realm);
3671        let client_uuid = p(client_uuid);
3672        let mut builder = self
3673            .client
3674            .get(format!(
3675                "{}/admin/realms/{realm}/clients/{client_uuid}/user-sessions",
3676                self.url
3677            ))
3678            .bearer_auth(self.token_supplier.get(&self.url).await?);
3679        if let Some(v) = first {
3680            builder = builder.query(&[("first", v)]);
3681        }
3682        if let Some(v) = max {
3683            builder = builder.query(&[("max", v)]);
3684        }
3685        let response = builder.send().await?;
3686        Ok(error_check(response).await?.json().await?)
3687    }
3688
3689    // <h4>Component</h4>
3690
3691    /// Parameters:
3692    ///
3693    /// - `realm`: realm name (not id!)
3694    /// - `name`
3695    /// - `parent`
3696    /// - `type_`
3697    ///
3698    /// Resource: `Component`
3699    ///
3700    /// `GET /admin/realms/{realm}/components`
3701    ///
3702    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmcomponents>
3703    #[cfg(feature = "tag-component")]
3704    pub async fn realm_components_get(
3705        &self,
3706        realm: &str,
3707        name: Option<String>,
3708        parent: Option<String>,
3709        type_: Option<String>,
3710    ) -> Result<TypeVec<ComponentRepresentation>, KeycloakError> {
3711        let realm = p(realm);
3712        let mut builder = self
3713            .client
3714            .get(format!("{}/admin/realms/{realm}/components", self.url))
3715            .bearer_auth(self.token_supplier.get(&self.url).await?);
3716        if let Some(v) = name {
3717            builder = builder.query(&[("name", v)]);
3718        }
3719        if let Some(v) = parent {
3720            builder = builder.query(&[("parent", v)]);
3721        }
3722        if let Some(v) = type_ {
3723            builder = builder.query(&[("type", v)]);
3724        }
3725        let response = builder.send().await?;
3726        Ok(error_check(response).await?.json().await?)
3727    }
3728
3729    /// Parameters:
3730    ///
3731    /// - `realm`: realm name (not id!)
3732    /// - `body`
3733    ///
3734    /// Returns id of created resource
3735    ///
3736    /// Resource: `Component`
3737    ///
3738    /// `POST /admin/realms/{realm}/components`
3739    ///
3740    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmcomponents>
3741    #[cfg(feature = "tag-component")]
3742    pub async fn realm_components_post(
3743        &self,
3744        realm: &str,
3745        body: ComponentRepresentation,
3746    ) -> Result<Option<TypeString>, KeycloakError> {
3747        let realm = p(realm);
3748        let builder = self
3749            .client
3750            .post(format!("{}/admin/realms/{realm}/components", self.url))
3751            .json(&body)
3752            .bearer_auth(self.token_supplier.get(&self.url).await?);
3753        let response = builder.send().await?;
3754        error_check(response).await.map(to_id)
3755    }
3756
3757    /// Parameters:
3758    ///
3759    /// - `realm`: realm name (not id!)
3760    /// - `id`
3761    ///
3762    /// Resource: `Component`
3763    ///
3764    /// `GET /admin/realms/{realm}/components/{id}`
3765    ///
3766    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmcomponentsid>
3767    #[cfg(feature = "tag-component")]
3768    pub async fn realm_components_with_id_get(
3769        &self,
3770        realm: &str,
3771        id: &str,
3772    ) -> Result<ComponentRepresentation, KeycloakError> {
3773        let realm = p(realm);
3774        let id = p(id);
3775        let builder = self
3776            .client
3777            .get(format!("{}/admin/realms/{realm}/components/{id}", self.url))
3778            .bearer_auth(self.token_supplier.get(&self.url).await?);
3779        let response = builder.send().await?;
3780        Ok(error_check(response).await?.json().await?)
3781    }
3782
3783    /// Parameters:
3784    ///
3785    /// - `realm`: realm name (not id!)
3786    /// - `id`
3787    /// - `body`
3788    ///
3789    /// Resource: `Component`
3790    ///
3791    /// `PUT /admin/realms/{realm}/components/{id}`
3792    ///
3793    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmcomponentsid>
3794    #[cfg(feature = "tag-component")]
3795    pub async fn realm_components_with_id_put(
3796        &self,
3797        realm: &str,
3798        id: &str,
3799        body: ComponentRepresentation,
3800    ) -> Result<(), KeycloakError> {
3801        let realm = p(realm);
3802        let id = p(id);
3803        let builder = self
3804            .client
3805            .put(format!("{}/admin/realms/{realm}/components/{id}", self.url))
3806            .json(&body)
3807            .bearer_auth(self.token_supplier.get(&self.url).await?);
3808        let response = builder.send().await?;
3809        error_check(response).await?;
3810        Ok(())
3811    }
3812
3813    /// Parameters:
3814    ///
3815    /// - `realm`: realm name (not id!)
3816    /// - `id`
3817    ///
3818    /// Resource: `Component`
3819    ///
3820    /// `DELETE /admin/realms/{realm}/components/{id}`
3821    ///
3822    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmcomponentsid>
3823    #[cfg(feature = "tag-component")]
3824    pub async fn realm_components_with_id_delete(
3825        &self,
3826        realm: &str,
3827        id: &str,
3828    ) -> Result<(), KeycloakError> {
3829        let realm = p(realm);
3830        let id = p(id);
3831        let builder = self
3832            .client
3833            .delete(format!("{}/admin/realms/{realm}/components/{id}", self.url))
3834            .bearer_auth(self.token_supplier.get(&self.url).await?);
3835        let response = builder.send().await?;
3836        error_check(response).await?;
3837        Ok(())
3838    }
3839
3840    /// List of subcomponent types that are available to configure for a particular parent component.
3841    ///
3842    /// Parameters:
3843    ///
3844    /// - `realm`: realm name (not id!)
3845    /// - `id`
3846    /// - `type_`
3847    ///
3848    /// Resource: `Component`
3849    ///
3850    /// `GET /admin/realms/{realm}/components/{id}/sub-component-types`
3851    ///
3852    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmcomponentsidsub_component_types>
3853    #[cfg(feature = "tag-component")]
3854    pub async fn realm_components_with_id_sub_component_types_get(
3855        &self,
3856        realm: &str,
3857        id: &str,
3858        type_: Option<String>,
3859    ) -> Result<TypeVec<ComponentTypeRepresentation>, KeycloakError> {
3860        let realm = p(realm);
3861        let id = p(id);
3862        let mut builder = self
3863            .client
3864            .get(format!(
3865                "{}/admin/realms/{realm}/components/{id}/sub-component-types",
3866                self.url
3867            ))
3868            .bearer_auth(self.token_supplier.get(&self.url).await?);
3869        if let Some(v) = type_ {
3870            builder = builder.query(&[("type", v)]);
3871        }
3872        let response = builder.send().await?;
3873        Ok(error_check(response).await?.json().await?)
3874    }
3875
3876    // <h4>Groups</h4>
3877
3878    /// Get group hierarchy.  Only `name` and `id` are returned.  `subGroups` are only returned when using the `search` or `q` parameter. If none of these parameters is provided, the top-level groups are returned without `subGroups` being filled.
3879    ///
3880    /// Parameters:
3881    ///
3882    /// - `realm`: realm name (not id!)
3883    /// - `brief_representation`
3884    /// - `exact`
3885    /// - `first`
3886    /// - `max`
3887    /// - `populate_hierarchy`
3888    /// - `q`
3889    /// - `search`
3890    ///
3891    /// Resource: `Groups`
3892    ///
3893    /// `GET /admin/realms/{realm}/groups`
3894    ///
3895    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroups>
3896    #[cfg(feature = "tag-groups")]
3897    #[allow(clippy::too_many_arguments)]
3898    pub async fn realm_groups_get(
3899        &self,
3900        realm: &str,
3901        brief_representation: Option<bool>,
3902        exact: Option<bool>,
3903        first: Option<i32>,
3904        max: Option<i32>,
3905        populate_hierarchy: Option<bool>,
3906        q: Option<String>,
3907        search: Option<String>,
3908    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
3909        let realm = p(realm);
3910        let mut builder = self
3911            .client
3912            .get(format!("{}/admin/realms/{realm}/groups", self.url))
3913            .bearer_auth(self.token_supplier.get(&self.url).await?);
3914        if let Some(v) = brief_representation {
3915            builder = builder.query(&[("briefRepresentation", v)]);
3916        }
3917        if let Some(v) = exact {
3918            builder = builder.query(&[("exact", v)]);
3919        }
3920        if let Some(v) = first {
3921            builder = builder.query(&[("first", v)]);
3922        }
3923        if let Some(v) = max {
3924            builder = builder.query(&[("max", v)]);
3925        }
3926        if let Some(v) = populate_hierarchy {
3927            builder = builder.query(&[("populateHierarchy", v)]);
3928        }
3929        if let Some(v) = q {
3930            builder = builder.query(&[("q", v)]);
3931        }
3932        if let Some(v) = search {
3933            builder = builder.query(&[("search", v)]);
3934        }
3935        let response = builder.send().await?;
3936        Ok(error_check(response).await?.json().await?)
3937    }
3938
3939    /// create or add a top level realm groupSet or create child.
3940    ///
3941    /// Parameters:
3942    ///
3943    /// - `realm`: realm name (not id!)
3944    /// - `body`
3945    ///
3946    /// Returns id of created resource
3947    ///
3948    /// Resource: `Groups`
3949    ///
3950    /// `POST /admin/realms/{realm}/groups`
3951    ///
3952    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmgroups>
3953    #[cfg(feature = "tag-groups")]
3954    pub async fn realm_groups_post(
3955        &self,
3956        realm: &str,
3957        body: GroupRepresentation,
3958    ) -> Result<Option<TypeString>, KeycloakError> {
3959        let realm = p(realm);
3960        let builder = self
3961            .client
3962            .post(format!("{}/admin/realms/{realm}/groups", self.url))
3963            .json(&body)
3964            .bearer_auth(self.token_supplier.get(&self.url).await?);
3965        let response = builder.send().await?;
3966        error_check(response).await.map(to_id)
3967    }
3968
3969    /// Returns the groups counts.
3970    ///
3971    /// Parameters:
3972    ///
3973    /// - `realm`: realm name (not id!)
3974    /// - `search`
3975    /// - `top`
3976    ///
3977    /// Resource: `Groups`
3978    ///
3979    /// `GET /admin/realms/{realm}/groups/count`
3980    ///
3981    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupscount>
3982    #[cfg(feature = "tag-groups")]
3983    pub async fn realm_groups_count_get(
3984        &self,
3985        realm: &str,
3986        search: Option<String>,
3987        top: Option<bool>,
3988    ) -> Result<TypeMap<String, i64>, KeycloakError> {
3989        let realm = p(realm);
3990        let mut builder = self
3991            .client
3992            .get(format!("{}/admin/realms/{realm}/groups/count", self.url))
3993            .bearer_auth(self.token_supplier.get(&self.url).await?);
3994        if let Some(v) = search {
3995            builder = builder.query(&[("search", v)]);
3996        }
3997        if let Some(v) = top {
3998            builder = builder.query(&[("top", v)]);
3999        }
4000        let response = builder.send().await?;
4001        Ok(error_check(response).await?.json().await?)
4002    }
4003
4004    /// Parameters:
4005    ///
4006    /// - `realm`: realm name (not id!)
4007    /// - `group_id`
4008    ///
4009    /// Resource: `Groups`
4010    ///
4011    /// `GET /admin/realms/{realm}/groups/{group_id}`
4012    ///
4013    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_id>
4014    ///
4015    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}`
4016    #[cfg(feature = "tag-groups")]
4017    pub async fn realm_groups_with_group_id_get(
4018        &self,
4019        realm: &str,
4020        group_id: &str,
4021    ) -> Result<GroupRepresentation, KeycloakError> {
4022        let realm = p(realm);
4023        let group_id = p(group_id);
4024        let builder = self
4025            .client
4026            .get(format!(
4027                "{}/admin/realms/{realm}/groups/{group_id}",
4028                self.url
4029            ))
4030            .bearer_auth(self.token_supplier.get(&self.url).await?);
4031        let response = builder.send().await?;
4032        Ok(error_check(response).await?.json().await?)
4033    }
4034
4035    /// Update group, ignores subgroups.
4036    ///
4037    /// Parameters:
4038    ///
4039    /// - `realm`: realm name (not id!)
4040    /// - `group_id`
4041    /// - `body`
4042    ///
4043    /// Resource: `Groups`
4044    ///
4045    /// `PUT /admin/realms/{realm}/groups/{group_id}`
4046    ///
4047    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmgroupsgroup_id>
4048    ///
4049    /// REST method: `PUT /admin/realms/{realm}/groups/{group-id}`
4050    #[cfg(feature = "tag-groups")]
4051    pub async fn realm_groups_with_group_id_put(
4052        &self,
4053        realm: &str,
4054        group_id: &str,
4055        body: GroupRepresentation,
4056    ) -> Result<(), KeycloakError> {
4057        let realm = p(realm);
4058        let group_id = p(group_id);
4059        let builder = self
4060            .client
4061            .put(format!(
4062                "{}/admin/realms/{realm}/groups/{group_id}",
4063                self.url
4064            ))
4065            .json(&body)
4066            .bearer_auth(self.token_supplier.get(&self.url).await?);
4067        let response = builder.send().await?;
4068        error_check(response).await?;
4069        Ok(())
4070    }
4071
4072    /// Parameters:
4073    ///
4074    /// - `realm`: realm name (not id!)
4075    /// - `group_id`
4076    ///
4077    /// Resource: `Groups`
4078    ///
4079    /// `DELETE /admin/realms/{realm}/groups/{group_id}`
4080    ///
4081    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmgroupsgroup_id>
4082    ///
4083    /// REST method: `DELETE /admin/realms/{realm}/groups/{group-id}`
4084    #[cfg(feature = "tag-groups")]
4085    pub async fn realm_groups_with_group_id_delete(
4086        &self,
4087        realm: &str,
4088        group_id: &str,
4089    ) -> Result<(), KeycloakError> {
4090        let realm = p(realm);
4091        let group_id = p(group_id);
4092        let builder = self
4093            .client
4094            .delete(format!(
4095                "{}/admin/realms/{realm}/groups/{group_id}",
4096                self.url
4097            ))
4098            .bearer_auth(self.token_supplier.get(&self.url).await?);
4099        let response = builder.send().await?;
4100        error_check(response).await?;
4101        Ok(())
4102    }
4103
4104    /// Return a paginated list of subgroups that have a parent group corresponding to the group on the URL
4105    ///
4106    /// Parameters:
4107    ///
4108    /// - `realm`: realm name (not id!)
4109    /// - `group_id`
4110    /// - `brief_representation`: Boolean which defines whether brief groups representations are returned or not (default: false)
4111    /// - `exact`: Boolean which defines whether the params "search" must match exactly or not
4112    /// - `first`: The position of the first result to be returned (pagination offset).
4113    /// - `max`: The maximum number of results that are to be returned. Defaults to 10
4114    /// - `search`: A String representing either an exact group name or a partial name
4115    ///
4116    /// Resource: `Groups`
4117    ///
4118    /// `GET /admin/realms/{realm}/groups/{group_id}/children`
4119    ///
4120    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idchildren>
4121    ///
4122    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/children`
4123    #[cfg(feature = "tag-groups")]
4124    #[allow(clippy::too_many_arguments)]
4125    pub async fn realm_groups_with_group_id_children_get(
4126        &self,
4127        realm: &str,
4128        group_id: &str,
4129        brief_representation: Option<bool>,
4130        exact: Option<bool>,
4131        first: Option<i32>,
4132        max: Option<i32>,
4133        search: Option<String>,
4134    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
4135        let realm = p(realm);
4136        let group_id = p(group_id);
4137        let mut builder = self
4138            .client
4139            .get(format!(
4140                "{}/admin/realms/{realm}/groups/{group_id}/children",
4141                self.url
4142            ))
4143            .bearer_auth(self.token_supplier.get(&self.url).await?);
4144        if let Some(v) = brief_representation {
4145            builder = builder.query(&[("briefRepresentation", v)]);
4146        }
4147        if let Some(v) = exact {
4148            builder = builder.query(&[("exact", v)]);
4149        }
4150        if let Some(v) = first {
4151            builder = builder.query(&[("first", v)]);
4152        }
4153        if let Some(v) = max {
4154            builder = builder.query(&[("max", v)]);
4155        }
4156        if let Some(v) = search {
4157            builder = builder.query(&[("search", v)]);
4158        }
4159        let response = builder.send().await?;
4160        Ok(error_check(response).await?.json().await?)
4161    }
4162
4163    /// Set or create child.
4164    ///
4165    /// Parameters:
4166    ///
4167    /// - `realm`: realm name (not id!)
4168    /// - `group_id`
4169    /// - `body`
4170    ///
4171    /// Returns id of created resource
4172    ///
4173    /// Resource: `Groups`
4174    ///
4175    /// `POST /admin/realms/{realm}/groups/{group_id}/children`
4176    ///
4177    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmgroupsgroup_idchildren>
4178    ///
4179    /// REST method: `POST /admin/realms/{realm}/groups/{group-id}/children`
4180    #[cfg(feature = "tag-groups")]
4181    pub async fn realm_groups_with_group_id_children_post(
4182        &self,
4183        realm: &str,
4184        group_id: &str,
4185        body: GroupRepresentation,
4186    ) -> Result<Option<TypeString>, KeycloakError> {
4187        let realm = p(realm);
4188        let group_id = p(group_id);
4189        let builder = self
4190            .client
4191            .post(format!(
4192                "{}/admin/realms/{realm}/groups/{group_id}/children",
4193                self.url
4194            ))
4195            .json(&body)
4196            .bearer_auth(self.token_supplier.get(&self.url).await?);
4197        let response = builder.send().await?;
4198        error_check(response).await.map(to_id)
4199    }
4200
4201    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
4202    ///
4203    /// Parameters:
4204    ///
4205    /// - `realm`: realm name (not id!)
4206    /// - `group_id`
4207    ///
4208    /// Resource: `Groups`
4209    ///
4210    /// `GET /admin/realms/{realm}/groups/{group_id}/management/permissions`
4211    ///
4212    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idmanagementpermissions>
4213    ///
4214    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/management/permissions`
4215    #[cfg(feature = "tag-groups")]
4216    pub async fn realm_groups_with_group_id_management_permissions_get(
4217        &self,
4218        realm: &str,
4219        group_id: &str,
4220    ) -> Result<ManagementPermissionReference, KeycloakError> {
4221        let realm = p(realm);
4222        let group_id = p(group_id);
4223        let builder = self
4224            .client
4225            .get(format!(
4226                "{}/admin/realms/{realm}/groups/{group_id}/management/permissions",
4227                self.url
4228            ))
4229            .bearer_auth(self.token_supplier.get(&self.url).await?);
4230        let response = builder.send().await?;
4231        Ok(error_check(response).await?.json().await?)
4232    }
4233
4234    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
4235    ///
4236    /// Parameters:
4237    ///
4238    /// - `realm`: realm name (not id!)
4239    /// - `group_id`
4240    /// - `body`
4241    ///
4242    /// Resource: `Groups`
4243    ///
4244    /// `PUT /admin/realms/{realm}/groups/{group_id}/management/permissions`
4245    ///
4246    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmgroupsgroup_idmanagementpermissions>
4247    ///
4248    /// REST method: `PUT /admin/realms/{realm}/groups/{group-id}/management/permissions`
4249    #[cfg(feature = "tag-groups")]
4250    pub async fn realm_groups_with_group_id_management_permissions_put(
4251        &self,
4252        realm: &str,
4253        group_id: &str,
4254        body: ManagementPermissionReference,
4255    ) -> Result<ManagementPermissionReference, KeycloakError> {
4256        let realm = p(realm);
4257        let group_id = p(group_id);
4258        let builder = self
4259            .client
4260            .put(format!(
4261                "{}/admin/realms/{realm}/groups/{group_id}/management/permissions",
4262                self.url
4263            ))
4264            .json(&body)
4265            .bearer_auth(self.token_supplier.get(&self.url).await?);
4266        let response = builder.send().await?;
4267        Ok(error_check(response).await?.json().await?)
4268    }
4269
4270    /// Get users Returns a stream of users, filtered according to query parameters
4271    ///
4272    /// Parameters:
4273    ///
4274    /// - `realm`: realm name (not id!)
4275    /// - `group_id`
4276    /// - `brief_representation`: Only return basic information (only guaranteed to return id, username, created, first and last name, email, enabled state, email verification state, federation link, and access. Note that it means that namely user attributes, required actions, and not before are not returned.)
4277    /// - `first`: Pagination offset
4278    /// - `max`: Maximum results size (defaults to 100)
4279    ///
4280    /// Resource: `Groups`
4281    ///
4282    /// `GET /admin/realms/{realm}/groups/{group_id}/members`
4283    ///
4284    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idmembers>
4285    ///
4286    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/members`
4287    #[cfg(feature = "tag-groups")]
4288    pub async fn realm_groups_with_group_id_members_get(
4289        &self,
4290        realm: &str,
4291        group_id: &str,
4292        brief_representation: Option<bool>,
4293        first: Option<i32>,
4294        max: Option<i32>,
4295    ) -> Result<TypeVec<UserRepresentation>, KeycloakError> {
4296        let realm = p(realm);
4297        let group_id = p(group_id);
4298        let mut builder = self
4299            .client
4300            .get(format!(
4301                "{}/admin/realms/{realm}/groups/{group_id}/members",
4302                self.url
4303            ))
4304            .bearer_auth(self.token_supplier.get(&self.url).await?);
4305        if let Some(v) = brief_representation {
4306            builder = builder.query(&[("briefRepresentation", v)]);
4307        }
4308        if let Some(v) = first {
4309            builder = builder.query(&[("first", v)]);
4310        }
4311        if let Some(v) = max {
4312            builder = builder.query(&[("max", v)]);
4313        }
4314        let response = builder.send().await?;
4315        Ok(error_check(response).await?.json().await?)
4316    }
4317
4318    // <h4>Identity Providers</h4>
4319
4320    /// Import identity provider from JSON body
4321    ///
4322    /// Parameters:
4323    ///
4324    /// - `realm`: realm name (not id!)
4325    /// - `body`
4326    ///
4327    /// Resource: `Identity Providers`
4328    ///
4329    /// `POST /admin/realms/{realm}/identity-provider/import-config`
4330    ///
4331    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmidentity_providerimport_config>
4332    #[cfg(feature = "tag-identity-providers")]
4333    pub async fn realm_identity_provider_import_config_post(
4334        &self,
4335        realm: &str,
4336        body: TypeMap<String, Value>,
4337    ) -> Result<TypeMap<String, TypeString>, KeycloakError> {
4338        let realm = p(realm);
4339        let builder = self
4340            .client
4341            .post(format!(
4342                "{}/admin/realms/{realm}/identity-provider/import-config",
4343                self.url
4344            ))
4345            .json(&body)
4346            .bearer_auth(self.token_supplier.get(&self.url).await?);
4347        let response = builder.send().await?;
4348        Ok(error_check(response).await?.json().await?)
4349    }
4350
4351    /// List identity providers
4352    ///
4353    /// Parameters:
4354    ///
4355    /// - `realm`: realm name (not id!)
4356    /// - `brief_representation`: Boolean which defines whether brief representations are returned (default: false)
4357    /// - `first`: Pagination offset
4358    /// - `max`: Maximum results size (defaults to 100)
4359    /// - `realm_only`: Boolean which defines if only realm-level IDPs (not associated with orgs) should be returned (default: false)
4360    /// - `search`: Filter specific providers by name. Search can be prefix (name*), contains (*name*) or exact ("name"). Default prefixed.
4361    ///
4362    /// Resource: `Identity Providers`
4363    ///
4364    /// `GET /admin/realms/{realm}/identity-provider/instances`
4365    ///
4366    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstances>
4367    #[cfg(feature = "tag-identity-providers")]
4368    pub async fn realm_identity_provider_instances_get(
4369        &self,
4370        realm: &str,
4371        brief_representation: Option<bool>,
4372        first: Option<i32>,
4373        max: Option<i32>,
4374        realm_only: Option<bool>,
4375        search: Option<String>,
4376    ) -> Result<TypeVec<IdentityProviderRepresentation>, KeycloakError> {
4377        let realm = p(realm);
4378        let mut builder = self
4379            .client
4380            .get(format!(
4381                "{}/admin/realms/{realm}/identity-provider/instances",
4382                self.url
4383            ))
4384            .bearer_auth(self.token_supplier.get(&self.url).await?);
4385        if let Some(v) = brief_representation {
4386            builder = builder.query(&[("briefRepresentation", v)]);
4387        }
4388        if let Some(v) = first {
4389            builder = builder.query(&[("first", v)]);
4390        }
4391        if let Some(v) = max {
4392            builder = builder.query(&[("max", v)]);
4393        }
4394        if let Some(v) = realm_only {
4395            builder = builder.query(&[("realmOnly", v)]);
4396        }
4397        if let Some(v) = search {
4398            builder = builder.query(&[("search", v)]);
4399        }
4400        let response = builder.send().await?;
4401        Ok(error_check(response).await?.json().await?)
4402    }
4403
4404    /// Create a new identity provider
4405    ///
4406    /// Parameters:
4407    ///
4408    /// - `realm`: realm name (not id!)
4409    /// - `body`
4410    ///
4411    /// Returns id of created resource
4412    ///
4413    /// Resource: `Identity Providers`
4414    ///
4415    /// `POST /admin/realms/{realm}/identity-provider/instances`
4416    ///
4417    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmidentity_providerinstances>
4418    #[cfg(feature = "tag-identity-providers")]
4419    pub async fn realm_identity_provider_instances_post(
4420        &self,
4421        realm: &str,
4422        body: IdentityProviderRepresentation,
4423    ) -> Result<Option<TypeString>, KeycloakError> {
4424        let realm = p(realm);
4425        let builder = self
4426            .client
4427            .post(format!(
4428                "{}/admin/realms/{realm}/identity-provider/instances",
4429                self.url
4430            ))
4431            .json(&body)
4432            .bearer_auth(self.token_supplier.get(&self.url).await?);
4433        let response = builder.send().await?;
4434        error_check(response).await.map(to_id)
4435    }
4436
4437    /// Get the identity provider
4438    ///
4439    /// Parameters:
4440    ///
4441    /// - `realm`: realm name (not id!)
4442    /// - `alias`
4443    ///
4444    /// Resource: `Identity Providers`
4445    ///
4446    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}`
4447    ///
4448    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesalias>
4449    #[cfg(feature = "tag-identity-providers")]
4450    pub async fn realm_identity_provider_instances_with_alias_get(
4451        &self,
4452        realm: &str,
4453        alias: &str,
4454    ) -> Result<IdentityProviderRepresentation, KeycloakError> {
4455        let realm = p(realm);
4456        let alias = p(alias);
4457        let builder = self
4458            .client
4459            .get(format!(
4460                "{}/admin/realms/{realm}/identity-provider/instances/{alias}",
4461                self.url
4462            ))
4463            .bearer_auth(self.token_supplier.get(&self.url).await?);
4464        let response = builder.send().await?;
4465        Ok(error_check(response).await?.json().await?)
4466    }
4467
4468    /// Update the identity provider
4469    ///
4470    /// Parameters:
4471    ///
4472    /// - `realm`: realm name (not id!)
4473    /// - `alias`
4474    /// - `body`
4475    ///
4476    /// Resource: `Identity Providers`
4477    ///
4478    /// `PUT /admin/realms/{realm}/identity-provider/instances/{alias}`
4479    ///
4480    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmidentity_providerinstancesalias>
4481    #[cfg(feature = "tag-identity-providers")]
4482    pub async fn realm_identity_provider_instances_with_alias_put(
4483        &self,
4484        realm: &str,
4485        alias: &str,
4486        body: IdentityProviderRepresentation,
4487    ) -> Result<(), KeycloakError> {
4488        let realm = p(realm);
4489        let alias = p(alias);
4490        let builder = self
4491            .client
4492            .put(format!(
4493                "{}/admin/realms/{realm}/identity-provider/instances/{alias}",
4494                self.url
4495            ))
4496            .json(&body)
4497            .bearer_auth(self.token_supplier.get(&self.url).await?);
4498        let response = builder.send().await?;
4499        error_check(response).await?;
4500        Ok(())
4501    }
4502
4503    /// Delete the identity provider
4504    ///
4505    /// Parameters:
4506    ///
4507    /// - `realm`: realm name (not id!)
4508    /// - `alias`
4509    ///
4510    /// Resource: `Identity Providers`
4511    ///
4512    /// `DELETE /admin/realms/{realm}/identity-provider/instances/{alias}`
4513    ///
4514    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmidentity_providerinstancesalias>
4515    #[cfg(feature = "tag-identity-providers")]
4516    pub async fn realm_identity_provider_instances_with_alias_delete(
4517        &self,
4518        realm: &str,
4519        alias: &str,
4520    ) -> Result<(), KeycloakError> {
4521        let realm = p(realm);
4522        let alias = p(alias);
4523        let builder = self
4524            .client
4525            .delete(format!(
4526                "{}/admin/realms/{realm}/identity-provider/instances/{alias}",
4527                self.url
4528            ))
4529            .bearer_auth(self.token_supplier.get(&self.url).await?);
4530        let response = builder.send().await?;
4531        error_check(response).await?;
4532        Ok(())
4533    }
4534
4535    /// Export public broker configuration for identity provider
4536    ///
4537    /// Parameters:
4538    ///
4539    /// - `realm`: realm name (not id!)
4540    /// - `alias`
4541    /// - `format`: Format to use
4542    ///
4543    /// Resource: `Identity Providers`
4544    ///
4545    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/export`
4546    ///
4547    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasexport>
4548    #[cfg(feature = "tag-identity-providers")]
4549    pub async fn realm_identity_provider_instances_with_alias_export_get(
4550        &self,
4551        realm: &str,
4552        alias: &str,
4553        format: Option<String>,
4554    ) -> Result<(), KeycloakError> {
4555        let realm = p(realm);
4556        let alias = p(alias);
4557        let mut builder = self
4558            .client
4559            .get(format!(
4560                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/export",
4561                self.url
4562            ))
4563            .bearer_auth(self.token_supplier.get(&self.url).await?);
4564        if let Some(v) = format {
4565            builder = builder.query(&[("format", v)]);
4566        }
4567        let response = builder.send().await?;
4568        error_check(response).await?;
4569        Ok(())
4570    }
4571
4572    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
4573    ///
4574    /// Parameters:
4575    ///
4576    /// - `realm`: realm name (not id!)
4577    /// - `alias`
4578    ///
4579    /// Resource: `Identity Providers`
4580    ///
4581    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/management/permissions`
4582    ///
4583    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasmanagementpermissions>
4584    #[cfg(feature = "tag-identity-providers")]
4585    pub async fn realm_identity_provider_instances_with_alias_management_permissions_get(
4586        &self,
4587        realm: &str,
4588        alias: &str,
4589    ) -> Result<ManagementPermissionReference, KeycloakError> {
4590        let realm = p(realm);
4591        let alias = p(alias);
4592        let builder = self
4593            .client
4594            .get(format!(
4595                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/management/permissions",
4596                self.url
4597            ))
4598            .bearer_auth(self.token_supplier.get(&self.url).await?);
4599        let response = builder.send().await?;
4600        Ok(error_check(response).await?.json().await?)
4601    }
4602
4603    /// Return object stating whether client Authorization permissions have been initialized or not and a reference
4604    ///
4605    /// Parameters:
4606    ///
4607    /// - `realm`: realm name (not id!)
4608    /// - `alias`
4609    /// - `body`
4610    ///
4611    /// Resource: `Identity Providers`
4612    ///
4613    /// `PUT /admin/realms/{realm}/identity-provider/instances/{alias}/management/permissions`
4614    ///
4615    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmidentity_providerinstancesaliasmanagementpermissions>
4616    #[cfg(feature = "tag-identity-providers")]
4617    pub async fn realm_identity_provider_instances_with_alias_management_permissions_put(
4618        &self,
4619        realm: &str,
4620        alias: &str,
4621        body: ManagementPermissionReference,
4622    ) -> Result<ManagementPermissionReference, KeycloakError> {
4623        let realm = p(realm);
4624        let alias = p(alias);
4625        let builder = self
4626            .client
4627            .put(format!(
4628                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/management/permissions",
4629                self.url
4630            ))
4631            .json(&body)
4632            .bearer_auth(self.token_supplier.get(&self.url).await?);
4633        let response = builder.send().await?;
4634        Ok(error_check(response).await?.json().await?)
4635    }
4636
4637    /// Get mapper types for identity provider
4638    ///
4639    /// Parameters:
4640    ///
4641    /// - `realm`: realm name (not id!)
4642    /// - `alias`
4643    ///
4644    /// Resource: `Identity Providers`
4645    ///
4646    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/mapper-types`
4647    ///
4648    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasmapper_types>
4649    #[cfg(feature = "tag-identity-providers")]
4650    pub async fn realm_identity_provider_instances_with_alias_mapper_types_get(
4651        &self,
4652        realm: &str,
4653        alias: &str,
4654    ) -> Result<TypeMap<String, IdentityProviderMapperTypeRepresentation>, KeycloakError> {
4655        let realm = p(realm);
4656        let alias = p(alias);
4657        let builder = self
4658            .client
4659            .get(format!(
4660                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mapper-types",
4661                self.url
4662            ))
4663            .bearer_auth(self.token_supplier.get(&self.url).await?);
4664        let response = builder.send().await?;
4665        Ok(error_check(response).await?.json().await?)
4666    }
4667
4668    /// Get mappers for identity provider
4669    ///
4670    /// Parameters:
4671    ///
4672    /// - `realm`: realm name (not id!)
4673    /// - `alias`
4674    ///
4675    /// Resource: `Identity Providers`
4676    ///
4677    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/mappers`
4678    ///
4679    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasmappers>
4680    #[cfg(feature = "tag-identity-providers")]
4681    pub async fn realm_identity_provider_instances_with_alias_mappers_get(
4682        &self,
4683        realm: &str,
4684        alias: &str,
4685    ) -> Result<TypeVec<IdentityProviderMapperRepresentation>, KeycloakError> {
4686        let realm = p(realm);
4687        let alias = p(alias);
4688        let builder = self
4689            .client
4690            .get(format!(
4691                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mappers",
4692                self.url
4693            ))
4694            .bearer_auth(self.token_supplier.get(&self.url).await?);
4695        let response = builder.send().await?;
4696        Ok(error_check(response).await?.json().await?)
4697    }
4698
4699    /// Add a mapper to identity provider
4700    ///
4701    /// Parameters:
4702    ///
4703    /// - `realm`: realm name (not id!)
4704    /// - `alias`
4705    /// - `body`
4706    ///
4707    /// Returns id of created resource
4708    ///
4709    /// Resource: `Identity Providers`
4710    ///
4711    /// `POST /admin/realms/{realm}/identity-provider/instances/{alias}/mappers`
4712    ///
4713    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmidentity_providerinstancesaliasmappers>
4714    #[cfg(feature = "tag-identity-providers")]
4715    pub async fn realm_identity_provider_instances_with_alias_mappers_post(
4716        &self,
4717        realm: &str,
4718        alias: &str,
4719        body: IdentityProviderMapperRepresentation,
4720    ) -> Result<Option<TypeString>, KeycloakError> {
4721        let realm = p(realm);
4722        let alias = p(alias);
4723        let builder = self
4724            .client
4725            .post(format!(
4726                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mappers",
4727                self.url
4728            ))
4729            .json(&body)
4730            .bearer_auth(self.token_supplier.get(&self.url).await?);
4731        let response = builder.send().await?;
4732        error_check(response).await.map(to_id)
4733    }
4734
4735    /// Get mapper by id for the identity provider
4736    ///
4737    /// Parameters:
4738    ///
4739    /// - `realm`: realm name (not id!)
4740    /// - `alias`
4741    /// - `id`
4742    ///
4743    /// Resource: `Identity Providers`
4744    ///
4745    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}`
4746    ///
4747    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasmappersid>
4748    #[cfg(feature = "tag-identity-providers")]
4749    pub async fn realm_identity_provider_instances_with_alias_mappers_with_id_get(
4750        &self,
4751        realm: &str,
4752        alias: &str,
4753        id: &str,
4754    ) -> Result<IdentityProviderMapperRepresentation, KeycloakError> {
4755        let realm = p(realm);
4756        let alias = p(alias);
4757        let id = p(id);
4758        let builder = self
4759            .client
4760            .get(format!(
4761                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}",
4762                self.url
4763            ))
4764            .bearer_auth(self.token_supplier.get(&self.url).await?);
4765        let response = builder.send().await?;
4766        Ok(error_check(response).await?.json().await?)
4767    }
4768
4769    /// Update a mapper for the identity provider
4770    ///
4771    /// Parameters:
4772    ///
4773    /// - `realm`: realm name (not id!)
4774    /// - `alias`
4775    /// - `id`: Mapper id
4776    /// - `body`
4777    ///
4778    /// Resource: `Identity Providers`
4779    ///
4780    /// `PUT /admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}`
4781    ///
4782    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmidentity_providerinstancesaliasmappersid>
4783    #[cfg(feature = "tag-identity-providers")]
4784    pub async fn realm_identity_provider_instances_with_alias_mappers_with_id_put(
4785        &self,
4786        realm: &str,
4787        alias: &str,
4788        id: &str,
4789        body: IdentityProviderMapperRepresentation,
4790    ) -> Result<(), KeycloakError> {
4791        let realm = p(realm);
4792        let alias = p(alias);
4793        let id = p(id);
4794        let builder = self
4795            .client
4796            .put(format!(
4797                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}",
4798                self.url
4799            ))
4800            .json(&body)
4801            .bearer_auth(self.token_supplier.get(&self.url).await?);
4802        let response = builder.send().await?;
4803        error_check(response).await?;
4804        Ok(())
4805    }
4806
4807    /// Delete a mapper for the identity provider
4808    ///
4809    /// Parameters:
4810    ///
4811    /// - `realm`: realm name (not id!)
4812    /// - `alias`
4813    /// - `id`: Mapper id
4814    ///
4815    /// Resource: `Identity Providers`
4816    ///
4817    /// `DELETE /admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}`
4818    ///
4819    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmidentity_providerinstancesaliasmappersid>
4820    #[cfg(feature = "tag-identity-providers")]
4821    pub async fn realm_identity_provider_instances_with_alias_mappers_with_id_delete(
4822        &self,
4823        realm: &str,
4824        alias: &str,
4825        id: &str,
4826    ) -> Result<(), KeycloakError> {
4827        let realm = p(realm);
4828        let alias = p(alias);
4829        let id = p(id);
4830        let builder = self
4831            .client
4832            .delete(format!(
4833                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/mappers/{id}",
4834                self.url
4835            ))
4836            .bearer_auth(self.token_supplier.get(&self.url).await?);
4837        let response = builder.send().await?;
4838        error_check(response).await?;
4839        Ok(())
4840    }
4841
4842    /// Reaload keys for the identity provider if the provider supports it, "true" is returned if reload was performed, "false" if not.
4843    ///
4844    /// Parameters:
4845    ///
4846    /// - `realm`: realm name (not id!)
4847    /// - `alias`
4848    ///
4849    /// Resource: `Identity Providers`
4850    ///
4851    /// `GET /admin/realms/{realm}/identity-provider/instances/{alias}/reload-keys`
4852    ///
4853    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerinstancesaliasreload_keys>
4854    #[cfg(feature = "tag-identity-providers")]
4855    pub async fn realm_identity_provider_instances_with_alias_reload_keys_get(
4856        &self,
4857        realm: &str,
4858        alias: &str,
4859    ) -> Result<bool, KeycloakError> {
4860        let realm = p(realm);
4861        let alias = p(alias);
4862        let builder = self
4863            .client
4864            .get(format!(
4865                "{}/admin/realms/{realm}/identity-provider/instances/{alias}/reload-keys",
4866                self.url
4867            ))
4868            .bearer_auth(self.token_supplier.get(&self.url).await?);
4869        let response = builder.send().await?;
4870        Ok(error_check(response).await?.json().await?)
4871    }
4872
4873    /// Get the identity provider factory for that provider id
4874    ///
4875    /// Parameters:
4876    ///
4877    /// - `realm`: realm name (not id!)
4878    /// - `provider_id`: The provider id to get the factory
4879    ///
4880    /// Resource: `Identity Providers`
4881    ///
4882    /// `GET /admin/realms/{realm}/identity-provider/providers/{provider_id}`
4883    ///
4884    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmidentity_providerprovidersprovider_id>
4885    #[cfg(feature = "tag-identity-providers")]
4886    pub async fn realm_identity_provider_providers_with_provider_id_get(
4887        &self,
4888        realm: &str,
4889        provider_id: &str,
4890    ) -> Result<IdentityProviderRepresentation, KeycloakError> {
4891        let realm = p(realm);
4892        let provider_id = p(provider_id);
4893        let builder = self
4894            .client
4895            .get(format!(
4896                "{}/admin/realms/{realm}/identity-provider/providers/{provider_id}",
4897                self.url
4898            ))
4899            .bearer_auth(self.token_supplier.get(&self.url).await?);
4900        let response = builder.send().await?;
4901        Ok(error_check(response).await?.json().await?)
4902    }
4903
4904    // <h4>Key</h4>
4905
4906    /// Parameters:
4907    ///
4908    /// - `realm`: realm name (not id!)
4909    ///
4910    /// Resource: `Key`
4911    ///
4912    /// `GET /admin/realms/{realm}/keys`
4913    ///
4914    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmkeys>
4915    #[cfg(feature = "tag-key")]
4916    pub async fn realm_keys_get(
4917        &self,
4918        realm: &str,
4919    ) -> Result<KeysMetadataRepresentation, KeycloakError> {
4920        let realm = p(realm);
4921        let builder = self
4922            .client
4923            .get(format!("{}/admin/realms/{realm}/keys", self.url))
4924            .bearer_auth(self.token_supplier.get(&self.url).await?);
4925        let response = builder.send().await?;
4926        Ok(error_check(response).await?.json().await?)
4927    }
4928
4929    // <h4>Organizations</h4>
4930
4931    /// Returns a paginated list of organizations filtered according to the specified parameters
4932    ///
4933    /// Parameters:
4934    ///
4935    /// - `realm`: realm name (not id!)
4936    /// - `brief_representation`: if true, return the full representation. Otherwise, only the basic fields are returned.
4937    /// - `exact`: Boolean which defines whether the param 'search' must match exactly or not
4938    /// - `first`: The position of the first result to be processed (pagination offset)
4939    /// - `max`: The maximum number of results to be returned - defaults to 10
4940    /// - `q`: A query to search for custom attributes, in the format 'key1:value2 key2:value2'
4941    /// - `search`: A String representing either an organization name or domain
4942    ///
4943    /// Resource: `Organizations`
4944    ///
4945    /// `GET /admin/realms/{realm}/organizations`
4946    ///
4947    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizations>
4948    #[cfg(feature = "tag-organizations")]
4949    #[allow(clippy::too_many_arguments)]
4950    pub async fn realm_organizations_get(
4951        &self,
4952        realm: &str,
4953        brief_representation: Option<bool>,
4954        exact: Option<bool>,
4955        first: Option<i32>,
4956        max: Option<i32>,
4957        q: Option<String>,
4958        search: Option<String>,
4959    ) -> Result<TypeVec<OrganizationRepresentation>, KeycloakError> {
4960        let realm = p(realm);
4961        let mut builder = self
4962            .client
4963            .get(format!("{}/admin/realms/{realm}/organizations", self.url))
4964            .bearer_auth(self.token_supplier.get(&self.url).await?);
4965        if let Some(v) = brief_representation {
4966            builder = builder.query(&[("briefRepresentation", v)]);
4967        }
4968        if let Some(v) = exact {
4969            builder = builder.query(&[("exact", v)]);
4970        }
4971        if let Some(v) = first {
4972            builder = builder.query(&[("first", v)]);
4973        }
4974        if let Some(v) = max {
4975            builder = builder.query(&[("max", v)]);
4976        }
4977        if let Some(v) = q {
4978            builder = builder.query(&[("q", v)]);
4979        }
4980        if let Some(v) = search {
4981            builder = builder.query(&[("search", v)]);
4982        }
4983        let response = builder.send().await?;
4984        Ok(error_check(response).await?.json().await?)
4985    }
4986
4987    /// Creates a new organization
4988    ///
4989    /// Parameters:
4990    ///
4991    /// - `realm`: realm name (not id!)
4992    /// - `body`
4993    ///
4994    /// Returns id of created resource
4995    ///
4996    /// Resource: `Organizations`
4997    ///
4998    /// `POST /admin/realms/{realm}/organizations`
4999    ///
5000    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmorganizations>
5001    #[cfg(feature = "tag-organizations")]
5002    pub async fn realm_organizations_post(
5003        &self,
5004        realm: &str,
5005        body: OrganizationRepresentation,
5006    ) -> Result<Option<TypeString>, KeycloakError> {
5007        let realm = p(realm);
5008        let builder = self
5009            .client
5010            .post(format!("{}/admin/realms/{realm}/organizations", self.url))
5011            .json(&body)
5012            .bearer_auth(self.token_supplier.get(&self.url).await?);
5013        let response = builder.send().await?;
5014        error_check(response).await.map(to_id)
5015    }
5016
5017    /// Returns the organizations associated with the user that has the specified id
5018    ///
5019    /// Parameters:
5020    ///
5021    /// - `realm`: realm name (not id!)
5022    /// - `member_id`
5023    ///
5024    /// Resource: `Organizations`
5025    ///
5026    /// `GET /admin/realms/{realm}/organizations/members/{member_id}/organizations`
5027    ///
5028    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsmembersmember_idorganizations>
5029    ///
5030    /// REST method: `GET /admin/realms/{realm}/organizations/members/{member-id}/organizations`
5031    #[cfg(feature = "tag-organizations")]
5032    pub async fn realm_organizations_members_with_member_id_organizations_get(
5033        &self,
5034        realm: &str,
5035        member_id: &str,
5036    ) -> Result<TypeVec<OrganizationRepresentation>, KeycloakError> {
5037        let realm = p(realm);
5038        let member_id = p(member_id);
5039        let builder = self
5040            .client
5041            .get(format!(
5042                "{}/admin/realms/{realm}/organizations/members/{member_id}/organizations",
5043                self.url
5044            ))
5045            .bearer_auth(self.token_supplier.get(&self.url).await?);
5046        let response = builder.send().await?;
5047        Ok(error_check(response).await?.json().await?)
5048    }
5049
5050    /// Returns the organization representation
5051    ///
5052    /// Parameters:
5053    ///
5054    /// - `realm`: realm name (not id!)
5055    /// - `org_id`
5056    ///
5057    /// Resource: `Organizations`
5058    ///
5059    /// `GET /admin/realms/{realm}/organizations/{org_id}`
5060    ///
5061    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_id>
5062    ///
5063    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}`
5064    #[cfg(feature = "tag-organizations")]
5065    pub async fn realm_organizations_with_org_id_get(
5066        &self,
5067        realm: &str,
5068        org_id: &str,
5069    ) -> Result<OrganizationRepresentation, KeycloakError> {
5070        let realm = p(realm);
5071        let org_id = p(org_id);
5072        let builder = self
5073            .client
5074            .get(format!(
5075                "{}/admin/realms/{realm}/organizations/{org_id}",
5076                self.url
5077            ))
5078            .bearer_auth(self.token_supplier.get(&self.url).await?);
5079        let response = builder.send().await?;
5080        Ok(error_check(response).await?.json().await?)
5081    }
5082
5083    /// Updates the organization
5084    ///
5085    /// Parameters:
5086    ///
5087    /// - `realm`: realm name (not id!)
5088    /// - `org_id`
5089    /// - `body`
5090    ///
5091    /// Resource: `Organizations`
5092    ///
5093    /// `PUT /admin/realms/{realm}/organizations/{org_id}`
5094    ///
5095    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmorganizationsorg_id>
5096    ///
5097    /// REST method: `PUT /admin/realms/{realm}/organizations/{org-id}`
5098    #[cfg(feature = "tag-organizations")]
5099    pub async fn realm_organizations_with_org_id_put(
5100        &self,
5101        realm: &str,
5102        org_id: &str,
5103        body: OrganizationRepresentation,
5104    ) -> Result<(), KeycloakError> {
5105        let realm = p(realm);
5106        let org_id = p(org_id);
5107        let builder = self
5108            .client
5109            .put(format!(
5110                "{}/admin/realms/{realm}/organizations/{org_id}",
5111                self.url
5112            ))
5113            .json(&body)
5114            .bearer_auth(self.token_supplier.get(&self.url).await?);
5115        let response = builder.send().await?;
5116        error_check(response).await?;
5117        Ok(())
5118    }
5119
5120    /// Deletes the organization
5121    ///
5122    /// Parameters:
5123    ///
5124    /// - `realm`: realm name (not id!)
5125    /// - `org_id`
5126    ///
5127    /// Resource: `Organizations`
5128    ///
5129    /// `DELETE /admin/realms/{realm}/organizations/{org_id}`
5130    ///
5131    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmorganizationsorg_id>
5132    ///
5133    /// REST method: `DELETE /admin/realms/{realm}/organizations/{org-id}`
5134    #[cfg(feature = "tag-organizations")]
5135    pub async fn realm_organizations_with_org_id_delete(
5136        &self,
5137        realm: &str,
5138        org_id: &str,
5139    ) -> Result<(), KeycloakError> {
5140        let realm = p(realm);
5141        let org_id = p(org_id);
5142        let builder = self
5143            .client
5144            .delete(format!(
5145                "{}/admin/realms/{realm}/organizations/{org_id}",
5146                self.url
5147            ))
5148            .bearer_auth(self.token_supplier.get(&self.url).await?);
5149        let response = builder.send().await?;
5150        error_check(response).await?;
5151        Ok(())
5152    }
5153
5154    /// Returns all identity providers associated with the organization
5155    ///
5156    /// Parameters:
5157    ///
5158    /// - `realm`: realm name (not id!)
5159    /// - `org_id`
5160    ///
5161    /// Resource: `Organizations`
5162    ///
5163    /// `GET /admin/realms/{realm}/organizations/{org_id}/identity-providers`
5164    ///
5165    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_ididentity_providers>
5166    ///
5167    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/identity-providers`
5168    #[cfg(feature = "tag-organizations")]
5169    pub async fn realm_organizations_with_org_id_identity_providers_get(
5170        &self,
5171        realm: &str,
5172        org_id: &str,
5173    ) -> Result<TypeVec<IdentityProviderRepresentation>, KeycloakError> {
5174        let realm = p(realm);
5175        let org_id = p(org_id);
5176        let builder = self
5177            .client
5178            .get(format!(
5179                "{}/admin/realms/{realm}/organizations/{org_id}/identity-providers",
5180                self.url
5181            ))
5182            .bearer_auth(self.token_supplier.get(&self.url).await?);
5183        let response = builder.send().await?;
5184        Ok(error_check(response).await?.json().await?)
5185    }
5186
5187    /// Adds the identity provider with the specified id to the organization
5188    ///
5189    /// Parameters:
5190    ///
5191    /// - `realm`: realm name (not id!)
5192    /// - `org_id`
5193    /// - `body`
5194    ///
5195    /// Returns id of created resource
5196    ///
5197    /// Resource: `Organizations`
5198    ///
5199    /// `POST /admin/realms/{realm}/organizations/{org_id}/identity-providers`
5200    ///
5201    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmorganizationsorg_ididentity_providers>
5202    ///
5203    /// REST method: `POST /admin/realms/{realm}/organizations/{org-id}/identity-providers`
5204    #[cfg(feature = "tag-organizations")]
5205    pub async fn realm_organizations_with_org_id_identity_providers_post(
5206        &self,
5207        realm: &str,
5208        org_id: &str,
5209        body: String,
5210    ) -> Result<Option<TypeString>, KeycloakError> {
5211        let realm = p(realm);
5212        let org_id = p(org_id);
5213        let builder = self
5214            .client
5215            .post(format!(
5216                "{}/admin/realms/{realm}/organizations/{org_id}/identity-providers",
5217                self.url
5218            ))
5219            .json(&body)
5220            .bearer_auth(self.token_supplier.get(&self.url).await?);
5221        let response = builder.send().await?;
5222        error_check(response).await.map(to_id)
5223    }
5224
5225    /// Returns the identity provider associated with the organization that has the specified alias
5226    ///
5227    /// Parameters:
5228    ///
5229    /// - `realm`: realm name (not id!)
5230    /// - `org_id`
5231    /// - `alias`
5232    ///
5233    /// Resource: `Organizations`
5234    ///
5235    /// `GET /admin/realms/{realm}/organizations/{org_id}/identity-providers/{alias}`
5236    ///
5237    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_ididentity_providersalias>
5238    ///
5239    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/identity-providers/{alias}`
5240    #[cfg(feature = "tag-organizations")]
5241    pub async fn realm_organizations_with_org_id_identity_providers_with_alias_get(
5242        &self,
5243        realm: &str,
5244        org_id: &str,
5245        alias: &str,
5246    ) -> Result<IdentityProviderRepresentation, KeycloakError> {
5247        let realm = p(realm);
5248        let org_id = p(org_id);
5249        let alias = p(alias);
5250        let builder = self
5251            .client
5252            .get(format!(
5253                "{}/admin/realms/{realm}/organizations/{org_id}/identity-providers/{alias}",
5254                self.url
5255            ))
5256            .bearer_auth(self.token_supplier.get(&self.url).await?);
5257        let response = builder.send().await?;
5258        Ok(error_check(response).await?.json().await?)
5259    }
5260
5261    /// Removes the identity provider with the specified alias from the organization
5262    ///
5263    /// Parameters:
5264    ///
5265    /// - `realm`: realm name (not id!)
5266    /// - `org_id`
5267    /// - `alias`
5268    ///
5269    /// Resource: `Organizations`
5270    ///
5271    /// `DELETE /admin/realms/{realm}/organizations/{org_id}/identity-providers/{alias}`
5272    ///
5273    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmorganizationsorg_ididentity_providersalias>
5274    ///
5275    /// REST method: `DELETE /admin/realms/{realm}/organizations/{org-id}/identity-providers/{alias}`
5276    #[cfg(feature = "tag-organizations")]
5277    pub async fn realm_organizations_with_org_id_identity_providers_with_alias_delete(
5278        &self,
5279        realm: &str,
5280        org_id: &str,
5281        alias: &str,
5282    ) -> Result<(), KeycloakError> {
5283        let realm = p(realm);
5284        let org_id = p(org_id);
5285        let alias = p(alias);
5286        let builder = self
5287            .client
5288            .delete(format!(
5289                "{}/admin/realms/{realm}/organizations/{org_id}/identity-providers/{alias}",
5290                self.url
5291            ))
5292            .bearer_auth(self.token_supplier.get(&self.url).await?);
5293        let response = builder.send().await?;
5294        error_check(response).await?;
5295        Ok(())
5296    }
5297
5298    /// Returns a paginated list of organization members filtered according to the specified parameters
5299    ///
5300    /// Parameters:
5301    ///
5302    /// - `realm`: realm name (not id!)
5303    /// - `org_id`
5304    /// - `exact`: Boolean which defines whether the param 'search' must match exactly or not
5305    /// - `first`: The position of the first result to be processed (pagination offset)
5306    /// - `max`: The maximum number of results to be returned. Defaults to 10
5307    /// - `membership_type`: The membership type
5308    /// - `search`: A String representing either a member's username, e-mail, first name, or last name.
5309    ///
5310    /// Resource: `Organizations`
5311    ///
5312    /// `GET /admin/realms/{realm}/organizations/{org_id}/members`
5313    ///
5314    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_idmembers>
5315    ///
5316    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/members`
5317    #[cfg(feature = "tag-organizations")]
5318    #[allow(clippy::too_many_arguments)]
5319    pub async fn realm_organizations_with_org_id_members_get(
5320        &self,
5321        realm: &str,
5322        org_id: &str,
5323        exact: Option<bool>,
5324        first: Option<i32>,
5325        max: Option<i32>,
5326        membership_type: Option<String>,
5327        search: Option<String>,
5328    ) -> Result<TypeVec<MemberRepresentation>, KeycloakError> {
5329        let realm = p(realm);
5330        let org_id = p(org_id);
5331        let mut builder = self
5332            .client
5333            .get(format!(
5334                "{}/admin/realms/{realm}/organizations/{org_id}/members",
5335                self.url
5336            ))
5337            .bearer_auth(self.token_supplier.get(&self.url).await?);
5338        if let Some(v) = exact {
5339            builder = builder.query(&[("exact", v)]);
5340        }
5341        if let Some(v) = first {
5342            builder = builder.query(&[("first", v)]);
5343        }
5344        if let Some(v) = max {
5345            builder = builder.query(&[("max", v)]);
5346        }
5347        if let Some(v) = membership_type {
5348            builder = builder.query(&[("membershipType", v)]);
5349        }
5350        if let Some(v) = search {
5351            builder = builder.query(&[("search", v)]);
5352        }
5353        let response = builder.send().await?;
5354        Ok(error_check(response).await?.json().await?)
5355    }
5356
5357    /// Adds the user with the specified id as a member of the organization
5358    ///
5359    /// Parameters:
5360    ///
5361    /// - `realm`: realm name (not id!)
5362    /// - `org_id`
5363    /// - `body`
5364    ///
5365    /// Returns id of created resource
5366    ///
5367    /// Resource: `Organizations`
5368    ///
5369    /// `POST /admin/realms/{realm}/organizations/{org_id}/members`
5370    ///
5371    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmorganizationsorg_idmembers>
5372    ///
5373    /// REST method: `POST /admin/realms/{realm}/organizations/{org-id}/members`
5374    #[cfg(feature = "tag-organizations")]
5375    pub async fn realm_organizations_with_org_id_members_post(
5376        &self,
5377        realm: &str,
5378        org_id: &str,
5379        body: String,
5380    ) -> Result<Option<TypeString>, KeycloakError> {
5381        let realm = p(realm);
5382        let org_id = p(org_id);
5383        let builder = self
5384            .client
5385            .post(format!(
5386                "{}/admin/realms/{realm}/organizations/{org_id}/members",
5387                self.url
5388            ))
5389            .json(&body)
5390            .bearer_auth(self.token_supplier.get(&self.url).await?);
5391        let response = builder.send().await?;
5392        error_check(response).await.map(to_id)
5393    }
5394
5395    /// Returns number of members in the organization.
5396    ///
5397    /// Parameters:
5398    ///
5399    /// - `realm`: realm name (not id!)
5400    /// - `org_id`
5401    ///
5402    /// Resource: `Organizations`
5403    ///
5404    /// `GET /admin/realms/{realm}/organizations/{org_id}/members/count`
5405    ///
5406    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_idmemberscount>
5407    ///
5408    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/members/count`
5409    #[cfg(feature = "tag-organizations")]
5410    pub async fn realm_organizations_with_org_id_members_count_get(
5411        &self,
5412        realm: &str,
5413        org_id: &str,
5414    ) -> Result<i64, KeycloakError> {
5415        let realm = p(realm);
5416        let org_id = p(org_id);
5417        let builder = self
5418            .client
5419            .get(format!(
5420                "{}/admin/realms/{realm}/organizations/{org_id}/members/count",
5421                self.url
5422            ))
5423            .bearer_auth(self.token_supplier.get(&self.url).await?);
5424        let response = builder.send().await?;
5425        Ok(error_check(response).await?.json().await?)
5426    }
5427
5428    /// Invites an existing user to the organization, using the specified user id
5429    ///
5430    /// Parameters:
5431    ///
5432    /// - `realm`: realm name (not id!)
5433    /// - `org_id`
5434    /// - `body`
5435    ///
5436    /// Returns id of created resource
5437    ///
5438    /// Resource: `Organizations`
5439    ///
5440    /// `POST /admin/realms/{realm}/organizations/{org_id}/members/invite-existing-user`
5441    ///
5442    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmorganizationsorg_idmembersinvite_existing_user>
5443    ///
5444    /// REST method: `POST /admin/realms/{realm}/organizations/{org-id}/members/invite-existing-user`
5445    #[cfg(feature = "tag-organizations")]
5446    pub async fn realm_organizations_with_org_id_members_invite_existing_user_post(
5447        &self,
5448        realm: &str,
5449        org_id: &str,
5450        body: TypeMap<String, String>,
5451    ) -> Result<Option<TypeString>, KeycloakError> {
5452        let realm = p(realm);
5453        let org_id = p(org_id);
5454        let builder = self
5455            .client
5456            .post(format!(
5457                "{}/admin/realms/{realm}/organizations/{org_id}/members/invite-existing-user",
5458                self.url
5459            ))
5460            .form(&body)
5461            .bearer_auth(self.token_supplier.get(&self.url).await?);
5462        let response = builder.send().await?;
5463        error_check(response).await.map(to_id)
5464    }
5465
5466    /// Invites an existing user or sends a registration link to a new user, based on the provided e-mail address.
5467    ///
5468    /// Parameters:
5469    ///
5470    /// - `realm`: realm name (not id!)
5471    /// - `org_id`
5472    /// - `body`
5473    ///
5474    /// Returns id of created resource
5475    ///
5476    /// Resource: `Organizations`
5477    ///
5478    /// `POST /admin/realms/{realm}/organizations/{org_id}/members/invite-user`
5479    ///
5480    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmorganizationsorg_idmembersinvite_user>
5481    ///
5482    /// REST method: `POST /admin/realms/{realm}/organizations/{org-id}/members/invite-user`
5483    #[cfg(feature = "tag-organizations")]
5484    pub async fn realm_organizations_with_org_id_members_invite_user_post(
5485        &self,
5486        realm: &str,
5487        org_id: &str,
5488        body: TypeMap<String, String>,
5489    ) -> Result<Option<TypeString>, KeycloakError> {
5490        let realm = p(realm);
5491        let org_id = p(org_id);
5492        let builder = self
5493            .client
5494            .post(format!(
5495                "{}/admin/realms/{realm}/organizations/{org_id}/members/invite-user",
5496                self.url
5497            ))
5498            .form(&body)
5499            .bearer_auth(self.token_supplier.get(&self.url).await?);
5500        let response = builder.send().await?;
5501        error_check(response).await.map(to_id)
5502    }
5503
5504    /// Returns the member of the organization with the specified id
5505    ///
5506    /// Parameters:
5507    ///
5508    /// - `realm`: realm name (not id!)
5509    /// - `org_id`
5510    /// - `member_id`
5511    ///
5512    /// Resource: `Organizations`
5513    ///
5514    /// `GET /admin/realms/{realm}/organizations/{org_id}/members/{member_id}`
5515    ///
5516    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_idmembersmember_id>
5517    ///
5518    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/members/{member-id}`
5519    #[cfg(feature = "tag-organizations")]
5520    pub async fn realm_organizations_with_org_id_members_with_member_id_get(
5521        &self,
5522        realm: &str,
5523        org_id: &str,
5524        member_id: &str,
5525    ) -> Result<MemberRepresentation, KeycloakError> {
5526        let realm = p(realm);
5527        let org_id = p(org_id);
5528        let member_id = p(member_id);
5529        let builder = self
5530            .client
5531            .get(format!(
5532                "{}/admin/realms/{realm}/organizations/{org_id}/members/{member_id}",
5533                self.url
5534            ))
5535            .bearer_auth(self.token_supplier.get(&self.url).await?);
5536        let response = builder.send().await?;
5537        Ok(error_check(response).await?.json().await?)
5538    }
5539
5540    /// Removes the user with the specified id from the organization
5541    ///
5542    /// Parameters:
5543    ///
5544    /// - `realm`: realm name (not id!)
5545    /// - `org_id`
5546    /// - `member_id`
5547    ///
5548    /// Resource: `Organizations`
5549    ///
5550    /// `DELETE /admin/realms/{realm}/organizations/{org_id}/members/{member_id}`
5551    ///
5552    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmorganizationsorg_idmembersmember_id>
5553    ///
5554    /// REST method: `DELETE /admin/realms/{realm}/organizations/{org-id}/members/{member-id}`
5555    #[cfg(feature = "tag-organizations")]
5556    pub async fn realm_organizations_with_org_id_members_with_member_id_delete(
5557        &self,
5558        realm: &str,
5559        org_id: &str,
5560        member_id: &str,
5561    ) -> Result<(), KeycloakError> {
5562        let realm = p(realm);
5563        let org_id = p(org_id);
5564        let member_id = p(member_id);
5565        let builder = self
5566            .client
5567            .delete(format!(
5568                "{}/admin/realms/{realm}/organizations/{org_id}/members/{member_id}",
5569                self.url
5570            ))
5571            .bearer_auth(self.token_supplier.get(&self.url).await?);
5572        let response = builder.send().await?;
5573        error_check(response).await?;
5574        Ok(())
5575    }
5576
5577    /// Returns the organizations associated with the user that has the specified id
5578    ///
5579    /// Parameters:
5580    ///
5581    /// - `realm`: realm name (not id!)
5582    /// - `org_id`
5583    /// - `member_id`
5584    ///
5585    /// Resource: `Organizations`
5586    ///
5587    /// `GET /admin/realms/{realm}/organizations/{org_id}/members/{member_id}/organizations`
5588    ///
5589    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmorganizationsorg_idmembersmember_idorganizations>
5590    ///
5591    /// REST method: `GET /admin/realms/{realm}/organizations/{org-id}/members/{member-id}/organizations`
5592    #[cfg(feature = "tag-organizations")]
5593    pub async fn realm_organizations_with_org_id_members_with_member_id_organizations_get(
5594        &self,
5595        realm: &str,
5596        org_id: &str,
5597        member_id: &str,
5598    ) -> Result<TypeVec<OrganizationRepresentation>, KeycloakError> {
5599        let realm = p(realm);
5600        let org_id = p(org_id);
5601        let member_id = p(member_id);
5602        let builder = self
5603            .client
5604            .get(format!(
5605                "{}/admin/realms/{realm}/organizations/{org_id}/members/{member_id}/organizations",
5606                self.url
5607            ))
5608            .bearer_auth(self.token_supplier.get(&self.url).await?);
5609        let response = builder.send().await?;
5610        Ok(error_check(response).await?.json().await?)
5611    }
5612
5613    // <h4>Protocol Mappers</h4>
5614
5615    /// Create multiple mappers
5616    ///
5617    /// Parameters:
5618    ///
5619    /// - `realm`: realm name (not id!)
5620    /// - `client_scope_id`
5621    /// - `body`
5622    ///
5623    /// Returns id of created resource
5624    ///
5625    /// Resource: `Protocol Mappers`
5626    ///
5627    /// `POST /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/add-models`
5628    ///
5629    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersadd_models>
5630    ///
5631    /// REST method: `POST /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/add-models`
5632    #[cfg(feature = "tag-protocol-mappers")]
5633    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_add_models_post(
5634        &self,
5635        realm: &str,
5636        client_scope_id: &str,
5637        body: Vec<ProtocolMapperRepresentation>,
5638    ) -> Result<Option<TypeString>, KeycloakError> {
5639        let realm = p(realm);
5640        let client_scope_id = p(client_scope_id);
5641        let builder = self
5642            .client
5643            .post(format!(
5644                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/add-models",
5645                self.url
5646            ))
5647            .json(&body)
5648            .bearer_auth(self.token_supplier.get(&self.url).await?);
5649        let response = builder.send().await?;
5650        error_check(response).await.map(to_id)
5651    }
5652
5653    /// Get mappers
5654    ///
5655    /// Parameters:
5656    ///
5657    /// - `realm`: realm name (not id!)
5658    /// - `client_scope_id`
5659    ///
5660    /// Resource: `Protocol Mappers`
5661    ///
5662    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models`
5663    ///
5664    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersmodels>
5665    ///
5666    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/models`
5667    #[cfg(feature = "tag-protocol-mappers")]
5668    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_models_get(
5669        &self,
5670        realm: &str,
5671        client_scope_id: &str,
5672    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
5673        let realm = p(realm);
5674        let client_scope_id = p(client_scope_id);
5675        let builder = self
5676            .client
5677            .get(format!(
5678                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models",
5679                self.url
5680            ))
5681            .bearer_auth(self.token_supplier.get(&self.url).await?);
5682        let response = builder.send().await?;
5683        Ok(error_check(response).await?.json().await?)
5684    }
5685
5686    /// Create a mapper
5687    ///
5688    /// Parameters:
5689    ///
5690    /// - `realm`: realm name (not id!)
5691    /// - `client_scope_id`
5692    /// - `body`
5693    ///
5694    /// Returns id of created resource
5695    ///
5696    /// Resource: `Protocol Mappers`
5697    ///
5698    /// `POST /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models`
5699    ///
5700    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersmodels>
5701    ///
5702    /// REST method: `POST /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/models`
5703    #[cfg(feature = "tag-protocol-mappers")]
5704    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_models_post(
5705        &self,
5706        realm: &str,
5707        client_scope_id: &str,
5708        body: ProtocolMapperRepresentation,
5709    ) -> Result<Option<TypeString>, KeycloakError> {
5710        let realm = p(realm);
5711        let client_scope_id = p(client_scope_id);
5712        let builder = self
5713            .client
5714            .post(format!(
5715                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models",
5716                self.url
5717            ))
5718            .json(&body)
5719            .bearer_auth(self.token_supplier.get(&self.url).await?);
5720        let response = builder.send().await?;
5721        error_check(response).await.map(to_id)
5722    }
5723
5724    /// Get mapper by id
5725    ///
5726    /// Parameters:
5727    ///
5728    /// - `realm`: realm name (not id!)
5729    /// - `client_scope_id`
5730    /// - `id`: Mapper id
5731    ///
5732    /// Resource: `Protocol Mappers`
5733    ///
5734    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}`
5735    ///
5736    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersmodelsid>
5737    ///
5738    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/models/{id}`
5739    #[cfg(feature = "tag-protocol-mappers")]
5740    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_models_with_id_get(
5741        &self,
5742        realm: &str,
5743        client_scope_id: &str,
5744        id: &str,
5745    ) -> Result<ProtocolMapperRepresentation, KeycloakError> {
5746        let realm = p(realm);
5747        let client_scope_id = p(client_scope_id);
5748        let id = p(id);
5749        let builder = self
5750            .client
5751            .get(format!(
5752                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}",
5753                self.url
5754            ))
5755            .bearer_auth(self.token_supplier.get(&self.url).await?);
5756        let response = builder.send().await?;
5757        Ok(error_check(response).await?.json().await?)
5758    }
5759
5760    /// Update the mapper
5761    ///
5762    /// Parameters:
5763    ///
5764    /// - `realm`: realm name (not id!)
5765    /// - `client_scope_id`
5766    /// - `id`: Mapper id
5767    /// - `body`
5768    ///
5769    /// Resource: `Protocol Mappers`
5770    ///
5771    /// `PUT /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}`
5772    ///
5773    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersmodelsid>
5774    ///
5775    /// REST method: `PUT /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/models/{id}`
5776    #[cfg(feature = "tag-protocol-mappers")]
5777    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_models_with_id_put(
5778        &self,
5779        realm: &str,
5780        client_scope_id: &str,
5781        id: &str,
5782        body: ProtocolMapperRepresentation,
5783    ) -> Result<(), KeycloakError> {
5784        let realm = p(realm);
5785        let client_scope_id = p(client_scope_id);
5786        let id = p(id);
5787        let builder = self
5788            .client
5789            .put(format!(
5790                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}",
5791                self.url
5792            ))
5793            .json(&body)
5794            .bearer_auth(self.token_supplier.get(&self.url).await?);
5795        let response = builder.send().await?;
5796        error_check(response).await?;
5797        Ok(())
5798    }
5799
5800    /// Delete the mapper
5801    ///
5802    /// Parameters:
5803    ///
5804    /// - `realm`: realm name (not id!)
5805    /// - `client_scope_id`
5806    /// - `id`: Mapper id
5807    ///
5808    /// Resource: `Protocol Mappers`
5809    ///
5810    /// `DELETE /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}`
5811    ///
5812    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersmodelsid>
5813    ///
5814    /// REST method: `DELETE /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/models/{id}`
5815    #[cfg(feature = "tag-protocol-mappers")]
5816    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_models_with_id_delete(
5817        &self,
5818        realm: &str,
5819        client_scope_id: &str,
5820        id: &str,
5821    ) -> Result<(), KeycloakError> {
5822        let realm = p(realm);
5823        let client_scope_id = p(client_scope_id);
5824        let id = p(id);
5825        let builder = self
5826            .client
5827            .delete(format!(
5828                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/models/{id}",
5829                self.url
5830            ))
5831            .bearer_auth(self.token_supplier.get(&self.url).await?);
5832        let response = builder.send().await?;
5833        error_check(response).await?;
5834        Ok(())
5835    }
5836
5837    /// Get mappers by name for a specific protocol
5838    ///
5839    /// Parameters:
5840    ///
5841    /// - `realm`: realm name (not id!)
5842    /// - `client_scope_id`
5843    /// - `protocol`
5844    ///
5845    /// Resource: `Protocol Mappers`
5846    ///
5847    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/protocol/{protocol}`
5848    ///
5849    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idprotocol_mappersprotocolprotocol>
5850    ///
5851    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/protocol-mappers/protocol/{protocol}`
5852    #[cfg(feature = "tag-protocol-mappers")]
5853    pub async fn realm_client_scopes_with_client_scope_id_protocol_mappers_protocol_with_protocol_get(
5854        &self,
5855        realm: &str,
5856        client_scope_id: &str,
5857        protocol: &str,
5858    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
5859        let realm = p(realm);
5860        let client_scope_id = p(client_scope_id);
5861        let protocol = p(protocol);
5862        let builder = self
5863            .client
5864            .get(format!(
5865                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/protocol-mappers/protocol/{protocol}",
5866                self.url
5867            ))
5868            .bearer_auth(self.token_supplier.get(&self.url).await?);
5869        let response = builder.send().await?;
5870        Ok(error_check(response).await?.json().await?)
5871    }
5872
5873    /// Create multiple mappers
5874    ///
5875    /// Parameters:
5876    ///
5877    /// - `realm`: realm name (not id!)
5878    /// - `client_scope_id`
5879    /// - `body`
5880    ///
5881    /// Returns id of created resource
5882    ///
5883    /// Resource: `Protocol Mappers`
5884    ///
5885    /// `POST /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/add-models`
5886    ///
5887    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersadd_models>
5888    ///
5889    /// REST method: `POST /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/add-models`
5890    #[cfg(feature = "tag-protocol-mappers")]
5891    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_add_models_post(
5892        &self,
5893        realm: &str,
5894        client_scope_id: &str,
5895        body: Vec<ProtocolMapperRepresentation>,
5896    ) -> Result<Option<TypeString>, KeycloakError> {
5897        let realm = p(realm);
5898        let client_scope_id = p(client_scope_id);
5899        let builder = self
5900            .client
5901            .post(format!(
5902                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/add-models",
5903                self.url
5904            ))
5905            .json(&body)
5906            .bearer_auth(self.token_supplier.get(&self.url).await?);
5907        let response = builder.send().await?;
5908        error_check(response).await.map(to_id)
5909    }
5910
5911    /// Get mappers
5912    ///
5913    /// Parameters:
5914    ///
5915    /// - `realm`: realm name (not id!)
5916    /// - `client_scope_id`
5917    ///
5918    /// Resource: `Protocol Mappers`
5919    ///
5920    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models`
5921    ///
5922    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersmodels>
5923    ///
5924    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/models`
5925    #[cfg(feature = "tag-protocol-mappers")]
5926    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_models_get(
5927        &self,
5928        realm: &str,
5929        client_scope_id: &str,
5930    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
5931        let realm = p(realm);
5932        let client_scope_id = p(client_scope_id);
5933        let builder = self
5934            .client
5935            .get(format!(
5936                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models",
5937                self.url
5938            ))
5939            .bearer_auth(self.token_supplier.get(&self.url).await?);
5940        let response = builder.send().await?;
5941        Ok(error_check(response).await?.json().await?)
5942    }
5943
5944    /// Create a mapper
5945    ///
5946    /// Parameters:
5947    ///
5948    /// - `realm`: realm name (not id!)
5949    /// - `client_scope_id`
5950    /// - `body`
5951    ///
5952    /// Returns id of created resource
5953    ///
5954    /// Resource: `Protocol Mappers`
5955    ///
5956    /// `POST /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models`
5957    ///
5958    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersmodels>
5959    ///
5960    /// REST method: `POST /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/models`
5961    #[cfg(feature = "tag-protocol-mappers")]
5962    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_models_post(
5963        &self,
5964        realm: &str,
5965        client_scope_id: &str,
5966        body: ProtocolMapperRepresentation,
5967    ) -> Result<Option<TypeString>, KeycloakError> {
5968        let realm = p(realm);
5969        let client_scope_id = p(client_scope_id);
5970        let builder = self
5971            .client
5972            .post(format!(
5973                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models",
5974                self.url
5975            ))
5976            .json(&body)
5977            .bearer_auth(self.token_supplier.get(&self.url).await?);
5978        let response = builder.send().await?;
5979        error_check(response).await.map(to_id)
5980    }
5981
5982    /// Get mapper by id
5983    ///
5984    /// Parameters:
5985    ///
5986    /// - `realm`: realm name (not id!)
5987    /// - `client_scope_id`
5988    /// - `id`: Mapper id
5989    ///
5990    /// Resource: `Protocol Mappers`
5991    ///
5992    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}`
5993    ///
5994    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersmodelsid>
5995    ///
5996    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/models/{id}`
5997    #[cfg(feature = "tag-protocol-mappers")]
5998    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_models_with_id_get(
5999        &self,
6000        realm: &str,
6001        client_scope_id: &str,
6002        id: &str,
6003    ) -> Result<ProtocolMapperRepresentation, KeycloakError> {
6004        let realm = p(realm);
6005        let client_scope_id = p(client_scope_id);
6006        let id = p(id);
6007        let builder = self
6008            .client
6009            .get(format!(
6010                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}",
6011                self.url
6012            ))
6013            .bearer_auth(self.token_supplier.get(&self.url).await?);
6014        let response = builder.send().await?;
6015        Ok(error_check(response).await?.json().await?)
6016    }
6017
6018    /// Update the mapper
6019    ///
6020    /// Parameters:
6021    ///
6022    /// - `realm`: realm name (not id!)
6023    /// - `client_scope_id`
6024    /// - `id`: Mapper id
6025    /// - `body`
6026    ///
6027    /// Resource: `Protocol Mappers`
6028    ///
6029    /// `PUT /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}`
6030    ///
6031    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersmodelsid>
6032    ///
6033    /// REST method: `PUT /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/models/{id}`
6034    #[cfg(feature = "tag-protocol-mappers")]
6035    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_models_with_id_put(
6036        &self,
6037        realm: &str,
6038        client_scope_id: &str,
6039        id: &str,
6040        body: ProtocolMapperRepresentation,
6041    ) -> Result<(), KeycloakError> {
6042        let realm = p(realm);
6043        let client_scope_id = p(client_scope_id);
6044        let id = p(id);
6045        let builder = self
6046            .client
6047            .put(format!(
6048                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}",
6049                self.url
6050            ))
6051            .json(&body)
6052            .bearer_auth(self.token_supplier.get(&self.url).await?);
6053        let response = builder.send().await?;
6054        error_check(response).await?;
6055        Ok(())
6056    }
6057
6058    /// Delete the mapper
6059    ///
6060    /// Parameters:
6061    ///
6062    /// - `realm`: realm name (not id!)
6063    /// - `client_scope_id`
6064    /// - `id`: Mapper id
6065    ///
6066    /// Resource: `Protocol Mappers`
6067    ///
6068    /// `DELETE /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}`
6069    ///
6070    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersmodelsid>
6071    ///
6072    /// REST method: `DELETE /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/models/{id}`
6073    #[cfg(feature = "tag-protocol-mappers")]
6074    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_models_with_id_delete(
6075        &self,
6076        realm: &str,
6077        client_scope_id: &str,
6078        id: &str,
6079    ) -> Result<(), KeycloakError> {
6080        let realm = p(realm);
6081        let client_scope_id = p(client_scope_id);
6082        let id = p(id);
6083        let builder = self
6084            .client
6085            .delete(format!(
6086                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/models/{id}",
6087                self.url
6088            ))
6089            .bearer_auth(self.token_supplier.get(&self.url).await?);
6090        let response = builder.send().await?;
6091        error_check(response).await?;
6092        Ok(())
6093    }
6094
6095    /// Get mappers by name for a specific protocol
6096    ///
6097    /// Parameters:
6098    ///
6099    /// - `realm`: realm name (not id!)
6100    /// - `client_scope_id`
6101    /// - `protocol`
6102    ///
6103    /// Resource: `Protocol Mappers`
6104    ///
6105    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/protocol/{protocol}`
6106    ///
6107    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idprotocol_mappersprotocolprotocol>
6108    ///
6109    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/protocol-mappers/protocol/{protocol}`
6110    #[cfg(feature = "tag-protocol-mappers")]
6111    pub async fn realm_client_templates_with_client_scope_id_protocol_mappers_protocol_with_protocol_get(
6112        &self,
6113        realm: &str,
6114        client_scope_id: &str,
6115        protocol: &str,
6116    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
6117        let realm = p(realm);
6118        let client_scope_id = p(client_scope_id);
6119        let protocol = p(protocol);
6120        let builder = self
6121            .client
6122            .get(format!(
6123                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/protocol-mappers/protocol/{protocol}",
6124                self.url
6125            ))
6126            .bearer_auth(self.token_supplier.get(&self.url).await?);
6127        let response = builder.send().await?;
6128        Ok(error_check(response).await?.json().await?)
6129    }
6130
6131    /// Create multiple mappers
6132    ///
6133    /// Parameters:
6134    ///
6135    /// - `realm`: realm name (not id!)
6136    /// - `client_uuid`: id of client (not client-id!)
6137    /// - `body`
6138    ///
6139    /// Returns id of created resource
6140    ///
6141    /// Resource: `Protocol Mappers`
6142    ///
6143    /// `POST /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/add-models`
6144    ///
6145    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidprotocol_mappersadd_models>
6146    ///
6147    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/add-models`
6148    #[cfg(feature = "tag-protocol-mappers")]
6149    pub async fn realm_clients_with_client_uuid_protocol_mappers_add_models_post(
6150        &self,
6151        realm: &str,
6152        client_uuid: &str,
6153        body: Vec<ProtocolMapperRepresentation>,
6154    ) -> Result<Option<TypeString>, KeycloakError> {
6155        let realm = p(realm);
6156        let client_uuid = p(client_uuid);
6157        let builder = self
6158            .client
6159            .post(format!(
6160                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/add-models",
6161                self.url
6162            ))
6163            .json(&body)
6164            .bearer_auth(self.token_supplier.get(&self.url).await?);
6165        let response = builder.send().await?;
6166        error_check(response).await.map(to_id)
6167    }
6168
6169    /// Get mappers
6170    ///
6171    /// Parameters:
6172    ///
6173    /// - `realm`: realm name (not id!)
6174    /// - `client_uuid`: id of client (not client-id!)
6175    ///
6176    /// Resource: `Protocol Mappers`
6177    ///
6178    /// `GET /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models`
6179    ///
6180    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidprotocol_mappersmodels>
6181    ///
6182    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/models`
6183    #[cfg(feature = "tag-protocol-mappers")]
6184    pub async fn realm_clients_with_client_uuid_protocol_mappers_models_get(
6185        &self,
6186        realm: &str,
6187        client_uuid: &str,
6188    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
6189        let realm = p(realm);
6190        let client_uuid = p(client_uuid);
6191        let builder = self
6192            .client
6193            .get(format!(
6194                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models",
6195                self.url
6196            ))
6197            .bearer_auth(self.token_supplier.get(&self.url).await?);
6198        let response = builder.send().await?;
6199        Ok(error_check(response).await?.json().await?)
6200    }
6201
6202    /// Create a mapper
6203    ///
6204    /// Parameters:
6205    ///
6206    /// - `realm`: realm name (not id!)
6207    /// - `client_uuid`: id of client (not client-id!)
6208    /// - `body`
6209    ///
6210    /// Returns id of created resource
6211    ///
6212    /// Resource: `Protocol Mappers`
6213    ///
6214    /// `POST /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models`
6215    ///
6216    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidprotocol_mappersmodels>
6217    ///
6218    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/models`
6219    #[cfg(feature = "tag-protocol-mappers")]
6220    pub async fn realm_clients_with_client_uuid_protocol_mappers_models_post(
6221        &self,
6222        realm: &str,
6223        client_uuid: &str,
6224        body: ProtocolMapperRepresentation,
6225    ) -> Result<Option<TypeString>, KeycloakError> {
6226        let realm = p(realm);
6227        let client_uuid = p(client_uuid);
6228        let builder = self
6229            .client
6230            .post(format!(
6231                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models",
6232                self.url
6233            ))
6234            .json(&body)
6235            .bearer_auth(self.token_supplier.get(&self.url).await?);
6236        let response = builder.send().await?;
6237        error_check(response).await.map(to_id)
6238    }
6239
6240    /// Get mapper by id
6241    ///
6242    /// Parameters:
6243    ///
6244    /// - `realm`: realm name (not id!)
6245    /// - `client_uuid`: id of client (not client-id!)
6246    /// - `id`: Mapper id
6247    ///
6248    /// Resource: `Protocol Mappers`
6249    ///
6250    /// `GET /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}`
6251    ///
6252    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidprotocol_mappersmodelsid>
6253    ///
6254    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/models/{id}`
6255    #[cfg(feature = "tag-protocol-mappers")]
6256    pub async fn realm_clients_with_client_uuid_protocol_mappers_models_with_id_get(
6257        &self,
6258        realm: &str,
6259        client_uuid: &str,
6260        id: &str,
6261    ) -> Result<ProtocolMapperRepresentation, KeycloakError> {
6262        let realm = p(realm);
6263        let client_uuid = p(client_uuid);
6264        let id = p(id);
6265        let builder = self
6266            .client
6267            .get(format!(
6268                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}",
6269                self.url
6270            ))
6271            .bearer_auth(self.token_supplier.get(&self.url).await?);
6272        let response = builder.send().await?;
6273        Ok(error_check(response).await?.json().await?)
6274    }
6275
6276    /// Update the mapper
6277    ///
6278    /// Parameters:
6279    ///
6280    /// - `realm`: realm name (not id!)
6281    /// - `client_uuid`: id of client (not client-id!)
6282    /// - `id`: Mapper id
6283    /// - `body`
6284    ///
6285    /// Resource: `Protocol Mappers`
6286    ///
6287    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}`
6288    ///
6289    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidprotocol_mappersmodelsid>
6290    ///
6291    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/models/{id}`
6292    #[cfg(feature = "tag-protocol-mappers")]
6293    pub async fn realm_clients_with_client_uuid_protocol_mappers_models_with_id_put(
6294        &self,
6295        realm: &str,
6296        client_uuid: &str,
6297        id: &str,
6298        body: ProtocolMapperRepresentation,
6299    ) -> Result<(), KeycloakError> {
6300        let realm = p(realm);
6301        let client_uuid = p(client_uuid);
6302        let id = p(id);
6303        let builder = self
6304            .client
6305            .put(format!(
6306                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}",
6307                self.url
6308            ))
6309            .json(&body)
6310            .bearer_auth(self.token_supplier.get(&self.url).await?);
6311        let response = builder.send().await?;
6312        error_check(response).await?;
6313        Ok(())
6314    }
6315
6316    /// Delete the mapper
6317    ///
6318    /// Parameters:
6319    ///
6320    /// - `realm`: realm name (not id!)
6321    /// - `client_uuid`: id of client (not client-id!)
6322    /// - `id`: Mapper id
6323    ///
6324    /// Resource: `Protocol Mappers`
6325    ///
6326    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}`
6327    ///
6328    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidprotocol_mappersmodelsid>
6329    ///
6330    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/models/{id}`
6331    #[cfg(feature = "tag-protocol-mappers")]
6332    pub async fn realm_clients_with_client_uuid_protocol_mappers_models_with_id_delete(
6333        &self,
6334        realm: &str,
6335        client_uuid: &str,
6336        id: &str,
6337    ) -> Result<(), KeycloakError> {
6338        let realm = p(realm);
6339        let client_uuid = p(client_uuid);
6340        let id = p(id);
6341        let builder = self
6342            .client
6343            .delete(format!(
6344                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/models/{id}",
6345                self.url
6346            ))
6347            .bearer_auth(self.token_supplier.get(&self.url).await?);
6348        let response = builder.send().await?;
6349        error_check(response).await?;
6350        Ok(())
6351    }
6352
6353    /// Get mappers by name for a specific protocol
6354    ///
6355    /// Parameters:
6356    ///
6357    /// - `realm`: realm name (not id!)
6358    /// - `client_uuid`: id of client (not client-id!)
6359    /// - `protocol`
6360    ///
6361    /// Resource: `Protocol Mappers`
6362    ///
6363    /// `GET /admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/protocol/{protocol}`
6364    ///
6365    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidprotocol_mappersprotocolprotocol>
6366    ///
6367    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/protocol-mappers/protocol/{protocol}`
6368    #[cfg(feature = "tag-protocol-mappers")]
6369    pub async fn realm_clients_with_client_uuid_protocol_mappers_protocol_with_protocol_get(
6370        &self,
6371        realm: &str,
6372        client_uuid: &str,
6373        protocol: &str,
6374    ) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
6375        let realm = p(realm);
6376        let client_uuid = p(client_uuid);
6377        let protocol = p(protocol);
6378        let builder = self
6379            .client
6380            .get(format!(
6381                "{}/admin/realms/{realm}/clients/{client_uuid}/protocol-mappers/protocol/{protocol}",
6382                self.url
6383            ))
6384            .bearer_auth(self.token_supplier.get(&self.url).await?);
6385        let response = builder.send().await?;
6386        Ok(error_check(response).await?.json().await?)
6387    }
6388
6389    // <h4>Realms Admin</h4>
6390
6391    /// Get accessible realms Returns a list of accessible realms. The list is filtered based on what realms the caller is allowed to view.
6392    ///
6393    /// Parameters:
6394    ///
6395    /// - `brief_representation`
6396    ///
6397    /// Resource: `Realms Admin`
6398    ///
6399    /// `GET /admin/realms`
6400    ///
6401    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealms>
6402    #[cfg(feature = "tag-realms-admin")]
6403    pub async fn get(
6404        &self,
6405        brief_representation: Option<bool>,
6406    ) -> Result<TypeVec<RealmRepresentation>, KeycloakError> {
6407        let mut builder = self
6408            .client
6409            .get(format!("{}/admin/realms", self.url))
6410            .bearer_auth(self.token_supplier.get(&self.url).await?);
6411        if let Some(v) = brief_representation {
6412            builder = builder.query(&[("briefRepresentation", v)]);
6413        }
6414        let response = builder.send().await?;
6415        Ok(error_check(response).await?.json().await?)
6416    }
6417
6418    /// Import a realm. Imports a realm from a full representation of that realm.
6419    ///
6420    /// Parameters:
6421    ///
6422    /// - `body`
6423    ///
6424    /// Returns id of created resource
6425    ///
6426    /// Resource: `Realms Admin`
6427    ///
6428    /// `POST /admin/realms`
6429    ///
6430    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealms>
6431    #[cfg(feature = "tag-realms-admin")]
6432    pub async fn post(
6433        &self,
6434        body: RealmRepresentation,
6435    ) -> Result<Option<TypeString>, KeycloakError> {
6436        let builder = self
6437            .client
6438            .post(format!("{}/admin/realms", self.url))
6439            .json(&body)
6440            .bearer_auth(self.token_supplier.get(&self.url).await?);
6441        let response = builder.send().await?;
6442        error_check(response).await.map(to_id)
6443    }
6444
6445    /// Get the top-level representation of the realm It will not include nested information like User and Client representations.
6446    ///
6447    /// Parameters:
6448    ///
6449    /// - `realm`: realm name (not id!)
6450    ///
6451    /// Resource: `Realms Admin`
6452    ///
6453    /// `GET /admin/realms/{realm}`
6454    ///
6455    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealm>
6456    #[cfg(feature = "tag-realms-admin")]
6457    pub async fn realm_get(&self, realm: &str) -> Result<RealmRepresentation, KeycloakError> {
6458        let realm = p(realm);
6459        let builder = self
6460            .client
6461            .get(format!("{}/admin/realms/{realm}", self.url))
6462            .bearer_auth(self.token_supplier.get(&self.url).await?);
6463        let response = builder.send().await?;
6464        Ok(error_check(response).await?.json().await?)
6465    }
6466
6467    /// Update the top-level information of the realm Any user, roles or client information in the representation will be ignored.
6468    ///
6469    /// Parameters:
6470    ///
6471    /// - `realm`: realm name (not id!)
6472    /// - `body`
6473    ///
6474    /// Resource: `Realms Admin`
6475    ///
6476    /// `PUT /admin/realms/{realm}`
6477    ///
6478    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealm>
6479    #[cfg(feature = "tag-realms-admin")]
6480    pub async fn realm_put(
6481        &self,
6482        realm: &str,
6483        body: RealmRepresentation,
6484    ) -> Result<(), KeycloakError> {
6485        let realm = p(realm);
6486        let builder = self
6487            .client
6488            .put(format!("{}/admin/realms/{realm}", self.url))
6489            .json(&body)
6490            .bearer_auth(self.token_supplier.get(&self.url).await?);
6491        let response = builder.send().await?;
6492        error_check(response).await?;
6493        Ok(())
6494    }
6495
6496    /// Delete the realm
6497    ///
6498    /// Parameters:
6499    ///
6500    /// - `realm`: realm name (not id!)
6501    ///
6502    /// Resource: `Realms Admin`
6503    ///
6504    /// `DELETE /admin/realms/{realm}`
6505    ///
6506    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealm>
6507    #[cfg(feature = "tag-realms-admin")]
6508    pub async fn realm_delete(&self, realm: &str) -> Result<(), KeycloakError> {
6509        let realm = p(realm);
6510        let builder = self
6511            .client
6512            .delete(format!("{}/admin/realms/{realm}", self.url))
6513            .bearer_auth(self.token_supplier.get(&self.url).await?);
6514        let response = builder.send().await?;
6515        error_check(response).await?;
6516        Ok(())
6517    }
6518
6519    /// Get admin events Returns all admin events, or filters events based on URL query parameters listed here
6520    ///
6521    /// Parameters:
6522    ///
6523    /// - `realm`: realm name (not id!)
6524    /// - `auth_client`
6525    /// - `auth_ip_address`
6526    /// - `auth_realm`
6527    /// - `auth_user`: user id
6528    /// - `date_from`
6529    /// - `date_to`
6530    /// - `first`
6531    /// - `max`: Maximum results size (defaults to 100)
6532    /// - `operation_types`
6533    /// - `resource_path`
6534    /// - `resource_types`
6535    ///
6536    /// Resource: `Realms Admin`
6537    ///
6538    /// `GET /admin/realms/{realm}/admin-events`
6539    ///
6540    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmadmin_events>
6541    #[cfg(feature = "tag-realms-admin")]
6542    #[allow(clippy::too_many_arguments)]
6543    pub async fn realm_admin_events_get(
6544        &self,
6545        realm: &str,
6546        auth_client: Option<String>,
6547        auth_ip_address: Option<String>,
6548        auth_realm: Option<String>,
6549        auth_user: Option<String>,
6550        date_from: Option<String>,
6551        date_to: Option<String>,
6552        first: Option<i32>,
6553        max: Option<i32>,
6554        operation_types: Option<Vec<String>>,
6555        resource_path: Option<String>,
6556        resource_types: Option<Vec<String>>,
6557    ) -> Result<TypeVec<AdminEventRepresentation>, KeycloakError> {
6558        let realm = p(realm);
6559        let mut builder = self
6560            .client
6561            .get(format!("{}/admin/realms/{realm}/admin-events", self.url))
6562            .bearer_auth(self.token_supplier.get(&self.url).await?);
6563        if let Some(v) = auth_client {
6564            builder = builder.query(&[("authClient", v)]);
6565        }
6566        if let Some(v) = auth_ip_address {
6567            builder = builder.query(&[("authIpAddress", v)]);
6568        }
6569        if let Some(v) = auth_realm {
6570            builder = builder.query(&[("authRealm", v)]);
6571        }
6572        if let Some(v) = auth_user {
6573            builder = builder.query(&[("authUser", v)]);
6574        }
6575        if let Some(v) = date_from {
6576            builder = builder.query(&[("dateFrom", v)]);
6577        }
6578        if let Some(v) = date_to {
6579            builder = builder.query(&[("dateTo", v)]);
6580        }
6581        if let Some(v) = first {
6582            builder = builder.query(&[("first", v)]);
6583        }
6584        if let Some(v) = max {
6585            builder = builder.query(&[("max", v)]);
6586        }
6587        if let Some(v) = operation_types {
6588            builder = builder.query(
6589                &v.into_iter()
6590                    .map(|e| ("operationTypes", e))
6591                    .collect::<Vec<_>>(),
6592            );
6593        }
6594        if let Some(v) = resource_path {
6595            builder = builder.query(&[("resourcePath", v)]);
6596        }
6597        if let Some(v) = resource_types {
6598            builder = builder.query(
6599                &v.into_iter()
6600                    .map(|e| ("resourceTypes", e))
6601                    .collect::<Vec<_>>(),
6602            );
6603        }
6604        let response = builder.send().await?;
6605        Ok(error_check(response).await?.json().await?)
6606    }
6607
6608    /// Delete all admin events
6609    ///
6610    /// Parameters:
6611    ///
6612    /// - `realm`: realm name (not id!)
6613    ///
6614    /// Resource: `Realms Admin`
6615    ///
6616    /// `DELETE /admin/realms/{realm}/admin-events`
6617    ///
6618    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmadmin_events>
6619    #[cfg(feature = "tag-realms-admin")]
6620    pub async fn realm_admin_events_delete(&self, realm: &str) -> Result<(), KeycloakError> {
6621        let realm = p(realm);
6622        let builder = self
6623            .client
6624            .delete(format!("{}/admin/realms/{realm}/admin-events", self.url))
6625            .bearer_auth(self.token_supplier.get(&self.url).await?);
6626        let response = builder.send().await?;
6627        error_check(response).await?;
6628        Ok(())
6629    }
6630
6631    /// Base path for importing clients under this realm.
6632    ///
6633    /// Parameters:
6634    ///
6635    /// - `realm`: realm name (not id!)
6636    /// - `body`
6637    ///
6638    /// Resource: `Realms Admin`
6639    ///
6640    /// `POST /admin/realms/{realm}/client-description-converter`
6641    ///
6642    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_description_converter>
6643    #[cfg(feature = "tag-realms-admin")]
6644    pub async fn realm_client_description_converter_post(
6645        &self,
6646        realm: &str,
6647        body: String,
6648    ) -> Result<ClientRepresentation, KeycloakError> {
6649        let realm = p(realm);
6650        let builder = self
6651            .client
6652            .post(format!(
6653                "{}/admin/realms/{realm}/client-description-converter",
6654                self.url
6655            ))
6656            .json(&body)
6657            .bearer_auth(self.token_supplier.get(&self.url).await?);
6658        let response = builder.send().await?;
6659        Ok(error_check(response).await?.json().await?)
6660    }
6661
6662    /// Parameters:
6663    ///
6664    /// - `realm`: realm name (not id!)
6665    /// - `include_global_policies`
6666    ///
6667    /// Resource: `Realms Admin`
6668    ///
6669    /// `GET /admin/realms/{realm}/client-policies/policies`
6670    ///
6671    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_policiespolicies>
6672    #[cfg(feature = "tag-realms-admin")]
6673    pub async fn realm_client_policies_policies_get(
6674        &self,
6675        realm: &str,
6676        include_global_policies: Option<bool>,
6677    ) -> Result<ClientPoliciesRepresentation, KeycloakError> {
6678        let realm = p(realm);
6679        let mut builder = self
6680            .client
6681            .get(format!(
6682                "{}/admin/realms/{realm}/client-policies/policies",
6683                self.url
6684            ))
6685            .bearer_auth(self.token_supplier.get(&self.url).await?);
6686        if let Some(v) = include_global_policies {
6687            builder = builder.query(&[("include-global-policies", v)]);
6688        }
6689        let response = builder.send().await?;
6690        Ok(error_check(response).await?.json().await?)
6691    }
6692
6693    /// Parameters:
6694    ///
6695    /// - `realm`: realm name (not id!)
6696    /// - `body`
6697    ///
6698    /// Resource: `Realms Admin`
6699    ///
6700    /// `PUT /admin/realms/{realm}/client-policies/policies`
6701    ///
6702    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_policiespolicies>
6703    #[cfg(feature = "tag-realms-admin")]
6704    pub async fn realm_client_policies_policies_put(
6705        &self,
6706        realm: &str,
6707        body: ClientPoliciesRepresentation,
6708    ) -> Result<(), KeycloakError> {
6709        let realm = p(realm);
6710        let builder = self
6711            .client
6712            .put(format!(
6713                "{}/admin/realms/{realm}/client-policies/policies",
6714                self.url
6715            ))
6716            .json(&body)
6717            .bearer_auth(self.token_supplier.get(&self.url).await?);
6718        let response = builder.send().await?;
6719        error_check(response).await?;
6720        Ok(())
6721    }
6722
6723    /// Parameters:
6724    ///
6725    /// - `realm`: realm name (not id!)
6726    /// - `include_global_profiles`
6727    ///
6728    /// Resource: `Realms Admin`
6729    ///
6730    /// `GET /admin/realms/{realm}/client-policies/profiles`
6731    ///
6732    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_policiesprofiles>
6733    #[cfg(feature = "tag-realms-admin")]
6734    pub async fn realm_client_policies_profiles_get(
6735        &self,
6736        realm: &str,
6737        include_global_profiles: Option<bool>,
6738    ) -> Result<ClientProfilesRepresentation, KeycloakError> {
6739        let realm = p(realm);
6740        let mut builder = self
6741            .client
6742            .get(format!(
6743                "{}/admin/realms/{realm}/client-policies/profiles",
6744                self.url
6745            ))
6746            .bearer_auth(self.token_supplier.get(&self.url).await?);
6747        if let Some(v) = include_global_profiles {
6748            builder = builder.query(&[("include-global-profiles", v)]);
6749        }
6750        let response = builder.send().await?;
6751        Ok(error_check(response).await?.json().await?)
6752    }
6753
6754    /// Parameters:
6755    ///
6756    /// - `realm`: realm name (not id!)
6757    /// - `body`
6758    ///
6759    /// Resource: `Realms Admin`
6760    ///
6761    /// `PUT /admin/realms/{realm}/client-policies/profiles`
6762    ///
6763    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_policiesprofiles>
6764    #[cfg(feature = "tag-realms-admin")]
6765    pub async fn realm_client_policies_profiles_put(
6766        &self,
6767        realm: &str,
6768        body: ClientProfilesRepresentation,
6769    ) -> Result<(), KeycloakError> {
6770        let realm = p(realm);
6771        let builder = self
6772            .client
6773            .put(format!(
6774                "{}/admin/realms/{realm}/client-policies/profiles",
6775                self.url
6776            ))
6777            .json(&body)
6778            .bearer_auth(self.token_supplier.get(&self.url).await?);
6779        let response = builder.send().await?;
6780        error_check(response).await?;
6781        Ok(())
6782    }
6783
6784    /// Get client session stats Returns a JSON map.
6785    ///
6786    /// Parameters:
6787    ///
6788    /// - `realm`: realm name (not id!)
6789    ///
6790    /// Resource: `Realms Admin`
6791    ///
6792    /// `GET /admin/realms/{realm}/client-session-stats`
6793    ///
6794    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_session_stats>
6795    #[cfg(feature = "tag-realms-admin")]
6796    pub async fn realm_client_session_stats_get(
6797        &self,
6798        realm: &str,
6799    ) -> Result<TypeVec<TypeMap<String, String>>, KeycloakError> {
6800        let realm = p(realm);
6801        let builder = self
6802            .client
6803            .get(format!(
6804                "{}/admin/realms/{realm}/client-session-stats",
6805                self.url
6806            ))
6807            .bearer_auth(self.token_supplier.get(&self.url).await?);
6808        let response = builder.send().await?;
6809        Ok(error_check(response).await?.json().await?)
6810    }
6811
6812    /// List all client types available in the current realm
6813    ///
6814    /// Parameters:
6815    ///
6816    /// - `realm`: realm name (not id!)
6817    ///
6818    /// Resource: `Realms Admin`
6819    ///
6820    /// `GET /admin/realms/{realm}/client-types`
6821    ///
6822    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_types>
6823    #[cfg(feature = "tag-realms-admin")]
6824    pub async fn realm_client_types_get(
6825        &self,
6826        realm: &str,
6827    ) -> Result<ClientTypesRepresentation, KeycloakError> {
6828        let realm = p(realm);
6829        let builder = self
6830            .client
6831            .get(format!("{}/admin/realms/{realm}/client-types", self.url))
6832            .bearer_auth(self.token_supplier.get(&self.url).await?);
6833        let response = builder.send().await?;
6834        Ok(error_check(response).await?.json().await?)
6835    }
6836
6837    /// Update a client type
6838    ///
6839    /// Parameters:
6840    ///
6841    /// - `realm`: realm name (not id!)
6842    /// - `body`
6843    ///
6844    /// Resource: `Realms Admin`
6845    ///
6846    /// `PUT /admin/realms/{realm}/client-types`
6847    ///
6848    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclient_types>
6849    #[cfg(feature = "tag-realms-admin")]
6850    pub async fn realm_client_types_put(
6851        &self,
6852        realm: &str,
6853        body: ClientTypesRepresentation,
6854    ) -> Result<(), KeycloakError> {
6855        let realm = p(realm);
6856        let builder = self
6857            .client
6858            .put(format!("{}/admin/realms/{realm}/client-types", self.url))
6859            .json(&body)
6860            .bearer_auth(self.token_supplier.get(&self.url).await?);
6861        let response = builder.send().await?;
6862        error_check(response).await?;
6863        Ok(())
6864    }
6865
6866    /// Parameters:
6867    ///
6868    /// - `realm`: realm name (not id!)
6869    ///
6870    /// Resource: `Realms Admin`
6871    ///
6872    /// `GET /admin/realms/{realm}/credential-registrators`
6873    ///
6874    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmcredential_registrators>
6875    #[cfg(feature = "tag-realms-admin")]
6876    pub async fn realm_credential_registrators_get(
6877        &self,
6878        realm: &str,
6879    ) -> Result<TypeVec<String>, KeycloakError> {
6880        let realm = p(realm);
6881        let builder = self
6882            .client
6883            .get(format!(
6884                "{}/admin/realms/{realm}/credential-registrators",
6885                self.url
6886            ))
6887            .bearer_auth(self.token_supplier.get(&self.url).await?);
6888        let response = builder.send().await?;
6889        Ok(error_check(response).await?.json().await?)
6890    }
6891
6892    /// Get realm default client scopes.  Only name and ids are returned.
6893    ///
6894    /// Parameters:
6895    ///
6896    /// - `realm`: realm name (not id!)
6897    ///
6898    /// Resource: `Realms Admin`
6899    ///
6900    /// `GET /admin/realms/{realm}/default-default-client-scopes`
6901    ///
6902    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmdefault_default_client_scopes>
6903    #[cfg(feature = "tag-realms-admin")]
6904    pub async fn realm_default_default_client_scopes_get(
6905        &self,
6906        realm: &str,
6907    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
6908        let realm = p(realm);
6909        let builder = self
6910            .client
6911            .get(format!(
6912                "{}/admin/realms/{realm}/default-default-client-scopes",
6913                self.url
6914            ))
6915            .bearer_auth(self.token_supplier.get(&self.url).await?);
6916        let response = builder.send().await?;
6917        Ok(error_check(response).await?.json().await?)
6918    }
6919
6920    /// Parameters:
6921    ///
6922    /// - `realm`: realm name (not id!)
6923    /// - `client_scope_id`
6924    ///
6925    /// Resource: `Realms Admin`
6926    ///
6927    /// `PUT /admin/realms/{realm}/default-default-client-scopes/{client_scope_id}`
6928    ///
6929    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmdefault_default_client_scopesclientscopeid>
6930    ///
6931    /// REST method: `PUT /admin/realms/{realm}/default-default-client-scopes/{clientScopeId}`
6932    #[cfg(feature = "tag-realms-admin")]
6933    pub async fn realm_default_default_client_scopes_with_client_scope_id_put(
6934        &self,
6935        realm: &str,
6936        client_scope_id: &str,
6937    ) -> Result<(), KeycloakError> {
6938        let realm = p(realm);
6939        let client_scope_id = p(client_scope_id);
6940        let builder = self
6941            .client
6942            .put(format!(
6943                "{}/admin/realms/{realm}/default-default-client-scopes/{client_scope_id}",
6944                self.url
6945            ))
6946            .header(CONTENT_LENGTH, "0")
6947            .bearer_auth(self.token_supplier.get(&self.url).await?);
6948        let response = builder.send().await?;
6949        error_check(response).await?;
6950        Ok(())
6951    }
6952
6953    /// Parameters:
6954    ///
6955    /// - `realm`: realm name (not id!)
6956    /// - `client_scope_id`
6957    ///
6958    /// Resource: `Realms Admin`
6959    ///
6960    /// `DELETE /admin/realms/{realm}/default-default-client-scopes/{client_scope_id}`
6961    ///
6962    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmdefault_default_client_scopesclientscopeid>
6963    ///
6964    /// REST method: `DELETE /admin/realms/{realm}/default-default-client-scopes/{clientScopeId}`
6965    #[cfg(feature = "tag-realms-admin")]
6966    pub async fn realm_default_default_client_scopes_with_client_scope_id_delete(
6967        &self,
6968        realm: &str,
6969        client_scope_id: &str,
6970    ) -> Result<(), KeycloakError> {
6971        let realm = p(realm);
6972        let client_scope_id = p(client_scope_id);
6973        let builder = self
6974            .client
6975            .delete(format!(
6976                "{}/admin/realms/{realm}/default-default-client-scopes/{client_scope_id}",
6977                self.url
6978            ))
6979            .bearer_auth(self.token_supplier.get(&self.url).await?);
6980        let response = builder.send().await?;
6981        error_check(response).await?;
6982        Ok(())
6983    }
6984
6985    /// Get group hierarchy.  Only name and ids are returned.
6986    ///
6987    /// Parameters:
6988    ///
6989    /// - `realm`: realm name (not id!)
6990    ///
6991    /// Resource: `Realms Admin`
6992    ///
6993    /// `GET /admin/realms/{realm}/default-groups`
6994    ///
6995    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmdefault_groups>
6996    #[cfg(feature = "tag-realms-admin")]
6997    pub async fn realm_default_groups_get(
6998        &self,
6999        realm: &str,
7000    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
7001        let realm = p(realm);
7002        let builder = self
7003            .client
7004            .get(format!("{}/admin/realms/{realm}/default-groups", self.url))
7005            .bearer_auth(self.token_supplier.get(&self.url).await?);
7006        let response = builder.send().await?;
7007        Ok(error_check(response).await?.json().await?)
7008    }
7009
7010    /// Parameters:
7011    ///
7012    /// - `realm`: realm name (not id!)
7013    /// - `group_id`
7014    ///
7015    /// Resource: `Realms Admin`
7016    ///
7017    /// `PUT /admin/realms/{realm}/default-groups/{group_id}`
7018    ///
7019    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmdefault_groupsgroupid>
7020    ///
7021    /// REST method: `PUT /admin/realms/{realm}/default-groups/{groupId}`
7022    #[cfg(feature = "tag-realms-admin")]
7023    pub async fn realm_default_groups_with_group_id_put(
7024        &self,
7025        realm: &str,
7026        group_id: &str,
7027    ) -> Result<(), KeycloakError> {
7028        let realm = p(realm);
7029        let group_id = p(group_id);
7030        let builder = self
7031            .client
7032            .put(format!(
7033                "{}/admin/realms/{realm}/default-groups/{group_id}",
7034                self.url
7035            ))
7036            .header(CONTENT_LENGTH, "0")
7037            .bearer_auth(self.token_supplier.get(&self.url).await?);
7038        let response = builder.send().await?;
7039        error_check(response).await?;
7040        Ok(())
7041    }
7042
7043    /// Parameters:
7044    ///
7045    /// - `realm`: realm name (not id!)
7046    /// - `group_id`
7047    ///
7048    /// Resource: `Realms Admin`
7049    ///
7050    /// `DELETE /admin/realms/{realm}/default-groups/{group_id}`
7051    ///
7052    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmdefault_groupsgroupid>
7053    ///
7054    /// REST method: `DELETE /admin/realms/{realm}/default-groups/{groupId}`
7055    #[cfg(feature = "tag-realms-admin")]
7056    pub async fn realm_default_groups_with_group_id_delete(
7057        &self,
7058        realm: &str,
7059        group_id: &str,
7060    ) -> Result<(), KeycloakError> {
7061        let realm = p(realm);
7062        let group_id = p(group_id);
7063        let builder = self
7064            .client
7065            .delete(format!(
7066                "{}/admin/realms/{realm}/default-groups/{group_id}",
7067                self.url
7068            ))
7069            .bearer_auth(self.token_supplier.get(&self.url).await?);
7070        let response = builder.send().await?;
7071        error_check(response).await?;
7072        Ok(())
7073    }
7074
7075    /// Get realm optional client scopes.  Only name and ids are returned.
7076    ///
7077    /// Parameters:
7078    ///
7079    /// - `realm`: realm name (not id!)
7080    ///
7081    /// Resource: `Realms Admin`
7082    ///
7083    /// `GET /admin/realms/{realm}/default-optional-client-scopes`
7084    ///
7085    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmdefault_optional_client_scopes>
7086    #[cfg(feature = "tag-realms-admin")]
7087    pub async fn realm_default_optional_client_scopes_get(
7088        &self,
7089        realm: &str,
7090    ) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
7091        let realm = p(realm);
7092        let builder = self
7093            .client
7094            .get(format!(
7095                "{}/admin/realms/{realm}/default-optional-client-scopes",
7096                self.url
7097            ))
7098            .bearer_auth(self.token_supplier.get(&self.url).await?);
7099        let response = builder.send().await?;
7100        Ok(error_check(response).await?.json().await?)
7101    }
7102
7103    /// Parameters:
7104    ///
7105    /// - `realm`: realm name (not id!)
7106    /// - `client_scope_id`
7107    ///
7108    /// Resource: `Realms Admin`
7109    ///
7110    /// `PUT /admin/realms/{realm}/default-optional-client-scopes/{client_scope_id}`
7111    ///
7112    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmdefault_optional_client_scopesclientscopeid>
7113    ///
7114    /// REST method: `PUT /admin/realms/{realm}/default-optional-client-scopes/{clientScopeId}`
7115    #[cfg(feature = "tag-realms-admin")]
7116    pub async fn realm_default_optional_client_scopes_with_client_scope_id_put(
7117        &self,
7118        realm: &str,
7119        client_scope_id: &str,
7120    ) -> Result<(), KeycloakError> {
7121        let realm = p(realm);
7122        let client_scope_id = p(client_scope_id);
7123        let builder = self
7124            .client
7125            .put(format!(
7126                "{}/admin/realms/{realm}/default-optional-client-scopes/{client_scope_id}",
7127                self.url
7128            ))
7129            .header(CONTENT_LENGTH, "0")
7130            .bearer_auth(self.token_supplier.get(&self.url).await?);
7131        let response = builder.send().await?;
7132        error_check(response).await?;
7133        Ok(())
7134    }
7135
7136    /// Parameters:
7137    ///
7138    /// - `realm`: realm name (not id!)
7139    /// - `client_scope_id`
7140    ///
7141    /// Resource: `Realms Admin`
7142    ///
7143    /// `DELETE /admin/realms/{realm}/default-optional-client-scopes/{client_scope_id}`
7144    ///
7145    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmdefault_optional_client_scopesclientscopeid>
7146    ///
7147    /// REST method: `DELETE /admin/realms/{realm}/default-optional-client-scopes/{clientScopeId}`
7148    #[cfg(feature = "tag-realms-admin")]
7149    pub async fn realm_default_optional_client_scopes_with_client_scope_id_delete(
7150        &self,
7151        realm: &str,
7152        client_scope_id: &str,
7153    ) -> Result<(), KeycloakError> {
7154        let realm = p(realm);
7155        let client_scope_id = p(client_scope_id);
7156        let builder = self
7157            .client
7158            .delete(format!(
7159                "{}/admin/realms/{realm}/default-optional-client-scopes/{client_scope_id}",
7160                self.url
7161            ))
7162            .bearer_auth(self.token_supplier.get(&self.url).await?);
7163        let response = builder.send().await?;
7164        error_check(response).await?;
7165        Ok(())
7166    }
7167
7168    /// Get events Returns all events, or filters them based on URL query parameters listed here
7169    ///
7170    /// Parameters:
7171    ///
7172    /// - `realm`: realm name (not id!)
7173    /// - `client`: App or oauth client name
7174    /// - `date_from`: From date
7175    /// - `date_to`: To date
7176    /// - `first`: Paging offset
7177    /// - `ip_address`: IP Address
7178    /// - `max`: Maximum results size (defaults to 100)
7179    /// - `type_`: The types of events to return
7180    /// - `user`: User id
7181    ///
7182    /// Resource: `Realms Admin`
7183    ///
7184    /// `GET /admin/realms/{realm}/events`
7185    ///
7186    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmevents>
7187    #[cfg(feature = "tag-realms-admin")]
7188    #[allow(clippy::too_many_arguments)]
7189    pub async fn realm_events_get(
7190        &self,
7191        realm: &str,
7192        client: Option<String>,
7193        date_from: Option<String>,
7194        date_to: Option<String>,
7195        first: Option<i32>,
7196        ip_address: Option<String>,
7197        max: Option<i32>,
7198        type_: Option<Vec<String>>,
7199        user: Option<String>,
7200    ) -> Result<TypeVec<EventRepresentation>, KeycloakError> {
7201        let realm = p(realm);
7202        let mut builder = self
7203            .client
7204            .get(format!("{}/admin/realms/{realm}/events", self.url))
7205            .bearer_auth(self.token_supplier.get(&self.url).await?);
7206        if let Some(v) = client {
7207            builder = builder.query(&[("client", v)]);
7208        }
7209        if let Some(v) = date_from {
7210            builder = builder.query(&[("dateFrom", v)]);
7211        }
7212        if let Some(v) = date_to {
7213            builder = builder.query(&[("dateTo", v)]);
7214        }
7215        if let Some(v) = first {
7216            builder = builder.query(&[("first", v)]);
7217        }
7218        if let Some(v) = ip_address {
7219            builder = builder.query(&[("ipAddress", v)]);
7220        }
7221        if let Some(v) = max {
7222            builder = builder.query(&[("max", v)]);
7223        }
7224        if let Some(v) = type_ {
7225            builder = builder.query(&v.into_iter().map(|e| ("type", e)).collect::<Vec<_>>());
7226        }
7227        if let Some(v) = user {
7228            builder = builder.query(&[("user", v)]);
7229        }
7230        let response = builder.send().await?;
7231        Ok(error_check(response).await?.json().await?)
7232    }
7233
7234    /// Delete all events
7235    ///
7236    /// Parameters:
7237    ///
7238    /// - `realm`: realm name (not id!)
7239    ///
7240    /// Resource: `Realms Admin`
7241    ///
7242    /// `DELETE /admin/realms/{realm}/events`
7243    ///
7244    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmevents>
7245    #[cfg(feature = "tag-realms-admin")]
7246    pub async fn realm_events_delete(&self, realm: &str) -> Result<(), KeycloakError> {
7247        let realm = p(realm);
7248        let builder = self
7249            .client
7250            .delete(format!("{}/admin/realms/{realm}/events", self.url))
7251            .bearer_auth(self.token_supplier.get(&self.url).await?);
7252        let response = builder.send().await?;
7253        error_check(response).await?;
7254        Ok(())
7255    }
7256
7257    /// Get the events provider configuration Returns JSON object with events provider configuration
7258    ///
7259    /// Parameters:
7260    ///
7261    /// - `realm`: realm name (not id!)
7262    ///
7263    /// Resource: `Realms Admin`
7264    ///
7265    /// `GET /admin/realms/{realm}/events/config`
7266    ///
7267    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmeventsconfig>
7268    #[cfg(feature = "tag-realms-admin")]
7269    pub async fn realm_events_config_get(
7270        &self,
7271        realm: &str,
7272    ) -> Result<RealmEventsConfigRepresentation, KeycloakError> {
7273        let realm = p(realm);
7274        let builder = self
7275            .client
7276            .get(format!("{}/admin/realms/{realm}/events/config", self.url))
7277            .bearer_auth(self.token_supplier.get(&self.url).await?);
7278        let response = builder.send().await?;
7279        Ok(error_check(response).await?.json().await?)
7280    }
7281
7282    /// Parameters:
7283    ///
7284    /// - `realm`: realm name (not id!)
7285    /// - `body`
7286    ///
7287    /// Resource: `Realms Admin`
7288    ///
7289    /// `PUT /admin/realms/{realm}/events/config`
7290    ///
7291    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmeventsconfig>
7292    #[cfg(feature = "tag-realms-admin")]
7293    pub async fn realm_events_config_put(
7294        &self,
7295        realm: &str,
7296        body: RealmEventsConfigRepresentation,
7297    ) -> Result<(), KeycloakError> {
7298        let realm = p(realm);
7299        let builder = self
7300            .client
7301            .put(format!("{}/admin/realms/{realm}/events/config", self.url))
7302            .json(&body)
7303            .bearer_auth(self.token_supplier.get(&self.url).await?);
7304        let response = builder.send().await?;
7305        error_check(response).await?;
7306        Ok(())
7307    }
7308
7309    /// Parameters:
7310    ///
7311    /// - `realm`: realm name (not id!)
7312    /// - `path`
7313    ///
7314    /// Resource: `Realms Admin`
7315    ///
7316    /// `GET /admin/realms/{realm}/group-by-path/{path}`
7317    ///
7318    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroup_by_pathpath>
7319    #[cfg(feature = "tag-realms-admin")]
7320    pub async fn realm_group_by_path_with_path_get(
7321        &self,
7322        realm: &str,
7323        path: &str,
7324    ) -> Result<GroupRepresentation, KeycloakError> {
7325        let realm = p(realm);
7326        let path = p(path);
7327        let builder = self
7328            .client
7329            .get(format!(
7330                "{}/admin/realms/{realm}/group-by-path/{path}",
7331                self.url
7332            ))
7333            .bearer_auth(self.token_supplier.get(&self.url).await?);
7334        let response = builder.send().await?;
7335        Ok(error_check(response).await?.json().await?)
7336    }
7337
7338    /// Parameters:
7339    ///
7340    /// - `realm`: realm name (not id!)
7341    ///
7342    /// Resource: `Realms Admin`
7343    ///
7344    /// `GET /admin/realms/{realm}/localization`
7345    ///
7346    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmlocalization>
7347    #[cfg(feature = "tag-realms-admin")]
7348    pub async fn realm_localization_get(
7349        &self,
7350        realm: &str,
7351    ) -> Result<TypeVec<String>, KeycloakError> {
7352        let realm = p(realm);
7353        let builder = self
7354            .client
7355            .get(format!("{}/admin/realms/{realm}/localization", self.url))
7356            .bearer_auth(self.token_supplier.get(&self.url).await?);
7357        let response = builder.send().await?;
7358        Ok(error_check(response).await?.json().await?)
7359    }
7360
7361    /// Parameters:
7362    ///
7363    /// - `realm`: realm name (not id!)
7364    /// - `locale`
7365    /// - `use_realm_default_locale_fallback`
7366    ///
7367    /// Resource: `Realms Admin`
7368    ///
7369    /// `GET /admin/realms/{realm}/localization/{locale}`
7370    ///
7371    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmlocalizationlocale>
7372    #[cfg(feature = "tag-realms-admin")]
7373    pub async fn realm_localization_with_locale_get(
7374        &self,
7375        realm: &str,
7376        locale: &str,
7377        use_realm_default_locale_fallback: Option<bool>,
7378    ) -> Result<TypeMap<String, TypeString>, KeycloakError> {
7379        let realm = p(realm);
7380        let locale = p(locale);
7381        let mut builder = self
7382            .client
7383            .get(format!(
7384                "{}/admin/realms/{realm}/localization/{locale}",
7385                self.url
7386            ))
7387            .bearer_auth(self.token_supplier.get(&self.url).await?);
7388        if let Some(v) = use_realm_default_locale_fallback {
7389            builder = builder.query(&[("useRealmDefaultLocaleFallback", v)]);
7390        }
7391        let response = builder.send().await?;
7392        Ok(error_check(response).await?.json().await?)
7393    }
7394
7395    /// Import localization from uploaded JSON file
7396    ///
7397    /// Parameters:
7398    ///
7399    /// - `realm`: realm name (not id!)
7400    /// - `locale`
7401    /// - `body`
7402    ///
7403    /// Returns id of created resource
7404    ///
7405    /// Resource: `Realms Admin`
7406    ///
7407    /// `POST /admin/realms/{realm}/localization/{locale}`
7408    ///
7409    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmlocalizationlocale>
7410    #[cfg(feature = "tag-realms-admin")]
7411    pub async fn realm_localization_with_locale_post(
7412        &self,
7413        realm: &str,
7414        locale: &str,
7415        body: TypeMap<String, String>,
7416    ) -> Result<Option<TypeString>, KeycloakError> {
7417        let realm = p(realm);
7418        let locale = p(locale);
7419        let builder = self
7420            .client
7421            .post(format!(
7422                "{}/admin/realms/{realm}/localization/{locale}",
7423                self.url
7424            ))
7425            .json(&body)
7426            .bearer_auth(self.token_supplier.get(&self.url).await?);
7427        let response = builder.send().await?;
7428        error_check(response).await.map(to_id)
7429    }
7430
7431    /// Parameters:
7432    ///
7433    /// - `realm`: realm name (not id!)
7434    /// - `locale`
7435    ///
7436    /// Resource: `Realms Admin`
7437    ///
7438    /// `DELETE /admin/realms/{realm}/localization/{locale}`
7439    ///
7440    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmlocalizationlocale>
7441    #[cfg(feature = "tag-realms-admin")]
7442    pub async fn realm_localization_with_locale_delete(
7443        &self,
7444        realm: &str,
7445        locale: &str,
7446    ) -> Result<(), KeycloakError> {
7447        let realm = p(realm);
7448        let locale = p(locale);
7449        let builder = self
7450            .client
7451            .delete(format!(
7452                "{}/admin/realms/{realm}/localization/{locale}",
7453                self.url
7454            ))
7455            .bearer_auth(self.token_supplier.get(&self.url).await?);
7456        let response = builder.send().await?;
7457        error_check(response).await?;
7458        Ok(())
7459    }
7460
7461    /// Parameters:
7462    ///
7463    /// - `realm`: realm name (not id!)
7464    /// - `key`
7465    /// - `locale`
7466    ///
7467    /// Resource: `Realms Admin`
7468    ///
7469    /// `GET /admin/realms/{realm}/localization/{locale}/{key}`
7470    ///
7471    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmlocalizationlocalekey>
7472    #[cfg(feature = "tag-realms-admin")]
7473    pub async fn realm_localization_with_locale_with_key_get(
7474        &self,
7475        realm: &str,
7476        key: &str,
7477        locale: &str,
7478    ) -> Result<TypeString, KeycloakError> {
7479        let realm = p(realm);
7480        let key = p(key);
7481        let locale = p(locale);
7482        let builder = self
7483            .client
7484            .get(format!(
7485                "{}/admin/realms/{realm}/localization/{locale}/{key}",
7486                self.url
7487            ))
7488            .bearer_auth(self.token_supplier.get(&self.url).await?);
7489        let response = builder.send().await?;
7490        Ok(error_check(response).await?.text().await.map(From::from)?)
7491    }
7492
7493    /// Parameters:
7494    ///
7495    /// - `realm`: realm name (not id!)
7496    /// - `key`
7497    /// - `locale`
7498    /// - `body`
7499    ///
7500    /// Resource: `Realms Admin`
7501    ///
7502    /// `PUT /admin/realms/{realm}/localization/{locale}/{key}`
7503    ///
7504    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmlocalizationlocalekey>
7505    #[cfg(feature = "tag-realms-admin")]
7506    pub async fn realm_localization_with_locale_with_key_put(
7507        &self,
7508        realm: &str,
7509        key: &str,
7510        locale: &str,
7511        body: String,
7512    ) -> Result<(), KeycloakError> {
7513        let realm = p(realm);
7514        let key = p(key);
7515        let locale = p(locale);
7516        let builder = self
7517            .client
7518            .put(format!(
7519                "{}/admin/realms/{realm}/localization/{locale}/{key}",
7520                self.url
7521            ))
7522            .body(body)
7523            .bearer_auth(self.token_supplier.get(&self.url).await?);
7524        let response = builder.send().await?;
7525        error_check(response).await?;
7526        Ok(())
7527    }
7528
7529    /// Parameters:
7530    ///
7531    /// - `realm`: realm name (not id!)
7532    /// - `key`
7533    /// - `locale`
7534    ///
7535    /// Resource: `Realms Admin`
7536    ///
7537    /// `DELETE /admin/realms/{realm}/localization/{locale}/{key}`
7538    ///
7539    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmlocalizationlocalekey>
7540    #[cfg(feature = "tag-realms-admin")]
7541    pub async fn realm_localization_with_locale_with_key_delete(
7542        &self,
7543        realm: &str,
7544        key: &str,
7545        locale: &str,
7546    ) -> Result<(), KeycloakError> {
7547        let realm = p(realm);
7548        let key = p(key);
7549        let locale = p(locale);
7550        let builder = self
7551            .client
7552            .delete(format!(
7553                "{}/admin/realms/{realm}/localization/{locale}/{key}",
7554                self.url
7555            ))
7556            .bearer_auth(self.token_supplier.get(&self.url).await?);
7557        let response = builder.send().await?;
7558        error_check(response).await?;
7559        Ok(())
7560    }
7561
7562    /// Removes all user sessions.
7563    ///
7564    /// Parameters:
7565    ///
7566    /// - `realm`: realm name (not id!)
7567    ///
7568    /// Resource: `Realms Admin`
7569    ///
7570    /// `POST /admin/realms/{realm}/logout-all`
7571    ///
7572    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmlogout_all>
7573    #[cfg(feature = "tag-realms-admin")]
7574    pub async fn realm_logout_all_post(
7575        &self,
7576        realm: &str,
7577    ) -> Result<GlobalRequestResult, KeycloakError> {
7578        let realm = p(realm);
7579        let builder = self
7580            .client
7581            .post(format!("{}/admin/realms/{realm}/logout-all", self.url))
7582            .bearer_auth(self.token_supplier.get(&self.url).await?);
7583        let response = builder.send().await?;
7584        Ok(error_check(response).await?.json().await?)
7585    }
7586
7587    /// Partial export of existing realm into a JSON file.
7588    ///
7589    /// Parameters:
7590    ///
7591    /// - `realm`: realm name (not id!)
7592    /// - `export_clients`
7593    /// - `export_groups_and_roles`
7594    ///
7595    /// Returns id of created resource
7596    ///
7597    /// Resource: `Realms Admin`
7598    ///
7599    /// `POST /admin/realms/{realm}/partial-export`
7600    ///
7601    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmpartial_export>
7602    #[cfg(feature = "tag-realms-admin")]
7603    pub async fn realm_partial_export_post(
7604        &self,
7605        realm: &str,
7606        export_clients: Option<bool>,
7607        export_groups_and_roles: Option<bool>,
7608    ) -> Result<Option<TypeString>, KeycloakError> {
7609        let realm = p(realm);
7610        let mut builder = self
7611            .client
7612            .post(format!("{}/admin/realms/{realm}/partial-export", self.url))
7613            .bearer_auth(self.token_supplier.get(&self.url).await?);
7614        if let Some(v) = export_clients {
7615            builder = builder.query(&[("exportClients", v)]);
7616        }
7617        if let Some(v) = export_groups_and_roles {
7618            builder = builder.query(&[("exportGroupsAndRoles", v)]);
7619        }
7620        let response = builder.send().await?;
7621        error_check(response).await.map(to_id)
7622    }
7623
7624    /// Partial import from a JSON file to an existing realm.
7625    ///
7626    /// Parameters:
7627    ///
7628    /// - `realm`: realm name (not id!)
7629    /// - `body`
7630    ///
7631    /// Returns id of created resource
7632    ///
7633    /// Resource: `Realms Admin`
7634    ///
7635    /// `POST /admin/realms/{realm}/partialImport`
7636    ///
7637    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmpartialimport>
7638    #[cfg(feature = "tag-realms-admin")]
7639    pub async fn realm_partial_import_post(
7640        &self,
7641        realm: &str,
7642        body: String,
7643    ) -> Result<Option<TypeString>, KeycloakError> {
7644        let realm = p(realm);
7645        let builder = self
7646            .client
7647            .post(format!("{}/admin/realms/{realm}/partialImport", self.url))
7648            .json(&body)
7649            .bearer_auth(self.token_supplier.get(&self.url).await?);
7650        let response = builder.send().await?;
7651        error_check(response).await.map(to_id)
7652    }
7653
7654    /// Push the realm's revocation policy to any client that has an admin url associated with it.
7655    ///
7656    /// Parameters:
7657    ///
7658    /// - `realm`: realm name (not id!)
7659    ///
7660    /// Resource: `Realms Admin`
7661    ///
7662    /// `POST /admin/realms/{realm}/push-revocation`
7663    ///
7664    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmpush_revocation>
7665    #[cfg(feature = "tag-realms-admin")]
7666    pub async fn realm_push_revocation_post(
7667        &self,
7668        realm: &str,
7669    ) -> Result<GlobalRequestResult, KeycloakError> {
7670        let realm = p(realm);
7671        let builder = self
7672            .client
7673            .post(format!("{}/admin/realms/{realm}/push-revocation", self.url))
7674            .bearer_auth(self.token_supplier.get(&self.url).await?);
7675        let response = builder.send().await?;
7676        Ok(error_check(response).await?.json().await?)
7677    }
7678
7679    /// Remove a specific user session.
7680    ///
7681    /// Parameters:
7682    ///
7683    /// - `realm`: realm name (not id!)
7684    /// - `session`
7685    /// - `is_offline`
7686    ///
7687    /// Resource: `Realms Admin`
7688    ///
7689    /// `DELETE /admin/realms/{realm}/sessions/{session}`
7690    ///
7691    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmsessionssession>
7692    #[cfg(feature = "tag-realms-admin")]
7693    pub async fn realm_sessions_with_session_delete(
7694        &self,
7695        realm: &str,
7696        session: &str,
7697        is_offline: Option<bool>,
7698    ) -> Result<(), KeycloakError> {
7699        let realm = p(realm);
7700        let session = p(session);
7701        let mut builder = self
7702            .client
7703            .delete(format!(
7704                "{}/admin/realms/{realm}/sessions/{session}",
7705                self.url
7706            ))
7707            .bearer_auth(self.token_supplier.get(&self.url).await?);
7708        if let Some(v) = is_offline {
7709            builder = builder.query(&[("isOffline", v)]);
7710        }
7711        let response = builder.send().await?;
7712        error_check(response).await?;
7713        Ok(())
7714    }
7715
7716    /// Test SMTP connection with current logged in user
7717    ///
7718    /// Parameters:
7719    ///
7720    /// - `realm`: realm name (not id!)
7721    /// - `body`
7722    ///
7723    /// Returns id of created resource
7724    ///
7725    /// Resource: `Realms Admin`
7726    ///
7727    /// `POST /admin/realms/{realm}/testSMTPConnection`
7728    ///
7729    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmtestsmtpconnection>
7730    #[cfg(feature = "tag-realms-admin")]
7731    #[deprecated]
7732    pub async fn realm_test_smtp_connection_post(
7733        &self,
7734        realm: &str,
7735        body: TypeMap<String, String>,
7736    ) -> Result<Option<TypeString>, KeycloakError> {
7737        let realm = p(realm);
7738        let builder = self
7739            .client
7740            .post(format!(
7741                "{}/admin/realms/{realm}/testSMTPConnection",
7742                self.url
7743            ))
7744            .json(&body)
7745            .bearer_auth(self.token_supplier.get(&self.url).await?);
7746        let response = builder.send().await?;
7747        error_check(response).await.map(to_id)
7748    }
7749
7750    /// Parameters:
7751    ///
7752    /// - `realm`: realm name (not id!)
7753    ///
7754    /// Resource: `Realms Admin`
7755    ///
7756    /// `GET /admin/realms/{realm}/users-management-permissions`
7757    ///
7758    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusers_management_permissions>
7759    #[cfg(feature = "tag-realms-admin")]
7760    pub async fn realm_users_management_permissions_get(
7761        &self,
7762        realm: &str,
7763    ) -> Result<ManagementPermissionReference, KeycloakError> {
7764        let realm = p(realm);
7765        let builder = self
7766            .client
7767            .get(format!(
7768                "{}/admin/realms/{realm}/users-management-permissions",
7769                self.url
7770            ))
7771            .bearer_auth(self.token_supplier.get(&self.url).await?);
7772        let response = builder.send().await?;
7773        Ok(error_check(response).await?.json().await?)
7774    }
7775
7776    /// Parameters:
7777    ///
7778    /// - `realm`: realm name (not id!)
7779    /// - `body`
7780    ///
7781    /// Resource: `Realms Admin`
7782    ///
7783    /// `PUT /admin/realms/{realm}/users-management-permissions`
7784    ///
7785    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusers_management_permissions>
7786    #[cfg(feature = "tag-realms-admin")]
7787    pub async fn realm_users_management_permissions_put(
7788        &self,
7789        realm: &str,
7790        body: ManagementPermissionReference,
7791    ) -> Result<ManagementPermissionReference, KeycloakError> {
7792        let realm = p(realm);
7793        let builder = self
7794            .client
7795            .put(format!(
7796                "{}/admin/realms/{realm}/users-management-permissions",
7797                self.url
7798            ))
7799            .json(&body)
7800            .bearer_auth(self.token_supplier.get(&self.url).await?);
7801        let response = builder.send().await?;
7802        Ok(error_check(response).await?.json().await?)
7803    }
7804
7805    // <h4>Role Mapper</h4>
7806
7807    /// Get role mappings
7808    ///
7809    /// Parameters:
7810    ///
7811    /// - `realm`: realm name (not id!)
7812    /// - `group_id`
7813    ///
7814    /// Resource: `Role Mapper`
7815    ///
7816    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings`
7817    ///
7818    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappings>
7819    ///
7820    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings`
7821    #[cfg(feature = "tag-role-mapper")]
7822    pub async fn realm_groups_with_group_id_role_mappings_get(
7823        &self,
7824        realm: &str,
7825        group_id: &str,
7826    ) -> Result<MappingsRepresentation, KeycloakError> {
7827        let realm = p(realm);
7828        let group_id = p(group_id);
7829        let builder = self
7830            .client
7831            .get(format!(
7832                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings",
7833                self.url
7834            ))
7835            .bearer_auth(self.token_supplier.get(&self.url).await?);
7836        let response = builder.send().await?;
7837        Ok(error_check(response).await?.json().await?)
7838    }
7839
7840    /// Get realm-level role mappings
7841    ///
7842    /// Parameters:
7843    ///
7844    /// - `realm`: realm name (not id!)
7845    /// - `group_id`
7846    ///
7847    /// Resource: `Role Mapper`
7848    ///
7849    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/realm`
7850    ///
7851    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsrealm>
7852    ///
7853    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm`
7854    #[cfg(feature = "tag-role-mapper")]
7855    pub async fn realm_groups_with_group_id_role_mappings_realm_get(
7856        &self,
7857        realm: &str,
7858        group_id: &str,
7859    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
7860        let realm = p(realm);
7861        let group_id = p(group_id);
7862        let builder = self
7863            .client
7864            .get(format!(
7865                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/realm",
7866                self.url
7867            ))
7868            .bearer_auth(self.token_supplier.get(&self.url).await?);
7869        let response = builder.send().await?;
7870        Ok(error_check(response).await?.json().await?)
7871    }
7872
7873    /// Add realm-level role mappings to the user
7874    ///
7875    /// Parameters:
7876    ///
7877    /// - `realm`: realm name (not id!)
7878    /// - `group_id`
7879    /// - `body`
7880    ///
7881    /// Returns id of created resource
7882    ///
7883    /// Resource: `Role Mapper`
7884    ///
7885    /// `POST /admin/realms/{realm}/groups/{group_id}/role-mappings/realm`
7886    ///
7887    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmgroupsgroup_idrole_mappingsrealm>
7888    ///
7889    /// REST method: `POST /admin/realms/{realm}/groups/{group-id}/role-mappings/realm`
7890    #[cfg(feature = "tag-role-mapper")]
7891    pub async fn realm_groups_with_group_id_role_mappings_realm_post(
7892        &self,
7893        realm: &str,
7894        group_id: &str,
7895        body: Vec<RoleRepresentation>,
7896    ) -> Result<Option<TypeString>, KeycloakError> {
7897        let realm = p(realm);
7898        let group_id = p(group_id);
7899        let builder = self
7900            .client
7901            .post(format!(
7902                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/realm",
7903                self.url
7904            ))
7905            .json(&body)
7906            .bearer_auth(self.token_supplier.get(&self.url).await?);
7907        let response = builder.send().await?;
7908        error_check(response).await.map(to_id)
7909    }
7910
7911    /// Delete realm-level role mappings
7912    ///
7913    /// Parameters:
7914    ///
7915    /// - `realm`: realm name (not id!)
7916    /// - `group_id`
7917    /// - `body`
7918    ///
7919    /// Resource: `Role Mapper`
7920    ///
7921    /// `DELETE /admin/realms/{realm}/groups/{group_id}/role-mappings/realm`
7922    ///
7923    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmgroupsgroup_idrole_mappingsrealm>
7924    ///
7925    /// REST method: `DELETE /admin/realms/{realm}/groups/{group-id}/role-mappings/realm`
7926    #[cfg(feature = "tag-role-mapper")]
7927    pub async fn realm_groups_with_group_id_role_mappings_realm_delete(
7928        &self,
7929        realm: &str,
7930        group_id: &str,
7931        body: Vec<RoleRepresentation>,
7932    ) -> Result<(), KeycloakError> {
7933        let realm = p(realm);
7934        let group_id = p(group_id);
7935        let builder = self
7936            .client
7937            .delete(format!(
7938                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/realm",
7939                self.url
7940            ))
7941            .json(&body)
7942            .bearer_auth(self.token_supplier.get(&self.url).await?);
7943        let response = builder.send().await?;
7944        error_check(response).await?;
7945        Ok(())
7946    }
7947
7948    /// Get realm-level roles that can be mapped
7949    ///
7950    /// Parameters:
7951    ///
7952    /// - `realm`: realm name (not id!)
7953    /// - `group_id`
7954    ///
7955    /// Resource: `Role Mapper`
7956    ///
7957    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/realm/available`
7958    ///
7959    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsrealmavailable>
7960    ///
7961    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/available`
7962    #[cfg(feature = "tag-role-mapper")]
7963    pub async fn realm_groups_with_group_id_role_mappings_realm_available_get(
7964        &self,
7965        realm: &str,
7966        group_id: &str,
7967    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
7968        let realm = p(realm);
7969        let group_id = p(group_id);
7970        let builder = self
7971            .client
7972            .get(format!(
7973                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/realm/available",
7974                self.url
7975            ))
7976            .bearer_auth(self.token_supplier.get(&self.url).await?);
7977        let response = builder.send().await?;
7978        Ok(error_check(response).await?.json().await?)
7979    }
7980
7981    /// Get effective realm-level role mappings This will recurse all composite roles to get the result.
7982    ///
7983    /// Parameters:
7984    ///
7985    /// - `realm`: realm name (not id!)
7986    /// - `group_id`
7987    /// - `brief_representation`: if false, return roles with their attributes
7988    ///
7989    /// Resource: `Role Mapper`
7990    ///
7991    /// `GET /admin/realms/{realm}/groups/{group_id}/role-mappings/realm/composite`
7992    ///
7993    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmgroupsgroup_idrole_mappingsrealmcomposite>
7994    ///
7995    /// REST method: `GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/composite`
7996    #[cfg(feature = "tag-role-mapper")]
7997    pub async fn realm_groups_with_group_id_role_mappings_realm_composite_get(
7998        &self,
7999        realm: &str,
8000        group_id: &str,
8001        brief_representation: Option<bool>,
8002    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8003        let realm = p(realm);
8004        let group_id = p(group_id);
8005        let mut builder = self
8006            .client
8007            .get(format!(
8008                "{}/admin/realms/{realm}/groups/{group_id}/role-mappings/realm/composite",
8009                self.url
8010            ))
8011            .bearer_auth(self.token_supplier.get(&self.url).await?);
8012        if let Some(v) = brief_representation {
8013            builder = builder.query(&[("briefRepresentation", v)]);
8014        }
8015        let response = builder.send().await?;
8016        Ok(error_check(response).await?.json().await?)
8017    }
8018
8019    /// Get role mappings
8020    ///
8021    /// Parameters:
8022    ///
8023    /// - `realm`: realm name (not id!)
8024    /// - `user_id`
8025    ///
8026    /// Resource: `Role Mapper`
8027    ///
8028    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings`
8029    ///
8030    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappings>
8031    ///
8032    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings`
8033    #[cfg(feature = "tag-role-mapper")]
8034    pub async fn realm_users_with_user_id_role_mappings_get(
8035        &self,
8036        realm: &str,
8037        user_id: &str,
8038    ) -> Result<MappingsRepresentation, KeycloakError> {
8039        let realm = p(realm);
8040        let user_id = p(user_id);
8041        let builder = self
8042            .client
8043            .get(format!(
8044                "{}/admin/realms/{realm}/users/{user_id}/role-mappings",
8045                self.url
8046            ))
8047            .bearer_auth(self.token_supplier.get(&self.url).await?);
8048        let response = builder.send().await?;
8049        Ok(error_check(response).await?.json().await?)
8050    }
8051
8052    /// Get realm-level role mappings
8053    ///
8054    /// Parameters:
8055    ///
8056    /// - `realm`: realm name (not id!)
8057    /// - `user_id`
8058    ///
8059    /// Resource: `Role Mapper`
8060    ///
8061    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/realm`
8062    ///
8063    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsrealm>
8064    ///
8065    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm`
8066    #[cfg(feature = "tag-role-mapper")]
8067    pub async fn realm_users_with_user_id_role_mappings_realm_get(
8068        &self,
8069        realm: &str,
8070        user_id: &str,
8071    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8072        let realm = p(realm);
8073        let user_id = p(user_id);
8074        let builder = self
8075            .client
8076            .get(format!(
8077                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/realm",
8078                self.url
8079            ))
8080            .bearer_auth(self.token_supplier.get(&self.url).await?);
8081        let response = builder.send().await?;
8082        Ok(error_check(response).await?.json().await?)
8083    }
8084
8085    /// Add realm-level role mappings to the user
8086    ///
8087    /// Parameters:
8088    ///
8089    /// - `realm`: realm name (not id!)
8090    /// - `user_id`
8091    /// - `body`
8092    ///
8093    /// Returns id of created resource
8094    ///
8095    /// Resource: `Role Mapper`
8096    ///
8097    /// `POST /admin/realms/{realm}/users/{user_id}/role-mappings/realm`
8098    ///
8099    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idrole_mappingsrealm>
8100    ///
8101    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/role-mappings/realm`
8102    #[cfg(feature = "tag-role-mapper")]
8103    pub async fn realm_users_with_user_id_role_mappings_realm_post(
8104        &self,
8105        realm: &str,
8106        user_id: &str,
8107        body: Vec<RoleRepresentation>,
8108    ) -> Result<Option<TypeString>, KeycloakError> {
8109        let realm = p(realm);
8110        let user_id = p(user_id);
8111        let builder = self
8112            .client
8113            .post(format!(
8114                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/realm",
8115                self.url
8116            ))
8117            .json(&body)
8118            .bearer_auth(self.token_supplier.get(&self.url).await?);
8119        let response = builder.send().await?;
8120        error_check(response).await.map(to_id)
8121    }
8122
8123    /// Delete realm-level role mappings
8124    ///
8125    /// Parameters:
8126    ///
8127    /// - `realm`: realm name (not id!)
8128    /// - `user_id`
8129    /// - `body`
8130    ///
8131    /// Resource: `Role Mapper`
8132    ///
8133    /// `DELETE /admin/realms/{realm}/users/{user_id}/role-mappings/realm`
8134    ///
8135    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idrole_mappingsrealm>
8136    ///
8137    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/role-mappings/realm`
8138    #[cfg(feature = "tag-role-mapper")]
8139    pub async fn realm_users_with_user_id_role_mappings_realm_delete(
8140        &self,
8141        realm: &str,
8142        user_id: &str,
8143        body: Vec<RoleRepresentation>,
8144    ) -> Result<(), KeycloakError> {
8145        let realm = p(realm);
8146        let user_id = p(user_id);
8147        let builder = self
8148            .client
8149            .delete(format!(
8150                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/realm",
8151                self.url
8152            ))
8153            .json(&body)
8154            .bearer_auth(self.token_supplier.get(&self.url).await?);
8155        let response = builder.send().await?;
8156        error_check(response).await?;
8157        Ok(())
8158    }
8159
8160    /// Get realm-level roles that can be mapped
8161    ///
8162    /// Parameters:
8163    ///
8164    /// - `realm`: realm name (not id!)
8165    /// - `user_id`
8166    ///
8167    /// Resource: `Role Mapper`
8168    ///
8169    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/realm/available`
8170    ///
8171    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsrealmavailable>
8172    ///
8173    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm/available`
8174    #[cfg(feature = "tag-role-mapper")]
8175    pub async fn realm_users_with_user_id_role_mappings_realm_available_get(
8176        &self,
8177        realm: &str,
8178        user_id: &str,
8179    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8180        let realm = p(realm);
8181        let user_id = p(user_id);
8182        let builder = self
8183            .client
8184            .get(format!(
8185                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/realm/available",
8186                self.url
8187            ))
8188            .bearer_auth(self.token_supplier.get(&self.url).await?);
8189        let response = builder.send().await?;
8190        Ok(error_check(response).await?.json().await?)
8191    }
8192
8193    /// Get effective realm-level role mappings This will recurse all composite roles to get the result.
8194    ///
8195    /// Parameters:
8196    ///
8197    /// - `realm`: realm name (not id!)
8198    /// - `user_id`
8199    /// - `brief_representation`: if false, return roles with their attributes
8200    ///
8201    /// Resource: `Role Mapper`
8202    ///
8203    /// `GET /admin/realms/{realm}/users/{user_id}/role-mappings/realm/composite`
8204    ///
8205    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idrole_mappingsrealmcomposite>
8206    ///
8207    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm/composite`
8208    #[cfg(feature = "tag-role-mapper")]
8209    pub async fn realm_users_with_user_id_role_mappings_realm_composite_get(
8210        &self,
8211        realm: &str,
8212        user_id: &str,
8213        brief_representation: Option<bool>,
8214    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8215        let realm = p(realm);
8216        let user_id = p(user_id);
8217        let mut builder = self
8218            .client
8219            .get(format!(
8220                "{}/admin/realms/{realm}/users/{user_id}/role-mappings/realm/composite",
8221                self.url
8222            ))
8223            .bearer_auth(self.token_supplier.get(&self.url).await?);
8224        if let Some(v) = brief_representation {
8225            builder = builder.query(&[("briefRepresentation", v)]);
8226        }
8227        let response = builder.send().await?;
8228        Ok(error_check(response).await?.json().await?)
8229    }
8230
8231    // <h4>Roles</h4>
8232
8233    /// Get all roles for the realm or client
8234    ///
8235    /// Parameters:
8236    ///
8237    /// - `realm`: realm name (not id!)
8238    /// - `client_uuid`: id of client (not client-id!)
8239    /// - `brief_representation`
8240    /// - `first`
8241    /// - `max`
8242    /// - `search`
8243    ///
8244    /// Resource: `Roles`
8245    ///
8246    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles`
8247    ///
8248    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidroles>
8249    ///
8250    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles`
8251    #[cfg(feature = "tag-roles")]
8252    pub async fn realm_clients_with_client_uuid_roles_get(
8253        &self,
8254        realm: &str,
8255        client_uuid: &str,
8256        brief_representation: Option<bool>,
8257        first: Option<i32>,
8258        max: Option<i32>,
8259        search: Option<String>,
8260    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8261        let realm = p(realm);
8262        let client_uuid = p(client_uuid);
8263        let mut builder = self
8264            .client
8265            .get(format!(
8266                "{}/admin/realms/{realm}/clients/{client_uuid}/roles",
8267                self.url
8268            ))
8269            .bearer_auth(self.token_supplier.get(&self.url).await?);
8270        if let Some(v) = brief_representation {
8271            builder = builder.query(&[("briefRepresentation", v)]);
8272        }
8273        if let Some(v) = first {
8274            builder = builder.query(&[("first", v)]);
8275        }
8276        if let Some(v) = max {
8277            builder = builder.query(&[("max", v)]);
8278        }
8279        if let Some(v) = search {
8280            builder = builder.query(&[("search", v)]);
8281        }
8282        let response = builder.send().await?;
8283        Ok(error_check(response).await?.json().await?)
8284    }
8285
8286    /// Create a new role for the realm or client
8287    ///
8288    /// Parameters:
8289    ///
8290    /// - `realm`: realm name (not id!)
8291    /// - `client_uuid`: id of client (not client-id!)
8292    /// - `body`
8293    ///
8294    /// Returns id of created resource
8295    ///
8296    /// Resource: `Roles`
8297    ///
8298    /// `POST /admin/realms/{realm}/clients/{client_uuid}/roles`
8299    ///
8300    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidroles>
8301    ///
8302    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/roles`
8303    #[cfg(feature = "tag-roles")]
8304    pub async fn realm_clients_with_client_uuid_roles_post(
8305        &self,
8306        realm: &str,
8307        client_uuid: &str,
8308        body: RoleRepresentation,
8309    ) -> Result<Option<TypeString>, KeycloakError> {
8310        let realm = p(realm);
8311        let client_uuid = p(client_uuid);
8312        let builder = self
8313            .client
8314            .post(format!(
8315                "{}/admin/realms/{realm}/clients/{client_uuid}/roles",
8316                self.url
8317            ))
8318            .json(&body)
8319            .bearer_auth(self.token_supplier.get(&self.url).await?);
8320        let response = builder.send().await?;
8321        error_check(response).await.map(to_id)
8322    }
8323
8324    /// Get a role by name
8325    ///
8326    /// Parameters:
8327    ///
8328    /// - `realm`: realm name (not id!)
8329    /// - `client_uuid`: id of client (not client-id!)
8330    /// - `role_name`: role's name (not id!)
8331    ///
8332    /// Resource: `Roles`
8333    ///
8334    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}`
8335    ///
8336    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_name>
8337    ///
8338    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}`
8339    #[cfg(feature = "tag-roles")]
8340    pub async fn realm_clients_with_client_uuid_roles_with_role_name_get(
8341        &self,
8342        realm: &str,
8343        client_uuid: &str,
8344        role_name: &str,
8345    ) -> Result<RoleRepresentation, KeycloakError> {
8346        let realm = p(realm);
8347        let client_uuid = p(client_uuid);
8348        let role_name = p(role_name);
8349        let builder = self
8350            .client
8351            .get(format!(
8352                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}",
8353                self.url
8354            ))
8355            .bearer_auth(self.token_supplier.get(&self.url).await?);
8356        let response = builder.send().await?;
8357        Ok(error_check(response).await?.json().await?)
8358    }
8359
8360    /// Update a role by name
8361    ///
8362    /// Parameters:
8363    ///
8364    /// - `realm`: realm name (not id!)
8365    /// - `client_uuid`: id of client (not client-id!)
8366    /// - `role_name`: role's name (not id!)
8367    /// - `body`
8368    ///
8369    /// Resource: `Roles`
8370    ///
8371    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}`
8372    ///
8373    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidrolesrole_name>
8374    ///
8375    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}`
8376    #[cfg(feature = "tag-roles")]
8377    pub async fn realm_clients_with_client_uuid_roles_with_role_name_put(
8378        &self,
8379        realm: &str,
8380        client_uuid: &str,
8381        role_name: &str,
8382        body: RoleRepresentation,
8383    ) -> Result<(), KeycloakError> {
8384        let realm = p(realm);
8385        let client_uuid = p(client_uuid);
8386        let role_name = p(role_name);
8387        let builder = self
8388            .client
8389            .put(format!(
8390                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}",
8391                self.url
8392            ))
8393            .json(&body)
8394            .bearer_auth(self.token_supplier.get(&self.url).await?);
8395        let response = builder.send().await?;
8396        error_check(response).await?;
8397        Ok(())
8398    }
8399
8400    /// Delete a role by name
8401    ///
8402    /// Parameters:
8403    ///
8404    /// - `realm`: realm name (not id!)
8405    /// - `client_uuid`: id of client (not client-id!)
8406    /// - `role_name`: role's name (not id!)
8407    ///
8408    /// Resource: `Roles`
8409    ///
8410    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}`
8411    ///
8412    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidrolesrole_name>
8413    ///
8414    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}`
8415    #[cfg(feature = "tag-roles")]
8416    pub async fn realm_clients_with_client_uuid_roles_with_role_name_delete(
8417        &self,
8418        realm: &str,
8419        client_uuid: &str,
8420        role_name: &str,
8421    ) -> Result<(), KeycloakError> {
8422        let realm = p(realm);
8423        let client_uuid = p(client_uuid);
8424        let role_name = p(role_name);
8425        let builder = self
8426            .client
8427            .delete(format!(
8428                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}",
8429                self.url
8430            ))
8431            .bearer_auth(self.token_supplier.get(&self.url).await?);
8432        let response = builder.send().await?;
8433        error_check(response).await?;
8434        Ok(())
8435    }
8436
8437    /// Get composites of the role
8438    ///
8439    /// Parameters:
8440    ///
8441    /// - `realm`: realm name (not id!)
8442    /// - `client_uuid`: id of client (not client-id!)
8443    /// - `role_name`: role's name (not id!)
8444    ///
8445    /// Resource: `Roles`
8446    ///
8447    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites`
8448    ///
8449    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_namecomposites>
8450    ///
8451    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites`
8452    #[cfg(feature = "tag-roles")]
8453    pub async fn realm_clients_with_client_uuid_roles_with_role_name_composites_get(
8454        &self,
8455        realm: &str,
8456        client_uuid: &str,
8457        role_name: &str,
8458    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8459        let realm = p(realm);
8460        let client_uuid = p(client_uuid);
8461        let role_name = p(role_name);
8462        let builder = self
8463            .client
8464            .get(format!(
8465                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites",
8466                self.url
8467            ))
8468            .bearer_auth(self.token_supplier.get(&self.url).await?);
8469        let response = builder.send().await?;
8470        Ok(error_check(response).await?.json().await?)
8471    }
8472
8473    /// Add a composite to the role
8474    ///
8475    /// Parameters:
8476    ///
8477    /// - `realm`: realm name (not id!)
8478    /// - `client_uuid`: id of client (not client-id!)
8479    /// - `role_name`: role's name (not id!)
8480    /// - `body`
8481    ///
8482    /// Returns id of created resource
8483    ///
8484    /// Resource: `Roles`
8485    ///
8486    /// `POST /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites`
8487    ///
8488    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidrolesrole_namecomposites>
8489    ///
8490    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites`
8491    #[cfg(feature = "tag-roles")]
8492    pub async fn realm_clients_with_client_uuid_roles_with_role_name_composites_post(
8493        &self,
8494        realm: &str,
8495        client_uuid: &str,
8496        role_name: &str,
8497        body: Vec<RoleRepresentation>,
8498    ) -> Result<Option<TypeString>, KeycloakError> {
8499        let realm = p(realm);
8500        let client_uuid = p(client_uuid);
8501        let role_name = p(role_name);
8502        let builder = self
8503            .client
8504            .post(format!(
8505                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites",
8506                self.url
8507            ))
8508            .json(&body)
8509            .bearer_auth(self.token_supplier.get(&self.url).await?);
8510        let response = builder.send().await?;
8511        error_check(response).await.map(to_id)
8512    }
8513
8514    /// Remove roles from the role's composite
8515    ///
8516    /// Parameters:
8517    ///
8518    /// - `realm`: realm name (not id!)
8519    /// - `client_uuid`: id of client (not client-id!)
8520    /// - `role_name`: role's name (not id!)
8521    /// - `body`
8522    ///
8523    /// Resource: `Roles`
8524    ///
8525    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites`
8526    ///
8527    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidrolesrole_namecomposites>
8528    ///
8529    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites`
8530    #[cfg(feature = "tag-roles")]
8531    pub async fn realm_clients_with_client_uuid_roles_with_role_name_composites_delete(
8532        &self,
8533        realm: &str,
8534        client_uuid: &str,
8535        role_name: &str,
8536        body: Vec<RoleRepresentation>,
8537    ) -> Result<(), KeycloakError> {
8538        let realm = p(realm);
8539        let client_uuid = p(client_uuid);
8540        let role_name = p(role_name);
8541        let builder = self
8542            .client
8543            .delete(format!(
8544                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites",
8545                self.url
8546            ))
8547            .json(&body)
8548            .bearer_auth(self.token_supplier.get(&self.url).await?);
8549        let response = builder.send().await?;
8550        error_check(response).await?;
8551        Ok(())
8552    }
8553
8554    /// Get client-level roles for the client that are in the role's composite
8555    ///
8556    /// Parameters:
8557    ///
8558    /// - `realm`: realm name (not id!)
8559    /// - `client_uuid`
8560    /// - `role_name`: role's name (not id!)
8561    ///
8562    /// Resource: `Roles`
8563    ///
8564    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites/clients/{client_uuid}`
8565    ///
8566    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_namecompositesclientsclient_uuid>
8567    ///
8568    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/clients/{client-uuid}`
8569    #[cfg(feature = "tag-roles")]
8570    pub async fn realm_clients_with_client_uuid_roles_with_role_name_composites_clients_with_client_uuid_get(
8571        &self,
8572        realm: &str,
8573        client_uuid: &str,
8574        role_name: &str,
8575    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8576        let realm = p(realm);
8577        let client_uuid = p(client_uuid);
8578        let role_name = p(role_name);
8579        let builder = self
8580            .client
8581            .get(format!(
8582                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites/clients/{client_uuid}",
8583                self.url
8584            ))
8585            .bearer_auth(self.token_supplier.get(&self.url).await?);
8586        let response = builder.send().await?;
8587        Ok(error_check(response).await?.json().await?)
8588    }
8589
8590    /// Get realm-level roles of the role's composite
8591    ///
8592    /// Parameters:
8593    ///
8594    /// - `realm`: realm name (not id!)
8595    /// - `client_uuid`: id of client (not client-id!)
8596    /// - `role_name`: role's name (not id!)
8597    ///
8598    /// Resource: `Roles`
8599    ///
8600    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites/realm`
8601    ///
8602    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_namecompositesrealm>
8603    ///
8604    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/realm`
8605    #[cfg(feature = "tag-roles")]
8606    pub async fn realm_clients_with_client_uuid_roles_with_role_name_composites_realm_get(
8607        &self,
8608        realm: &str,
8609        client_uuid: &str,
8610        role_name: &str,
8611    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8612        let realm = p(realm);
8613        let client_uuid = p(client_uuid);
8614        let role_name = p(role_name);
8615        let builder = self
8616            .client
8617            .get(format!(
8618                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/composites/realm",
8619                self.url
8620            ))
8621            .bearer_auth(self.token_supplier.get(&self.url).await?);
8622        let response = builder.send().await?;
8623        Ok(error_check(response).await?.json().await?)
8624    }
8625
8626    /// Returns a stream of groups that have the specified role name
8627    ///
8628    /// Parameters:
8629    ///
8630    /// - `realm`: realm name (not id!)
8631    /// - `client_uuid`: id of client (not client-id!)
8632    /// - `role_name`: the role name.
8633    /// - `brief_representation`: if false, return a full representation of the {@code GroupRepresentation} objects.
8634    /// - `first`: first result to return. Ignored if negative or {@code null}.
8635    /// - `max`: maximum number of results to return. Ignored if negative or {@code null}.
8636    ///
8637    /// Resource: `Roles`
8638    ///
8639    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/groups`
8640    ///
8641    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_namegroups>
8642    ///
8643    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/groups`
8644    #[cfg(feature = "tag-roles")]
8645    pub async fn realm_clients_with_client_uuid_roles_with_role_name_groups_get(
8646        &self,
8647        realm: &str,
8648        client_uuid: &str,
8649        role_name: &str,
8650        brief_representation: Option<bool>,
8651        first: Option<i32>,
8652        max: Option<i32>,
8653    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
8654        let realm = p(realm);
8655        let client_uuid = p(client_uuid);
8656        let role_name = p(role_name);
8657        let mut builder = self
8658            .client
8659            .get(format!(
8660                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/groups",
8661                self.url
8662            ))
8663            .bearer_auth(self.token_supplier.get(&self.url).await?);
8664        if let Some(v) = brief_representation {
8665            builder = builder.query(&[("briefRepresentation", v)]);
8666        }
8667        if let Some(v) = first {
8668            builder = builder.query(&[("first", v)]);
8669        }
8670        if let Some(v) = max {
8671            builder = builder.query(&[("max", v)]);
8672        }
8673        let response = builder.send().await?;
8674        Ok(error_check(response).await?.json().await?)
8675    }
8676
8677    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
8678    ///
8679    /// Parameters:
8680    ///
8681    /// - `realm`: realm name (not id!)
8682    /// - `client_uuid`: id of client (not client-id!)
8683    /// - `role_name`
8684    ///
8685    /// Resource: `Roles`
8686    ///
8687    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/management/permissions`
8688    ///
8689    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_namemanagementpermissions>
8690    ///
8691    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/management/permissions`
8692    #[cfg(feature = "tag-roles")]
8693    pub async fn realm_clients_with_client_uuid_roles_with_role_name_management_permissions_get(
8694        &self,
8695        realm: &str,
8696        client_uuid: &str,
8697        role_name: &str,
8698    ) -> Result<ManagementPermissionReference, KeycloakError> {
8699        let realm = p(realm);
8700        let client_uuid = p(client_uuid);
8701        let role_name = p(role_name);
8702        let builder = self
8703            .client
8704            .get(format!(
8705                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/management/permissions",
8706                self.url
8707            ))
8708            .bearer_auth(self.token_supplier.get(&self.url).await?);
8709        let response = builder.send().await?;
8710        Ok(error_check(response).await?.json().await?)
8711    }
8712
8713    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
8714    ///
8715    /// Parameters:
8716    ///
8717    /// - `realm`: realm name (not id!)
8718    /// - `client_uuid`: id of client (not client-id!)
8719    /// - `role_name`
8720    /// - `body`
8721    ///
8722    /// Resource: `Roles`
8723    ///
8724    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/management/permissions`
8725    ///
8726    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidrolesrole_namemanagementpermissions>
8727    ///
8728    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/management/permissions`
8729    #[cfg(feature = "tag-roles")]
8730    pub async fn realm_clients_with_client_uuid_roles_with_role_name_management_permissions_put(
8731        &self,
8732        realm: &str,
8733        client_uuid: &str,
8734        role_name: &str,
8735        body: ManagementPermissionReference,
8736    ) -> Result<ManagementPermissionReference, KeycloakError> {
8737        let realm = p(realm);
8738        let client_uuid = p(client_uuid);
8739        let role_name = p(role_name);
8740        let builder = self
8741            .client
8742            .put(format!(
8743                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/management/permissions",
8744                self.url
8745            ))
8746            .json(&body)
8747            .bearer_auth(self.token_supplier.get(&self.url).await?);
8748        let response = builder.send().await?;
8749        Ok(error_check(response).await?.json().await?)
8750    }
8751
8752    /// Returns a stream of users that have the specified role name.
8753    ///
8754    /// Parameters:
8755    ///
8756    /// - `realm`: realm name (not id!)
8757    /// - `client_uuid`: id of client (not client-id!)
8758    /// - `role_name`: the role name.
8759    /// - `brief_representation`: Boolean which defines whether brief representations are returned (default: false)
8760    /// - `first`: first result to return. Ignored if negative or {@code null}.
8761    /// - `max`: maximum number of results to return. Ignored if negative or {@code null}.
8762    ///
8763    /// Resource: `Roles`
8764    ///
8765    /// `GET /admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/users`
8766    ///
8767    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidrolesrole_nameusers>
8768    ///
8769    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/users`
8770    #[cfg(feature = "tag-roles")]
8771    pub async fn realm_clients_with_client_uuid_roles_with_role_name_users_get(
8772        &self,
8773        realm: &str,
8774        client_uuid: &str,
8775        role_name: &str,
8776        brief_representation: Option<bool>,
8777        first: Option<i32>,
8778        max: Option<i32>,
8779    ) -> Result<TypeVec<UserRepresentation>, KeycloakError> {
8780        let realm = p(realm);
8781        let client_uuid = p(client_uuid);
8782        let role_name = p(role_name);
8783        let mut builder = self
8784            .client
8785            .get(format!(
8786                "{}/admin/realms/{realm}/clients/{client_uuid}/roles/{role_name}/users",
8787                self.url
8788            ))
8789            .bearer_auth(self.token_supplier.get(&self.url).await?);
8790        if let Some(v) = brief_representation {
8791            builder = builder.query(&[("briefRepresentation", v)]);
8792        }
8793        if let Some(v) = first {
8794            builder = builder.query(&[("first", v)]);
8795        }
8796        if let Some(v) = max {
8797            builder = builder.query(&[("max", v)]);
8798        }
8799        let response = builder.send().await?;
8800        Ok(error_check(response).await?.json().await?)
8801    }
8802
8803    /// Get all roles for the realm or client
8804    ///
8805    /// Parameters:
8806    ///
8807    /// - `realm`: realm name (not id!)
8808    /// - `brief_representation`
8809    /// - `first`
8810    /// - `max`
8811    /// - `search`
8812    ///
8813    /// Resource: `Roles`
8814    ///
8815    /// `GET /admin/realms/{realm}/roles`
8816    ///
8817    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles>
8818    #[cfg(feature = "tag-roles")]
8819    pub async fn realm_roles_get(
8820        &self,
8821        realm: &str,
8822        brief_representation: Option<bool>,
8823        first: Option<i32>,
8824        max: Option<i32>,
8825        search: Option<String>,
8826    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
8827        let realm = p(realm);
8828        let mut builder = self
8829            .client
8830            .get(format!("{}/admin/realms/{realm}/roles", self.url))
8831            .bearer_auth(self.token_supplier.get(&self.url).await?);
8832        if let Some(v) = brief_representation {
8833            builder = builder.query(&[("briefRepresentation", v)]);
8834        }
8835        if let Some(v) = first {
8836            builder = builder.query(&[("first", v)]);
8837        }
8838        if let Some(v) = max {
8839            builder = builder.query(&[("max", v)]);
8840        }
8841        if let Some(v) = search {
8842            builder = builder.query(&[("search", v)]);
8843        }
8844        let response = builder.send().await?;
8845        Ok(error_check(response).await?.json().await?)
8846    }
8847
8848    /// Create a new role for the realm or client
8849    ///
8850    /// Parameters:
8851    ///
8852    /// - `realm`: realm name (not id!)
8853    /// - `body`
8854    ///
8855    /// Returns id of created resource
8856    ///
8857    /// Resource: `Roles`
8858    ///
8859    /// `POST /admin/realms/{realm}/roles`
8860    ///
8861    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmroles>
8862    #[cfg(feature = "tag-roles")]
8863    pub async fn realm_roles_post(
8864        &self,
8865        realm: &str,
8866        body: RoleRepresentation,
8867    ) -> Result<Option<TypeString>, KeycloakError> {
8868        let realm = p(realm);
8869        let builder = self
8870            .client
8871            .post(format!("{}/admin/realms/{realm}/roles", self.url))
8872            .json(&body)
8873            .bearer_auth(self.token_supplier.get(&self.url).await?);
8874        let response = builder.send().await?;
8875        error_check(response).await.map(to_id)
8876    }
8877
8878    /// Get a role by name
8879    ///
8880    /// Parameters:
8881    ///
8882    /// - `realm`: realm name (not id!)
8883    /// - `role_name`: role's name (not id!)
8884    ///
8885    /// Resource: `Roles`
8886    ///
8887    /// `GET /admin/realms/{realm}/roles/{role_name}`
8888    ///
8889    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_name>
8890    ///
8891    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}`
8892    #[cfg(feature = "tag-roles")]
8893    pub async fn realm_roles_with_role_name_get(
8894        &self,
8895        realm: &str,
8896        role_name: &str,
8897    ) -> Result<RoleRepresentation, KeycloakError> {
8898        let realm = p(realm);
8899        let role_name = p(role_name);
8900        let builder = self
8901            .client
8902            .get(format!(
8903                "{}/admin/realms/{realm}/roles/{role_name}",
8904                self.url
8905            ))
8906            .bearer_auth(self.token_supplier.get(&self.url).await?);
8907        let response = builder.send().await?;
8908        Ok(error_check(response).await?.json().await?)
8909    }
8910
8911    /// Update a role by name
8912    ///
8913    /// Parameters:
8914    ///
8915    /// - `realm`: realm name (not id!)
8916    /// - `role_name`: role's name (not id!)
8917    /// - `body`
8918    ///
8919    /// Resource: `Roles`
8920    ///
8921    /// `PUT /admin/realms/{realm}/roles/{role_name}`
8922    ///
8923    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmrolesrole_name>
8924    ///
8925    /// REST method: `PUT /admin/realms/{realm}/roles/{role-name}`
8926    #[cfg(feature = "tag-roles")]
8927    pub async fn realm_roles_with_role_name_put(
8928        &self,
8929        realm: &str,
8930        role_name: &str,
8931        body: RoleRepresentation,
8932    ) -> Result<(), KeycloakError> {
8933        let realm = p(realm);
8934        let role_name = p(role_name);
8935        let builder = self
8936            .client
8937            .put(format!(
8938                "{}/admin/realms/{realm}/roles/{role_name}",
8939                self.url
8940            ))
8941            .json(&body)
8942            .bearer_auth(self.token_supplier.get(&self.url).await?);
8943        let response = builder.send().await?;
8944        error_check(response).await?;
8945        Ok(())
8946    }
8947
8948    /// Delete a role by name
8949    ///
8950    /// Parameters:
8951    ///
8952    /// - `realm`: realm name (not id!)
8953    /// - `role_name`: role's name (not id!)
8954    ///
8955    /// Resource: `Roles`
8956    ///
8957    /// `DELETE /admin/realms/{realm}/roles/{role_name}`
8958    ///
8959    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmrolesrole_name>
8960    ///
8961    /// REST method: `DELETE /admin/realms/{realm}/roles/{role-name}`
8962    #[cfg(feature = "tag-roles")]
8963    pub async fn realm_roles_with_role_name_delete(
8964        &self,
8965        realm: &str,
8966        role_name: &str,
8967    ) -> Result<(), KeycloakError> {
8968        let realm = p(realm);
8969        let role_name = p(role_name);
8970        let builder = self
8971            .client
8972            .delete(format!(
8973                "{}/admin/realms/{realm}/roles/{role_name}",
8974                self.url
8975            ))
8976            .bearer_auth(self.token_supplier.get(&self.url).await?);
8977        let response = builder.send().await?;
8978        error_check(response).await?;
8979        Ok(())
8980    }
8981
8982    /// Get composites of the role
8983    ///
8984    /// Parameters:
8985    ///
8986    /// - `realm`: realm name (not id!)
8987    /// - `role_name`: role's name (not id!)
8988    ///
8989    /// Resource: `Roles`
8990    ///
8991    /// `GET /admin/realms/{realm}/roles/{role_name}/composites`
8992    ///
8993    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_namecomposites>
8994    ///
8995    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/composites`
8996    #[cfg(feature = "tag-roles")]
8997    pub async fn realm_roles_with_role_name_composites_get(
8998        &self,
8999        realm: &str,
9000        role_name: &str,
9001    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9002        let realm = p(realm);
9003        let role_name = p(role_name);
9004        let builder = self
9005            .client
9006            .get(format!(
9007                "{}/admin/realms/{realm}/roles/{role_name}/composites",
9008                self.url
9009            ))
9010            .bearer_auth(self.token_supplier.get(&self.url).await?);
9011        let response = builder.send().await?;
9012        Ok(error_check(response).await?.json().await?)
9013    }
9014
9015    /// Add a composite to the role
9016    ///
9017    /// Parameters:
9018    ///
9019    /// - `realm`: realm name (not id!)
9020    /// - `role_name`: role's name (not id!)
9021    /// - `body`
9022    ///
9023    /// Returns id of created resource
9024    ///
9025    /// Resource: `Roles`
9026    ///
9027    /// `POST /admin/realms/{realm}/roles/{role_name}/composites`
9028    ///
9029    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmrolesrole_namecomposites>
9030    ///
9031    /// REST method: `POST /admin/realms/{realm}/roles/{role-name}/composites`
9032    #[cfg(feature = "tag-roles")]
9033    pub async fn realm_roles_with_role_name_composites_post(
9034        &self,
9035        realm: &str,
9036        role_name: &str,
9037        body: Vec<RoleRepresentation>,
9038    ) -> Result<Option<TypeString>, KeycloakError> {
9039        let realm = p(realm);
9040        let role_name = p(role_name);
9041        let builder = self
9042            .client
9043            .post(format!(
9044                "{}/admin/realms/{realm}/roles/{role_name}/composites",
9045                self.url
9046            ))
9047            .json(&body)
9048            .bearer_auth(self.token_supplier.get(&self.url).await?);
9049        let response = builder.send().await?;
9050        error_check(response).await.map(to_id)
9051    }
9052
9053    /// Remove roles from the role's composite
9054    ///
9055    /// Parameters:
9056    ///
9057    /// - `realm`: realm name (not id!)
9058    /// - `role_name`: role's name (not id!)
9059    /// - `body`
9060    ///
9061    /// Resource: `Roles`
9062    ///
9063    /// `DELETE /admin/realms/{realm}/roles/{role_name}/composites`
9064    ///
9065    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmrolesrole_namecomposites>
9066    ///
9067    /// REST method: `DELETE /admin/realms/{realm}/roles/{role-name}/composites`
9068    #[cfg(feature = "tag-roles")]
9069    pub async fn realm_roles_with_role_name_composites_delete(
9070        &self,
9071        realm: &str,
9072        role_name: &str,
9073        body: Vec<RoleRepresentation>,
9074    ) -> Result<(), KeycloakError> {
9075        let realm = p(realm);
9076        let role_name = p(role_name);
9077        let builder = self
9078            .client
9079            .delete(format!(
9080                "{}/admin/realms/{realm}/roles/{role_name}/composites",
9081                self.url
9082            ))
9083            .json(&body)
9084            .bearer_auth(self.token_supplier.get(&self.url).await?);
9085        let response = builder.send().await?;
9086        error_check(response).await?;
9087        Ok(())
9088    }
9089
9090    /// Get client-level roles for the client that are in the role's composite
9091    ///
9092    /// Parameters:
9093    ///
9094    /// - `realm`: realm name (not id!)
9095    /// - `client_uuid`
9096    /// - `role_name`: role's name (not id!)
9097    ///
9098    /// Resource: `Roles`
9099    ///
9100    /// `GET /admin/realms/{realm}/roles/{role_name}/composites/clients/{client_uuid}`
9101    ///
9102    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_namecompositesclientsclient_uuid>
9103    ///
9104    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/composites/clients/{client-uuid}`
9105    #[cfg(feature = "tag-roles")]
9106    pub async fn realm_roles_with_role_name_composites_clients_with_client_uuid_get(
9107        &self,
9108        realm: &str,
9109        client_uuid: &str,
9110        role_name: &str,
9111    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9112        let realm = p(realm);
9113        let client_uuid = p(client_uuid);
9114        let role_name = p(role_name);
9115        let builder = self
9116            .client
9117            .get(format!(
9118                "{}/admin/realms/{realm}/roles/{role_name}/composites/clients/{client_uuid}",
9119                self.url
9120            ))
9121            .bearer_auth(self.token_supplier.get(&self.url).await?);
9122        let response = builder.send().await?;
9123        Ok(error_check(response).await?.json().await?)
9124    }
9125
9126    /// Get realm-level roles of the role's composite
9127    ///
9128    /// Parameters:
9129    ///
9130    /// - `realm`: realm name (not id!)
9131    /// - `role_name`: role's name (not id!)
9132    ///
9133    /// Resource: `Roles`
9134    ///
9135    /// `GET /admin/realms/{realm}/roles/{role_name}/composites/realm`
9136    ///
9137    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_namecompositesrealm>
9138    ///
9139    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/composites/realm`
9140    #[cfg(feature = "tag-roles")]
9141    pub async fn realm_roles_with_role_name_composites_realm_get(
9142        &self,
9143        realm: &str,
9144        role_name: &str,
9145    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9146        let realm = p(realm);
9147        let role_name = p(role_name);
9148        let builder = self
9149            .client
9150            .get(format!(
9151                "{}/admin/realms/{realm}/roles/{role_name}/composites/realm",
9152                self.url
9153            ))
9154            .bearer_auth(self.token_supplier.get(&self.url).await?);
9155        let response = builder.send().await?;
9156        Ok(error_check(response).await?.json().await?)
9157    }
9158
9159    /// Returns a stream of groups that have the specified role name
9160    ///
9161    /// Parameters:
9162    ///
9163    /// - `realm`: realm name (not id!)
9164    /// - `role_name`: the role name.
9165    /// - `brief_representation`: if false, return a full representation of the {@code GroupRepresentation} objects.
9166    /// - `first`: first result to return. Ignored if negative or {@code null}.
9167    /// - `max`: maximum number of results to return. Ignored if negative or {@code null}.
9168    ///
9169    /// Resource: `Roles`
9170    ///
9171    /// `GET /admin/realms/{realm}/roles/{role_name}/groups`
9172    ///
9173    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_namegroups>
9174    ///
9175    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/groups`
9176    #[cfg(feature = "tag-roles")]
9177    pub async fn realm_roles_with_role_name_groups_get(
9178        &self,
9179        realm: &str,
9180        role_name: &str,
9181        brief_representation: Option<bool>,
9182        first: Option<i32>,
9183        max: Option<i32>,
9184    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
9185        let realm = p(realm);
9186        let role_name = p(role_name);
9187        let mut builder = self
9188            .client
9189            .get(format!(
9190                "{}/admin/realms/{realm}/roles/{role_name}/groups",
9191                self.url
9192            ))
9193            .bearer_auth(self.token_supplier.get(&self.url).await?);
9194        if let Some(v) = brief_representation {
9195            builder = builder.query(&[("briefRepresentation", v)]);
9196        }
9197        if let Some(v) = first {
9198            builder = builder.query(&[("first", v)]);
9199        }
9200        if let Some(v) = max {
9201            builder = builder.query(&[("max", v)]);
9202        }
9203        let response = builder.send().await?;
9204        Ok(error_check(response).await?.json().await?)
9205    }
9206
9207    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
9208    ///
9209    /// Parameters:
9210    ///
9211    /// - `realm`: realm name (not id!)
9212    /// - `role_name`
9213    ///
9214    /// Resource: `Roles`
9215    ///
9216    /// `GET /admin/realms/{realm}/roles/{role_name}/management/permissions`
9217    ///
9218    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_namemanagementpermissions>
9219    ///
9220    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/management/permissions`
9221    #[cfg(feature = "tag-roles")]
9222    pub async fn realm_roles_with_role_name_management_permissions_get(
9223        &self,
9224        realm: &str,
9225        role_name: &str,
9226    ) -> Result<ManagementPermissionReference, KeycloakError> {
9227        let realm = p(realm);
9228        let role_name = p(role_name);
9229        let builder = self
9230            .client
9231            .get(format!(
9232                "{}/admin/realms/{realm}/roles/{role_name}/management/permissions",
9233                self.url
9234            ))
9235            .bearer_auth(self.token_supplier.get(&self.url).await?);
9236        let response = builder.send().await?;
9237        Ok(error_check(response).await?.json().await?)
9238    }
9239
9240    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
9241    ///
9242    /// Parameters:
9243    ///
9244    /// - `realm`: realm name (not id!)
9245    /// - `role_name`
9246    /// - `body`
9247    ///
9248    /// Resource: `Roles`
9249    ///
9250    /// `PUT /admin/realms/{realm}/roles/{role_name}/management/permissions`
9251    ///
9252    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmrolesrole_namemanagementpermissions>
9253    ///
9254    /// REST method: `PUT /admin/realms/{realm}/roles/{role-name}/management/permissions`
9255    #[cfg(feature = "tag-roles")]
9256    pub async fn realm_roles_with_role_name_management_permissions_put(
9257        &self,
9258        realm: &str,
9259        role_name: &str,
9260        body: ManagementPermissionReference,
9261    ) -> Result<ManagementPermissionReference, KeycloakError> {
9262        let realm = p(realm);
9263        let role_name = p(role_name);
9264        let builder = self
9265            .client
9266            .put(format!(
9267                "{}/admin/realms/{realm}/roles/{role_name}/management/permissions",
9268                self.url
9269            ))
9270            .json(&body)
9271            .bearer_auth(self.token_supplier.get(&self.url).await?);
9272        let response = builder.send().await?;
9273        Ok(error_check(response).await?.json().await?)
9274    }
9275
9276    /// Returns a stream of users that have the specified role name.
9277    ///
9278    /// Parameters:
9279    ///
9280    /// - `realm`: realm name (not id!)
9281    /// - `role_name`: the role name.
9282    /// - `brief_representation`: Boolean which defines whether brief representations are returned (default: false)
9283    /// - `first`: first result to return. Ignored if negative or {@code null}.
9284    /// - `max`: maximum number of results to return. Ignored if negative or {@code null}.
9285    ///
9286    /// Resource: `Roles`
9287    ///
9288    /// `GET /admin/realms/{realm}/roles/{role_name}/users`
9289    ///
9290    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmrolesrole_nameusers>
9291    ///
9292    /// REST method: `GET /admin/realms/{realm}/roles/{role-name}/users`
9293    #[cfg(feature = "tag-roles")]
9294    pub async fn realm_roles_with_role_name_users_get(
9295        &self,
9296        realm: &str,
9297        role_name: &str,
9298        brief_representation: Option<bool>,
9299        first: Option<i32>,
9300        max: Option<i32>,
9301    ) -> Result<TypeVec<UserRepresentation>, KeycloakError> {
9302        let realm = p(realm);
9303        let role_name = p(role_name);
9304        let mut builder = self
9305            .client
9306            .get(format!(
9307                "{}/admin/realms/{realm}/roles/{role_name}/users",
9308                self.url
9309            ))
9310            .bearer_auth(self.token_supplier.get(&self.url).await?);
9311        if let Some(v) = brief_representation {
9312            builder = builder.query(&[("briefRepresentation", v)]);
9313        }
9314        if let Some(v) = first {
9315            builder = builder.query(&[("first", v)]);
9316        }
9317        if let Some(v) = max {
9318            builder = builder.query(&[("max", v)]);
9319        }
9320        let response = builder.send().await?;
9321        Ok(error_check(response).await?.json().await?)
9322    }
9323
9324    // <h4>Roles (by ID)</h4>
9325
9326    /// Get a specific role's representation
9327    ///
9328    /// Parameters:
9329    ///
9330    /// - `realm`: realm name (not id!)
9331    /// - `role_id`: id of role
9332    ///
9333    /// Resource: `Roles (by ID)`
9334    ///
9335    /// `GET /admin/realms/{realm}/roles-by-id/{role_id}`
9336    ///
9337    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles_by_idrole_id>
9338    ///
9339    /// REST method: `GET /admin/realms/{realm}/roles-by-id/{role-id}`
9340    #[cfg(feature = "tag-roles-by-id")]
9341    pub async fn realm_roles_by_id_with_role_id_get(
9342        &self,
9343        realm: &str,
9344        role_id: &str,
9345    ) -> Result<RoleRepresentation, KeycloakError> {
9346        let realm = p(realm);
9347        let role_id = p(role_id);
9348        let builder = self
9349            .client
9350            .get(format!(
9351                "{}/admin/realms/{realm}/roles-by-id/{role_id}",
9352                self.url
9353            ))
9354            .bearer_auth(self.token_supplier.get(&self.url).await?);
9355        let response = builder.send().await?;
9356        Ok(error_check(response).await?.json().await?)
9357    }
9358
9359    /// Update the role
9360    ///
9361    /// Parameters:
9362    ///
9363    /// - `realm`: realm name (not id!)
9364    /// - `role_id`: id of role
9365    /// - `body`
9366    ///
9367    /// Resource: `Roles (by ID)`
9368    ///
9369    /// `PUT /admin/realms/{realm}/roles-by-id/{role_id}`
9370    ///
9371    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmroles_by_idrole_id>
9372    ///
9373    /// REST method: `PUT /admin/realms/{realm}/roles-by-id/{role-id}`
9374    #[cfg(feature = "tag-roles-by-id")]
9375    pub async fn realm_roles_by_id_with_role_id_put(
9376        &self,
9377        realm: &str,
9378        role_id: &str,
9379        body: RoleRepresentation,
9380    ) -> Result<(), KeycloakError> {
9381        let realm = p(realm);
9382        let role_id = p(role_id);
9383        let builder = self
9384            .client
9385            .put(format!(
9386                "{}/admin/realms/{realm}/roles-by-id/{role_id}",
9387                self.url
9388            ))
9389            .json(&body)
9390            .bearer_auth(self.token_supplier.get(&self.url).await?);
9391        let response = builder.send().await?;
9392        error_check(response).await?;
9393        Ok(())
9394    }
9395
9396    /// Delete the role
9397    ///
9398    /// Parameters:
9399    ///
9400    /// - `realm`: realm name (not id!)
9401    /// - `role_id`: id of role
9402    ///
9403    /// Resource: `Roles (by ID)`
9404    ///
9405    /// `DELETE /admin/realms/{realm}/roles-by-id/{role_id}`
9406    ///
9407    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmroles_by_idrole_id>
9408    ///
9409    /// REST method: `DELETE /admin/realms/{realm}/roles-by-id/{role-id}`
9410    #[cfg(feature = "tag-roles-by-id")]
9411    pub async fn realm_roles_by_id_with_role_id_delete(
9412        &self,
9413        realm: &str,
9414        role_id: &str,
9415    ) -> Result<(), KeycloakError> {
9416        let realm = p(realm);
9417        let role_id = p(role_id);
9418        let builder = self
9419            .client
9420            .delete(format!(
9421                "{}/admin/realms/{realm}/roles-by-id/{role_id}",
9422                self.url
9423            ))
9424            .bearer_auth(self.token_supplier.get(&self.url).await?);
9425        let response = builder.send().await?;
9426        error_check(response).await?;
9427        Ok(())
9428    }
9429
9430    /// Get role's children Returns a set of role's children provided the role is a composite.
9431    ///
9432    /// Parameters:
9433    ///
9434    /// - `realm`: realm name (not id!)
9435    /// - `role_id`
9436    /// - `first`
9437    /// - `max`
9438    /// - `search`
9439    ///
9440    /// Resource: `Roles (by ID)`
9441    ///
9442    /// `GET /admin/realms/{realm}/roles-by-id/{role_id}/composites`
9443    ///
9444    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles_by_idrole_idcomposites>
9445    ///
9446    /// REST method: `GET /admin/realms/{realm}/roles-by-id/{role-id}/composites`
9447    #[cfg(feature = "tag-roles-by-id")]
9448    pub async fn realm_roles_by_id_with_role_id_composites_get(
9449        &self,
9450        realm: &str,
9451        role_id: &str,
9452        first: Option<i32>,
9453        max: Option<i32>,
9454        search: Option<String>,
9455    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9456        let realm = p(realm);
9457        let role_id = p(role_id);
9458        let mut builder = self
9459            .client
9460            .get(format!(
9461                "{}/admin/realms/{realm}/roles-by-id/{role_id}/composites",
9462                self.url
9463            ))
9464            .bearer_auth(self.token_supplier.get(&self.url).await?);
9465        if let Some(v) = first {
9466            builder = builder.query(&[("first", v)]);
9467        }
9468        if let Some(v) = max {
9469            builder = builder.query(&[("max", v)]);
9470        }
9471        if let Some(v) = search {
9472            builder = builder.query(&[("search", v)]);
9473        }
9474        let response = builder.send().await?;
9475        Ok(error_check(response).await?.json().await?)
9476    }
9477
9478    /// Make the role a composite role by associating some child roles
9479    ///
9480    /// Parameters:
9481    ///
9482    /// - `realm`: realm name (not id!)
9483    /// - `role_id`
9484    /// - `body`
9485    ///
9486    /// Returns id of created resource
9487    ///
9488    /// Resource: `Roles (by ID)`
9489    ///
9490    /// `POST /admin/realms/{realm}/roles-by-id/{role_id}/composites`
9491    ///
9492    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmroles_by_idrole_idcomposites>
9493    ///
9494    /// REST method: `POST /admin/realms/{realm}/roles-by-id/{role-id}/composites`
9495    #[cfg(feature = "tag-roles-by-id")]
9496    pub async fn realm_roles_by_id_with_role_id_composites_post(
9497        &self,
9498        realm: &str,
9499        role_id: &str,
9500        body: Vec<RoleRepresentation>,
9501    ) -> Result<Option<TypeString>, KeycloakError> {
9502        let realm = p(realm);
9503        let role_id = p(role_id);
9504        let builder = self
9505            .client
9506            .post(format!(
9507                "{}/admin/realms/{realm}/roles-by-id/{role_id}/composites",
9508                self.url
9509            ))
9510            .json(&body)
9511            .bearer_auth(self.token_supplier.get(&self.url).await?);
9512        let response = builder.send().await?;
9513        error_check(response).await.map(to_id)
9514    }
9515
9516    /// Remove a set of roles from the role's composite
9517    ///
9518    /// Parameters:
9519    ///
9520    /// - `realm`: realm name (not id!)
9521    /// - `role_id`: Role id
9522    /// - `body`
9523    ///
9524    /// Resource: `Roles (by ID)`
9525    ///
9526    /// `DELETE /admin/realms/{realm}/roles-by-id/{role_id}/composites`
9527    ///
9528    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmroles_by_idrole_idcomposites>
9529    ///
9530    /// REST method: `DELETE /admin/realms/{realm}/roles-by-id/{role-id}/composites`
9531    #[cfg(feature = "tag-roles-by-id")]
9532    pub async fn realm_roles_by_id_with_role_id_composites_delete(
9533        &self,
9534        realm: &str,
9535        role_id: &str,
9536        body: Vec<RoleRepresentation>,
9537    ) -> Result<(), KeycloakError> {
9538        let realm = p(realm);
9539        let role_id = p(role_id);
9540        let builder = self
9541            .client
9542            .delete(format!(
9543                "{}/admin/realms/{realm}/roles-by-id/{role_id}/composites",
9544                self.url
9545            ))
9546            .json(&body)
9547            .bearer_auth(self.token_supplier.get(&self.url).await?);
9548        let response = builder.send().await?;
9549        error_check(response).await?;
9550        Ok(())
9551    }
9552
9553    /// Get client-level roles for the client that are in the role's composite
9554    ///
9555    /// Parameters:
9556    ///
9557    /// - `realm`: realm name (not id!)
9558    /// - `client_uuid`
9559    /// - `role_id`
9560    ///
9561    /// Resource: `Roles (by ID)`
9562    ///
9563    /// `GET /admin/realms/{realm}/roles-by-id/{role_id}/composites/clients/{client_uuid}`
9564    ///
9565    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles_by_idrole_idcompositesclientsclientuuid>
9566    ///
9567    /// REST method: `GET /admin/realms/{realm}/roles-by-id/{role-id}/composites/clients/{clientUuid}`
9568    #[cfg(feature = "tag-roles-by-id")]
9569    pub async fn realm_roles_by_id_with_role_id_composites_clients_with_client_uuid_get(
9570        &self,
9571        realm: &str,
9572        client_uuid: &str,
9573        role_id: &str,
9574    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9575        let realm = p(realm);
9576        let client_uuid = p(client_uuid);
9577        let role_id = p(role_id);
9578        let builder = self
9579            .client
9580            .get(format!(
9581                "{}/admin/realms/{realm}/roles-by-id/{role_id}/composites/clients/{client_uuid}",
9582                self.url
9583            ))
9584            .bearer_auth(self.token_supplier.get(&self.url).await?);
9585        let response = builder.send().await?;
9586        Ok(error_check(response).await?.json().await?)
9587    }
9588
9589    /// Get realm-level roles that are in the role's composite
9590    ///
9591    /// Parameters:
9592    ///
9593    /// - `realm`: realm name (not id!)
9594    /// - `role_id`
9595    ///
9596    /// Resource: `Roles (by ID)`
9597    ///
9598    /// `GET /admin/realms/{realm}/roles-by-id/{role_id}/composites/realm`
9599    ///
9600    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles_by_idrole_idcompositesrealm>
9601    ///
9602    /// REST method: `GET /admin/realms/{realm}/roles-by-id/{role-id}/composites/realm`
9603    #[cfg(feature = "tag-roles-by-id")]
9604    pub async fn realm_roles_by_id_with_role_id_composites_realm_get(
9605        &self,
9606        realm: &str,
9607        role_id: &str,
9608    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9609        let realm = p(realm);
9610        let role_id = p(role_id);
9611        let builder = self
9612            .client
9613            .get(format!(
9614                "{}/admin/realms/{realm}/roles-by-id/{role_id}/composites/realm",
9615                self.url
9616            ))
9617            .bearer_auth(self.token_supplier.get(&self.url).await?);
9618        let response = builder.send().await?;
9619        Ok(error_check(response).await?.json().await?)
9620    }
9621
9622    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
9623    ///
9624    /// Parameters:
9625    ///
9626    /// - `realm`: realm name (not id!)
9627    /// - `role_id`
9628    ///
9629    /// Resource: `Roles (by ID)`
9630    ///
9631    /// `GET /admin/realms/{realm}/roles-by-id/{role_id}/management/permissions`
9632    ///
9633    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmroles_by_idrole_idmanagementpermissions>
9634    ///
9635    /// REST method: `GET /admin/realms/{realm}/roles-by-id/{role-id}/management/permissions`
9636    #[cfg(feature = "tag-roles-by-id")]
9637    pub async fn realm_roles_by_id_with_role_id_management_permissions_get(
9638        &self,
9639        realm: &str,
9640        role_id: &str,
9641    ) -> Result<ManagementPermissionReference, KeycloakError> {
9642        let realm = p(realm);
9643        let role_id = p(role_id);
9644        let builder = self
9645            .client
9646            .get(format!(
9647                "{}/admin/realms/{realm}/roles-by-id/{role_id}/management/permissions",
9648                self.url
9649            ))
9650            .bearer_auth(self.token_supplier.get(&self.url).await?);
9651        let response = builder.send().await?;
9652        Ok(error_check(response).await?.json().await?)
9653    }
9654
9655    /// Return object stating whether role Authorization permissions have been initialized or not and a reference
9656    ///
9657    /// Parameters:
9658    ///
9659    /// - `realm`: realm name (not id!)
9660    /// - `role_id`
9661    /// - `body`
9662    ///
9663    /// Resource: `Roles (by ID)`
9664    ///
9665    /// `PUT /admin/realms/{realm}/roles-by-id/{role_id}/management/permissions`
9666    ///
9667    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmroles_by_idrole_idmanagementpermissions>
9668    ///
9669    /// REST method: `PUT /admin/realms/{realm}/roles-by-id/{role-id}/management/permissions`
9670    #[cfg(feature = "tag-roles-by-id")]
9671    pub async fn realm_roles_by_id_with_role_id_management_permissions_put(
9672        &self,
9673        realm: &str,
9674        role_id: &str,
9675        body: ManagementPermissionReference,
9676    ) -> Result<ManagementPermissionReference, KeycloakError> {
9677        let realm = p(realm);
9678        let role_id = p(role_id);
9679        let builder = self
9680            .client
9681            .put(format!(
9682                "{}/admin/realms/{realm}/roles-by-id/{role_id}/management/permissions",
9683                self.url
9684            ))
9685            .json(&body)
9686            .bearer_auth(self.token_supplier.get(&self.url).await?);
9687        let response = builder.send().await?;
9688        Ok(error_check(response).await?.json().await?)
9689    }
9690
9691    // <h4>Scope Mappings</h4>
9692
9693    /// Get all scope mappings for the client
9694    ///
9695    /// Parameters:
9696    ///
9697    /// - `realm`: realm name (not id!)
9698    /// - `client_scope_id`
9699    ///
9700    /// Resource: `Scope Mappings`
9701    ///
9702    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings`
9703    ///
9704    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappings>
9705    ///
9706    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings`
9707    #[cfg(feature = "tag-scope-mappings")]
9708    #[deprecated]
9709    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_get(
9710        &self,
9711        realm: &str,
9712        client_scope_id: &str,
9713    ) -> Result<MappingsRepresentation, KeycloakError> {
9714        let realm = p(realm);
9715        let client_scope_id = p(client_scope_id);
9716        let builder = self
9717            .client
9718            .get(format!(
9719                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings",
9720                self.url
9721            ))
9722            .bearer_auth(self.token_supplier.get(&self.url).await?);
9723        let response = builder.send().await?;
9724        Ok(error_check(response).await?.json().await?)
9725    }
9726
9727    /// Get the roles associated with a client's scope Returns roles for the client.
9728    ///
9729    /// Parameters:
9730    ///
9731    /// - `realm`: realm name (not id!)
9732    /// - `client_scope_id`
9733    /// - `client`
9734    ///
9735    /// Resource: `Scope Mappings`
9736    ///
9737    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}`
9738    ///
9739    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsclientsclient>
9740    ///
9741    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/clients/{client}`
9742    #[cfg(feature = "tag-scope-mappings")]
9743    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_clients_with_client_get(
9744        &self,
9745        realm: &str,
9746        client_scope_id: &str,
9747        client: &str,
9748    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9749        let realm = p(realm);
9750        let client_scope_id = p(client_scope_id);
9751        let client = p(client);
9752        let builder = self
9753            .client
9754            .get(format!(
9755                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}",
9756                self.url
9757            ))
9758            .bearer_auth(self.token_supplier.get(&self.url).await?);
9759        let response = builder.send().await?;
9760        Ok(error_check(response).await?.json().await?)
9761    }
9762
9763    /// Add client-level roles to the client's scope
9764    ///
9765    /// Parameters:
9766    ///
9767    /// - `realm`: realm name (not id!)
9768    /// - `client_scope_id`
9769    /// - `client`
9770    /// - `body`
9771    ///
9772    /// Returns id of created resource
9773    ///
9774    /// Resource: `Scope Mappings`
9775    ///
9776    /// `POST /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}`
9777    ///
9778    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsclientsclient>
9779    ///
9780    /// REST method: `POST /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/clients/{client}`
9781    #[cfg(feature = "tag-scope-mappings")]
9782    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_clients_with_client_post(
9783        &self,
9784        realm: &str,
9785        client_scope_id: &str,
9786        client: &str,
9787        body: Vec<RoleRepresentation>,
9788    ) -> Result<Option<TypeString>, KeycloakError> {
9789        let realm = p(realm);
9790        let client_scope_id = p(client_scope_id);
9791        let client = p(client);
9792        let builder = self
9793            .client
9794            .post(format!(
9795                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}",
9796                self.url
9797            ))
9798            .json(&body)
9799            .bearer_auth(self.token_supplier.get(&self.url).await?);
9800        let response = builder.send().await?;
9801        error_check(response).await.map(to_id)
9802    }
9803
9804    /// Remove client-level roles from the client's scope.
9805    ///
9806    /// Parameters:
9807    ///
9808    /// - `realm`: realm name (not id!)
9809    /// - `client_scope_id`
9810    /// - `client`
9811    /// - `body`
9812    ///
9813    /// Resource: `Scope Mappings`
9814    ///
9815    /// `DELETE /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}`
9816    ///
9817    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsclientsclient>
9818    ///
9819    /// REST method: `DELETE /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/clients/{client}`
9820    #[cfg(feature = "tag-scope-mappings")]
9821    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_clients_with_client_delete(
9822        &self,
9823        realm: &str,
9824        client_scope_id: &str,
9825        client: &str,
9826        body: Vec<RoleRepresentation>,
9827    ) -> Result<(), KeycloakError> {
9828        let realm = p(realm);
9829        let client_scope_id = p(client_scope_id);
9830        let client = p(client);
9831        let builder = self
9832            .client
9833            .delete(format!(
9834                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}",
9835                self.url
9836            ))
9837            .json(&body)
9838            .bearer_auth(self.token_supplier.get(&self.url).await?);
9839        let response = builder.send().await?;
9840        error_check(response).await?;
9841        Ok(())
9842    }
9843
9844    /// The available client-level roles Returns the roles for the client that can be associated with the client's scope
9845    ///
9846    /// Parameters:
9847    ///
9848    /// - `realm`: realm name (not id!)
9849    /// - `client_scope_id`
9850    /// - `client`
9851    ///
9852    /// Resource: `Scope Mappings`
9853    ///
9854    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}/available`
9855    ///
9856    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsclientsclientavailable>
9857    ///
9858    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/clients/{client}/available`
9859    #[cfg(feature = "tag-scope-mappings")]
9860    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_clients_with_client_available_get(
9861        &self,
9862        realm: &str,
9863        client_scope_id: &str,
9864        client: &str,
9865    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9866        let realm = p(realm);
9867        let client_scope_id = p(client_scope_id);
9868        let client = p(client);
9869        let builder = self
9870            .client
9871            .get(format!(
9872                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}/available",
9873                self.url
9874            ))
9875            .bearer_auth(self.token_supplier.get(&self.url).await?);
9876        let response = builder.send().await?;
9877        Ok(error_check(response).await?.json().await?)
9878    }
9879
9880    /// Get effective client roles Returns the roles for the client that are associated with the client's scope.
9881    ///
9882    /// Parameters:
9883    ///
9884    /// - `realm`: realm name (not id!)
9885    /// - `client_scope_id`
9886    /// - `client`
9887    /// - `brief_representation`: if false, return roles with their attributes
9888    ///
9889    /// Resource: `Scope Mappings`
9890    ///
9891    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}/composite`
9892    ///
9893    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsclientsclientcomposite>
9894    ///
9895    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/clients/{client}/composite`
9896    #[cfg(feature = "tag-scope-mappings")]
9897    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_clients_with_client_composite_get(
9898        &self,
9899        realm: &str,
9900        client_scope_id: &str,
9901        client: &str,
9902        brief_representation: Option<bool>,
9903    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9904        let realm = p(realm);
9905        let client_scope_id = p(client_scope_id);
9906        let client = p(client);
9907        let mut builder = self
9908            .client
9909            .get(format!(
9910                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/clients/{client}/composite",
9911                self.url
9912            ))
9913            .bearer_auth(self.token_supplier.get(&self.url).await?);
9914        if let Some(v) = brief_representation {
9915            builder = builder.query(&[("briefRepresentation", v)]);
9916        }
9917        let response = builder.send().await?;
9918        Ok(error_check(response).await?.json().await?)
9919    }
9920
9921    /// Get realm-level roles associated with the client's scope
9922    ///
9923    /// Parameters:
9924    ///
9925    /// - `realm`: realm name (not id!)
9926    /// - `client_scope_id`
9927    ///
9928    /// Resource: `Scope Mappings`
9929    ///
9930    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm`
9931    ///
9932    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsrealm>
9933    ///
9934    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/realm`
9935    #[cfg(feature = "tag-scope-mappings")]
9936    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_realm_get(
9937        &self,
9938        realm: &str,
9939        client_scope_id: &str,
9940    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
9941        let realm = p(realm);
9942        let client_scope_id = p(client_scope_id);
9943        let builder = self
9944            .client
9945            .get(format!(
9946                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm",
9947                self.url
9948            ))
9949            .bearer_auth(self.token_supplier.get(&self.url).await?);
9950        let response = builder.send().await?;
9951        Ok(error_check(response).await?.json().await?)
9952    }
9953
9954    /// Add a set of realm-level roles to the client's scope
9955    ///
9956    /// Parameters:
9957    ///
9958    /// - `realm`: realm name (not id!)
9959    /// - `client_scope_id`
9960    /// - `body`
9961    ///
9962    /// Returns id of created resource
9963    ///
9964    /// Resource: `Scope Mappings`
9965    ///
9966    /// `POST /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm`
9967    ///
9968    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsrealm>
9969    ///
9970    /// REST method: `POST /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/realm`
9971    #[cfg(feature = "tag-scope-mappings")]
9972    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_realm_post(
9973        &self,
9974        realm: &str,
9975        client_scope_id: &str,
9976        body: Vec<RoleRepresentation>,
9977    ) -> Result<Option<TypeString>, KeycloakError> {
9978        let realm = p(realm);
9979        let client_scope_id = p(client_scope_id);
9980        let builder = self
9981            .client
9982            .post(format!(
9983                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm",
9984                self.url
9985            ))
9986            .json(&body)
9987            .bearer_auth(self.token_supplier.get(&self.url).await?);
9988        let response = builder.send().await?;
9989        error_check(response).await.map(to_id)
9990    }
9991
9992    /// Remove a set of realm-level roles from the client's scope
9993    ///
9994    /// Parameters:
9995    ///
9996    /// - `realm`: realm name (not id!)
9997    /// - `client_scope_id`
9998    /// - `body`
9999    ///
10000    /// Resource: `Scope Mappings`
10001    ///
10002    /// `DELETE /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm`
10003    ///
10004    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsrealm>
10005    ///
10006    /// REST method: `DELETE /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/realm`
10007    #[cfg(feature = "tag-scope-mappings")]
10008    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_realm_delete(
10009        &self,
10010        realm: &str,
10011        client_scope_id: &str,
10012        body: Vec<RoleRepresentation>,
10013    ) -> Result<(), KeycloakError> {
10014        let realm = p(realm);
10015        let client_scope_id = p(client_scope_id);
10016        let builder = self
10017            .client
10018            .delete(format!(
10019                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm",
10020                self.url
10021            ))
10022            .json(&body)
10023            .bearer_auth(self.token_supplier.get(&self.url).await?);
10024        let response = builder.send().await?;
10025        error_check(response).await?;
10026        Ok(())
10027    }
10028
10029    /// Get realm-level roles that are available to attach to this client's scope
10030    ///
10031    /// Parameters:
10032    ///
10033    /// - `realm`: realm name (not id!)
10034    /// - `client_scope_id`
10035    ///
10036    /// Resource: `Scope Mappings`
10037    ///
10038    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm/available`
10039    ///
10040    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsrealmavailable>
10041    ///
10042    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/realm/available`
10043    #[cfg(feature = "tag-scope-mappings")]
10044    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_realm_available_get(
10045        &self,
10046        realm: &str,
10047        client_scope_id: &str,
10048    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10049        let realm = p(realm);
10050        let client_scope_id = p(client_scope_id);
10051        let builder = self
10052            .client
10053            .get(format!(
10054                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm/available",
10055                self.url
10056            ))
10057            .bearer_auth(self.token_supplier.get(&self.url).await?);
10058        let response = builder.send().await?;
10059        Ok(error_check(response).await?.json().await?)
10060    }
10061
10062    /// Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists.
10063    ///
10064    /// Parameters:
10065    ///
10066    /// - `realm`: realm name (not id!)
10067    /// - `client_scope_id`
10068    /// - `brief_representation`: if false, return roles with their attributes
10069    ///
10070    /// Resource: `Scope Mappings`
10071    ///
10072    /// `GET /admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm/composite`
10073    ///
10074    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_scopesclient_scope_idscope_mappingsrealmcomposite>
10075    ///
10076    /// REST method: `GET /admin/realms/{realm}/client-scopes/{client-scope-id}/scope-mappings/realm/composite`
10077    #[cfg(feature = "tag-scope-mappings")]
10078    pub async fn realm_client_scopes_with_client_scope_id_scope_mappings_realm_composite_get(
10079        &self,
10080        realm: &str,
10081        client_scope_id: &str,
10082        brief_representation: Option<bool>,
10083    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10084        let realm = p(realm);
10085        let client_scope_id = p(client_scope_id);
10086        let mut builder = self
10087            .client
10088            .get(format!(
10089                "{}/admin/realms/{realm}/client-scopes/{client_scope_id}/scope-mappings/realm/composite",
10090                self.url
10091            ))
10092            .bearer_auth(self.token_supplier.get(&self.url).await?);
10093        if let Some(v) = brief_representation {
10094            builder = builder.query(&[("briefRepresentation", v)]);
10095        }
10096        let response = builder.send().await?;
10097        Ok(error_check(response).await?.json().await?)
10098    }
10099
10100    /// Get all scope mappings for the client
10101    ///
10102    /// Parameters:
10103    ///
10104    /// - `realm`: realm name (not id!)
10105    /// - `client_scope_id`
10106    ///
10107    /// Resource: `Scope Mappings`
10108    ///
10109    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings`
10110    ///
10111    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappings>
10112    ///
10113    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings`
10114    #[cfg(feature = "tag-scope-mappings")]
10115    #[deprecated]
10116    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_get(
10117        &self,
10118        realm: &str,
10119        client_scope_id: &str,
10120    ) -> Result<MappingsRepresentation, KeycloakError> {
10121        let realm = p(realm);
10122        let client_scope_id = p(client_scope_id);
10123        let builder = self
10124            .client
10125            .get(format!(
10126                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings",
10127                self.url
10128            ))
10129            .bearer_auth(self.token_supplier.get(&self.url).await?);
10130        let response = builder.send().await?;
10131        Ok(error_check(response).await?.json().await?)
10132    }
10133
10134    /// Get the roles associated with a client's scope Returns roles for the client.
10135    ///
10136    /// Parameters:
10137    ///
10138    /// - `realm`: realm name (not id!)
10139    /// - `client_scope_id`
10140    /// - `client`
10141    ///
10142    /// Resource: `Scope Mappings`
10143    ///
10144    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}`
10145    ///
10146    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsclientsclient>
10147    ///
10148    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/clients/{client}`
10149    #[cfg(feature = "tag-scope-mappings")]
10150    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_clients_with_client_get(
10151        &self,
10152        realm: &str,
10153        client_scope_id: &str,
10154        client: &str,
10155    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10156        let realm = p(realm);
10157        let client_scope_id = p(client_scope_id);
10158        let client = p(client);
10159        let builder = self
10160            .client
10161            .get(format!(
10162                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}",
10163                self.url
10164            ))
10165            .bearer_auth(self.token_supplier.get(&self.url).await?);
10166        let response = builder.send().await?;
10167        Ok(error_check(response).await?.json().await?)
10168    }
10169
10170    /// Add client-level roles to the client's scope
10171    ///
10172    /// Parameters:
10173    ///
10174    /// - `realm`: realm name (not id!)
10175    /// - `client_scope_id`
10176    /// - `client`
10177    /// - `body`
10178    ///
10179    /// Returns id of created resource
10180    ///
10181    /// Resource: `Scope Mappings`
10182    ///
10183    /// `POST /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}`
10184    ///
10185    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsclientsclient>
10186    ///
10187    /// REST method: `POST /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/clients/{client}`
10188    #[cfg(feature = "tag-scope-mappings")]
10189    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_clients_with_client_post(
10190        &self,
10191        realm: &str,
10192        client_scope_id: &str,
10193        client: &str,
10194        body: Vec<RoleRepresentation>,
10195    ) -> Result<Option<TypeString>, KeycloakError> {
10196        let realm = p(realm);
10197        let client_scope_id = p(client_scope_id);
10198        let client = p(client);
10199        let builder = self
10200            .client
10201            .post(format!(
10202                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}",
10203                self.url
10204            ))
10205            .json(&body)
10206            .bearer_auth(self.token_supplier.get(&self.url).await?);
10207        let response = builder.send().await?;
10208        error_check(response).await.map(to_id)
10209    }
10210
10211    /// Remove client-level roles from the client's scope.
10212    ///
10213    /// Parameters:
10214    ///
10215    /// - `realm`: realm name (not id!)
10216    /// - `client_scope_id`
10217    /// - `client`
10218    /// - `body`
10219    ///
10220    /// Resource: `Scope Mappings`
10221    ///
10222    /// `DELETE /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}`
10223    ///
10224    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsclientsclient>
10225    ///
10226    /// REST method: `DELETE /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/clients/{client}`
10227    #[cfg(feature = "tag-scope-mappings")]
10228    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_clients_with_client_delete(
10229        &self,
10230        realm: &str,
10231        client_scope_id: &str,
10232        client: &str,
10233        body: Vec<RoleRepresentation>,
10234    ) -> Result<(), KeycloakError> {
10235        let realm = p(realm);
10236        let client_scope_id = p(client_scope_id);
10237        let client = p(client);
10238        let builder = self
10239            .client
10240            .delete(format!(
10241                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}",
10242                self.url
10243            ))
10244            .json(&body)
10245            .bearer_auth(self.token_supplier.get(&self.url).await?);
10246        let response = builder.send().await?;
10247        error_check(response).await?;
10248        Ok(())
10249    }
10250
10251    /// The available client-level roles Returns the roles for the client that can be associated with the client's scope
10252    ///
10253    /// Parameters:
10254    ///
10255    /// - `realm`: realm name (not id!)
10256    /// - `client_scope_id`
10257    /// - `client`
10258    ///
10259    /// Resource: `Scope Mappings`
10260    ///
10261    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}/available`
10262    ///
10263    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsclientsclientavailable>
10264    ///
10265    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/clients/{client}/available`
10266    #[cfg(feature = "tag-scope-mappings")]
10267    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_clients_with_client_available_get(
10268        &self,
10269        realm: &str,
10270        client_scope_id: &str,
10271        client: &str,
10272    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10273        let realm = p(realm);
10274        let client_scope_id = p(client_scope_id);
10275        let client = p(client);
10276        let builder = self
10277            .client
10278            .get(format!(
10279                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}/available",
10280                self.url
10281            ))
10282            .bearer_auth(self.token_supplier.get(&self.url).await?);
10283        let response = builder.send().await?;
10284        Ok(error_check(response).await?.json().await?)
10285    }
10286
10287    /// Get effective client roles Returns the roles for the client that are associated with the client's scope.
10288    ///
10289    /// Parameters:
10290    ///
10291    /// - `realm`: realm name (not id!)
10292    /// - `client_scope_id`
10293    /// - `client`
10294    /// - `brief_representation`: if false, return roles with their attributes
10295    ///
10296    /// Resource: `Scope Mappings`
10297    ///
10298    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}/composite`
10299    ///
10300    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsclientsclientcomposite>
10301    ///
10302    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/clients/{client}/composite`
10303    #[cfg(feature = "tag-scope-mappings")]
10304    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_clients_with_client_composite_get(
10305        &self,
10306        realm: &str,
10307        client_scope_id: &str,
10308        client: &str,
10309        brief_representation: Option<bool>,
10310    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10311        let realm = p(realm);
10312        let client_scope_id = p(client_scope_id);
10313        let client = p(client);
10314        let mut builder = self
10315            .client
10316            .get(format!(
10317                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/clients/{client}/composite",
10318                self.url
10319            ))
10320            .bearer_auth(self.token_supplier.get(&self.url).await?);
10321        if let Some(v) = brief_representation {
10322            builder = builder.query(&[("briefRepresentation", v)]);
10323        }
10324        let response = builder.send().await?;
10325        Ok(error_check(response).await?.json().await?)
10326    }
10327
10328    /// Get realm-level roles associated with the client's scope
10329    ///
10330    /// Parameters:
10331    ///
10332    /// - `realm`: realm name (not id!)
10333    /// - `client_scope_id`
10334    ///
10335    /// Resource: `Scope Mappings`
10336    ///
10337    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm`
10338    ///
10339    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsrealm>
10340    ///
10341    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/realm`
10342    #[cfg(feature = "tag-scope-mappings")]
10343    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_realm_get(
10344        &self,
10345        realm: &str,
10346        client_scope_id: &str,
10347    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10348        let realm = p(realm);
10349        let client_scope_id = p(client_scope_id);
10350        let builder = self
10351            .client
10352            .get(format!(
10353                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm",
10354                self.url
10355            ))
10356            .bearer_auth(self.token_supplier.get(&self.url).await?);
10357        let response = builder.send().await?;
10358        Ok(error_check(response).await?.json().await?)
10359    }
10360
10361    /// Add a set of realm-level roles to the client's scope
10362    ///
10363    /// Parameters:
10364    ///
10365    /// - `realm`: realm name (not id!)
10366    /// - `client_scope_id`
10367    /// - `body`
10368    ///
10369    /// Returns id of created resource
10370    ///
10371    /// Resource: `Scope Mappings`
10372    ///
10373    /// `POST /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm`
10374    ///
10375    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsrealm>
10376    ///
10377    /// REST method: `POST /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/realm`
10378    #[cfg(feature = "tag-scope-mappings")]
10379    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_realm_post(
10380        &self,
10381        realm: &str,
10382        client_scope_id: &str,
10383        body: Vec<RoleRepresentation>,
10384    ) -> Result<Option<TypeString>, KeycloakError> {
10385        let realm = p(realm);
10386        let client_scope_id = p(client_scope_id);
10387        let builder = self
10388            .client
10389            .post(format!(
10390                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm",
10391                self.url
10392            ))
10393            .json(&body)
10394            .bearer_auth(self.token_supplier.get(&self.url).await?);
10395        let response = builder.send().await?;
10396        error_check(response).await.map(to_id)
10397    }
10398
10399    /// Remove a set of realm-level roles from the client's scope
10400    ///
10401    /// Parameters:
10402    ///
10403    /// - `realm`: realm name (not id!)
10404    /// - `client_scope_id`
10405    /// - `body`
10406    ///
10407    /// Resource: `Scope Mappings`
10408    ///
10409    /// `DELETE /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm`
10410    ///
10411    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsrealm>
10412    ///
10413    /// REST method: `DELETE /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/realm`
10414    #[cfg(feature = "tag-scope-mappings")]
10415    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_realm_delete(
10416        &self,
10417        realm: &str,
10418        client_scope_id: &str,
10419        body: Vec<RoleRepresentation>,
10420    ) -> Result<(), KeycloakError> {
10421        let realm = p(realm);
10422        let client_scope_id = p(client_scope_id);
10423        let builder = self
10424            .client
10425            .delete(format!(
10426                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm",
10427                self.url
10428            ))
10429            .json(&body)
10430            .bearer_auth(self.token_supplier.get(&self.url).await?);
10431        let response = builder.send().await?;
10432        error_check(response).await?;
10433        Ok(())
10434    }
10435
10436    /// Get realm-level roles that are available to attach to this client's scope
10437    ///
10438    /// Parameters:
10439    ///
10440    /// - `realm`: realm name (not id!)
10441    /// - `client_scope_id`
10442    ///
10443    /// Resource: `Scope Mappings`
10444    ///
10445    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm/available`
10446    ///
10447    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsrealmavailable>
10448    ///
10449    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/realm/available`
10450    #[cfg(feature = "tag-scope-mappings")]
10451    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_realm_available_get(
10452        &self,
10453        realm: &str,
10454        client_scope_id: &str,
10455    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10456        let realm = p(realm);
10457        let client_scope_id = p(client_scope_id);
10458        let builder = self
10459            .client
10460            .get(format!(
10461                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm/available",
10462                self.url
10463            ))
10464            .bearer_auth(self.token_supplier.get(&self.url).await?);
10465        let response = builder.send().await?;
10466        Ok(error_check(response).await?.json().await?)
10467    }
10468
10469    /// Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists.
10470    ///
10471    /// Parameters:
10472    ///
10473    /// - `realm`: realm name (not id!)
10474    /// - `client_scope_id`
10475    /// - `brief_representation`: if false, return roles with their attributes
10476    ///
10477    /// Resource: `Scope Mappings`
10478    ///
10479    /// `GET /admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm/composite`
10480    ///
10481    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclient_templatesclient_scope_idscope_mappingsrealmcomposite>
10482    ///
10483    /// REST method: `GET /admin/realms/{realm}/client-templates/{client-scope-id}/scope-mappings/realm/composite`
10484    #[cfg(feature = "tag-scope-mappings")]
10485    pub async fn realm_client_templates_with_client_scope_id_scope_mappings_realm_composite_get(
10486        &self,
10487        realm: &str,
10488        client_scope_id: &str,
10489        brief_representation: Option<bool>,
10490    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10491        let realm = p(realm);
10492        let client_scope_id = p(client_scope_id);
10493        let mut builder = self
10494            .client
10495            .get(format!(
10496                "{}/admin/realms/{realm}/client-templates/{client_scope_id}/scope-mappings/realm/composite",
10497                self.url
10498            ))
10499            .bearer_auth(self.token_supplier.get(&self.url).await?);
10500        if let Some(v) = brief_representation {
10501            builder = builder.query(&[("briefRepresentation", v)]);
10502        }
10503        let response = builder.send().await?;
10504        Ok(error_check(response).await?.json().await?)
10505    }
10506
10507    /// Get all scope mappings for the client
10508    ///
10509    /// Parameters:
10510    ///
10511    /// - `realm`: realm name (not id!)
10512    /// - `client_uuid`: id of client (not client-id!)
10513    ///
10514    /// Resource: `Scope Mappings`
10515    ///
10516    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings`
10517    ///
10518    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappings>
10519    ///
10520    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings`
10521    #[cfg(feature = "tag-scope-mappings")]
10522    #[deprecated]
10523    pub async fn realm_clients_with_client_uuid_scope_mappings_get(
10524        &self,
10525        realm: &str,
10526        client_uuid: &str,
10527    ) -> Result<MappingsRepresentation, KeycloakError> {
10528        let realm = p(realm);
10529        let client_uuid = p(client_uuid);
10530        let builder = self
10531            .client
10532            .get(format!(
10533                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings",
10534                self.url
10535            ))
10536            .bearer_auth(self.token_supplier.get(&self.url).await?);
10537        let response = builder.send().await?;
10538        Ok(error_check(response).await?.json().await?)
10539    }
10540
10541    /// Get the roles associated with a client's scope Returns roles for the client.
10542    ///
10543    /// Parameters:
10544    ///
10545    /// - `realm`: realm name (not id!)
10546    /// - `client_uuid`: id of client (not client-id!)
10547    /// - `client`
10548    ///
10549    /// Resource: `Scope Mappings`
10550    ///
10551    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}`
10552    ///
10553    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsclientsclient>
10554    ///
10555    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/clients/{client}`
10556    #[cfg(feature = "tag-scope-mappings")]
10557    pub async fn realm_clients_with_client_uuid_scope_mappings_clients_with_client_get(
10558        &self,
10559        realm: &str,
10560        client_uuid: &str,
10561        client: &str,
10562    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10563        let realm = p(realm);
10564        let client_uuid = p(client_uuid);
10565        let client = p(client);
10566        let builder = self
10567            .client
10568            .get(format!(
10569                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}",
10570                self.url
10571            ))
10572            .bearer_auth(self.token_supplier.get(&self.url).await?);
10573        let response = builder.send().await?;
10574        Ok(error_check(response).await?.json().await?)
10575    }
10576
10577    /// Add client-level roles to the client's scope
10578    ///
10579    /// Parameters:
10580    ///
10581    /// - `realm`: realm name (not id!)
10582    /// - `client_uuid`: id of client (not client-id!)
10583    /// - `client`
10584    /// - `body`
10585    ///
10586    /// Returns id of created resource
10587    ///
10588    /// Resource: `Scope Mappings`
10589    ///
10590    /// `POST /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}`
10591    ///
10592    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidscope_mappingsclientsclient>
10593    ///
10594    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/clients/{client}`
10595    #[cfg(feature = "tag-scope-mappings")]
10596    pub async fn realm_clients_with_client_uuid_scope_mappings_clients_with_client_post(
10597        &self,
10598        realm: &str,
10599        client_uuid: &str,
10600        client: &str,
10601        body: Vec<RoleRepresentation>,
10602    ) -> Result<Option<TypeString>, KeycloakError> {
10603        let realm = p(realm);
10604        let client_uuid = p(client_uuid);
10605        let client = p(client);
10606        let builder = self
10607            .client
10608            .post(format!(
10609                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}",
10610                self.url
10611            ))
10612            .json(&body)
10613            .bearer_auth(self.token_supplier.get(&self.url).await?);
10614        let response = builder.send().await?;
10615        error_check(response).await.map(to_id)
10616    }
10617
10618    /// Remove client-level roles from the client's scope.
10619    ///
10620    /// Parameters:
10621    ///
10622    /// - `realm`: realm name (not id!)
10623    /// - `client_uuid`: id of client (not client-id!)
10624    /// - `client`
10625    /// - `body`
10626    ///
10627    /// Resource: `Scope Mappings`
10628    ///
10629    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}`
10630    ///
10631    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidscope_mappingsclientsclient>
10632    ///
10633    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/clients/{client}`
10634    #[cfg(feature = "tag-scope-mappings")]
10635    pub async fn realm_clients_with_client_uuid_scope_mappings_clients_with_client_delete(
10636        &self,
10637        realm: &str,
10638        client_uuid: &str,
10639        client: &str,
10640        body: Vec<RoleRepresentation>,
10641    ) -> Result<(), KeycloakError> {
10642        let realm = p(realm);
10643        let client_uuid = p(client_uuid);
10644        let client = p(client);
10645        let builder = self
10646            .client
10647            .delete(format!(
10648                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}",
10649                self.url
10650            ))
10651            .json(&body)
10652            .bearer_auth(self.token_supplier.get(&self.url).await?);
10653        let response = builder.send().await?;
10654        error_check(response).await?;
10655        Ok(())
10656    }
10657
10658    /// The available client-level roles Returns the roles for the client that can be associated with the client's scope
10659    ///
10660    /// Parameters:
10661    ///
10662    /// - `realm`: realm name (not id!)
10663    /// - `client_uuid`: id of client (not client-id!)
10664    /// - `client`
10665    ///
10666    /// Resource: `Scope Mappings`
10667    ///
10668    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}/available`
10669    ///
10670    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsclientsclientavailable>
10671    ///
10672    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/clients/{client}/available`
10673    #[cfg(feature = "tag-scope-mappings")]
10674    pub async fn realm_clients_with_client_uuid_scope_mappings_clients_with_client_available_get(
10675        &self,
10676        realm: &str,
10677        client_uuid: &str,
10678        client: &str,
10679    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10680        let realm = p(realm);
10681        let client_uuid = p(client_uuid);
10682        let client = p(client);
10683        let builder = self
10684            .client
10685            .get(format!(
10686                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}/available",
10687                self.url
10688            ))
10689            .bearer_auth(self.token_supplier.get(&self.url).await?);
10690        let response = builder.send().await?;
10691        Ok(error_check(response).await?.json().await?)
10692    }
10693
10694    /// Get effective client roles Returns the roles for the client that are associated with the client's scope.
10695    ///
10696    /// Parameters:
10697    ///
10698    /// - `realm`: realm name (not id!)
10699    /// - `client_uuid`: id of client (not client-id!)
10700    /// - `client`
10701    /// - `brief_representation`: if false, return roles with their attributes
10702    ///
10703    /// Resource: `Scope Mappings`
10704    ///
10705    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}/composite`
10706    ///
10707    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsclientsclientcomposite>
10708    ///
10709    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/clients/{client}/composite`
10710    #[cfg(feature = "tag-scope-mappings")]
10711    pub async fn realm_clients_with_client_uuid_scope_mappings_clients_with_client_composite_get(
10712        &self,
10713        realm: &str,
10714        client_uuid: &str,
10715        client: &str,
10716        brief_representation: Option<bool>,
10717    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10718        let realm = p(realm);
10719        let client_uuid = p(client_uuid);
10720        let client = p(client);
10721        let mut builder = self
10722            .client
10723            .get(format!(
10724                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/clients/{client}/composite",
10725                self.url
10726            ))
10727            .bearer_auth(self.token_supplier.get(&self.url).await?);
10728        if let Some(v) = brief_representation {
10729            builder = builder.query(&[("briefRepresentation", v)]);
10730        }
10731        let response = builder.send().await?;
10732        Ok(error_check(response).await?.json().await?)
10733    }
10734
10735    /// Get realm-level roles associated with the client's scope
10736    ///
10737    /// Parameters:
10738    ///
10739    /// - `realm`: realm name (not id!)
10740    /// - `client_uuid`: id of client (not client-id!)
10741    ///
10742    /// Resource: `Scope Mappings`
10743    ///
10744    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm`
10745    ///
10746    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsrealm>
10747    ///
10748    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/realm`
10749    #[cfg(feature = "tag-scope-mappings")]
10750    pub async fn realm_clients_with_client_uuid_scope_mappings_realm_get(
10751        &self,
10752        realm: &str,
10753        client_uuid: &str,
10754    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10755        let realm = p(realm);
10756        let client_uuid = p(client_uuid);
10757        let builder = self
10758            .client
10759            .get(format!(
10760                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm",
10761                self.url
10762            ))
10763            .bearer_auth(self.token_supplier.get(&self.url).await?);
10764        let response = builder.send().await?;
10765        Ok(error_check(response).await?.json().await?)
10766    }
10767
10768    /// Add a set of realm-level roles to the client's scope
10769    ///
10770    /// Parameters:
10771    ///
10772    /// - `realm`: realm name (not id!)
10773    /// - `client_uuid`: id of client (not client-id!)
10774    /// - `body`
10775    ///
10776    /// Returns id of created resource
10777    ///
10778    /// Resource: `Scope Mappings`
10779    ///
10780    /// `POST /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm`
10781    ///
10782    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidscope_mappingsrealm>
10783    ///
10784    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/realm`
10785    #[cfg(feature = "tag-scope-mappings")]
10786    pub async fn realm_clients_with_client_uuid_scope_mappings_realm_post(
10787        &self,
10788        realm: &str,
10789        client_uuid: &str,
10790        body: Vec<RoleRepresentation>,
10791    ) -> Result<Option<TypeString>, KeycloakError> {
10792        let realm = p(realm);
10793        let client_uuid = p(client_uuid);
10794        let builder = self
10795            .client
10796            .post(format!(
10797                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm",
10798                self.url
10799            ))
10800            .json(&body)
10801            .bearer_auth(self.token_supplier.get(&self.url).await?);
10802        let response = builder.send().await?;
10803        error_check(response).await.map(to_id)
10804    }
10805
10806    /// Remove a set of realm-level roles from the client's scope
10807    ///
10808    /// Parameters:
10809    ///
10810    /// - `realm`: realm name (not id!)
10811    /// - `client_uuid`: id of client (not client-id!)
10812    /// - `body`
10813    ///
10814    /// Resource: `Scope Mappings`
10815    ///
10816    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm`
10817    ///
10818    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidscope_mappingsrealm>
10819    ///
10820    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/realm`
10821    #[cfg(feature = "tag-scope-mappings")]
10822    pub async fn realm_clients_with_client_uuid_scope_mappings_realm_delete(
10823        &self,
10824        realm: &str,
10825        client_uuid: &str,
10826        body: Vec<RoleRepresentation>,
10827    ) -> Result<(), KeycloakError> {
10828        let realm = p(realm);
10829        let client_uuid = p(client_uuid);
10830        let builder = self
10831            .client
10832            .delete(format!(
10833                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm",
10834                self.url
10835            ))
10836            .json(&body)
10837            .bearer_auth(self.token_supplier.get(&self.url).await?);
10838        let response = builder.send().await?;
10839        error_check(response).await?;
10840        Ok(())
10841    }
10842
10843    /// Get realm-level roles that are available to attach to this client's scope
10844    ///
10845    /// Parameters:
10846    ///
10847    /// - `realm`: realm name (not id!)
10848    /// - `client_uuid`: id of client (not client-id!)
10849    ///
10850    /// Resource: `Scope Mappings`
10851    ///
10852    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm/available`
10853    ///
10854    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsrealmavailable>
10855    ///
10856    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/realm/available`
10857    #[cfg(feature = "tag-scope-mappings")]
10858    pub async fn realm_clients_with_client_uuid_scope_mappings_realm_available_get(
10859        &self,
10860        realm: &str,
10861        client_uuid: &str,
10862    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10863        let realm = p(realm);
10864        let client_uuid = p(client_uuid);
10865        let builder = self
10866            .client
10867            .get(format!(
10868                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm/available",
10869                self.url
10870            ))
10871            .bearer_auth(self.token_supplier.get(&self.url).await?);
10872        let response = builder.send().await?;
10873        Ok(error_check(response).await?.json().await?)
10874    }
10875
10876    /// Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists.
10877    ///
10878    /// Parameters:
10879    ///
10880    /// - `realm`: realm name (not id!)
10881    /// - `client_uuid`: id of client (not client-id!)
10882    /// - `brief_representation`: if false, return roles with their attributes
10883    ///
10884    /// Resource: `Scope Mappings`
10885    ///
10886    /// `GET /admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm/composite`
10887    ///
10888    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidscope_mappingsrealmcomposite>
10889    ///
10890    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/scope-mappings/realm/composite`
10891    #[cfg(feature = "tag-scope-mappings")]
10892    pub async fn realm_clients_with_client_uuid_scope_mappings_realm_composite_get(
10893        &self,
10894        realm: &str,
10895        client_uuid: &str,
10896        brief_representation: Option<bool>,
10897    ) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
10898        let realm = p(realm);
10899        let client_uuid = p(client_uuid);
10900        let mut builder = self
10901            .client
10902            .get(format!(
10903                "{}/admin/realms/{realm}/clients/{client_uuid}/scope-mappings/realm/composite",
10904                self.url
10905            ))
10906            .bearer_auth(self.token_supplier.get(&self.url).await?);
10907        if let Some(v) = brief_representation {
10908            builder = builder.query(&[("briefRepresentation", v)]);
10909        }
10910        let response = builder.send().await?;
10911        Ok(error_check(response).await?.json().await?)
10912    }
10913
10914    // <h4>Users</h4>
10915
10916    /// Get users Returns a stream of users, filtered according to query parameters.
10917    ///
10918    /// Parameters:
10919    ///
10920    /// - `realm`: realm name (not id!)
10921    /// - `brief_representation`: Boolean which defines whether brief representations are returned (default: false)
10922    /// - `email`: A String contained in email, or the complete email, if param "exact" is true
10923    /// - `email_verified`: whether the email has been verified
10924    /// - `enabled`: Boolean representing if user is enabled or not
10925    /// - `exact`: Boolean which defines whether the params "last", "first", "email" and "username" must match exactly
10926    /// - `first`: Pagination offset
10927    /// - `first_name`: A String contained in firstName, or the complete firstName, if param "exact" is true
10928    /// - `idp_alias`: The alias of an Identity Provider linked to the user
10929    /// - `idp_user_id`: The userId at an Identity Provider linked to the user
10930    /// - `last_name`: A String contained in lastName, or the complete lastName, if param "exact" is true
10931    /// - `max`: Maximum results size (defaults to 100)
10932    /// - `q`: A query to search for custom attributes, in the format 'key1:value2 key2:value2'
10933    /// - `search`: A String contained in username, first or last name, or email. Default search behavior is prefix-based (e.g., foo or foo*). Use *foo* for infix search and "foo" for exact search.
10934    /// - `username`: A String contained in username, or the complete username, if param "exact" is true
10935    ///
10936    /// Resource: `Users`
10937    ///
10938    /// `GET /admin/realms/{realm}/users`
10939    ///
10940    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusers>
10941    #[cfg(feature = "tag-users")]
10942    #[allow(clippy::too_many_arguments)]
10943    pub async fn realm_users_get(
10944        &self,
10945        realm: &str,
10946        brief_representation: Option<bool>,
10947        email: Option<String>,
10948        email_verified: Option<bool>,
10949        enabled: Option<bool>,
10950        exact: Option<bool>,
10951        first: Option<i32>,
10952        first_name: Option<String>,
10953        idp_alias: Option<String>,
10954        idp_user_id: Option<String>,
10955        last_name: Option<String>,
10956        max: Option<i32>,
10957        q: Option<String>,
10958        search: Option<String>,
10959        username: Option<String>,
10960    ) -> Result<TypeVec<UserRepresentation>, KeycloakError> {
10961        let realm = p(realm);
10962        let mut builder = self
10963            .client
10964            .get(format!("{}/admin/realms/{realm}/users", self.url))
10965            .bearer_auth(self.token_supplier.get(&self.url).await?);
10966        if let Some(v) = brief_representation {
10967            builder = builder.query(&[("briefRepresentation", v)]);
10968        }
10969        if let Some(v) = email {
10970            builder = builder.query(&[("email", v)]);
10971        }
10972        if let Some(v) = email_verified {
10973            builder = builder.query(&[("emailVerified", v)]);
10974        }
10975        if let Some(v) = enabled {
10976            builder = builder.query(&[("enabled", v)]);
10977        }
10978        if let Some(v) = exact {
10979            builder = builder.query(&[("exact", v)]);
10980        }
10981        if let Some(v) = first {
10982            builder = builder.query(&[("first", v)]);
10983        }
10984        if let Some(v) = first_name {
10985            builder = builder.query(&[("firstName", v)]);
10986        }
10987        if let Some(v) = idp_alias {
10988            builder = builder.query(&[("idpAlias", v)]);
10989        }
10990        if let Some(v) = idp_user_id {
10991            builder = builder.query(&[("idpUserId", v)]);
10992        }
10993        if let Some(v) = last_name {
10994            builder = builder.query(&[("lastName", v)]);
10995        }
10996        if let Some(v) = max {
10997            builder = builder.query(&[("max", v)]);
10998        }
10999        if let Some(v) = q {
11000            builder = builder.query(&[("q", v)]);
11001        }
11002        if let Some(v) = search {
11003            builder = builder.query(&[("search", v)]);
11004        }
11005        if let Some(v) = username {
11006            builder = builder.query(&[("username", v)]);
11007        }
11008        let response = builder.send().await?;
11009        Ok(error_check(response).await?.json().await?)
11010    }
11011
11012    /// Create a new user Username must be unique.
11013    ///
11014    /// Parameters:
11015    ///
11016    /// - `realm`: realm name (not id!)
11017    /// - `body`
11018    ///
11019    /// Returns id of created resource
11020    ///
11021    /// Resource: `Users`
11022    ///
11023    /// `POST /admin/realms/{realm}/users`
11024    ///
11025    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusers>
11026    #[cfg(feature = "tag-users")]
11027    pub async fn realm_users_post(
11028        &self,
11029        realm: &str,
11030        body: UserRepresentation,
11031    ) -> Result<Option<TypeString>, KeycloakError> {
11032        let realm = p(realm);
11033        let builder = self
11034            .client
11035            .post(format!("{}/admin/realms/{realm}/users", self.url))
11036            .json(&body)
11037            .bearer_auth(self.token_supplier.get(&self.url).await?);
11038        let response = builder.send().await?;
11039        error_check(response).await.map(to_id)
11040    }
11041
11042    /// Returns the number of users that match the given criteria.
11043    ///
11044    /// Parameters:
11045    ///
11046    /// - `realm`: realm name (not id!)
11047    /// - `email`: email filter
11048    /// - `email_verified`
11049    /// - `enabled`: Boolean representing if user is enabled or not
11050    /// - `first_name`: first name filter
11051    /// - `last_name`: last name filter
11052    /// - `q`
11053    /// - `search`: arbitrary search string for all the fields below. Default search behavior is prefix-based (e.g., foo or foo*). Use *foo* for infix search and "foo" for exact search.
11054    /// - `username`: username filter
11055    ///
11056    /// Resource: `Users`
11057    ///
11058    /// `GET /admin/realms/{realm}/users/count`
11059    ///
11060    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmuserscount>
11061    #[cfg(feature = "tag-users")]
11062    #[allow(clippy::too_many_arguments)]
11063    pub async fn realm_users_count_get(
11064        &self,
11065        realm: &str,
11066        email: Option<String>,
11067        email_verified: Option<bool>,
11068        enabled: Option<bool>,
11069        first_name: Option<String>,
11070        last_name: Option<String>,
11071        q: Option<String>,
11072        search: Option<String>,
11073        username: Option<String>,
11074    ) -> Result<i32, KeycloakError> {
11075        let realm = p(realm);
11076        let mut builder = self
11077            .client
11078            .get(format!("{}/admin/realms/{realm}/users/count", self.url))
11079            .bearer_auth(self.token_supplier.get(&self.url).await?);
11080        if let Some(v) = email {
11081            builder = builder.query(&[("email", v)]);
11082        }
11083        if let Some(v) = email_verified {
11084            builder = builder.query(&[("emailVerified", v)]);
11085        }
11086        if let Some(v) = enabled {
11087            builder = builder.query(&[("enabled", v)]);
11088        }
11089        if let Some(v) = first_name {
11090            builder = builder.query(&[("firstName", v)]);
11091        }
11092        if let Some(v) = last_name {
11093            builder = builder.query(&[("lastName", v)]);
11094        }
11095        if let Some(v) = q {
11096            builder = builder.query(&[("q", v)]);
11097        }
11098        if let Some(v) = search {
11099            builder = builder.query(&[("search", v)]);
11100        }
11101        if let Some(v) = username {
11102            builder = builder.query(&[("username", v)]);
11103        }
11104        let response = builder.send().await?;
11105        Ok(error_check(response).await?.json().await?)
11106    }
11107
11108    /// Parameters:
11109    ///
11110    /// - `realm`: realm name (not id!)
11111    ///
11112    /// Resource: `Users`
11113    ///
11114    /// `GET /admin/realms/{realm}/users/profile`
11115    ///
11116    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersprofile>
11117    #[cfg(feature = "tag-users")]
11118    pub async fn realm_users_profile_get(&self, realm: &str) -> Result<UPConfig, KeycloakError> {
11119        let realm = p(realm);
11120        let builder = self
11121            .client
11122            .get(format!("{}/admin/realms/{realm}/users/profile", self.url))
11123            .bearer_auth(self.token_supplier.get(&self.url).await?);
11124        let response = builder.send().await?;
11125        Ok(error_check(response).await?.json().await?)
11126    }
11127
11128    /// Parameters:
11129    ///
11130    /// - `realm`: realm name (not id!)
11131    /// - `body`
11132    ///
11133    /// Resource: `Users`
11134    ///
11135    /// `PUT /admin/realms/{realm}/users/profile`
11136    ///
11137    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersprofile>
11138    #[cfg(feature = "tag-users")]
11139    pub async fn realm_users_profile_put(
11140        &self,
11141        realm: &str,
11142        body: UPConfig,
11143    ) -> Result<UPConfig, KeycloakError> {
11144        let realm = p(realm);
11145        let builder = self
11146            .client
11147            .put(format!("{}/admin/realms/{realm}/users/profile", self.url))
11148            .json(&body)
11149            .bearer_auth(self.token_supplier.get(&self.url).await?);
11150        let response = builder.send().await?;
11151        Ok(error_check(response).await?.json().await?)
11152    }
11153
11154    /// Parameters:
11155    ///
11156    /// - `realm`: realm name (not id!)
11157    ///
11158    /// Resource: `Users`
11159    ///
11160    /// `GET /admin/realms/{realm}/users/profile/metadata`
11161    ///
11162    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersprofilemetadata>
11163    #[cfg(feature = "tag-users")]
11164    pub async fn realm_users_profile_metadata_get(
11165        &self,
11166        realm: &str,
11167    ) -> Result<UserProfileMetadata, KeycloakError> {
11168        let realm = p(realm);
11169        let builder = self
11170            .client
11171            .get(format!(
11172                "{}/admin/realms/{realm}/users/profile/metadata",
11173                self.url
11174            ))
11175            .bearer_auth(self.token_supplier.get(&self.url).await?);
11176        let response = builder.send().await?;
11177        Ok(error_check(response).await?.json().await?)
11178    }
11179
11180    /// Get representation of the user
11181    ///
11182    /// Parameters:
11183    ///
11184    /// - `realm`: realm name (not id!)
11185    /// - `user_id`
11186    /// - `user_profile_metadata`: Indicates if the user profile metadata should be added to the response
11187    ///
11188    /// Resource: `Users`
11189    ///
11190    /// `GET /admin/realms/{realm}/users/{user_id}`
11191    ///
11192    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_id>
11193    ///
11194    /// REST method: `GET /admin/realms/{realm}/users/{user-id}`
11195    #[cfg(feature = "tag-users")]
11196    pub async fn realm_users_with_user_id_get(
11197        &self,
11198        realm: &str,
11199        user_id: &str,
11200        user_profile_metadata: Option<bool>,
11201    ) -> Result<UserRepresentation, KeycloakError> {
11202        let realm = p(realm);
11203        let user_id = p(user_id);
11204        let mut builder = self
11205            .client
11206            .get(format!("{}/admin/realms/{realm}/users/{user_id}", self.url))
11207            .bearer_auth(self.token_supplier.get(&self.url).await?);
11208        if let Some(v) = user_profile_metadata {
11209            builder = builder.query(&[("userProfileMetadata", v)]);
11210        }
11211        let response = builder.send().await?;
11212        Ok(error_check(response).await?.json().await?)
11213    }
11214
11215    /// Update the user
11216    ///
11217    /// Parameters:
11218    ///
11219    /// - `realm`: realm name (not id!)
11220    /// - `user_id`
11221    /// - `body`
11222    ///
11223    /// Resource: `Users`
11224    ///
11225    /// `PUT /admin/realms/{realm}/users/{user_id}`
11226    ///
11227    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_id>
11228    ///
11229    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}`
11230    #[cfg(feature = "tag-users")]
11231    pub async fn realm_users_with_user_id_put(
11232        &self,
11233        realm: &str,
11234        user_id: &str,
11235        body: UserRepresentation,
11236    ) -> Result<(), KeycloakError> {
11237        let realm = p(realm);
11238        let user_id = p(user_id);
11239        let builder = self
11240            .client
11241            .put(format!("{}/admin/realms/{realm}/users/{user_id}", self.url))
11242            .json(&body)
11243            .bearer_auth(self.token_supplier.get(&self.url).await?);
11244        let response = builder.send().await?;
11245        error_check(response).await?;
11246        Ok(())
11247    }
11248
11249    /// Delete the user
11250    ///
11251    /// Parameters:
11252    ///
11253    /// - `realm`: realm name (not id!)
11254    /// - `user_id`
11255    ///
11256    /// Resource: `Users`
11257    ///
11258    /// `DELETE /admin/realms/{realm}/users/{user_id}`
11259    ///
11260    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_id>
11261    ///
11262    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}`
11263    #[cfg(feature = "tag-users")]
11264    pub async fn realm_users_with_user_id_delete(
11265        &self,
11266        realm: &str,
11267        user_id: &str,
11268    ) -> Result<(), KeycloakError> {
11269        let realm = p(realm);
11270        let user_id = p(user_id);
11271        let builder = self
11272            .client
11273            .delete(format!("{}/admin/realms/{realm}/users/{user_id}", self.url))
11274            .bearer_auth(self.token_supplier.get(&self.url).await?);
11275        let response = builder.send().await?;
11276        error_check(response).await?;
11277        Ok(())
11278    }
11279
11280    /// Return credential types, which are provided by the user storage where user is stored.
11281    ///
11282    /// Parameters:
11283    ///
11284    /// - `realm`: realm name (not id!)
11285    /// - `user_id`
11286    ///
11287    /// Resource: `Users`
11288    ///
11289    /// `GET /admin/realms/{realm}/users/{user_id}/configured-user-storage-credential-types`
11290    ///
11291    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idconfigured_user_storage_credential_types>
11292    ///
11293    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/configured-user-storage-credential-types`
11294    #[cfg(feature = "tag-users")]
11295    pub async fn realm_users_with_user_id_configured_user_storage_credential_types_get(
11296        &self,
11297        realm: &str,
11298        user_id: &str,
11299    ) -> Result<TypeVec<String>, KeycloakError> {
11300        let realm = p(realm);
11301        let user_id = p(user_id);
11302        let builder = self
11303            .client
11304            .get(format!(
11305                "{}/admin/realms/{realm}/users/{user_id}/configured-user-storage-credential-types",
11306                self.url
11307            ))
11308            .bearer_auth(self.token_supplier.get(&self.url).await?);
11309        let response = builder.send().await?;
11310        Ok(error_check(response).await?.json().await?)
11311    }
11312
11313    /// Get consents granted by the user
11314    ///
11315    /// Parameters:
11316    ///
11317    /// - `realm`: realm name (not id!)
11318    /// - `user_id`
11319    ///
11320    /// Resource: `Users`
11321    ///
11322    /// `GET /admin/realms/{realm}/users/{user_id}/consents`
11323    ///
11324    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idconsents>
11325    ///
11326    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/consents`
11327    #[cfg(feature = "tag-users")]
11328    pub async fn realm_users_with_user_id_consents_get(
11329        &self,
11330        realm: &str,
11331        user_id: &str,
11332    ) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
11333        let realm = p(realm);
11334        let user_id = p(user_id);
11335        let builder = self
11336            .client
11337            .get(format!(
11338                "{}/admin/realms/{realm}/users/{user_id}/consents",
11339                self.url
11340            ))
11341            .bearer_auth(self.token_supplier.get(&self.url).await?);
11342        let response = builder.send().await?;
11343        Ok(error_check(response).await?.json().await?)
11344    }
11345
11346    /// Revoke consent and offline tokens for particular client from user
11347    ///
11348    /// Parameters:
11349    ///
11350    /// - `realm`: realm name (not id!)
11351    /// - `user_id`
11352    /// - `client`: Client id
11353    ///
11354    /// Resource: `Users`
11355    ///
11356    /// `DELETE /admin/realms/{realm}/users/{user_id}/consents/{client}`
11357    ///
11358    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idconsentsclient>
11359    ///
11360    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/consents/{client}`
11361    #[cfg(feature = "tag-users")]
11362    pub async fn realm_users_with_user_id_consents_with_client_delete(
11363        &self,
11364        realm: &str,
11365        user_id: &str,
11366        client: &str,
11367    ) -> Result<(), KeycloakError> {
11368        let realm = p(realm);
11369        let user_id = p(user_id);
11370        let client = p(client);
11371        let builder = self
11372            .client
11373            .delete(format!(
11374                "{}/admin/realms/{realm}/users/{user_id}/consents/{client}",
11375                self.url
11376            ))
11377            .bearer_auth(self.token_supplier.get(&self.url).await?);
11378        let response = builder.send().await?;
11379        error_check(response).await?;
11380        Ok(())
11381    }
11382
11383    /// Parameters:
11384    ///
11385    /// - `realm`: realm name (not id!)
11386    /// - `user_id`
11387    ///
11388    /// Resource: `Users`
11389    ///
11390    /// `GET /admin/realms/{realm}/users/{user_id}/credentials`
11391    ///
11392    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idcredentials>
11393    ///
11394    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/credentials`
11395    #[cfg(feature = "tag-users")]
11396    pub async fn realm_users_with_user_id_credentials_get(
11397        &self,
11398        realm: &str,
11399        user_id: &str,
11400    ) -> Result<TypeVec<CredentialRepresentation>, KeycloakError> {
11401        let realm = p(realm);
11402        let user_id = p(user_id);
11403        let builder = self
11404            .client
11405            .get(format!(
11406                "{}/admin/realms/{realm}/users/{user_id}/credentials",
11407                self.url
11408            ))
11409            .bearer_auth(self.token_supplier.get(&self.url).await?);
11410        let response = builder.send().await?;
11411        Ok(error_check(response).await?.json().await?)
11412    }
11413
11414    /// Remove a credential for a user
11415    ///
11416    /// Parameters:
11417    ///
11418    /// - `realm`: realm name (not id!)
11419    /// - `user_id`
11420    /// - `credential_id`
11421    ///
11422    /// Resource: `Users`
11423    ///
11424    /// `DELETE /admin/realms/{realm}/users/{user_id}/credentials/{credential_id}`
11425    ///
11426    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idcredentialscredentialid>
11427    ///
11428    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/credentials/{credentialId}`
11429    #[cfg(feature = "tag-users")]
11430    pub async fn realm_users_with_user_id_credentials_with_credential_id_delete(
11431        &self,
11432        realm: &str,
11433        user_id: &str,
11434        credential_id: &str,
11435    ) -> Result<(), KeycloakError> {
11436        let realm = p(realm);
11437        let user_id = p(user_id);
11438        let credential_id = p(credential_id);
11439        let builder = self
11440            .client
11441            .delete(format!(
11442                "{}/admin/realms/{realm}/users/{user_id}/credentials/{credential_id}",
11443                self.url
11444            ))
11445            .bearer_auth(self.token_supplier.get(&self.url).await?);
11446        let response = builder.send().await?;
11447        error_check(response).await?;
11448        Ok(())
11449    }
11450
11451    /// Move a credential to a position behind another credential
11452    ///
11453    /// Parameters:
11454    ///
11455    /// - `realm`: realm name (not id!)
11456    /// - `user_id`
11457    /// - `credential_id`: The credential to move
11458    /// - `new_previous_credential_id`: The credential that will be the previous element in the list. If set to null, the moved credential will be the first element in the list.
11459    ///
11460    /// Returns id of created resource
11461    ///
11462    /// Resource: `Users`
11463    ///
11464    /// `POST /admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/moveAfter/{new_previous_credential_id}`
11465    ///
11466    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idcredentialscredentialidmoveafternewpreviouscredentialid>
11467    ///
11468    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/credentials/{credentialId}/moveAfter/{newPreviousCredentialId}`
11469    #[cfg(feature = "tag-users")]
11470    pub async fn realm_users_with_user_id_credentials_with_credential_id_move_after_with_new_previous_credential_id_post(
11471        &self,
11472        realm: &str,
11473        user_id: &str,
11474        credential_id: &str,
11475        new_previous_credential_id: &str,
11476    ) -> Result<Option<TypeString>, KeycloakError> {
11477        let realm = p(realm);
11478        let user_id = p(user_id);
11479        let credential_id = p(credential_id);
11480        let new_previous_credential_id = p(new_previous_credential_id);
11481        let builder = self
11482            .client
11483            .post(format!(
11484                "{}/admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/moveAfter/{new_previous_credential_id}",
11485                self.url
11486            ))
11487            .bearer_auth(self.token_supplier.get(&self.url).await?);
11488        let response = builder.send().await?;
11489        error_check(response).await.map(to_id)
11490    }
11491
11492    /// Move a credential to a first position in the credentials list of the user
11493    ///
11494    /// Parameters:
11495    ///
11496    /// - `realm`: realm name (not id!)
11497    /// - `user_id`
11498    /// - `credential_id`: The credential to move
11499    ///
11500    /// Returns id of created resource
11501    ///
11502    /// Resource: `Users`
11503    ///
11504    /// `POST /admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/moveToFirst`
11505    ///
11506    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idcredentialscredentialidmovetofirst>
11507    ///
11508    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/credentials/{credentialId}/moveToFirst`
11509    #[cfg(feature = "tag-users")]
11510    pub async fn realm_users_with_user_id_credentials_with_credential_id_move_to_first_post(
11511        &self,
11512        realm: &str,
11513        user_id: &str,
11514        credential_id: &str,
11515    ) -> Result<Option<TypeString>, KeycloakError> {
11516        let realm = p(realm);
11517        let user_id = p(user_id);
11518        let credential_id = p(credential_id);
11519        let builder = self
11520            .client
11521            .post(format!(
11522                "{}/admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/moveToFirst",
11523                self.url
11524            ))
11525            .bearer_auth(self.token_supplier.get(&self.url).await?);
11526        let response = builder.send().await?;
11527        error_check(response).await.map(to_id)
11528    }
11529
11530    /// Update a credential label for a user
11531    ///
11532    /// Parameters:
11533    ///
11534    /// - `realm`: realm name (not id!)
11535    /// - `user_id`
11536    /// - `credential_id`
11537    /// - `body`
11538    ///
11539    /// Resource: `Users`
11540    ///
11541    /// `PUT /admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/userLabel`
11542    ///
11543    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idcredentialscredentialiduserlabel>
11544    ///
11545    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/credentials/{credentialId}/userLabel`
11546    #[cfg(feature = "tag-users")]
11547    pub async fn realm_users_with_user_id_credentials_with_credential_id_user_label_put(
11548        &self,
11549        realm: &str,
11550        user_id: &str,
11551        credential_id: &str,
11552        body: String,
11553    ) -> Result<(), KeycloakError> {
11554        let realm = p(realm);
11555        let user_id = p(user_id);
11556        let credential_id = p(credential_id);
11557        let builder = self
11558            .client
11559            .put(format!(
11560                "{}/admin/realms/{realm}/users/{user_id}/credentials/{credential_id}/userLabel",
11561                self.url
11562            ))
11563            .body(body)
11564            .bearer_auth(self.token_supplier.get(&self.url).await?);
11565        let response = builder.send().await?;
11566        error_check(response).await?;
11567        Ok(())
11568    }
11569
11570    /// Disable all credentials for a user of a specific type
11571    ///
11572    /// Parameters:
11573    ///
11574    /// - `realm`: realm name (not id!)
11575    /// - `user_id`
11576    /// - `body`
11577    ///
11578    /// Resource: `Users`
11579    ///
11580    /// `PUT /admin/realms/{realm}/users/{user_id}/disable-credential-types`
11581    ///
11582    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_iddisable_credential_types>
11583    ///
11584    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/disable-credential-types`
11585    #[cfg(feature = "tag-users")]
11586    pub async fn realm_users_with_user_id_disable_credential_types_put(
11587        &self,
11588        realm: &str,
11589        user_id: &str,
11590        body: Vec<String>,
11591    ) -> Result<(), KeycloakError> {
11592        let realm = p(realm);
11593        let user_id = p(user_id);
11594        let builder = self
11595            .client
11596            .put(format!(
11597                "{}/admin/realms/{realm}/users/{user_id}/disable-credential-types",
11598                self.url
11599            ))
11600            .json(&body)
11601            .bearer_auth(self.token_supplier.get(&self.url).await?);
11602        let response = builder.send().await?;
11603        error_check(response).await?;
11604        Ok(())
11605    }
11606
11607    /// Send an email to the user with a link they can click to execute particular actions.
11608    ///
11609    /// Parameters:
11610    ///
11611    /// - `realm`: realm name (not id!)
11612    /// - `user_id`
11613    /// - `client_id`: Client id
11614    /// - `lifespan`: Number of seconds after which the generated token expires
11615    /// - `redirect_uri`: Redirect uri
11616    /// - `body`
11617    ///
11618    /// Resource: `Users`
11619    ///
11620    /// `PUT /admin/realms/{realm}/users/{user_id}/execute-actions-email`
11621    ///
11622    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idexecute_actions_email>
11623    ///
11624    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/execute-actions-email`
11625    #[cfg(feature = "tag-users")]
11626    pub async fn realm_users_with_user_id_execute_actions_email_put(
11627        &self,
11628        realm: &str,
11629        user_id: &str,
11630        client_id: Option<String>,
11631        lifespan: Option<i32>,
11632        redirect_uri: Option<String>,
11633        body: Vec<String>,
11634    ) -> Result<(), KeycloakError> {
11635        let realm = p(realm);
11636        let user_id = p(user_id);
11637        let mut builder = self
11638            .client
11639            .put(format!(
11640                "{}/admin/realms/{realm}/users/{user_id}/execute-actions-email",
11641                self.url
11642            ))
11643            .json(&body)
11644            .bearer_auth(self.token_supplier.get(&self.url).await?);
11645        if let Some(v) = client_id {
11646            builder = builder.query(&[("client_id", v)]);
11647        }
11648        if let Some(v) = lifespan {
11649            builder = builder.query(&[("lifespan", v)]);
11650        }
11651        if let Some(v) = redirect_uri {
11652            builder = builder.query(&[("redirect_uri", v)]);
11653        }
11654        let response = builder.send().await?;
11655        error_check(response).await?;
11656        Ok(())
11657    }
11658
11659    /// Get social logins associated with the user
11660    ///
11661    /// Parameters:
11662    ///
11663    /// - `realm`: realm name (not id!)
11664    /// - `user_id`
11665    ///
11666    /// Resource: `Users`
11667    ///
11668    /// `GET /admin/realms/{realm}/users/{user_id}/federated-identity`
11669    ///
11670    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idfederated_identity>
11671    ///
11672    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/federated-identity`
11673    #[cfg(feature = "tag-users")]
11674    pub async fn realm_users_with_user_id_federated_identity_get(
11675        &self,
11676        realm: &str,
11677        user_id: &str,
11678    ) -> Result<TypeVec<FederatedIdentityRepresentation>, KeycloakError> {
11679        let realm = p(realm);
11680        let user_id = p(user_id);
11681        let builder = self
11682            .client
11683            .get(format!(
11684                "{}/admin/realms/{realm}/users/{user_id}/federated-identity",
11685                self.url
11686            ))
11687            .bearer_auth(self.token_supplier.get(&self.url).await?);
11688        let response = builder.send().await?;
11689        Ok(error_check(response).await?.json().await?)
11690    }
11691
11692    /// Add a social login provider to the user
11693    ///
11694    /// Parameters:
11695    ///
11696    /// - `realm`: realm name (not id!)
11697    /// - `user_id`
11698    /// - `provider`: Social login provider id
11699    ///
11700    /// Returns id of created resource
11701    ///
11702    /// Resource: `Users`
11703    ///
11704    /// `POST /admin/realms/{realm}/users/{user_id}/federated-identity/{provider}`
11705    ///
11706    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idfederated_identityprovider>
11707    ///
11708    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/federated-identity/{provider}`
11709    #[cfg(feature = "tag-users")]
11710    pub async fn realm_users_with_user_id_federated_identity_with_provider_post(
11711        &self,
11712        realm: &str,
11713        user_id: &str,
11714        provider: &str,
11715    ) -> Result<Option<TypeString>, KeycloakError> {
11716        let realm = p(realm);
11717        let user_id = p(user_id);
11718        let provider = p(provider);
11719        let builder = self
11720            .client
11721            .post(format!(
11722                "{}/admin/realms/{realm}/users/{user_id}/federated-identity/{provider}",
11723                self.url
11724            ))
11725            .bearer_auth(self.token_supplier.get(&self.url).await?);
11726        let response = builder.send().await?;
11727        error_check(response).await.map(to_id)
11728    }
11729
11730    /// Remove a social login provider from user
11731    ///
11732    /// Parameters:
11733    ///
11734    /// - `realm`: realm name (not id!)
11735    /// - `user_id`
11736    /// - `provider`: Social login provider id
11737    ///
11738    /// Resource: `Users`
11739    ///
11740    /// `DELETE /admin/realms/{realm}/users/{user_id}/federated-identity/{provider}`
11741    ///
11742    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idfederated_identityprovider>
11743    ///
11744    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/federated-identity/{provider}`
11745    #[cfg(feature = "tag-users")]
11746    pub async fn realm_users_with_user_id_federated_identity_with_provider_delete(
11747        &self,
11748        realm: &str,
11749        user_id: &str,
11750        provider: &str,
11751    ) -> Result<(), KeycloakError> {
11752        let realm = p(realm);
11753        let user_id = p(user_id);
11754        let provider = p(provider);
11755        let builder = self
11756            .client
11757            .delete(format!(
11758                "{}/admin/realms/{realm}/users/{user_id}/federated-identity/{provider}",
11759                self.url
11760            ))
11761            .bearer_auth(self.token_supplier.get(&self.url).await?);
11762        let response = builder.send().await?;
11763        error_check(response).await?;
11764        Ok(())
11765    }
11766
11767    /// Parameters:
11768    ///
11769    /// - `realm`: realm name (not id!)
11770    /// - `user_id`
11771    /// - `brief_representation`
11772    /// - `first`
11773    /// - `max`
11774    /// - `search`
11775    ///
11776    /// Resource: `Users`
11777    ///
11778    /// `GET /admin/realms/{realm}/users/{user_id}/groups`
11779    ///
11780    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idgroups>
11781    ///
11782    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/groups`
11783    #[cfg(feature = "tag-users")]
11784    pub async fn realm_users_with_user_id_groups_get(
11785        &self,
11786        realm: &str,
11787        user_id: &str,
11788        brief_representation: Option<bool>,
11789        first: Option<i32>,
11790        max: Option<i32>,
11791        search: Option<String>,
11792    ) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
11793        let realm = p(realm);
11794        let user_id = p(user_id);
11795        let mut builder = self
11796            .client
11797            .get(format!(
11798                "{}/admin/realms/{realm}/users/{user_id}/groups",
11799                self.url
11800            ))
11801            .bearer_auth(self.token_supplier.get(&self.url).await?);
11802        if let Some(v) = brief_representation {
11803            builder = builder.query(&[("briefRepresentation", v)]);
11804        }
11805        if let Some(v) = first {
11806            builder = builder.query(&[("first", v)]);
11807        }
11808        if let Some(v) = max {
11809            builder = builder.query(&[("max", v)]);
11810        }
11811        if let Some(v) = search {
11812            builder = builder.query(&[("search", v)]);
11813        }
11814        let response = builder.send().await?;
11815        Ok(error_check(response).await?.json().await?)
11816    }
11817
11818    /// Parameters:
11819    ///
11820    /// - `realm`: realm name (not id!)
11821    /// - `user_id`
11822    /// - `search`
11823    ///
11824    /// Resource: `Users`
11825    ///
11826    /// `GET /admin/realms/{realm}/users/{user_id}/groups/count`
11827    ///
11828    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idgroupscount>
11829    ///
11830    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/groups/count`
11831    #[cfg(feature = "tag-users")]
11832    pub async fn realm_users_with_user_id_groups_count_get(
11833        &self,
11834        realm: &str,
11835        user_id: &str,
11836        search: Option<String>,
11837    ) -> Result<TypeMap<String, i64>, KeycloakError> {
11838        let realm = p(realm);
11839        let user_id = p(user_id);
11840        let mut builder = self
11841            .client
11842            .get(format!(
11843                "{}/admin/realms/{realm}/users/{user_id}/groups/count",
11844                self.url
11845            ))
11846            .bearer_auth(self.token_supplier.get(&self.url).await?);
11847        if let Some(v) = search {
11848            builder = builder.query(&[("search", v)]);
11849        }
11850        let response = builder.send().await?;
11851        Ok(error_check(response).await?.json().await?)
11852    }
11853
11854    /// Parameters:
11855    ///
11856    /// - `realm`: realm name (not id!)
11857    /// - `user_id`
11858    /// - `group_id`
11859    ///
11860    /// Resource: `Users`
11861    ///
11862    /// `PUT /admin/realms/{realm}/users/{user_id}/groups/{group_id}`
11863    ///
11864    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idgroupsgroupid>
11865    ///
11866    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/groups/{groupId}`
11867    #[cfg(feature = "tag-users")]
11868    pub async fn realm_users_with_user_id_groups_with_group_id_put(
11869        &self,
11870        realm: &str,
11871        user_id: &str,
11872        group_id: &str,
11873    ) -> Result<(), KeycloakError> {
11874        let realm = p(realm);
11875        let user_id = p(user_id);
11876        let group_id = p(group_id);
11877        let builder = self
11878            .client
11879            .put(format!(
11880                "{}/admin/realms/{realm}/users/{user_id}/groups/{group_id}",
11881                self.url
11882            ))
11883            .header(CONTENT_LENGTH, "0")
11884            .bearer_auth(self.token_supplier.get(&self.url).await?);
11885        let response = builder.send().await?;
11886        error_check(response).await?;
11887        Ok(())
11888    }
11889
11890    /// Parameters:
11891    ///
11892    /// - `realm`: realm name (not id!)
11893    /// - `user_id`
11894    /// - `group_id`
11895    ///
11896    /// Resource: `Users`
11897    ///
11898    /// `DELETE /admin/realms/{realm}/users/{user_id}/groups/{group_id}`
11899    ///
11900    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmusersuser_idgroupsgroupid>
11901    ///
11902    /// REST method: `DELETE /admin/realms/{realm}/users/{user-id}/groups/{groupId}`
11903    #[cfg(feature = "tag-users")]
11904    pub async fn realm_users_with_user_id_groups_with_group_id_delete(
11905        &self,
11906        realm: &str,
11907        user_id: &str,
11908        group_id: &str,
11909    ) -> Result<(), KeycloakError> {
11910        let realm = p(realm);
11911        let user_id = p(user_id);
11912        let group_id = p(group_id);
11913        let builder = self
11914            .client
11915            .delete(format!(
11916                "{}/admin/realms/{realm}/users/{user_id}/groups/{group_id}",
11917                self.url
11918            ))
11919            .bearer_auth(self.token_supplier.get(&self.url).await?);
11920        let response = builder.send().await?;
11921        error_check(response).await?;
11922        Ok(())
11923    }
11924
11925    /// Impersonate the user
11926    ///
11927    /// Parameters:
11928    ///
11929    /// - `realm`: realm name (not id!)
11930    /// - `user_id`
11931    ///
11932    /// Resource: `Users`
11933    ///
11934    /// `POST /admin/realms/{realm}/users/{user_id}/impersonation`
11935    ///
11936    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idimpersonation>
11937    ///
11938    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/impersonation`
11939    #[cfg(feature = "tag-users")]
11940    pub async fn realm_users_with_user_id_impersonation_post(
11941        &self,
11942        realm: &str,
11943        user_id: &str,
11944    ) -> Result<TypeMap<String, Value>, KeycloakError> {
11945        let realm = p(realm);
11946        let user_id = p(user_id);
11947        let builder = self
11948            .client
11949            .post(format!(
11950                "{}/admin/realms/{realm}/users/{user_id}/impersonation",
11951                self.url
11952            ))
11953            .bearer_auth(self.token_supplier.get(&self.url).await?);
11954        let response = builder.send().await?;
11955        Ok(error_check(response).await?.json().await?)
11956    }
11957
11958    /// Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user.
11959    ///
11960    /// Parameters:
11961    ///
11962    /// - `realm`: realm name (not id!)
11963    /// - `user_id`
11964    ///
11965    /// Returns id of created resource
11966    ///
11967    /// Resource: `Users`
11968    ///
11969    /// `POST /admin/realms/{realm}/users/{user_id}/logout`
11970    ///
11971    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmusersuser_idlogout>
11972    ///
11973    /// REST method: `POST /admin/realms/{realm}/users/{user-id}/logout`
11974    #[cfg(feature = "tag-users")]
11975    pub async fn realm_users_with_user_id_logout_post(
11976        &self,
11977        realm: &str,
11978        user_id: &str,
11979    ) -> Result<Option<TypeString>, KeycloakError> {
11980        let realm = p(realm);
11981        let user_id = p(user_id);
11982        let builder = self
11983            .client
11984            .post(format!(
11985                "{}/admin/realms/{realm}/users/{user_id}/logout",
11986                self.url
11987            ))
11988            .bearer_auth(self.token_supplier.get(&self.url).await?);
11989        let response = builder.send().await?;
11990        error_check(response).await.map(to_id)
11991    }
11992
11993    /// Get offline sessions associated with the user and client
11994    ///
11995    /// Parameters:
11996    ///
11997    /// - `realm`: realm name (not id!)
11998    /// - `user_id`
11999    /// - `client_uuid`
12000    ///
12001    /// Resource: `Users`
12002    ///
12003    /// `GET /admin/realms/{realm}/users/{user_id}/offline-sessions/{client_uuid}`
12004    ///
12005    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idoffline_sessionsclientuuid>
12006    ///
12007    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/offline-sessions/{clientUuid}`
12008    #[cfg(feature = "tag-users")]
12009    pub async fn realm_users_with_user_id_offline_sessions_with_client_uuid_get(
12010        &self,
12011        realm: &str,
12012        user_id: &str,
12013        client_uuid: &str,
12014    ) -> Result<TypeVec<UserSessionRepresentation>, KeycloakError> {
12015        let realm = p(realm);
12016        let user_id = p(user_id);
12017        let client_uuid = p(client_uuid);
12018        let builder = self
12019            .client
12020            .get(format!(
12021                "{}/admin/realms/{realm}/users/{user_id}/offline-sessions/{client_uuid}",
12022                self.url
12023            ))
12024            .bearer_auth(self.token_supplier.get(&self.url).await?);
12025        let response = builder.send().await?;
12026        Ok(error_check(response).await?.json().await?)
12027    }
12028
12029    /// Set up a new password for the user.
12030    ///
12031    /// Parameters:
12032    ///
12033    /// - `realm`: realm name (not id!)
12034    /// - `user_id`
12035    /// - `body`
12036    ///
12037    /// Resource: `Users`
12038    ///
12039    /// `PUT /admin/realms/{realm}/users/{user_id}/reset-password`
12040    ///
12041    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idreset_password>
12042    ///
12043    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/reset-password`
12044    #[cfg(feature = "tag-users")]
12045    pub async fn realm_users_with_user_id_reset_password_put(
12046        &self,
12047        realm: &str,
12048        user_id: &str,
12049        body: CredentialRepresentation,
12050    ) -> Result<(), KeycloakError> {
12051        let realm = p(realm);
12052        let user_id = p(user_id);
12053        let builder = self
12054            .client
12055            .put(format!(
12056                "{}/admin/realms/{realm}/users/{user_id}/reset-password",
12057                self.url
12058            ))
12059            .json(&body)
12060            .bearer_auth(self.token_supplier.get(&self.url).await?);
12061        let response = builder.send().await?;
12062        error_check(response).await?;
12063        Ok(())
12064    }
12065
12066    /// Send an email to the user with a link they can click to reset their password.
12067    ///
12068    /// Parameters:
12069    ///
12070    /// - `realm`: realm name (not id!)
12071    /// - `user_id`
12072    /// - `client_id`: client id
12073    /// - `redirect_uri`: redirect uri
12074    ///
12075    /// Resource: `Users`
12076    ///
12077    /// `PUT /admin/realms/{realm}/users/{user_id}/reset-password-email`
12078    ///
12079    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idreset_password_email>
12080    ///
12081    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/reset-password-email`
12082    #[cfg(feature = "tag-users")]
12083    #[deprecated]
12084    pub async fn realm_users_with_user_id_reset_password_email_put(
12085        &self,
12086        realm: &str,
12087        user_id: &str,
12088        client_id: Option<String>,
12089        redirect_uri: Option<String>,
12090    ) -> Result<(), KeycloakError> {
12091        let realm = p(realm);
12092        let user_id = p(user_id);
12093        let mut builder = self
12094            .client
12095            .put(format!(
12096                "{}/admin/realms/{realm}/users/{user_id}/reset-password-email",
12097                self.url
12098            ))
12099            .header(CONTENT_LENGTH, "0")
12100            .bearer_auth(self.token_supplier.get(&self.url).await?);
12101        if let Some(v) = client_id {
12102            builder = builder.query(&[("client_id", v)]);
12103        }
12104        if let Some(v) = redirect_uri {
12105            builder = builder.query(&[("redirect_uri", v)]);
12106        }
12107        let response = builder.send().await?;
12108        error_check(response).await?;
12109        Ok(())
12110    }
12111
12112    /// Send an email-verification email to the user An email contains a link the user can click to verify their email address.
12113    ///
12114    /// Parameters:
12115    ///
12116    /// - `realm`: realm name (not id!)
12117    /// - `user_id`
12118    /// - `client_id`: Client id
12119    /// - `lifespan`: Number of seconds after which the generated token expires
12120    /// - `redirect_uri`: Redirect uri
12121    ///
12122    /// Resource: `Users`
12123    ///
12124    /// `PUT /admin/realms/{realm}/users/{user_id}/send-verify-email`
12125    ///
12126    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmusersuser_idsend_verify_email>
12127    ///
12128    /// REST method: `PUT /admin/realms/{realm}/users/{user-id}/send-verify-email`
12129    #[cfg(feature = "tag-users")]
12130    pub async fn realm_users_with_user_id_send_verify_email_put(
12131        &self,
12132        realm: &str,
12133        user_id: &str,
12134        client_id: Option<String>,
12135        lifespan: Option<i32>,
12136        redirect_uri: Option<String>,
12137    ) -> Result<(), KeycloakError> {
12138        let realm = p(realm);
12139        let user_id = p(user_id);
12140        let mut builder = self
12141            .client
12142            .put(format!(
12143                "{}/admin/realms/{realm}/users/{user_id}/send-verify-email",
12144                self.url
12145            ))
12146            .header(CONTENT_LENGTH, "0")
12147            .bearer_auth(self.token_supplier.get(&self.url).await?);
12148        if let Some(v) = client_id {
12149            builder = builder.query(&[("client_id", v)]);
12150        }
12151        if let Some(v) = lifespan {
12152            builder = builder.query(&[("lifespan", v)]);
12153        }
12154        if let Some(v) = redirect_uri {
12155            builder = builder.query(&[("redirect_uri", v)]);
12156        }
12157        let response = builder.send().await?;
12158        error_check(response).await?;
12159        Ok(())
12160    }
12161
12162    /// Get sessions associated with the user
12163    ///
12164    /// Parameters:
12165    ///
12166    /// - `realm`: realm name (not id!)
12167    /// - `user_id`
12168    ///
12169    /// Resource: `Users`
12170    ///
12171    /// `GET /admin/realms/{realm}/users/{user_id}/sessions`
12172    ///
12173    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idsessions>
12174    ///
12175    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/sessions`
12176    #[cfg(feature = "tag-users")]
12177    pub async fn realm_users_with_user_id_sessions_get(
12178        &self,
12179        realm: &str,
12180        user_id: &str,
12181    ) -> Result<TypeVec<UserSessionRepresentation>, KeycloakError> {
12182        let realm = p(realm);
12183        let user_id = p(user_id);
12184        let builder = self
12185            .client
12186            .get(format!(
12187                "{}/admin/realms/{realm}/users/{user_id}/sessions",
12188                self.url
12189            ))
12190            .bearer_auth(self.token_supplier.get(&self.url).await?);
12191        let response = builder.send().await?;
12192        Ok(error_check(response).await?.json().await?)
12193    }
12194
12195    /// Parameters:
12196    ///
12197    /// - `realm`: realm name (not id!)
12198    /// - `user_id`
12199    ///
12200    /// Resource: `Users`
12201    ///
12202    /// `GET /admin/realms/{realm}/users/{user_id}/unmanagedAttributes`
12203    ///
12204    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmusersuser_idunmanagedattributes>
12205    ///
12206    /// REST method: `GET /admin/realms/{realm}/users/{user-id}/unmanagedAttributes`
12207    #[cfg(feature = "tag-users")]
12208    pub async fn realm_users_with_user_id_unmanaged_attributes_get(
12209        &self,
12210        realm: &str,
12211        user_id: &str,
12212    ) -> Result<TypeMap<String, TypeVec<String>>, KeycloakError> {
12213        let realm = p(realm);
12214        let user_id = p(user_id);
12215        let builder = self
12216            .client
12217            .get(format!(
12218                "{}/admin/realms/{realm}/users/{user_id}/unmanagedAttributes",
12219                self.url
12220            ))
12221            .bearer_auth(self.token_supplier.get(&self.url).await?);
12222        let response = builder.send().await?;
12223        Ok(error_check(response).await?.json().await?)
12224    }
12225
12226    // <h4>default</h4>
12227
12228    /// Parameters:
12229    ///
12230    /// - `realm`: realm name (not id!)
12231    /// - `client_uuid`: id of client (not client-id!)
12232    ///
12233    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server`
12234    ///
12235    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_server>
12236    ///
12237    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server`
12238    pub async fn realm_clients_with_client_uuid_authz_resource_server_get(
12239        &self,
12240        realm: &str,
12241        client_uuid: &str,
12242    ) -> Result<ResourceServerRepresentation, KeycloakError> {
12243        let realm = p(realm);
12244        let client_uuid = p(client_uuid);
12245        let builder = self
12246            .client
12247            .get(format!(
12248                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server",
12249                self.url
12250            ))
12251            .bearer_auth(self.token_supplier.get(&self.url).await?);
12252        let response = builder.send().await?;
12253        Ok(error_check(response).await?.json().await?)
12254    }
12255
12256    /// Parameters:
12257    ///
12258    /// - `realm`: realm name (not id!)
12259    /// - `client_uuid`: id of client (not client-id!)
12260    /// - `body`
12261    ///
12262    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server`
12263    ///
12264    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidauthzresource_server>
12265    ///
12266    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server`
12267    pub async fn realm_clients_with_client_uuid_authz_resource_server_put(
12268        &self,
12269        realm: &str,
12270        client_uuid: &str,
12271        body: ResourceServerRepresentation,
12272    ) -> Result<(), KeycloakError> {
12273        let realm = p(realm);
12274        let client_uuid = p(client_uuid);
12275        let builder = self
12276            .client
12277            .put(format!(
12278                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server",
12279                self.url
12280            ))
12281            .json(&body)
12282            .bearer_auth(self.token_supplier.get(&self.url).await?);
12283        let response = builder.send().await?;
12284        error_check(response).await?;
12285        Ok(())
12286    }
12287
12288    /// Parameters:
12289    ///
12290    /// - `realm`: realm name (not id!)
12291    /// - `client_uuid`: id of client (not client-id!)
12292    /// - `body`
12293    ///
12294    /// Returns id of created resource
12295    ///
12296    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/import`
12297    ///
12298    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverimport>
12299    ///
12300    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/import`
12301    pub async fn realm_clients_with_client_uuid_authz_resource_server_import_post(
12302        &self,
12303        realm: &str,
12304        client_uuid: &str,
12305        body: ResourceServerRepresentation,
12306    ) -> Result<Option<TypeString>, KeycloakError> {
12307        let realm = p(realm);
12308        let client_uuid = p(client_uuid);
12309        let builder = self
12310            .client
12311            .post(format!(
12312                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/import",
12313                self.url
12314            ))
12315            .json(&body)
12316            .bearer_auth(self.token_supplier.get(&self.url).await?);
12317        let response = builder.send().await?;
12318        error_check(response).await.map(to_id)
12319    }
12320
12321    /// Parameters:
12322    ///
12323    /// - `realm`: realm name (not id!)
12324    /// - `client_uuid`: id of client (not client-id!)
12325    /// - `fields`
12326    /// - `first`
12327    /// - `max`
12328    /// - `name`
12329    /// - `owner`
12330    /// - `permission`
12331    /// - `policy_id`
12332    /// - `resource`
12333    /// - `scope`
12334    /// - `type_`
12335    ///
12336    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission`
12337    ///
12338    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpermission>
12339    ///
12340    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/permission`
12341    #[allow(clippy::too_many_arguments)]
12342    pub async fn realm_clients_with_client_uuid_authz_resource_server_permission_get(
12343        &self,
12344        realm: &str,
12345        client_uuid: &str,
12346        fields: Option<String>,
12347        first: Option<i32>,
12348        max: Option<i32>,
12349        name: Option<String>,
12350        owner: Option<String>,
12351        permission: Option<bool>,
12352        policy_id: Option<String>,
12353        resource: Option<String>,
12354        scope: Option<String>,
12355        type_: Option<String>,
12356    ) -> Result<(), KeycloakError> {
12357        let realm = p(realm);
12358        let client_uuid = p(client_uuid);
12359        let mut builder = self
12360            .client
12361            .get(format!(
12362                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission",
12363                self.url
12364            ))
12365            .bearer_auth(self.token_supplier.get(&self.url).await?);
12366        if let Some(v) = fields {
12367            builder = builder.query(&[("fields", v)]);
12368        }
12369        if let Some(v) = first {
12370            builder = builder.query(&[("first", v)]);
12371        }
12372        if let Some(v) = max {
12373            builder = builder.query(&[("max", v)]);
12374        }
12375        if let Some(v) = name {
12376            builder = builder.query(&[("name", v)]);
12377        }
12378        if let Some(v) = owner {
12379            builder = builder.query(&[("owner", v)]);
12380        }
12381        if let Some(v) = permission {
12382            builder = builder.query(&[("permission", v)]);
12383        }
12384        if let Some(v) = policy_id {
12385            builder = builder.query(&[("policyId", v)]);
12386        }
12387        if let Some(v) = resource {
12388            builder = builder.query(&[("resource", v)]);
12389        }
12390        if let Some(v) = scope {
12391            builder = builder.query(&[("scope", v)]);
12392        }
12393        if let Some(v) = type_ {
12394            builder = builder.query(&[("type", v)]);
12395        }
12396        let response = builder.send().await?;
12397        error_check(response).await?;
12398        Ok(())
12399    }
12400
12401    /// Parameters:
12402    ///
12403    /// - `realm`: realm name (not id!)
12404    /// - `client_uuid`: id of client (not client-id!)
12405    /// - `body`
12406    ///
12407    /// Returns id of created resource
12408    ///
12409    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission`
12410    ///
12411    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverpermission>
12412    ///
12413    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/permission`
12414    pub async fn realm_clients_with_client_uuid_authz_resource_server_permission_post(
12415        &self,
12416        realm: &str,
12417        client_uuid: &str,
12418        body: String,
12419    ) -> Result<Option<TypeString>, KeycloakError> {
12420        let realm = p(realm);
12421        let client_uuid = p(client_uuid);
12422        let builder = self
12423            .client
12424            .post(format!(
12425                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission",
12426                self.url
12427            ))
12428            .json(&body)
12429            .bearer_auth(self.token_supplier.get(&self.url).await?);
12430        let response = builder.send().await?;
12431        error_check(response).await.map(to_id)
12432    }
12433
12434    /// Parameters:
12435    ///
12436    /// - `realm`: realm name (not id!)
12437    /// - `client_uuid`: id of client (not client-id!)
12438    /// - `body`
12439    ///
12440    /// Returns id of created resource
12441    ///
12442    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/evaluate`
12443    ///
12444    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverpermissionevaluate>
12445    ///
12446    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/permission/evaluate`
12447    pub async fn realm_clients_with_client_uuid_authz_resource_server_permission_evaluate_post(
12448        &self,
12449        realm: &str,
12450        client_uuid: &str,
12451        body: PolicyEvaluationRequest,
12452    ) -> Result<Option<TypeString>, KeycloakError> {
12453        let realm = p(realm);
12454        let client_uuid = p(client_uuid);
12455        let builder = self
12456            .client
12457            .post(format!(
12458                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/evaluate",
12459                self.url
12460            ))
12461            .json(&body)
12462            .bearer_auth(self.token_supplier.get(&self.url).await?);
12463        let response = builder.send().await?;
12464        error_check(response).await.map(to_id)
12465    }
12466
12467    /// Parameters:
12468    ///
12469    /// - `realm`: realm name (not id!)
12470    /// - `client_uuid`: id of client (not client-id!)
12471    ///
12472    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/providers`
12473    ///
12474    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpermissionproviders>
12475    ///
12476    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/permission/providers`
12477    pub async fn realm_clients_with_client_uuid_authz_resource_server_permission_providers_get(
12478        &self,
12479        realm: &str,
12480        client_uuid: &str,
12481    ) -> Result<TypeVec<PolicyProviderRepresentation>, KeycloakError> {
12482        let realm = p(realm);
12483        let client_uuid = p(client_uuid);
12484        let builder = self
12485            .client
12486            .get(format!(
12487                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/providers",
12488                self.url
12489            ))
12490            .bearer_auth(self.token_supplier.get(&self.url).await?);
12491        let response = builder.send().await?;
12492        Ok(error_check(response).await?.json().await?)
12493    }
12494
12495    /// Parameters:
12496    ///
12497    /// - `realm`: realm name (not id!)
12498    /// - `client_uuid`: id of client (not client-id!)
12499    /// - `fields`
12500    /// - `name`
12501    ///
12502    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/search`
12503    ///
12504    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpermissionsearch>
12505    ///
12506    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/permission/search`
12507    pub async fn realm_clients_with_client_uuid_authz_resource_server_permission_search_get(
12508        &self,
12509        realm: &str,
12510        client_uuid: &str,
12511        fields: Option<String>,
12512        name: Option<String>,
12513    ) -> Result<(), KeycloakError> {
12514        let realm = p(realm);
12515        let client_uuid = p(client_uuid);
12516        let mut builder = self
12517            .client
12518            .get(format!(
12519                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/permission/search",
12520                self.url
12521            ))
12522            .bearer_auth(self.token_supplier.get(&self.url).await?);
12523        if let Some(v) = fields {
12524            builder = builder.query(&[("fields", v)]);
12525        }
12526        if let Some(v) = name {
12527            builder = builder.query(&[("name", v)]);
12528        }
12529        let response = builder.send().await?;
12530        error_check(response).await?;
12531        Ok(())
12532    }
12533
12534    /// Parameters:
12535    ///
12536    /// - `realm`: realm name (not id!)
12537    /// - `client_uuid`: id of client (not client-id!)
12538    /// - `fields`
12539    /// - `first`
12540    /// - `max`
12541    /// - `name`
12542    /// - `owner`
12543    /// - `permission`
12544    /// - `policy_id`
12545    /// - `resource`
12546    /// - `scope`
12547    /// - `type_`
12548    ///
12549    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy`
12550    ///
12551    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpolicy>
12552    ///
12553    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/policy`
12554    #[allow(clippy::too_many_arguments)]
12555    pub async fn realm_clients_with_client_uuid_authz_resource_server_policy_get(
12556        &self,
12557        realm: &str,
12558        client_uuid: &str,
12559        fields: Option<String>,
12560        first: Option<i32>,
12561        max: Option<i32>,
12562        name: Option<String>,
12563        owner: Option<String>,
12564        permission: Option<bool>,
12565        policy_id: Option<String>,
12566        resource: Option<String>,
12567        scope: Option<String>,
12568        type_: Option<String>,
12569    ) -> Result<(), KeycloakError> {
12570        let realm = p(realm);
12571        let client_uuid = p(client_uuid);
12572        let mut builder = self
12573            .client
12574            .get(format!(
12575                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy",
12576                self.url
12577            ))
12578            .bearer_auth(self.token_supplier.get(&self.url).await?);
12579        if let Some(v) = fields {
12580            builder = builder.query(&[("fields", v)]);
12581        }
12582        if let Some(v) = first {
12583            builder = builder.query(&[("first", v)]);
12584        }
12585        if let Some(v) = max {
12586            builder = builder.query(&[("max", v)]);
12587        }
12588        if let Some(v) = name {
12589            builder = builder.query(&[("name", v)]);
12590        }
12591        if let Some(v) = owner {
12592            builder = builder.query(&[("owner", v)]);
12593        }
12594        if let Some(v) = permission {
12595            builder = builder.query(&[("permission", v)]);
12596        }
12597        if let Some(v) = policy_id {
12598            builder = builder.query(&[("policyId", v)]);
12599        }
12600        if let Some(v) = resource {
12601            builder = builder.query(&[("resource", v)]);
12602        }
12603        if let Some(v) = scope {
12604            builder = builder.query(&[("scope", v)]);
12605        }
12606        if let Some(v) = type_ {
12607            builder = builder.query(&[("type", v)]);
12608        }
12609        let response = builder.send().await?;
12610        error_check(response).await?;
12611        Ok(())
12612    }
12613
12614    /// Parameters:
12615    ///
12616    /// - `realm`: realm name (not id!)
12617    /// - `client_uuid`: id of client (not client-id!)
12618    /// - `body`
12619    ///
12620    /// Returns id of created resource
12621    ///
12622    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy`
12623    ///
12624    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverpolicy>
12625    ///
12626    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/policy`
12627    pub async fn realm_clients_with_client_uuid_authz_resource_server_policy_post(
12628        &self,
12629        realm: &str,
12630        client_uuid: &str,
12631        body: String,
12632    ) -> Result<Option<TypeString>, KeycloakError> {
12633        let realm = p(realm);
12634        let client_uuid = p(client_uuid);
12635        let builder = self
12636            .client
12637            .post(format!(
12638                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy",
12639                self.url
12640            ))
12641            .json(&body)
12642            .bearer_auth(self.token_supplier.get(&self.url).await?);
12643        let response = builder.send().await?;
12644        error_check(response).await.map(to_id)
12645    }
12646
12647    /// Parameters:
12648    ///
12649    /// - `realm`: realm name (not id!)
12650    /// - `client_uuid`: id of client (not client-id!)
12651    /// - `body`
12652    ///
12653    /// Returns id of created resource
12654    ///
12655    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/evaluate`
12656    ///
12657    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverpolicyevaluate>
12658    ///
12659    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/policy/evaluate`
12660    pub async fn realm_clients_with_client_uuid_authz_resource_server_policy_evaluate_post(
12661        &self,
12662        realm: &str,
12663        client_uuid: &str,
12664        body: PolicyEvaluationRequest,
12665    ) -> Result<Option<TypeString>, KeycloakError> {
12666        let realm = p(realm);
12667        let client_uuid = p(client_uuid);
12668        let builder = self
12669            .client
12670            .post(format!(
12671                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/evaluate",
12672                self.url
12673            ))
12674            .json(&body)
12675            .bearer_auth(self.token_supplier.get(&self.url).await?);
12676        let response = builder.send().await?;
12677        error_check(response).await.map(to_id)
12678    }
12679
12680    /// Parameters:
12681    ///
12682    /// - `realm`: realm name (not id!)
12683    /// - `client_uuid`: id of client (not client-id!)
12684    ///
12685    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/providers`
12686    ///
12687    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpolicyproviders>
12688    ///
12689    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/policy/providers`
12690    pub async fn realm_clients_with_client_uuid_authz_resource_server_policy_providers_get(
12691        &self,
12692        realm: &str,
12693        client_uuid: &str,
12694    ) -> Result<TypeVec<PolicyProviderRepresentation>, KeycloakError> {
12695        let realm = p(realm);
12696        let client_uuid = p(client_uuid);
12697        let builder = self
12698            .client
12699            .get(format!(
12700                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/providers",
12701                self.url
12702            ))
12703            .bearer_auth(self.token_supplier.get(&self.url).await?);
12704        let response = builder.send().await?;
12705        Ok(error_check(response).await?.json().await?)
12706    }
12707
12708    /// Parameters:
12709    ///
12710    /// - `realm`: realm name (not id!)
12711    /// - `client_uuid`: id of client (not client-id!)
12712    /// - `fields`
12713    /// - `name`
12714    ///
12715    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/search`
12716    ///
12717    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverpolicysearch>
12718    ///
12719    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/policy/search`
12720    pub async fn realm_clients_with_client_uuid_authz_resource_server_policy_search_get(
12721        &self,
12722        realm: &str,
12723        client_uuid: &str,
12724        fields: Option<String>,
12725        name: Option<String>,
12726    ) -> Result<(), KeycloakError> {
12727        let realm = p(realm);
12728        let client_uuid = p(client_uuid);
12729        let mut builder = self
12730            .client
12731            .get(format!(
12732                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/policy/search",
12733                self.url
12734            ))
12735            .bearer_auth(self.token_supplier.get(&self.url).await?);
12736        if let Some(v) = fields {
12737            builder = builder.query(&[("fields", v)]);
12738        }
12739        if let Some(v) = name {
12740            builder = builder.query(&[("name", v)]);
12741        }
12742        let response = builder.send().await?;
12743        error_check(response).await?;
12744        Ok(())
12745    }
12746
12747    /// Parameters:
12748    ///
12749    /// - `realm`: realm name (not id!)
12750    /// - `client_uuid`: id of client (not client-id!)
12751    /// - `id`
12752    /// - `deep`
12753    /// - `exact_name`
12754    /// - `first`
12755    /// - `matching_uri`
12756    /// - `max`
12757    /// - `name`
12758    /// - `owner`
12759    /// - `scope`
12760    /// - `type_`
12761    /// - `uri`
12762    ///
12763    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource`
12764    ///
12765    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresource>
12766    ///
12767    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource`
12768    #[allow(clippy::too_many_arguments)]
12769    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_get(
12770        &self,
12771        realm: &str,
12772        client_uuid: &str,
12773        id: Option<String>,
12774        deep: Option<bool>,
12775        exact_name: Option<bool>,
12776        first: Option<i32>,
12777        matching_uri: Option<bool>,
12778        max: Option<i32>,
12779        name: Option<String>,
12780        owner: Option<String>,
12781        scope: Option<String>,
12782        type_: Option<String>,
12783        uri: Option<String>,
12784    ) -> Result<TypeVec<ResourceRepresentation>, KeycloakError> {
12785        let realm = p(realm);
12786        let client_uuid = p(client_uuid);
12787        let mut builder = self
12788            .client
12789            .get(format!(
12790                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource",
12791                self.url
12792            ))
12793            .bearer_auth(self.token_supplier.get(&self.url).await?);
12794        if let Some(v) = id {
12795            builder = builder.query(&[("_id", v)]);
12796        }
12797        if let Some(v) = deep {
12798            builder = builder.query(&[("deep", v)]);
12799        }
12800        if let Some(v) = exact_name {
12801            builder = builder.query(&[("exactName", v)]);
12802        }
12803        if let Some(v) = first {
12804            builder = builder.query(&[("first", v)]);
12805        }
12806        if let Some(v) = matching_uri {
12807            builder = builder.query(&[("matchingUri", v)]);
12808        }
12809        if let Some(v) = max {
12810            builder = builder.query(&[("max", v)]);
12811        }
12812        if let Some(v) = name {
12813            builder = builder.query(&[("name", v)]);
12814        }
12815        if let Some(v) = owner {
12816            builder = builder.query(&[("owner", v)]);
12817        }
12818        if let Some(v) = scope {
12819            builder = builder.query(&[("scope", v)]);
12820        }
12821        if let Some(v) = type_ {
12822            builder = builder.query(&[("type", v)]);
12823        }
12824        if let Some(v) = uri {
12825            builder = builder.query(&[("uri", v)]);
12826        }
12827        let response = builder.send().await?;
12828        Ok(error_check(response).await?.json().await?)
12829    }
12830
12831    /// Parameters:
12832    ///
12833    /// - `realm`: realm name (not id!)
12834    /// - `client_uuid`: id of client (not client-id!)
12835    /// - `id`
12836    /// - `deep`
12837    /// - `exact_name`
12838    /// - `first`
12839    /// - `matching_uri`
12840    /// - `max`
12841    /// - `name`
12842    /// - `owner`
12843    /// - `scope`
12844    /// - `type_`
12845    /// - `uri`
12846    /// - `body`
12847    ///
12848    /// Returns id of created resource
12849    ///
12850    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource`
12851    ///
12852    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverresource>
12853    ///
12854    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource`
12855    #[allow(clippy::too_many_arguments)]
12856    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_post(
12857        &self,
12858        realm: &str,
12859        client_uuid: &str,
12860        id: Option<String>,
12861        deep: Option<bool>,
12862        exact_name: Option<bool>,
12863        first: Option<i32>,
12864        matching_uri: Option<bool>,
12865        max: Option<i32>,
12866        name: Option<String>,
12867        owner: Option<String>,
12868        scope: Option<String>,
12869        type_: Option<String>,
12870        uri: Option<String>,
12871        body: ResourceRepresentation,
12872    ) -> Result<Option<TypeString>, KeycloakError> {
12873        let realm = p(realm);
12874        let client_uuid = p(client_uuid);
12875        let mut builder = self
12876            .client
12877            .post(format!(
12878                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource",
12879                self.url
12880            ))
12881            .json(&body)
12882            .bearer_auth(self.token_supplier.get(&self.url).await?);
12883        if let Some(v) = id {
12884            builder = builder.query(&[("_id", v)]);
12885        }
12886        if let Some(v) = deep {
12887            builder = builder.query(&[("deep", v)]);
12888        }
12889        if let Some(v) = exact_name {
12890            builder = builder.query(&[("exactName", v)]);
12891        }
12892        if let Some(v) = first {
12893            builder = builder.query(&[("first", v)]);
12894        }
12895        if let Some(v) = matching_uri {
12896            builder = builder.query(&[("matchingUri", v)]);
12897        }
12898        if let Some(v) = max {
12899            builder = builder.query(&[("max", v)]);
12900        }
12901        if let Some(v) = name {
12902            builder = builder.query(&[("name", v)]);
12903        }
12904        if let Some(v) = owner {
12905            builder = builder.query(&[("owner", v)]);
12906        }
12907        if let Some(v) = scope {
12908            builder = builder.query(&[("scope", v)]);
12909        }
12910        if let Some(v) = type_ {
12911            builder = builder.query(&[("type", v)]);
12912        }
12913        if let Some(v) = uri {
12914            builder = builder.query(&[("uri", v)]);
12915        }
12916        let response = builder.send().await?;
12917        error_check(response).await.map(to_id)
12918    }
12919
12920    /// Parameters:
12921    ///
12922    /// - `realm`: realm name (not id!)
12923    /// - `client_uuid`: id of client (not client-id!)
12924    /// - `id`
12925    /// - `deep`
12926    /// - `exact_name`
12927    /// - `first`
12928    /// - `matching_uri`
12929    /// - `max`
12930    /// - `name`
12931    /// - `owner`
12932    /// - `scope`
12933    /// - `type_`
12934    /// - `uri`
12935    ///
12936    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/search`
12937    ///
12938    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresourcesearch>
12939    ///
12940    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/search`
12941    #[allow(clippy::too_many_arguments)]
12942    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_search_get(
12943        &self,
12944        realm: &str,
12945        client_uuid: &str,
12946        id: Option<String>,
12947        deep: Option<bool>,
12948        exact_name: Option<bool>,
12949        first: Option<i32>,
12950        matching_uri: Option<bool>,
12951        max: Option<i32>,
12952        name: Option<String>,
12953        owner: Option<String>,
12954        scope: Option<String>,
12955        type_: Option<String>,
12956        uri: Option<String>,
12957    ) -> Result<(), KeycloakError> {
12958        let realm = p(realm);
12959        let client_uuid = p(client_uuid);
12960        let mut builder = self
12961            .client
12962            .get(format!(
12963                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/search",
12964                self.url
12965            ))
12966            .bearer_auth(self.token_supplier.get(&self.url).await?);
12967        if let Some(v) = id {
12968            builder = builder.query(&[("_id", v)]);
12969        }
12970        if let Some(v) = deep {
12971            builder = builder.query(&[("deep", v)]);
12972        }
12973        if let Some(v) = exact_name {
12974            builder = builder.query(&[("exactName", v)]);
12975        }
12976        if let Some(v) = first {
12977            builder = builder.query(&[("first", v)]);
12978        }
12979        if let Some(v) = matching_uri {
12980            builder = builder.query(&[("matchingUri", v)]);
12981        }
12982        if let Some(v) = max {
12983            builder = builder.query(&[("max", v)]);
12984        }
12985        if let Some(v) = name {
12986            builder = builder.query(&[("name", v)]);
12987        }
12988        if let Some(v) = owner {
12989            builder = builder.query(&[("owner", v)]);
12990        }
12991        if let Some(v) = scope {
12992            builder = builder.query(&[("scope", v)]);
12993        }
12994        if let Some(v) = type_ {
12995            builder = builder.query(&[("type", v)]);
12996        }
12997        if let Some(v) = uri {
12998            builder = builder.query(&[("uri", v)]);
12999        }
13000        let response = builder.send().await?;
13001        error_check(response).await?;
13002        Ok(())
13003    }
13004
13005    /// Parameters:
13006    ///
13007    /// - `realm`: realm name (not id!)
13008    /// - `client_uuid`: id of client (not client-id!)
13009    /// - `id`
13010    /// - `deep`
13011    /// - `exact_name`
13012    /// - `first`
13013    /// - `matching_uri`
13014    /// - `max`
13015    /// - `name`
13016    /// - `owner`
13017    /// - `scope`
13018    /// - `type_`
13019    /// - `uri`
13020    /// - `resource_id`
13021    ///
13022    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}`
13023    ///
13024    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_id>
13025    ///
13026    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}`
13027    #[allow(clippy::too_many_arguments)]
13028    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_get(
13029        &self,
13030        realm: &str,
13031        client_uuid: &str,
13032        id: Option<String>,
13033        deep: Option<bool>,
13034        exact_name: Option<bool>,
13035        first: Option<i32>,
13036        matching_uri: Option<bool>,
13037        max: Option<i32>,
13038        name: Option<String>,
13039        owner: Option<String>,
13040        scope: Option<String>,
13041        type_: Option<String>,
13042        uri: Option<String>,
13043        resource_id: &str,
13044    ) -> Result<(), KeycloakError> {
13045        let realm = p(realm);
13046        let client_uuid = p(client_uuid);
13047        let resource_id = p(resource_id);
13048        let mut builder = self
13049            .client
13050            .get(format!(
13051                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}",
13052                self.url
13053            ))
13054            .bearer_auth(self.token_supplier.get(&self.url).await?);
13055        if let Some(v) = id {
13056            builder = builder.query(&[("_id", v)]);
13057        }
13058        if let Some(v) = deep {
13059            builder = builder.query(&[("deep", v)]);
13060        }
13061        if let Some(v) = exact_name {
13062            builder = builder.query(&[("exactName", v)]);
13063        }
13064        if let Some(v) = first {
13065            builder = builder.query(&[("first", v)]);
13066        }
13067        if let Some(v) = matching_uri {
13068            builder = builder.query(&[("matchingUri", v)]);
13069        }
13070        if let Some(v) = max {
13071            builder = builder.query(&[("max", v)]);
13072        }
13073        if let Some(v) = name {
13074            builder = builder.query(&[("name", v)]);
13075        }
13076        if let Some(v) = owner {
13077            builder = builder.query(&[("owner", v)]);
13078        }
13079        if let Some(v) = scope {
13080            builder = builder.query(&[("scope", v)]);
13081        }
13082        if let Some(v) = type_ {
13083            builder = builder.query(&[("type", v)]);
13084        }
13085        if let Some(v) = uri {
13086            builder = builder.query(&[("uri", v)]);
13087        }
13088        let response = builder.send().await?;
13089        error_check(response).await?;
13090        Ok(())
13091    }
13092
13093    /// Parameters:
13094    ///
13095    /// - `realm`: realm name (not id!)
13096    /// - `client_uuid`: id of client (not client-id!)
13097    /// - `id`
13098    /// - `deep`
13099    /// - `exact_name`
13100    /// - `first`
13101    /// - `matching_uri`
13102    /// - `max`
13103    /// - `name`
13104    /// - `owner`
13105    /// - `scope`
13106    /// - `type_`
13107    /// - `uri`
13108    /// - `resource_id`
13109    /// - `body`
13110    ///
13111    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}`
13112    ///
13113    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_id>
13114    ///
13115    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}`
13116    #[allow(clippy::too_many_arguments)]
13117    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_put(
13118        &self,
13119        realm: &str,
13120        client_uuid: &str,
13121        id: Option<String>,
13122        deep: Option<bool>,
13123        exact_name: Option<bool>,
13124        first: Option<i32>,
13125        matching_uri: Option<bool>,
13126        max: Option<i32>,
13127        name: Option<String>,
13128        owner: Option<String>,
13129        scope: Option<String>,
13130        type_: Option<String>,
13131        uri: Option<String>,
13132        resource_id: &str,
13133        body: ResourceRepresentation,
13134    ) -> Result<(), KeycloakError> {
13135        let realm = p(realm);
13136        let client_uuid = p(client_uuid);
13137        let resource_id = p(resource_id);
13138        let mut builder = self
13139            .client
13140            .put(format!(
13141                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}",
13142                self.url
13143            ))
13144            .json(&body)
13145            .bearer_auth(self.token_supplier.get(&self.url).await?);
13146        if let Some(v) = id {
13147            builder = builder.query(&[("_id", v)]);
13148        }
13149        if let Some(v) = deep {
13150            builder = builder.query(&[("deep", v)]);
13151        }
13152        if let Some(v) = exact_name {
13153            builder = builder.query(&[("exactName", v)]);
13154        }
13155        if let Some(v) = first {
13156            builder = builder.query(&[("first", v)]);
13157        }
13158        if let Some(v) = matching_uri {
13159            builder = builder.query(&[("matchingUri", v)]);
13160        }
13161        if let Some(v) = max {
13162            builder = builder.query(&[("max", v)]);
13163        }
13164        if let Some(v) = name {
13165            builder = builder.query(&[("name", v)]);
13166        }
13167        if let Some(v) = owner {
13168            builder = builder.query(&[("owner", v)]);
13169        }
13170        if let Some(v) = scope {
13171            builder = builder.query(&[("scope", v)]);
13172        }
13173        if let Some(v) = type_ {
13174            builder = builder.query(&[("type", v)]);
13175        }
13176        if let Some(v) = uri {
13177            builder = builder.query(&[("uri", v)]);
13178        }
13179        let response = builder.send().await?;
13180        error_check(response).await?;
13181        Ok(())
13182    }
13183
13184    /// Parameters:
13185    ///
13186    /// - `realm`: realm name (not id!)
13187    /// - `client_uuid`: id of client (not client-id!)
13188    /// - `id`
13189    /// - `deep`
13190    /// - `exact_name`
13191    /// - `first`
13192    /// - `matching_uri`
13193    /// - `max`
13194    /// - `name`
13195    /// - `owner`
13196    /// - `scope`
13197    /// - `type_`
13198    /// - `uri`
13199    /// - `resource_id`
13200    ///
13201    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}`
13202    ///
13203    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_id>
13204    ///
13205    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}`
13206    #[allow(clippy::too_many_arguments)]
13207    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_delete(
13208        &self,
13209        realm: &str,
13210        client_uuid: &str,
13211        id: Option<String>,
13212        deep: Option<bool>,
13213        exact_name: Option<bool>,
13214        first: Option<i32>,
13215        matching_uri: Option<bool>,
13216        max: Option<i32>,
13217        name: Option<String>,
13218        owner: Option<String>,
13219        scope: Option<String>,
13220        type_: Option<String>,
13221        uri: Option<String>,
13222        resource_id: &str,
13223    ) -> Result<(), KeycloakError> {
13224        let realm = p(realm);
13225        let client_uuid = p(client_uuid);
13226        let resource_id = p(resource_id);
13227        let mut builder = self
13228            .client
13229            .delete(format!(
13230                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}",
13231                self.url
13232            ))
13233            .bearer_auth(self.token_supplier.get(&self.url).await?);
13234        if let Some(v) = id {
13235            builder = builder.query(&[("_id", v)]);
13236        }
13237        if let Some(v) = deep {
13238            builder = builder.query(&[("deep", v)]);
13239        }
13240        if let Some(v) = exact_name {
13241            builder = builder.query(&[("exactName", v)]);
13242        }
13243        if let Some(v) = first {
13244            builder = builder.query(&[("first", v)]);
13245        }
13246        if let Some(v) = matching_uri {
13247            builder = builder.query(&[("matchingUri", v)]);
13248        }
13249        if let Some(v) = max {
13250            builder = builder.query(&[("max", v)]);
13251        }
13252        if let Some(v) = name {
13253            builder = builder.query(&[("name", v)]);
13254        }
13255        if let Some(v) = owner {
13256            builder = builder.query(&[("owner", v)]);
13257        }
13258        if let Some(v) = scope {
13259            builder = builder.query(&[("scope", v)]);
13260        }
13261        if let Some(v) = type_ {
13262            builder = builder.query(&[("type", v)]);
13263        }
13264        if let Some(v) = uri {
13265            builder = builder.query(&[("uri", v)]);
13266        }
13267        let response = builder.send().await?;
13268        error_check(response).await?;
13269        Ok(())
13270    }
13271
13272    /// Parameters:
13273    ///
13274    /// - `realm`: realm name (not id!)
13275    /// - `client_uuid`: id of client (not client-id!)
13276    /// - `id`
13277    /// - `deep`
13278    /// - `exact_name`
13279    /// - `first`
13280    /// - `matching_uri`
13281    /// - `max`
13282    /// - `name`
13283    /// - `owner`
13284    /// - `scope`
13285    /// - `type_`
13286    /// - `uri`
13287    /// - `resource_id`
13288    ///
13289    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/attributes`
13290    ///
13291    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_idattributes>
13292    ///
13293    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}/attributes`
13294    #[allow(clippy::too_many_arguments)]
13295    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_attributes_get(
13296        &self,
13297        realm: &str,
13298        client_uuid: &str,
13299        id: Option<String>,
13300        deep: Option<bool>,
13301        exact_name: Option<bool>,
13302        first: Option<i32>,
13303        matching_uri: Option<bool>,
13304        max: Option<i32>,
13305        name: Option<String>,
13306        owner: Option<String>,
13307        scope: Option<String>,
13308        type_: Option<String>,
13309        uri: Option<String>,
13310        resource_id: &str,
13311    ) -> Result<(), KeycloakError> {
13312        let realm = p(realm);
13313        let client_uuid = p(client_uuid);
13314        let resource_id = p(resource_id);
13315        let mut builder = self
13316            .client
13317            .get(format!(
13318                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/attributes",
13319                self.url
13320            ))
13321            .bearer_auth(self.token_supplier.get(&self.url).await?);
13322        if let Some(v) = id {
13323            builder = builder.query(&[("_id", v)]);
13324        }
13325        if let Some(v) = deep {
13326            builder = builder.query(&[("deep", v)]);
13327        }
13328        if let Some(v) = exact_name {
13329            builder = builder.query(&[("exactName", v)]);
13330        }
13331        if let Some(v) = first {
13332            builder = builder.query(&[("first", v)]);
13333        }
13334        if let Some(v) = matching_uri {
13335            builder = builder.query(&[("matchingUri", v)]);
13336        }
13337        if let Some(v) = max {
13338            builder = builder.query(&[("max", v)]);
13339        }
13340        if let Some(v) = name {
13341            builder = builder.query(&[("name", v)]);
13342        }
13343        if let Some(v) = owner {
13344            builder = builder.query(&[("owner", v)]);
13345        }
13346        if let Some(v) = scope {
13347            builder = builder.query(&[("scope", v)]);
13348        }
13349        if let Some(v) = type_ {
13350            builder = builder.query(&[("type", v)]);
13351        }
13352        if let Some(v) = uri {
13353            builder = builder.query(&[("uri", v)]);
13354        }
13355        let response = builder.send().await?;
13356        error_check(response).await?;
13357        Ok(())
13358    }
13359
13360    /// Parameters:
13361    ///
13362    /// - `realm`: realm name (not id!)
13363    /// - `client_uuid`: id of client (not client-id!)
13364    /// - `id`
13365    /// - `deep`
13366    /// - `exact_name`
13367    /// - `first`
13368    /// - `matching_uri`
13369    /// - `max`
13370    /// - `name`
13371    /// - `owner`
13372    /// - `scope`
13373    /// - `type_`
13374    /// - `uri`
13375    /// - `resource_id`
13376    ///
13377    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/permissions`
13378    ///
13379    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_idpermissions>
13380    ///
13381    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}/permissions`
13382    #[allow(clippy::too_many_arguments)]
13383    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_permissions_get(
13384        &self,
13385        realm: &str,
13386        client_uuid: &str,
13387        id: Option<String>,
13388        deep: Option<bool>,
13389        exact_name: Option<bool>,
13390        first: Option<i32>,
13391        matching_uri: Option<bool>,
13392        max: Option<i32>,
13393        name: Option<String>,
13394        owner: Option<String>,
13395        scope: Option<String>,
13396        type_: Option<String>,
13397        uri: Option<String>,
13398        resource_id: &str,
13399    ) -> Result<(), KeycloakError> {
13400        let realm = p(realm);
13401        let client_uuid = p(client_uuid);
13402        let resource_id = p(resource_id);
13403        let mut builder = self
13404            .client
13405            .get(format!(
13406                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/permissions",
13407                self.url
13408            ))
13409            .bearer_auth(self.token_supplier.get(&self.url).await?);
13410        if let Some(v) = id {
13411            builder = builder.query(&[("_id", v)]);
13412        }
13413        if let Some(v) = deep {
13414            builder = builder.query(&[("deep", v)]);
13415        }
13416        if let Some(v) = exact_name {
13417            builder = builder.query(&[("exactName", v)]);
13418        }
13419        if let Some(v) = first {
13420            builder = builder.query(&[("first", v)]);
13421        }
13422        if let Some(v) = matching_uri {
13423            builder = builder.query(&[("matchingUri", v)]);
13424        }
13425        if let Some(v) = max {
13426            builder = builder.query(&[("max", v)]);
13427        }
13428        if let Some(v) = name {
13429            builder = builder.query(&[("name", v)]);
13430        }
13431        if let Some(v) = owner {
13432            builder = builder.query(&[("owner", v)]);
13433        }
13434        if let Some(v) = scope {
13435            builder = builder.query(&[("scope", v)]);
13436        }
13437        if let Some(v) = type_ {
13438            builder = builder.query(&[("type", v)]);
13439        }
13440        if let Some(v) = uri {
13441            builder = builder.query(&[("uri", v)]);
13442        }
13443        let response = builder.send().await?;
13444        error_check(response).await?;
13445        Ok(())
13446    }
13447
13448    /// Parameters:
13449    ///
13450    /// - `realm`: realm name (not id!)
13451    /// - `client_uuid`: id of client (not client-id!)
13452    /// - `id`
13453    /// - `deep`
13454    /// - `exact_name`
13455    /// - `first`
13456    /// - `matching_uri`
13457    /// - `max`
13458    /// - `name`
13459    /// - `owner`
13460    /// - `scope`
13461    /// - `type_`
13462    /// - `uri`
13463    /// - `resource_id`
13464    ///
13465    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/scopes`
13466    ///
13467    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverresourceresource_idscopes>
13468    ///
13469    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/resource/{resource-id}/scopes`
13470    #[allow(clippy::too_many_arguments)]
13471    pub async fn realm_clients_with_client_uuid_authz_resource_server_resource_with_resource_id_scopes_get(
13472        &self,
13473        realm: &str,
13474        client_uuid: &str,
13475        id: Option<String>,
13476        deep: Option<bool>,
13477        exact_name: Option<bool>,
13478        first: Option<i32>,
13479        matching_uri: Option<bool>,
13480        max: Option<i32>,
13481        name: Option<String>,
13482        owner: Option<String>,
13483        scope: Option<String>,
13484        type_: Option<String>,
13485        uri: Option<String>,
13486        resource_id: &str,
13487    ) -> Result<(), KeycloakError> {
13488        let realm = p(realm);
13489        let client_uuid = p(client_uuid);
13490        let resource_id = p(resource_id);
13491        let mut builder = self
13492            .client
13493            .get(format!(
13494                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/resource/{resource_id}/scopes",
13495                self.url
13496            ))
13497            .bearer_auth(self.token_supplier.get(&self.url).await?);
13498        if let Some(v) = id {
13499            builder = builder.query(&[("_id", v)]);
13500        }
13501        if let Some(v) = deep {
13502            builder = builder.query(&[("deep", v)]);
13503        }
13504        if let Some(v) = exact_name {
13505            builder = builder.query(&[("exactName", v)]);
13506        }
13507        if let Some(v) = first {
13508            builder = builder.query(&[("first", v)]);
13509        }
13510        if let Some(v) = matching_uri {
13511            builder = builder.query(&[("matchingUri", v)]);
13512        }
13513        if let Some(v) = max {
13514            builder = builder.query(&[("max", v)]);
13515        }
13516        if let Some(v) = name {
13517            builder = builder.query(&[("name", v)]);
13518        }
13519        if let Some(v) = owner {
13520            builder = builder.query(&[("owner", v)]);
13521        }
13522        if let Some(v) = scope {
13523            builder = builder.query(&[("scope", v)]);
13524        }
13525        if let Some(v) = type_ {
13526            builder = builder.query(&[("type", v)]);
13527        }
13528        if let Some(v) = uri {
13529            builder = builder.query(&[("uri", v)]);
13530        }
13531        let response = builder.send().await?;
13532        error_check(response).await?;
13533        Ok(())
13534    }
13535
13536    /// Parameters:
13537    ///
13538    /// - `realm`: realm name (not id!)
13539    /// - `client_uuid`: id of client (not client-id!)
13540    /// - `first`
13541    /// - `max`
13542    /// - `name`
13543    /// - `scope_id`
13544    ///
13545    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope`
13546    ///
13547    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverscope>
13548    ///
13549    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope`
13550    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_get(
13551        &self,
13552        realm: &str,
13553        client_uuid: &str,
13554        first: Option<i32>,
13555        max: Option<i32>,
13556        name: Option<String>,
13557        scope_id: Option<String>,
13558    ) -> Result<TypeVec<ScopeRepresentation>, KeycloakError> {
13559        let realm = p(realm);
13560        let client_uuid = p(client_uuid);
13561        let mut builder = self
13562            .client
13563            .get(format!(
13564                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope",
13565                self.url
13566            ))
13567            .bearer_auth(self.token_supplier.get(&self.url).await?);
13568        if let Some(v) = first {
13569            builder = builder.query(&[("first", v)]);
13570        }
13571        if let Some(v) = max {
13572            builder = builder.query(&[("max", v)]);
13573        }
13574        if let Some(v) = name {
13575            builder = builder.query(&[("name", v)]);
13576        }
13577        if let Some(v) = scope_id {
13578            builder = builder.query(&[("scopeId", v)]);
13579        }
13580        let response = builder.send().await?;
13581        Ok(error_check(response).await?.json().await?)
13582    }
13583
13584    /// Parameters:
13585    ///
13586    /// - `realm`: realm name (not id!)
13587    /// - `client_uuid`: id of client (not client-id!)
13588    /// - `body`
13589    ///
13590    /// Returns id of created resource
13591    ///
13592    /// `POST /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope`
13593    ///
13594    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_post_adminrealmsrealmclientsclient_uuidauthzresource_serverscope>
13595    ///
13596    /// REST method: `POST /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope`
13597    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_post(
13598        &self,
13599        realm: &str,
13600        client_uuid: &str,
13601        body: ScopeRepresentation,
13602    ) -> Result<Option<TypeString>, KeycloakError> {
13603        let realm = p(realm);
13604        let client_uuid = p(client_uuid);
13605        let builder = self
13606            .client
13607            .post(format!(
13608                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope",
13609                self.url
13610            ))
13611            .json(&body)
13612            .bearer_auth(self.token_supplier.get(&self.url).await?);
13613        let response = builder.send().await?;
13614        error_check(response).await.map(to_id)
13615    }
13616
13617    /// Parameters:
13618    ///
13619    /// - `realm`: realm name (not id!)
13620    /// - `client_uuid`: id of client (not client-id!)
13621    /// - `name`
13622    ///
13623    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/search`
13624    ///
13625    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverscopesearch>
13626    ///
13627    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/search`
13628    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_search_get(
13629        &self,
13630        realm: &str,
13631        client_uuid: &str,
13632        name: Option<String>,
13633    ) -> Result<(), KeycloakError> {
13634        let realm = p(realm);
13635        let client_uuid = p(client_uuid);
13636        let mut builder = self
13637            .client
13638            .get(format!(
13639                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/search",
13640                self.url
13641            ))
13642            .bearer_auth(self.token_supplier.get(&self.url).await?);
13643        if let Some(v) = name {
13644            builder = builder.query(&[("name", v)]);
13645        }
13646        let response = builder.send().await?;
13647        error_check(response).await?;
13648        Ok(())
13649    }
13650
13651    /// Parameters:
13652    ///
13653    /// - `realm`: realm name (not id!)
13654    /// - `client_uuid`: id of client (not client-id!)
13655    /// - `scope_id`
13656    ///
13657    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}`
13658    ///
13659    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverscopescope_id>
13660    ///
13661    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/{scope-id}`
13662    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_with_scope_id_get(
13663        &self,
13664        realm: &str,
13665        client_uuid: &str,
13666        scope_id: &str,
13667    ) -> Result<(), KeycloakError> {
13668        let realm = p(realm);
13669        let client_uuid = p(client_uuid);
13670        let scope_id = p(scope_id);
13671        let builder = self
13672            .client
13673            .get(format!(
13674                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}",
13675                self.url
13676            ))
13677            .bearer_auth(self.token_supplier.get(&self.url).await?);
13678        let response = builder.send().await?;
13679        error_check(response).await?;
13680        Ok(())
13681    }
13682
13683    /// Parameters:
13684    ///
13685    /// - `realm`: realm name (not id!)
13686    /// - `client_uuid`: id of client (not client-id!)
13687    /// - `scope_id`
13688    /// - `body`
13689    ///
13690    /// `PUT /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}`
13691    ///
13692    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_put_adminrealmsrealmclientsclient_uuidauthzresource_serverscopescope_id>
13693    ///
13694    /// REST method: `PUT /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/{scope-id}`
13695    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_with_scope_id_put(
13696        &self,
13697        realm: &str,
13698        client_uuid: &str,
13699        scope_id: &str,
13700        body: ScopeRepresentation,
13701    ) -> Result<(), KeycloakError> {
13702        let realm = p(realm);
13703        let client_uuid = p(client_uuid);
13704        let scope_id = p(scope_id);
13705        let builder = self
13706            .client
13707            .put(format!(
13708                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}",
13709                self.url
13710            ))
13711            .json(&body)
13712            .bearer_auth(self.token_supplier.get(&self.url).await?);
13713        let response = builder.send().await?;
13714        error_check(response).await?;
13715        Ok(())
13716    }
13717
13718    /// Parameters:
13719    ///
13720    /// - `realm`: realm name (not id!)
13721    /// - `client_uuid`: id of client (not client-id!)
13722    /// - `scope_id`
13723    ///
13724    /// `DELETE /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}`
13725    ///
13726    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_delete_adminrealmsrealmclientsclient_uuidauthzresource_serverscopescope_id>
13727    ///
13728    /// REST method: `DELETE /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/{scope-id}`
13729    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_with_scope_id_delete(
13730        &self,
13731        realm: &str,
13732        client_uuid: &str,
13733        scope_id: &str,
13734    ) -> Result<(), KeycloakError> {
13735        let realm = p(realm);
13736        let client_uuid = p(client_uuid);
13737        let scope_id = p(scope_id);
13738        let builder = self
13739            .client
13740            .delete(format!(
13741                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}",
13742                self.url
13743            ))
13744            .bearer_auth(self.token_supplier.get(&self.url).await?);
13745        let response = builder.send().await?;
13746        error_check(response).await?;
13747        Ok(())
13748    }
13749
13750    /// Parameters:
13751    ///
13752    /// - `realm`: realm name (not id!)
13753    /// - `client_uuid`: id of client (not client-id!)
13754    /// - `scope_id`
13755    ///
13756    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}/permissions`
13757    ///
13758    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverscopescope_idpermissions>
13759    ///
13760    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/{scope-id}/permissions`
13761    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_with_scope_id_permissions_get(
13762        &self,
13763        realm: &str,
13764        client_uuid: &str,
13765        scope_id: &str,
13766    ) -> Result<(), KeycloakError> {
13767        let realm = p(realm);
13768        let client_uuid = p(client_uuid);
13769        let scope_id = p(scope_id);
13770        let builder = self
13771            .client
13772            .get(format!(
13773                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}/permissions",
13774                self.url
13775            ))
13776            .bearer_auth(self.token_supplier.get(&self.url).await?);
13777        let response = builder.send().await?;
13778        error_check(response).await?;
13779        Ok(())
13780    }
13781
13782    /// Parameters:
13783    ///
13784    /// - `realm`: realm name (not id!)
13785    /// - `client_uuid`: id of client (not client-id!)
13786    /// - `scope_id`
13787    ///
13788    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}/resources`
13789    ///
13790    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serverscopescope_idresources>
13791    ///
13792    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/scope/{scope-id}/resources`
13793    pub async fn realm_clients_with_client_uuid_authz_resource_server_scope_with_scope_id_resources_get(
13794        &self,
13795        realm: &str,
13796        client_uuid: &str,
13797        scope_id: &str,
13798    ) -> Result<(), KeycloakError> {
13799        let realm = p(realm);
13800        let client_uuid = p(client_uuid);
13801        let scope_id = p(scope_id);
13802        let builder = self
13803            .client
13804            .get(format!(
13805                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/scope/{scope_id}/resources",
13806                self.url
13807            ))
13808            .bearer_auth(self.token_supplier.get(&self.url).await?);
13809        let response = builder.send().await?;
13810        error_check(response).await?;
13811        Ok(())
13812    }
13813
13814    /// Parameters:
13815    ///
13816    /// - `realm`: realm name (not id!)
13817    /// - `client_uuid`: id of client (not client-id!)
13818    ///
13819    /// `GET /admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/settings`
13820    ///
13821    /// Documentation: <https://www.keycloak.org/docs-api/26.1.0/rest-api/index.html#_get_adminrealmsrealmclientsclient_uuidauthzresource_serversettings>
13822    ///
13823    /// REST method: `GET /admin/realms/{realm}/clients/{client-uuid}/authz/resource-server/settings`
13824    pub async fn realm_clients_with_client_uuid_authz_resource_server_settings_get(
13825        &self,
13826        realm: &str,
13827        client_uuid: &str,
13828    ) -> Result<ResourceServerRepresentation, KeycloakError> {
13829        let realm = p(realm);
13830        let client_uuid = p(client_uuid);
13831        let builder = self
13832            .client
13833            .get(format!(
13834                "{}/admin/realms/{realm}/clients/{client_uuid}/authz/resource-server/settings",
13835                self.url
13836            ))
13837            .bearer_auth(self.token_supplier.get(&self.url).await?);
13838        let response = builder.send().await?;
13839        Ok(error_check(response).await?.json().await?)
13840    }
13841}