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..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({ @@ -113,6 +114,20 @@ export class Client { }); } + invoices( + params: GetInvoicesRequestParams, + request_options?: Partial, + ): Promise { + return rest({ + auth: this.auth, + ...this.defaultRequestOptions, + ...request_options, + endpoint: `/invoices`, + params, + method: "GET", + }); + } + getInvoice( paymentHash: string, request_options?: Partial, 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;