Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and Update Groups #54

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
25 changes: 25 additions & 0 deletions src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,29 @@ public interface IKeycloakGroupClient
/// <returns>The group representation.</returns>
[Get(KeycloakClientApiConstants.GetGroup)]
Task<Group> GetGroup(string realm, [AliasAs("id")] string groupId);

/// <summary>
/// Create a new group.
/// </summary>
/// <remarks>
/// Group name must be unique.
/// </remarks>
/// <param name="realm">Realm name (not ID).</param>
/// <param name="group">Group representation.</param>
/// <returns></returns>
[Post(KeycloakClientApiConstants.CreateGroup)]
[Headers("Content-Type: application/json")]
Task<HttpResponseMessage> CreateGroup(string realm, [Body] Group group);

/// <summary>
/// Update the group.
/// </summary>
/// <param name="realm">Realm name (not ID).</param>
/// <param name="groupId">group ID.</param>
/// <param name="group">Group representation.</param>
/// <returns></returns>
[Put(KeycloakClientApiConstants.UpdateGroup)]
[Headers("Content-Type: application/json")]
Task<HttpResponseMessage> UpdateGroup(string realm, [AliasAs("id")] string groupId, [Body] Group group);

}
Loading