From 22c70d50697023cf448a379d7778695abb718ce9 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:31:00 +0300 Subject: [PATCH] fix: Google Contacts node warm up request, Google Calendar node events>getAll fields option (#10700) --- .../nodes/Google/Calendar/EventDescription.ts | 9 +++++++++ .../nodes/Google/Calendar/GoogleCalendar.node.ts | 4 ++++ .../nodes/Google/Contacts/GoogleContacts.node.ts | 13 +++++++++++++ 3 files changed, 26 insertions(+) diff --git a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts index 2a08e45a76..57b5062c6c 100644 --- a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts +++ b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts @@ -656,6 +656,15 @@ export const eventFields: INodeProperties[] = [ default: '', description: 'At least some part of the event must be before this time', }, + { + displayName: 'Fields', + name: 'fields', + type: 'string', + placeholder: 'e.g. items(ID,status,summary)', + default: '', + description: + "Specify fields to return, by default a predefined by Google set of commonly used fields would be returned. To return all fields, use '*', more info.", + }, { displayName: 'iCalUID', name: 'iCalUID', diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index 10373b59cf..dfdc9698b7 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -436,6 +436,10 @@ export class GoogleCalendar implements INodeType { if (options.updatedMin) { qs.updatedMin = addTimezoneToDate(options.updatedMin as string, tz || timezone); } + if (options.fields) { + qs.fields = options.fields as string; + } + if (returnAll) { responseData = await googleApiRequestAllItems.call( this, diff --git a/packages/nodes-base/nodes/Google/Contacts/GoogleContacts.node.ts b/packages/nodes-base/nodes/Google/Contacts/GoogleContacts.node.ts index 0ea59ef48a..7b2bfa3616 100644 --- a/packages/nodes-base/nodes/Google/Contacts/GoogleContacts.node.ts +++ b/packages/nodes-base/nodes/Google/Contacts/GoogleContacts.node.ts @@ -92,6 +92,19 @@ export class GoogleContacts implements INodeType { let responseData; const resource = this.getNodeParameter('resource', 0); const operation = this.getNodeParameter('operation', 0); + + // Warmup cache + // https://developers.google.com/people/v1/contacts#protocol_1 + if (resource === 'contact' && operation === 'getAll') { + await googleApiRequest.call(this, 'GET', '/people:searchContacts', undefined, { + query: '', + readMask: 'names', + }); + await googleApiRequest.call(this, 'GET', '/people/me/connections', undefined, { + personFields: 'names', + }); + } + for (let i = 0; i < length; i++) { try { if (resource === 'contact') {