From 2c68f53c91e3888e29d5c9107ff85e32180ed21f Mon Sep 17 00:00:00 2001 From: calle <93376500+callebtc@users.noreply.github.com> Date: Sun, 26 Jun 2022 19:05:34 +0200 Subject: [PATCH] /api/v1/payments with limit and offset (#594) --- lnbits/core/views/api.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 3b2f8b3a2..7db3b5c45 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -110,16 +110,15 @@ async def api_update_wallet( @core_app.get("/api/v1/payments") -async def api_payments(wallet: WalletTypeInfo = Depends(get_key_type)): - await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True) +async def api_payments(limit: Optional[int]=None, offset: Optional[int]=None, wallet: WalletTypeInfo = Depends(get_key_type)): pendingPayments = await get_payments( - wallet_id=wallet.wallet.id, pending=True, exclude_uncheckable=True + wallet_id=wallet.wallet.id, pending=True, exclude_uncheckable=True, limit=limit, offset=offset ) for payment in pendingPayments: await check_invoice_status( wallet_id=payment.wallet_id, payment_hash=payment.payment_hash ) - return await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True) + return await get_payments(wallet_id=wallet.wallet.id, pending=True, complete=True, limit=limit, offset=offset) class CreateInvoiceData(BaseModel):