btcpayserver/BTCPayServer.Client/BTCPayServerClient.StoreEmail.cs
d11n f8f98ab7f0
BTCPayServerClient refactoring (#6024)
* 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
2024-06-19 15:25:33 +02:00

25 lines
971 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<EmailSettingsData> GetStoreEmailSettings(string storeId, CancellationToken token = default)
{
return await SendHttpRequest<EmailSettingsData>($"api/v1/stores/{storeId}/email", null, HttpMethod.Get, token);
}
public virtual async Task<EmailSettingsData> UpdateStoreEmailSettings(string storeId, EmailSettingsData request, CancellationToken token = default)
{
return await SendHttpRequest<EmailSettingsData>($"api/v1/stores/{storeId}/email", request, method: HttpMethod.Put, token);
}
public virtual async Task SendEmail(string storeId, SendEmailRequest request, CancellationToken token = default)
{
await SendHttpRequest($"api/v1/stores/{storeId}/email/send", request, HttpMethod.Post, token);
}
}