mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 01:43:50 +01:00
f8f98ab7f0
* Allow overrides on all methods * Add non-returning SendHttpRequest methods * Use SendHttpRequest consistently * Use file-scoped namespace * Rates: Set default null value for currencyPair * Ensure it works with instances which have BTCPAY_ROOTPATH set
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
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<LightningAddressData[]> GetStoreLightningAddresses(string storeId,
|
|
CancellationToken token = default)
|
|
{
|
|
return await SendHttpRequest<LightningAddressData[]>($"api/v1/stores/{storeId}/lightning-addresses", null, HttpMethod.Get, token);
|
|
}
|
|
|
|
public virtual async Task<LightningAddressData> GetStoreLightningAddress(string storeId, string username,
|
|
CancellationToken token = default)
|
|
{
|
|
return await SendHttpRequest<LightningAddressData>($"api/v1/stores/{storeId}/lightning-addresses/{username}", null, HttpMethod.Get, token);
|
|
}
|
|
|
|
public virtual async Task RemoveStoreLightningAddress(string storeId, string username,
|
|
CancellationToken token = default)
|
|
{
|
|
await SendHttpRequest($"api/v1/stores/{storeId}/lightning-addresses/{username}", null, HttpMethod.Delete, token);
|
|
}
|
|
|
|
public virtual async Task<LightningAddressData> AddOrUpdateStoreLightningAddress(string storeId,
|
|
string username, LightningAddressData data,
|
|
CancellationToken token = default)
|
|
{
|
|
return await SendHttpRequest<LightningAddressData>($"api/v1/stores/{storeId}/lightning-addresses/{username}", data, HttpMethod.Post, token);
|
|
}
|
|
}
|