diff --git a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts index 035e8f0787..b1ed3e50cd 100644 --- a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts +++ b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts @@ -48,7 +48,7 @@ export const eventOperations = [ export const eventFields = [ /* -------------------------------------------------------------------------- */ - /* event:ALL */ + /* event:getAll */ /* -------------------------------------------------------------------------- */ { displayName: 'Calendar ID', @@ -300,6 +300,13 @@ export const eventFields = [ }, default: 1, }, + { + displayName: 'RRULE', + name: 'rrule', + type: 'string', + default: '', + description: 'Recurrence rule. When set, the parameters Repeat Frecuency, Repeat How Many Times and Repeat Until are ignored.', + }, { displayName: 'Send Updates', name: 'sendUpdates', @@ -920,6 +927,13 @@ export const eventFields = [ }, default: 1, }, + { + displayName: 'RRULE', + name: 'rrule', + type: 'string', + default: '', + description: 'Recurrence rule. When set, the parameters Repeat Frecuency, Repeat How Many Times and Repeat Until are ignored.', + }, { displayName: 'Start', name: 'start', diff --git a/packages/nodes-base/nodes/Google/Calendar/EventInterface.ts b/packages/nodes-base/nodes/Google/Calendar/EventInterface.ts index 2800333a1c..53471ca18f 100644 --- a/packages/nodes-base/nodes/Google/Calendar/EventInterface.ts +++ b/packages/nodes-base/nodes/Google/Calendar/EventInterface.ts @@ -1,6 +1,6 @@ import { IDataObject, - } from 'n8n-workflow'; +} from 'n8n-workflow'; export interface IReminder { useDefault?: boolean; diff --git a/packages/nodes-base/nodes/Google/Calendar/GenericFunctions.ts b/packages/nodes-base/nodes/Google/Calendar/GenericFunctions.ts index a2eed8ea96..edc841710c 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GenericFunctions.ts @@ -1,6 +1,6 @@ import { OptionsWithUri, - } from 'request'; +} from 'request'; import { IExecuteFunctions, @@ -47,7 +47,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF } } -export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any +export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index 803446de98..e66f718ecb 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -38,7 +38,7 @@ export class GoogleCalendar implements INodeType { description: INodeTypeDescription = { displayName: 'Google Calendar', name: 'googleCalendar', - icon: 'file:googleCalendar.png', + icon: 'file:googleCalendar.svg', group: ['input'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', @@ -321,33 +321,37 @@ export class GoogleCalendar implements INodeType { //exampel: RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=10;UNTIL=20110701T170000Z //https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html body.recurrence = []; - if ( - additionalFields.repeatHowManyTimes && - additionalFields.repeatUntil - ) { - throw new Error( - `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, - ); - } - if (additionalFields.repeatFrecuency) { - body.recurrence?.push( - `FREQ=${(additionalFields.repeatFrecuency as string).toUpperCase()};`, - ); - } - if (additionalFields.repeatHowManyTimes) { - body.recurrence?.push( - `COUNT=${additionalFields.repeatHowManyTimes};`, - ); - } - if (additionalFields.repeatUntil) { - body.recurrence?.push( - `UNTIL=${moment(additionalFields.repeatUntil as string) - .utc() - .format('YYYYMMDDTHHmmss')}Z`, - ); - } - if (body.recurrence.length !== 0) { - body.recurrence = [`RRULE:${body.recurrence.join('')}`]; + if (additionalFields.rrule) { + body.recurrence = [`RRULE:${additionalFields.rrule}`]; + } else { + if ( + additionalFields.repeatHowManyTimes && + additionalFields.repeatUntil + ) { + throw new Error( + `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, + ); + } + if (additionalFields.repeatFrecuency) { + body.recurrence?.push( + `FREQ=${(additionalFields.repeatFrecuency as string).toUpperCase()};`, + ); + } + if (additionalFields.repeatHowManyTimes) { + body.recurrence?.push( + `COUNT=${additionalFields.repeatHowManyTimes};`, + ); + } + if (additionalFields.repeatUntil) { + body.recurrence?.push( + `UNTIL=${moment(additionalFields.repeatUntil as string) + .utc() + .format('YYYYMMDDTHHmmss')}Z`, + ); + } + if (body.recurrence.length !== 0) { + body.recurrence = [`RRULE:${body.recurrence.join('')}`]; + } } if (additionalFields.conferenceDataUi) { @@ -565,30 +569,34 @@ export class GoogleCalendar implements INodeType { //exampel: RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=10;UNTIL=20110701T170000Z //https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html body.recurrence = []; - if (updateFields.repeatHowManyTimes && updateFields.repeatUntil) { - throw new Error( - `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, - ); - } - if (updateFields.repeatFrecuency) { - body.recurrence?.push( - `FREQ=${(updateFields.repeatFrecuency as string).toUpperCase()};`, - ); - } - if (updateFields.repeatHowManyTimes) { - body.recurrence?.push(`COUNT=${updateFields.repeatHowManyTimes};`); - } - if (updateFields.repeatUntil) { - body.recurrence?.push( - `UNTIL=${moment(updateFields.repeatUntil as string) - .utc() - .format('YYYYMMDDTHHmmss')}Z`, - ); - } - if (body.recurrence.length !== 0) { - body.recurrence = [`RRULE:${body.recurrence.join('')}`]; + if (updateFields.rrule) { + body.recurrence = [`RRULE:${updateFields.rrule}`]; } else { - delete body.recurrence; + if (updateFields.repeatHowManyTimes && updateFields.repeatUntil) { + throw new Error( + `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, + ); + } + if (updateFields.repeatFrecuency) { + body.recurrence?.push( + `FREQ=${(updateFields.repeatFrecuency as string).toUpperCase()};`, + ); + } + if (updateFields.repeatHowManyTimes) { + body.recurrence?.push(`COUNT=${updateFields.repeatHowManyTimes};`); + } + if (updateFields.repeatUntil) { + body.recurrence?.push( + `UNTIL=${moment(updateFields.repeatUntil as string) + .utc() + .format('YYYYMMDDTHHmmss')}Z`, + ); + } + if (body.recurrence.length !== 0) { + body.recurrence = [`RRULE:${body.recurrence.join('')}`]; + } else { + delete body.recurrence; + } } responseData = await googleApiRequest.call( this, diff --git a/packages/nodes-base/nodes/Google/Calendar/googleCalendar.png b/packages/nodes-base/nodes/Google/Calendar/googleCalendar.png deleted file mode 100644 index 31e365fdbd..0000000000 Binary files a/packages/nodes-base/nodes/Google/Calendar/googleCalendar.png and /dev/null differ diff --git a/packages/nodes-base/nodes/Google/Calendar/googleCalendar.svg b/packages/nodes-base/nodes/Google/Calendar/googleCalendar.svg new file mode 100644 index 0000000000..c139a747d2 --- /dev/null +++ b/packages/nodes-base/nodes/Google/Calendar/googleCalendar.svg @@ -0,0 +1 @@ + \ No newline at end of file