mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-31 11:54:24 +01:00
* ##3038 add pagination elements * correct skip to take * updated swagger docs * set take nullable to true
This commit is contained in:
@@ -17,6 +17,8 @@ namespace BTCPayServer.Client
|
||||
DateTimeOffset? endDate = null,
|
||||
string textSearch = null,
|
||||
bool includeArchived = false,
|
||||
int? skip = null,
|
||||
int? take = null,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
Dictionary<string, object> queryPayload = new Dictionary<string, object>();
|
||||
@@ -34,6 +36,14 @@ namespace BTCPayServer.Client
|
||||
queryPayload.Add(nameof(textSearch), textSearch);
|
||||
if (status != null)
|
||||
queryPayload.Add(nameof(status), status.Select(s=> s.ToString().ToLower()).ToArray());
|
||||
|
||||
if(skip != null) {
|
||||
queryPayload.Add(nameof(skip), skip);
|
||||
}
|
||||
|
||||
if(take != null) {
|
||||
queryPayload.Add(nameof(take), take);
|
||||
}
|
||||
|
||||
var response =
|
||||
await _httpClient.SendAsync(
|
||||
|
||||
@@ -57,7 +57,10 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
[ModelBinder(typeof(ModelBinders.DateTimeOffsetModelBinder))]
|
||||
DateTimeOffset? endDate = null,
|
||||
[FromQuery] string textSearch = null,
|
||||
[FromQuery] bool includeArchived = false)
|
||||
[FromQuery] bool includeArchived = false,
|
||||
[FromQuery] int? skip = null,
|
||||
[FromQuery] int? take = null
|
||||
)
|
||||
{
|
||||
var store = HttpContext.GetStoreData();
|
||||
if (store == null)
|
||||
@@ -77,6 +80,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
var invoices =
|
||||
await _invoiceRepository.GetInvoices(new InvoiceQuery()
|
||||
{
|
||||
Skip = skip,
|
||||
Take = take,
|
||||
StoreId = new[] {store.Id},
|
||||
IncludeArchived = includeArchived,
|
||||
StartDate = startDate,
|
||||
|
||||
@@ -823,12 +823,16 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
DateTimeOffset? endDate = null,
|
||||
string textSearch = null,
|
||||
bool includeArchived = false,
|
||||
CancellationToken token = default)
|
||||
int? skip = null,
|
||||
int? take = null,
|
||||
CancellationToken token = default
|
||||
|
||||
)
|
||||
{
|
||||
return GetFromActionResult<IEnumerable<InvoiceData>>(
|
||||
await _greenFieldInvoiceController.GetInvoices(storeId, orderId,
|
||||
status?.Select(invoiceStatus => invoiceStatus.ToString())?.ToArray(), startDate,
|
||||
endDate, textSearch, includeArchived));
|
||||
endDate, textSearch, includeArchived,skip,take));
|
||||
}
|
||||
|
||||
public override async Task<InvoiceData> GetInvoice(string storeId, string invoiceId,
|
||||
|
||||
@@ -58,6 +58,26 @@
|
||||
"required": false,
|
||||
"description": "End date of the period to retrieve invoices",
|
||||
"$ref": "#/components/schemas/UnixTimestamp"
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "Number of records to skip",
|
||||
"schema": {
|
||||
"nullable": true,
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"description": "Number of records returned in response",
|
||||
"schema": {
|
||||
"nullable": true,
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
],
|
||||
"description": "View information about the existing invoices",
|
||||
|
||||
Reference in New Issue
Block a user