Files
.circleci
.github
.vscode
BTCPayServer
BTCPayServer.Abstractions
BTCPayServer.Client
JsonConverters
Models
BTCPayServer.Client.csproj
BTCPayServerClient.APIKeys.cs
BTCPayServerClient.Apps.cs
BTCPayServerClient.Authorization.cs
BTCPayServerClient.CustodianAccounts.cs
BTCPayServerClient.Custodians.cs
BTCPayServerClient.Health.cs
BTCPayServerClient.Invoices.cs
BTCPayServerClient.LNURLPayPaymentMethods.cs
BTCPayServerClient.Lightning.Internal.cs
BTCPayServerClient.Lightning.Store.cs
BTCPayServerClient.LightningAddresses.cs
BTCPayServerClient.LightningNetworkPaymentMethods.cs
BTCPayServerClient.Misc.cs
BTCPayServerClient.Notifications.cs
BTCPayServerClient.OnChainPaymentMethods.cs
BTCPayServerClient.OnChainWallet.Objects.cs
BTCPayServerClient.OnChainWallet.cs
BTCPayServerClient.PaymentRequests.cs
BTCPayServerClient.PayoutProcessors.cs
BTCPayServerClient.PullPayments.cs
BTCPayServerClient.ServerInfo.cs
BTCPayServerClient.StoreEmail.cs
BTCPayServerClient.StorePaymentMethods.cs
BTCPayServerClient.StorePayoutProcessors.cs
BTCPayServerClient.StoreRatesConfiguration.cs
BTCPayServerClient.StoreUsers.cs
BTCPayServerClient.Stores.cs
BTCPayServerClient.Users.cs
BTCPayServerClient.Webhooks.cs
BTCPayServerClient.cs
GreenFieldAPIException.cs
GreenFieldValidationException.cs
Permissions.cs
PushNuget.ps1
icon.png
BTCPayServer.Common
BTCPayServer.Data
BTCPayServer.PluginPacker
BTCPayServer.Rating
BTCPayServer.Tests
Build
docs
.dockerignore
.editorconfig
.gitattributes
.gitignore
Changelog.md
LICENSE
README.md
RELEASE-CHECKLIST.md
SECURITY.md
amd64.Dockerfile
arm32v7.Dockerfile
arm64v8.Dockerfile
btcpayserver.sln
btcpayserver.sln.DotSettings
build.ps1
build.sh
docker-entrypoint.sh
nuget.config
publish-docker.ps1
run.ps1
run.sh
btcpayserver/BTCPayServer.Client/BTCPayServerClient.LightningNetworkPaymentMethods.cs
Andrew Camilleri 9f6c7180b2 Greenfield quality of life improvements from feedback ()
* Greenfield quality of life improvements from feedback

fix 

* Greenfield quality of life improvements from feedback

fix 
2021-09-25 14:04:34 +09:00

60 lines
2.5 KiB
C#

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<IEnumerable<LightningNetworkPaymentMethodData>>
GetStoreLightningNetworkPaymentMethods(string storeId, bool? enabled = null,
CancellationToken token = default)
{
var query = new Dictionary<string, object>();
if (enabled != null)
{
query.Add(nameof(enabled), enabled);
}
var response =
await _httpClient.SendAsync(
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork",
query), token);
return await HandleResponse<IEnumerable<LightningNetworkPaymentMethodData>>(response);
}
public virtual async Task<LightningNetworkPaymentMethodData> GetStoreLightningNetworkPaymentMethod(
string storeId,
string cryptoCode, CancellationToken token = default)
{
var response =
await _httpClient.SendAsync(
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}"), token);
return await HandleResponse<LightningNetworkPaymentMethodData>(response);
}
public virtual async Task RemoveStoreLightningNetworkPaymentMethod(string storeId,
string cryptoCode, CancellationToken token = default)
{
var response =
await _httpClient.SendAsync(
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}",
method: HttpMethod.Delete), token);
await HandleResponse(response);
}
public virtual async Task<LightningNetworkPaymentMethodData> UpdateStoreLightningNetworkPaymentMethod(
string storeId,
string cryptoCode, UpdateLightningNetworkPaymentMethodRequest paymentMethod,
CancellationToken token = default)
{
var response = await _httpClient.SendAsync(
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}",
bodyPayload: paymentMethod, method: HttpMethod.Put), token);
return await HandleResponse<LightningNetworkPaymentMethodData>(response);
}
}
}