using System.Collections.Generic; 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 GetStoreRateConfiguration(string storeId, CancellationToken token = default) { using var response = await _httpClient.SendAsync( CreateHttpRequest($"api/v1/stores/{storeId}/rates/configuration", method: HttpMethod.Get), token); return await HandleResponse(response); } public virtual async Task> GetRateSources( CancellationToken token = default) { using var response = await _httpClient.SendAsync( CreateHttpRequest($"misc/rate-sources", method: HttpMethod.Get), token); return await HandleResponse>(response); } public virtual async Task UpdateStoreRateConfiguration(string storeId, StoreRateConfiguration request, CancellationToken token = default) { using var response = await _httpClient.SendAsync( CreateHttpRequest($"api/v1/stores/{storeId}/rates/configuration", bodyPayload: request, method: HttpMethod.Put), token); return await HandleResponse(response); } public virtual async Task> PreviewUpdateStoreRateConfiguration(string storeId, StoreRateConfiguration request, string[] currencyPair, CancellationToken token = default) { using var response = await _httpClient.SendAsync( CreateHttpRequest($"api/v1/stores/{storeId}/rates/configuration/preview", bodyPayload: request, queryPayload: new Dictionary() { { "currencyPair", currencyPair } }, method: HttpMethod.Post), token); return await HandleResponse>(response); } public virtual async Task> GetStoreRates(string storeId, string[] currencyPair, CancellationToken token = default) { using var response = await _httpClient.SendAsync( CreateHttpRequest($"api/v1/stores/{storeId}/rates", queryPayload: new Dictionary() { { "currencyPair", currencyPair } }, method: HttpMethod.Get), token); return await HandleResponse>(response); } } }