using System; 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 CreatePointOfSaleApp(string storeId, CreatePointOfSaleAppRequest request, CancellationToken token = default) { if (request == null) throw new ArgumentNullException(nameof(request)); return await SendHttpRequest($"api/v1/stores/{storeId}/apps/pos", request, HttpMethod.Post, token); } public virtual async Task CreateCrowdfundApp(string storeId, CreateCrowdfundAppRequest request, CancellationToken token = default) { if (request == null) throw new ArgumentNullException(nameof(request)); return await SendHttpRequest($"api/v1/stores/{storeId}/apps/crowdfund", request, HttpMethod.Post, token); } public virtual async Task UpdatePointOfSaleApp(string appId, CreatePointOfSaleAppRequest request, CancellationToken token = default) { if (request == null) throw new ArgumentNullException(nameof(request)); return await SendHttpRequest($"api/v1/apps/pos/{appId}", request, HttpMethod.Put, token); } public virtual async Task GetApp(string appId, CancellationToken token = default) { if (appId == null) throw new ArgumentNullException(nameof(appId)); return await SendHttpRequest($"api/v1/apps/{appId}", null, HttpMethod.Get, token); } public virtual async Task GetAllApps(string storeId, CancellationToken token = default) { if (storeId == null) throw new ArgumentNullException(nameof(storeId)); return await SendHttpRequest($"api/v1/stores/{storeId}/apps", null, HttpMethod.Get, token); } public virtual async Task GetAllApps(CancellationToken token = default) { return await SendHttpRequest("api/v1/apps", null, HttpMethod.Get, token); } public virtual async Task GetPosApp(string appId, CancellationToken token = default) { if (appId == null) throw new ArgumentNullException(nameof(appId)); return await SendHttpRequest($"api/v1/apps/pos/{appId}", null, HttpMethod.Get, token); } public virtual async Task GetCrowdfundApp(string appId, CancellationToken token = default) { if (appId == null) throw new ArgumentNullException(nameof(appId)); return await SendHttpRequest($"api/v1/apps/crowdfund/{appId}", null, HttpMethod.Get, token); } public virtual async Task DeleteApp(string appId, CancellationToken token = default) { if (appId == null) throw new ArgumentNullException(nameof(appId)); await SendHttpRequest($"api/v1/apps/{appId}", null, HttpMethod.Delete, token); } }