From 50b723836e70bbe405594f690b73057f9c33fbe4 Mon Sep 17 00:00:00 2001 From: CodeShakingSheep <19874562+CodeShakingSheep@users.noreply.github.com> Date: Wed, 2 Oct 2024 04:09:53 -0500 Subject: [PATCH] feat(Invoice Ninja Node): Add more query params to getAll requests (#9238) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jonathan Bennetts Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ --- .../nodes/InvoiceNinja/ClientDescription.ts | 38 ++++++++++++ .../nodes/InvoiceNinja/InvoiceDescription.ts | 62 +++++++++++++++++++ .../nodes/InvoiceNinja/InvoiceNinja.node.ts | 58 ++++++++++++++++- .../nodes/InvoiceNinja/PaymentDescription.ts | 38 ++++++++++++ .../nodes/InvoiceNinja/QuoteDescription.ts | 38 ++++++++++++ 5 files changed, 233 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/InvoiceNinja/ClientDescription.ts b/packages/nodes-base/nodes/InvoiceNinja/ClientDescription.ts index 29d036aa92..ef5a9a34e5 100644 --- a/packages/nodes-base/nodes/InvoiceNinja/ClientDescription.ts +++ b/packages/nodes-base/nodes/InvoiceNinja/ClientDescription.ts @@ -394,6 +394,44 @@ export const clientFields: INodeProperties[] = [ ], default: 'invoices', }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'Active', + value: 'active', + }, + { + name: 'Archived', + value: 'archived', + }, + { + name: 'Deleted', + value: 'deleted', + }, + ], + default: 'active', + }, + { + displayName: 'Created At', + name: 'createdAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Updated At', + name: 'updatedAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Is Deleted', + name: 'isDeleted', + type: 'boolean', + default: false, + }, ], }, ]; diff --git a/packages/nodes-base/nodes/InvoiceNinja/InvoiceDescription.ts b/packages/nodes-base/nodes/InvoiceNinja/InvoiceDescription.ts index 783f7d1486..6c4f1a6cdb 100644 --- a/packages/nodes-base/nodes/InvoiceNinja/InvoiceDescription.ts +++ b/packages/nodes-base/nodes/InvoiceNinja/InvoiceDescription.ts @@ -441,6 +441,68 @@ export const invoiceFields: INodeProperties[] = [ ], default: 'client', }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'Active', + value: 'active', + }, + { + name: 'Archived', + value: 'archived', + }, + { + name: 'Deleted', + value: 'deleted', + }, + ], + default: 'active', + }, + { + displayName: 'Created At', + name: 'createdAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Updated At', + name: 'updatedAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Is Deleted', + name: 'isDeleted', + type: 'boolean', + default: false, + }, + { + displayName: 'Client Status', + name: 'clientStatus', + type: 'options', + options: [ + { + name: 'All', + value: 'all', + }, + { + name: 'Paid', + value: 'paid', + }, + { + name: 'Unpaid', + value: 'unpaid', + }, + { + name: 'Overdue', + value: 'overdue', + }, + ], + default: 'all', + }, ], }, ]; diff --git a/packages/nodes-base/nodes/InvoiceNinja/InvoiceNinja.node.ts b/packages/nodes-base/nodes/InvoiceNinja/InvoiceNinja.node.ts index fd43eb8e86..3702c1e34d 100644 --- a/packages/nodes-base/nodes/InvoiceNinja/InvoiceNinja.node.ts +++ b/packages/nodes-base/nodes/InvoiceNinja/InvoiceNinja.node.ts @@ -434,6 +434,18 @@ export class InvoiceNinja implements INodeType { if (options.include) { qs.include = options.include as string; } + if (options.status) { + qs.status = options.status as string; + } + if (options.createdAt) { + qs.created_at = options.createdAt as string; + } + if (options.updatedAt) { + qs.updated_at = options.updatedAt as string; + } + if (options.isDeleted) { + qs.is_deleted = options.isDeleted as boolean; + } if (returnAll) { responseData = await invoiceNinjaApiRequestAllItems.call( this, @@ -619,7 +631,27 @@ export class InvoiceNinja implements INodeType { qs.include = options.include as string; } if (options.invoiceNumber) { - qs.invoice_number = options.invoiceNumber as string; + if (apiVersion === 'v4') { + qs.invoice_number = options.invoiceNumber as string; + } else if (apiVersion === 'v5') { + // eslint-disable-next-line id-denylist + qs.number = options.invoiceNumber as string; + } + } + if (options.status) { + qs.status = options.status as string; + } + if (options.createdAt) { + qs.created_at = options.createdAt as string; + } + if (options.updatedAt) { + qs.updated_at = options.updatedAt as string; + } + if (options.isDeleted) { + qs.is_deleted = options.isDeleted as boolean; + } + if (options.clientStatus) { + qs.client_status = options.clientStatus as string; } if (returnAll) { responseData = await invoiceNinjaApiRequestAllItems.call( @@ -799,6 +831,18 @@ export class InvoiceNinja implements INodeType { if (options.include) { qs.include = options.include as string; } + if (options.status) { + qs.status = options.status as string; + } + if (options.createdAt) { + qs.created_at = options.createdAt as string; + } + if (options.updatedAt) { + qs.updated_at = options.updatedAt as string; + } + if (options.isDeleted) { + qs.is_deleted = options.isDeleted as boolean; + } if (returnAll) { responseData = await invoiceNinjaApiRequestAllItems.call( this, @@ -1178,6 +1222,18 @@ export class InvoiceNinja implements INodeType { if (options.invoiceNumber) { qs.invoice_number = options.invoiceNumber as string; } + if (options.status) { + qs.status = options.status as string; + } + if (options.createdAt) { + qs.created_at = options.createdAt as string; + } + if (options.updatedAt) { + qs.updated_at = options.updatedAt as string; + } + if (options.isDeleted) { + qs.is_deleted = options.isDeleted as boolean; + } if (returnAll) { responseData = await invoiceNinjaApiRequestAllItems.call( this, diff --git a/packages/nodes-base/nodes/InvoiceNinja/PaymentDescription.ts b/packages/nodes-base/nodes/InvoiceNinja/PaymentDescription.ts index 1e6188f350..99a683ecb2 100644 --- a/packages/nodes-base/nodes/InvoiceNinja/PaymentDescription.ts +++ b/packages/nodes-base/nodes/InvoiceNinja/PaymentDescription.ts @@ -584,6 +584,44 @@ export const paymentFields: INodeProperties[] = [ ], default: 'client', }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'Active', + value: 'active', + }, + { + name: 'Archived', + value: 'archived', + }, + { + name: 'Deleted', + value: 'deleted', + }, + ], + default: 'active', + }, + { + displayName: 'Created At', + name: 'createdAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Updated At', + name: 'updatedAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Is Deleted', + name: 'isDeleted', + type: 'boolean', + default: false, + }, ], }, ]; diff --git a/packages/nodes-base/nodes/InvoiceNinja/QuoteDescription.ts b/packages/nodes-base/nodes/InvoiceNinja/QuoteDescription.ts index d9a2e281c1..ea40608a5a 100644 --- a/packages/nodes-base/nodes/InvoiceNinja/QuoteDescription.ts +++ b/packages/nodes-base/nodes/InvoiceNinja/QuoteDescription.ts @@ -435,6 +435,44 @@ export const quoteFields: INodeProperties[] = [ ], default: 'client', }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'Active', + value: 'active', + }, + { + name: 'Archived', + value: 'archived', + }, + { + name: 'Deleted', + value: 'deleted', + }, + ], + default: 'active', + }, + { + displayName: 'Created At', + name: 'createdAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Updated At', + name: 'updatedAt', + type: 'dateTime', + default: '', + }, + { + displayName: 'Is Deleted', + name: 'isDeleted', + type: 'boolean', + default: false, + }, ], }, ];