diff --git a/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs b/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs index 7e4d7c52..61dfdc9d 100644 --- a/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs +++ b/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs @@ -44,8 +44,10 @@ internal static class KeycloakClientApiConstants internal const string GetGroups = $"{GetRealm}/groups"; + internal const string CreateGroup = $"{GetRealm}/groups"; internal const string GetGroup = $"{GetRealm}/groups/{{id}}"; + internal const string UpdateGroup = $"{GetRealm}/groups/{{id}}"; #endregion } diff --git a/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs index acd65722..c81bb985 100644 --- a/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs +++ b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs @@ -30,4 +30,29 @@ public interface IKeycloakGroupClient /// The group representation. [Get(KeycloakClientApiConstants.GetGroup)] Task GetGroup(string realm, [AliasAs("id")] string groupId); + + /// + /// Create a new group. + /// + /// + /// Group name must be unique. + /// + /// Realm name (not ID). + /// Group representation. + /// + [Post(KeycloakClientApiConstants.CreateGroup)] + [Headers("Content-Type: application/json")] + Task CreateGroup(string realm, [Body] Group group); + + /// + /// Update the group. + /// + /// Realm name (not ID). + /// group ID. + /// Group representation. + /// + [Put(KeycloakClientApiConstants.UpdateGroup)] + [Headers("Content-Type: application/json")] + Task UpdateGroup(string realm, [AliasAs("id")] string groupId, [Body] Group group); + }