Skip to content
Open
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
30 changes: 26 additions & 4 deletions src/Keycloak.Net/Users/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,32 @@ public async Task<IEnumerable<User>> GetUsersAsync(string realm, bool? briefRepr
.ConfigureAwait(false);
}

public async Task<int> GetUsersCountAsync(string realm) => await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/users/count")
.GetJsonAsync<int>()
.ConfigureAwait(false);
public async Task<int> GetUsersCountAsync(
string realm,
string email = null,
bool? emailVerified = null,
string firstName = null,
string lastName = null,
string search = null,
string username = null
)
{
var queryParams = new Dictionary<string, object>
{
[nameof(email)] = email,
[nameof(emailVerified)] = emailVerified,
[nameof(firstName)] = firstName,
[nameof(lastName)] = lastName,
[nameof(search)] = search,
[nameof(username)] = username
};

return await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/users/count")
.SetQueryParams(queryParams)
.GetJsonAsync<int>()
.ConfigureAwait(false);
}

public async Task<User> GetUserAsync(string realm, string userId) => await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/users/{userId}")
Expand Down