From f3128ef355aaceb5c00c34f2abfa17b5f0a69289 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Thu, 12 Oct 2023 16:37:49 +0530 Subject: [PATCH 1/2] feat: add invoices method --- README.md | 1 + src/client.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 34032f7..0ee22c4 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ Please have a look a the Alby OAuth2 Wallet API: - accountSummary - accountInformation - accountValue4Value +- invoices - incomingInvoices - outgoingInvoices - getInvoice diff --git a/src/client.ts b/src/client.ts index 9c4d1c1..3171f4b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -113,6 +113,20 @@ export class Client { }); } + invoices( + params: {}, + request_options?: Partial, + ): Promise { + return rest({ + auth: this.auth, + ...this.defaultRequestOptions, + ...request_options, + endpoint: `/invoices`, + params, + method: "GET", + }); + } + getInvoice( paymentHash: string, request_options?: Partial, From 0f429b5bdb95ee315f7b1a1ccd513271b8d03b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Aaron?= Date: Mon, 16 Oct 2023 13:36:22 +0200 Subject: [PATCH 2/2] fix: add params for invoices --- src/client.ts | 7 ++++--- src/types.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/client.ts b/src/client.ts index 3171f4b..a34fd62 100644 --- a/src/client.ts +++ b/src/client.ts @@ -10,6 +10,7 @@ import { CreateWebhookEndpointResponse, GetAccountBalanceResponse, GetAccountInformationResponse, + GetInvoicesRequestParams, Invoice, InvoiceRequestParams, KeysendRequestParams, @@ -86,7 +87,7 @@ export class Client { } incomingInvoices( - params: {}, + params: GetInvoicesRequestParams, request_options?: Partial, ): Promise { return rest({ @@ -100,7 +101,7 @@ export class Client { } outgoingInvoices( - params: {}, + params: GetInvoicesRequestParams, request_options?: Partial, ): Promise { return rest({ @@ -114,7 +115,7 @@ export class Client { } invoices( - params: {}, + params: GetInvoicesRequestParams, request_options?: Partial, ): Promise { return rest({ diff --git a/src/types.ts b/src/types.ts index b639667..a0b6fee 100644 --- a/src/types.ts +++ b/src/types.ts @@ -85,6 +85,16 @@ export type ExtractAlbyResponse = "responses" extends keyof T ? GetSuccess : never; +export type GetInvoicesRequestParams = { + q?: { + since?: string; + created_at_lt?: string; + created_at_gt?: string; + }; + page?: number; + items?: number; +}; + export type InvoiceRequestParams = { description?: string; description_hash?: string;