diff --git a/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts b/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts index db751cb258..61bf3e6471 100644 --- a/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts +++ b/packages/nodes-base/nodes/Google/Task/GoogleTasks.node.ts @@ -8,10 +8,10 @@ import { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow'; -import { taskOperations, taskFields } from './TaskDescription'; - import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions'; +import { taskOperations, taskFields } from './TaskDescription'; + export class GoogleTasks implements INodeType { description: INodeTypeDescription = { displayName: 'Google Tasks', @@ -98,43 +98,40 @@ export class GoogleTasks implements INodeType { i ) as IDataObject; - if (additionalFields.parent) + if (additionalFields.parent) { qs.parent = additionalFields.parent as string; - - if (additionalFields.previous) - qs.previous = additionalFields.previous as string; - - if (additionalFields.links) { - body.links = (additionalFields.links as string[]).map(link => { - return { link }; - }); } - if (additionalFields.status) + if (additionalFields.previous) { + qs.previous = additionalFields.previous as string; + } + + if (additionalFields.status) { body.status = additionalFields.status as string; + } - if (additionalFields.notes) + if (additionalFields.notes) { body.notes = additionalFields.notes as string; + } - if (additionalFields.title) + if (additionalFields.title) { body.title = additionalFields.title as string; + } - if (additionalFields.dueDate) + if (additionalFields.dueDate) { body.dueDate = additionalFields.dueDate as string; + } - if (additionalFields.completed) + if (additionalFields.completed) { body.completed = additionalFields.completed as string; + } - if (additionalFields.deleted) + if (additionalFields.deleted) { body.deleted = additionalFields.deleted as boolean; + } - if (additionalFields.hidden) - body.hidden = additionalFields.hidden as boolean; - - if (additionalFields.position) - body.position = additionalFields.position as string; - - if (additionalFields.selfLink) + if (additionalFields.selfLink) { body.selfLink = additionalFields.selfLink as string; + } responseData = await googleApiRequest.call( this, @@ -236,38 +233,37 @@ export class GoogleTasks implements INodeType { i ) as IDataObject; - if (updateFields.parent) qs.parent = updateFields.parent as string; - - if (updateFields.previous) + if (updateFields.previous) { qs.previous = updateFields.previous as string; - - if (updateFields.links) { - body.links = (updateFields.links as string[]).map(link => { - return { link: link }; - }); } - if (updateFields.status) body.status = updateFields.status as string; - if (updateFields.notes) body.notes = updateFields.notes as string; + if (updateFields.status) { + body.status = updateFields.status as string; + } - if (updateFields.title) body.title = updateFields.title as string; + if (updateFields.notes) { + body.notes = updateFields.notes as string; + } - if (updateFields.dueDate) + if (updateFields.title) { + body.title = updateFields.title as string; + } + + if (updateFields.dueDate) { body.dueDate = updateFields.dueDate as string; + } - if (updateFields.completed) + if (updateFields.completed) { body.completed = updateFields.completed as string; + } - if (updateFields.deleted) + if (updateFields.deleted) { body.deleted = updateFields.deleted as boolean; + } - if (updateFields.hidden) body.hidden = updateFields.hidden as boolean; - - if (updateFields.position) - body.position = updateFields.position as string; - - if (updateFields.selfLink) + if (updateFields.selfLink) { body.selfLink = updateFields.selfLink as string; + } responseData = await googleApiRequest.call( this, diff --git a/packages/nodes-base/nodes/Google/Task/TaskDescription.ts b/packages/nodes-base/nodes/Google/Task/TaskDescription.ts index 5b8df27097..4bf04ae8e4 100644 --- a/packages/nodes-base/nodes/Google/Task/TaskDescription.ts +++ b/packages/nodes-base/nodes/Google/Task/TaskDescription.ts @@ -7,38 +7,40 @@ export const taskOperations = [ type: 'options', displayOptions: { show: { - resource: ['task'] - } + resource: [ + 'task', + ], + }, }, options: [ { name: 'Create', value: 'create', - description: 'Add a task to tasklist' + description: 'Add a task to tasklist', }, { name: 'Delete', value: 'delete', - description: 'Delete a task' + description: 'Delete a task', }, { name: 'Get', value: 'get', - description: 'Retrieve a task' + description: 'Retrieve a task', }, { name: 'Get All', value: 'getAll', - description: 'Retrieve all tasks from a tasklist' + description: 'Retrieve all tasks from a tasklist', }, { name: 'Update', value: 'update', - description: 'Update a task' + description: 'Update a task', } ], default: 'create', - description: 'The operation to perform.' + description: 'The operation to perform.', } ] as INodeProperties[]; @@ -51,16 +53,20 @@ export const taskFields = [ name: 'task', type: 'options', typeOptions: { - loadOptionsMethod: 'getTasks' + loadOptionsMethod: 'getTasks', }, required: true, displayOptions: { show: { - operation: ['create'], - resource: ['task'] + operation: [ + 'create', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Additional Fields', @@ -70,11 +76,64 @@ export const taskFields = [ default: {}, displayOptions: { show: { - operation: ['create'], - resource: ['task'] + operation: [ + 'create', + ], + resource: [ + 'task', + ], } }, options: [ + { + displayName: 'Completion date', + name: 'completed', + type: 'dateTime', + default: '', + description: `Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.`, + }, + { + displayName: 'Deleted status', + name: 'deleted', + type: 'boolean', + default: false, + description: 'Flag indicating whether the task has been deleted.', + }, + { + displayName: 'Due Date', + name: 'dueDate', + type: 'dateTime', + default: '', + description: 'Due date of the task.', + }, + { + displayName: 'Notes', + name: 'notes', + type: 'string', + default: '', + description: 'Additional Notes.', + }, + { + displayName: 'Parent', + name: 'parent', + type: 'string', + default: '', + description: 'Parent task identifier. If the task is created at the top level, this parameter is omitted.', + }, + { + displayName: 'Previous', + name: 'previous', + type: 'string', + default: '', + description: 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.', + }, + { + displayName: 'Self Link', + name: 'selfLink', + type: 'string', + default: '', + description: 'URL pointing to this task. Used to retrieve, update, or delete this task.', + }, { displayName: 'Status', name: 'status', @@ -82,103 +141,24 @@ export const taskFields = [ options: [ { name: 'needs Action', - value: 'needsAction' + value: 'needsAction', }, { name: 'completed', - value: 'completed' + value: 'completed', } ], default: '', - description: 'Current status of the task.' - }, - { - displayName: 'Links', - name: 'links', - type: 'string', - typeOptions: { - multipleValues: true, - multipleValueButtonText: 'Add Link' - }, - default: '', - description: 'The links to insert in the task.' - }, - - { - displayName: 'Notes', - name: 'notes', - type: 'string', - default: '', - description: 'Additional Notes.' + description: 'Current status of the task.', }, { displayName: 'Title', name: 'title', type: 'string', default: '', - description: 'Title of the task.' - }, - { - displayName: 'Due Date', - name: 'dueDate', - type: 'dateTime', - default: '', - description: 'Due date of the task.' - }, - { - displayName: 'Completion date', - name: 'completed', - type: 'dateTime', - default: '', - description: `Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.` + description: 'Title of the task.', }, - { - displayName: 'Deleted status', - name: 'deleted', - type: 'boolean', - default: false, - description: 'Flag indicating whether the task has been deleted.' - }, - { - displayName: 'Hidden', - name: 'hidden', - type: 'boolean', - default: false, - description: 'Flag indicating whether the task is hidden.' - }, - { - displayName: 'Parent', - name: 'parent', - type: 'string', - default: '', - description: - 'Parent task identifier.This field is omitted if it is a top-level task.' - }, - { - displayName: 'Position', - name: 'position', - type: 'string', - default: '', - description: - 'Parent task identifier.This field is omitted if it is a top-level task.' - }, - { - displayName: 'Self Link', - name: 'selfLink', - type: 'string', - default: '', - description: - 'URL pointing to this task. Used to retrieve, update, or delete this task.' - }, - { - displayName: 'Previous', - name: 'previous', - type: 'string', - default: '', - description: - 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.' - } ] }, /* -------------------------------------------------------------------------- */ @@ -189,16 +169,20 @@ export const taskFields = [ name: 'task', type: 'options', typeOptions: { - loadOptionsMethod: 'getTasks' + loadOptionsMethod: 'getTasks', }, required: true, displayOptions: { show: { - operation: ['delete'], - resource: ['task'] + operation: [ + 'delete', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Task ID', @@ -207,11 +191,15 @@ export const taskFields = [ required: true, displayOptions: { show: { - operation: ['delete'], - resource: ['task'] + operation: [ + 'delete', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, /* -------------------------------------------------------------------------- */ /* task:get */ @@ -221,16 +209,20 @@ export const taskFields = [ name: 'task', type: 'options', typeOptions: { - loadOptionsMethod: 'getTasks' + loadOptionsMethod: 'getTasks', }, required: true, displayOptions: { show: { - operation: ['get'], - resource: ['task'] + operation: [ + 'get', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Task ID', @@ -239,11 +231,15 @@ export const taskFields = [ required: true, displayOptions: { show: { - operation: ['get'], - resource: ['task'] + operation: [ + 'get', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, /* -------------------------------------------------------------------------- */ /* task:getAll */ @@ -253,16 +249,20 @@ export const taskFields = [ name: 'task', type: 'options', typeOptions: { - loadOptionsMethod: 'getTasks' + loadOptionsMethod: 'getTasks', }, required: true, displayOptions: { show: { - operation: ['getAll'], - resource: ['task'] + operation: [ + 'getAll', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Return All', @@ -270,13 +270,16 @@ export const taskFields = [ type: 'boolean', displayOptions: { show: { - operation: ['getAll'], - resource: ['task'] + operation: [ + 'getAll', + ], + resource: [ + 'task', + ], } }, default: false, - description: - 'If all results should be returned or only up to a given limit.' + description: 'If all results should be returned or only up to a given limit.', }, { displayName: 'Limit', @@ -284,9 +287,15 @@ export const taskFields = [ type: 'number', displayOptions: { show: { - operation: ['getAll'], - resource: ['task'], - returnAll: [false] + operation: [ + 'getAll', + ], + resource: [ + 'task', + ], + returnAll: [ + false, + ], } }, typeOptions: { @@ -294,7 +303,7 @@ export const taskFields = [ maxValue: 100 }, default: 20, - description: 'How many results to return.' + description: 'How many results to return.', }, { displayName: 'Additional Fields', @@ -304,8 +313,12 @@ export const taskFields = [ default: {}, displayOptions: { show: { - operation: ['getAll'], - resource: ['task'] + operation: [ + 'getAll', + ], + resource: [ + 'task', + ], } }, @@ -315,40 +328,35 @@ export const taskFields = [ name: 'completedMax', type: 'dateTime', default: '', - description: - 'Upper bound for a task completion date (as a RFC 3339 timestamp) to filter by.' + description: 'Upper bound for a task completion date (as a RFC 3339 timestamp) to filter by.', }, { displayName: 'Completed Min', name: 'completedMin', type: 'dateTime', default: '', - description: - 'Lower bound for a task completion date (as a RFC 3339 timestamp) to filter by.' + description: 'Lower bound for a task completion date (as a RFC 3339 timestamp) to filter by.', }, { displayName: 'Due Min', name: 'dueMin', type: 'dateTime', default: '', - description: - 'Lower bound for a task due date (as a RFC 3339 timestamp) to filter by.' + description: 'Lower bound for a task due date (as a RFC 3339 timestamp) to filter by.', }, { displayName: 'Due Max', name: 'dueMax', type: 'dateTime', default: '', - description: - 'Upper bound for a task due date (as a RFC 3339 timestamp) to filter by.' + description: 'Upper bound for a task due date (as a RFC 3339 timestamp) to filter by.', }, - { displayName: 'Page Token', name: 'pageToken', type: 'string', default: '', - description: 'Token specifying the result page to return.' + description: 'Token specifying the result page to return.', }, { @@ -356,33 +364,29 @@ export const taskFields = [ name: 'showCompleted', type: 'boolean', default: true, - description: - 'Flag indicating whether completed tasks are returned in the result' + description: 'Flag indicating whether completed tasks are returned in the result', }, { displayName: 'Show Deleted', name: 'showDeleted', type: 'boolean', default: false, - description: - 'Flag indicating whether deleted tasks are returned in the result' + description: 'Flag indicating whether deleted tasks are returned in the result', }, { displayName: 'Show Hidden', name: 'showHidden', type: 'boolean', default: false, - description: - 'Flag indicating whether hidden tasks are returned in the result' + description: 'Flag indicating whether hidden tasks are returned in the result', }, { displayName: 'Updated Min', name: 'updatedMin', type: 'string', - - description: - 'Lower bound for a task last modification time (as a RFC 3339 timestamp) to filter by.' - } + default: '', + description: 'Lower bound for a task last modification time (as a RFC 3339 timestamp) to filter by.', + }, ] }, /* -------------------------------------------------------------------------- */ @@ -393,16 +397,20 @@ export const taskFields = [ name: 'task', type: 'options', typeOptions: { - loadOptionsMethod: 'getTasks' + loadOptionsMethod: 'getTasks', }, required: true, displayOptions: { show: { - operation: ['update'], - resource: ['task'] + operation: [ + 'update', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Task ID', @@ -411,11 +419,15 @@ export const taskFields = [ required: true, displayOptions: { show: { - operation: ['update'], - resource: ['task'] + operation: [ + 'update', + ], + resource: [ + 'task', + ], } }, - default: '' + default: '', }, { displayName: 'Update Fields', @@ -425,67 +437,21 @@ export const taskFields = [ default: {}, displayOptions: { show: { - operation: ['update'], - resource: ['task'] + operation: [ + 'update', + ], + resource: [ + 'task', + ], } }, options: [ - { - displayName: 'Status', - name: 'status', - type: 'options', - options: [ - { - name: 'needs Action', - value: 'needsAction' - }, - { - name: 'completed', - value: 'completed' - } - ], - default: '', - description: 'Current status of the task.' - }, - { - displayName: 'Links', - name: 'links', - type: 'string', - typeOptions: { - multipleValues: true, - multipleValueButtonText: 'Add Link' - }, - default: '', - description: 'The links to insert in the task.' - }, - - { - displayName: 'Notes', - name: 'notes', - type: 'string', - default: '', - description: 'Additional Notes.' - }, - { - displayName: 'Title', - name: 'title', - type: 'string', - default: '', - description: 'Title of the task.' - }, - { - displayName: 'Due Date', - name: 'dueDate', - type: 'dateTime', - default: '', - description: 'Due date of the task.' - }, { displayName: 'Completion date', name: 'completed', type: 'dateTime', default: '', - description: `Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.` + description: `Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.`, }, { @@ -493,47 +459,55 @@ export const taskFields = [ name: 'deleted', type: 'boolean', default: false, - description: 'Flag indicating whether the task has been deleted.' + description: 'Flag indicating whether the task has been deleted.', }, { - displayName: 'Hidden', - name: 'hidden', - type: 'boolean', - default: false, - description: 'Flag indicating whether the task is hidden.' - }, - { - displayName: 'Parent', - name: 'parent', + displayName: 'Notes', + name: 'notes', type: 'string', default: '', - description: - 'Parent task identifier.This field is omitted if it is a top-level task.' - }, - { - displayName: 'Position', - name: 'position', - type: 'string', - default: '', - description: - 'Parent task identifier.This field is omitted if it is a top-level task.' - }, - { - displayName: 'Self Link', - name: 'selfLink', - type: 'string', - default: '', - description: - 'URL pointing to this task. Used to retrieve, update, or delete this task.' + description: 'Additional Notes.', }, { displayName: 'Previous', name: 'previous', type: 'string', default: '', - description: - 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.' - } + description: 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.', + }, + { + displayName: 'Self Link', + name: 'selfLink', + type: 'string', + default: '', + description: 'URL pointing to this task. Used to retrieve, update, or delete this task.', + }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'needs Update', + value: 'needsAction', + }, + { + name: 'completed', + value: 'completed', + } + ], + default: '', + description: 'Current status of the task.', + }, + { + displayName: 'Title', + name: 'title', + type: 'string', + default: '', + description: 'Title of the task.', + }, + + ] } ] as INodeProperties[];