New API endpoint: Find 1 user by ID or by email, or list all users. (#3176)

Co-authored-by: Kukks <evilkukka@gmail.com>
This commit is contained in:
Wouter Samaey
2022-02-15 16:19:52 +01:00
committed by GitHub
parent 03bc91fd1e
commit 288fbda54f
9 changed files with 246 additions and 17 deletions

View File

@@ -27,6 +27,18 @@ namespace BTCPayServer.Client
await HandleResponse(response);
}
public virtual async Task<ApplicationUserData> GetUserByIdOrEmail(string idOrEmail, CancellationToken token = default)
{
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/users/{idOrEmail}", null, HttpMethod.Get), token);
return await HandleResponse<ApplicationUserData>(response);
}
public virtual async Task<ApplicationUserData[]> GetUsers( CancellationToken token = default)
{
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/users/", null, HttpMethod.Get), token);
return await HandleResponse<ApplicationUserData[]>(response);
}
public virtual async Task DeleteCurrentUser(CancellationToken token = default)
{
await DeleteUser("me", token);