mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
e99767c7e2
Slightly big PR because I started refactoring to reduce code duplication between the UI based business logic and the api one.
24 lines
874 B
C#
24 lines
874 B
C#
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Client.Models;
|
|
|
|
namespace BTCPayServer.Client
|
|
{
|
|
public partial class BTCPayServerClient
|
|
{
|
|
public virtual async Task<ApplicationUserData> GetCurrentUser(CancellationToken token = default)
|
|
{
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/users/me"), token);
|
|
return await HandleResponse<ApplicationUserData>(response);
|
|
}
|
|
|
|
public virtual async Task<ApplicationUserData> CreateUser(CreateApplicationUserRequest request,
|
|
CancellationToken token = default)
|
|
{
|
|
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/users", null, request, HttpMethod.Post), token);
|
|
return await HandleResponse<ApplicationUserData>(response);
|
|
}
|
|
}
|
|
}
|