btcpayserver/BTCPayServer.Client/BTCPayServerClient.Stores.cs

41 lines
1.6 KiB
C#
Raw Normal View History

2020-04-01 08:21:54 +02:00
using System;
2020-03-24 16:18:43 +01:00
using System.Collections.Generic;
2020-03-31 14:43:35 +02:00
using System.Net.Http;
2020-03-24 16:18:43 +01:00
using System.Threading;
using System.Threading.Tasks;
using BTCPayServer.Client.Models;
namespace BTCPayServer.Client;
public partial class BTCPayServerClient
2020-03-24 16:18:43 +01:00
{
public virtual async Task<IEnumerable<StoreData>> GetStores(CancellationToken token = default)
2020-03-24 16:18:43 +01:00
{
return await SendHttpRequest<IEnumerable<StoreData>>("api/v1/stores", null, HttpMethod.Get, token);
}
2020-06-28 10:55:27 +02:00
public virtual async Task<StoreData> GetStore(string storeId, CancellationToken token = default)
{
return await SendHttpRequest<StoreData>($"api/v1/stores/{storeId}", null, HttpMethod.Get, token);
}
2020-06-28 10:55:27 +02:00
public virtual async Task RemoveStore(string storeId, CancellationToken token = default)
{
await SendHttpRequest($"api/v1/stores/{storeId}", null, HttpMethod.Delete, token);
}
2020-06-28 10:55:27 +02:00
public virtual async Task<StoreData> CreateStore(CreateStoreRequest request, CancellationToken token = default)
{
if (request == null) throw new ArgumentNullException(nameof(request));
return await SendHttpRequest<StoreData>("api/v1/stores", request, HttpMethod.Post, token);
}
2020-04-01 08:21:54 +02:00
public virtual async Task<StoreData> UpdateStore(string storeId, UpdateStoreRequest request, CancellationToken token = default)
{
if (request == null) throw new ArgumentNullException(nameof(request));
if (storeId == null) throw new ArgumentNullException(nameof(storeId));
return await SendHttpRequest<StoreData>($"api/v1/stores/{storeId}", request, HttpMethod.Put, token);
2020-03-24 16:18:43 +01:00
}
2020-03-24 16:18:43 +01:00
}