2022-10-12 15:19:33 +02:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BTCPayServer.Client.Models;
|
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
namespace BTCPayServer.Client;
|
|
|
|
|
|
|
|
public partial class BTCPayServerClient
|
2022-10-12 15:19:33 +02:00
|
|
|
{
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<StoreRateConfiguration> GetStoreRateConfiguration(string storeId, CancellationToken token = default)
|
2022-10-12 15:19:33 +02:00
|
|
|
{
|
2024-06-19 15:25:33 +02:00
|
|
|
return await SendHttpRequest<StoreRateConfiguration>($"api/v1/stores/{storeId}/rates/configuration", null, HttpMethod.Get, token);
|
|
|
|
}
|
2022-10-12 15:19:33 +02:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<List<RateSource>> GetRateSources(CancellationToken token = default)
|
|
|
|
{
|
|
|
|
return await SendHttpRequest<List<RateSource>>("misc/rate-sources", null, HttpMethod.Get, token);
|
|
|
|
}
|
2022-10-12 15:19:33 +02:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<StoreRateConfiguration> UpdateStoreRateConfiguration(string storeId, StoreRateConfiguration request, CancellationToken token = default)
|
|
|
|
{
|
|
|
|
return await SendHttpRequest<StoreRateConfiguration>($"api/v1/stores/{storeId}/rates/configuration", request, HttpMethod.Put, token);
|
|
|
|
}
|
2022-10-12 15:19:33 +02:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<List<StoreRateResult>> PreviewUpdateStoreRateConfiguration(string storeId, StoreRateConfiguration request, string[] currencyPair = null, CancellationToken token = default)
|
|
|
|
{
|
|
|
|
var queryPayload = currencyPair == null ? null : new Dictionary<string, object> { { "currencyPair", currencyPair } };
|
|
|
|
return await SendHttpRequest<StoreRateConfiguration, List<StoreRateResult>>($"api/v1/stores/{storeId}/rates/configuration/preview", queryPayload, request, HttpMethod.Post, token);
|
|
|
|
}
|
2023-01-31 06:42:25 +01:00
|
|
|
|
2024-06-19 15:25:33 +02:00
|
|
|
public virtual async Task<List<StoreRateResult>> GetStoreRates(string storeId, string[] currencyPair = null, CancellationToken token = default)
|
|
|
|
{
|
|
|
|
var queryPayload = currencyPair == null ? null : new Dictionary<string, object> { { "currencyPair", currencyPair } };
|
|
|
|
return await SendHttpRequest<List<StoreRateResult>>($"api/v1/stores/{storeId}/rates", queryPayload, HttpMethod.Get, token);
|
2022-10-12 15:19:33 +02:00
|
|
|
}
|
|
|
|
}
|