From 1019f031542e2f55974727cc35f68558eea84ab6 Mon Sep 17 00:00:00 2001 From: ricardo Date: Mon, 20 Apr 2020 09:35:58 -0500 Subject: [PATCH 1/2] :zap: Extended ClickUp --- .../nodes/ClickUp/ChecklistDescription.ts | 152 ++++ .../nodes/ClickUp/ChecklistItemDescription.ts | 221 ++++++ .../nodes-base/nodes/ClickUp/ClickUp.node.ts | 668 +++++++++++++++- .../nodes/ClickUp/CommentDescription.ts | 292 +++++++ .../nodes/ClickUp/FolderDescription.ts | 438 ++++++++++ .../nodes/ClickUp/GenericFunctions.ts | 14 +- .../nodes/ClickUp/GoalDescription.ts | 305 +++++++ .../nodes/ClickUp/GoalKeyResultDescription.ts | 289 +++++++ .../nodes/ClickUp/GuestDescription.ts | 285 +++++++ .../nodes/ClickUp/ListDescription.ts | 751 +++++++++++++++++- .../nodes-base/nodes/ClickUp/ListInterface.ts | 11 + .../ClickUp/TaskDependencyDescription.ts | 140 ++++ .../nodes/ClickUp/TaskDescription.ts | 166 ++-- .../nodes-base/nodes/ClickUp/TaskInterface.ts | 4 +- .../nodes/ClickUp/TimeTrackingDescription.ts | 359 +++++++++ 15 files changed, 3979 insertions(+), 116 deletions(-) create mode 100644 packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/CommentDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/FolderDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/GoalDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/GuestDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/ListInterface.ts create mode 100644 packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts create mode 100644 packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts diff --git a/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts b/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts new file mode 100644 index 0000000000..3884a8ea47 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts @@ -0,0 +1,152 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const checklistOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'checklist', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a checklist', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a checklist', + }, + { + name: 'Update', + value: 'update', + description: 'Update a checklist', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const checklistFields = [ + +/* -------------------------------------------------------------------------- */ +/* checklist:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklist', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklist', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* checklist:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Checklist ID', + name: 'checklistId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklist', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* checklist:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Checklist ID', + name: 'checklistId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklist', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'checklist', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + { + displayName: 'Position', + name: 'position', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: 0, + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts b/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts new file mode 100644 index 0000000000..46d4de3bc7 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts @@ -0,0 +1,221 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const checklistItemOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a checklist item', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a checklist item', + }, + { + name: 'Update', + value: 'update', + description: 'Update a checklist item', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const checklistItemFields = [ + +/* -------------------------------------------------------------------------- */ +/* checklistItem:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Checklist ID', + name: 'checklistId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Assignee ID', + name: 'assigneeId', + type: 'string', + default: '', + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* checklistItem:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Checklist ID', + name: 'checklistId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, + { + displayName: 'Checklist Item ID', + name: 'checklistItemId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* checklistItem:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Checklist ID', + name: 'checklistId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Checklist Item ID', + name: 'checklistItemId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'checklistItem', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Assignee ID', + name: 'assigneeId', + type: 'string', + default: '', + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + { + displayName: 'Parent Checklist Item ID', + name: 'parentId', + type: 'string', + default: '', + description: 'Checklist item that you want to nest the target checklist item underneath.', + }, + { + displayName: 'Resolved', + name: 'resolved', + type: 'boolean', + default: false, + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts index 887f9033ae..8c7c006c5d 100644 --- a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts +++ b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts @@ -1,6 +1,7 @@ import { IExecuteFunctions, } from 'n8n-core'; + import { IDataObject, ILoadOptionsFunctions, @@ -9,23 +10,76 @@ import { INodeType, INodeTypeDescription, } from 'n8n-workflow'; + import { clickupApiRequest, clickupApiRequestAllItems, validateJSON, } from './GenericFunctions'; + +import { + checklistFields, + checklistOperations, +} from './ChecklistDescription'; + +import { + checklistItemFields, + checklistItemOperations, +} from './ChecklistItemDescription'; + +import { + commentFields, + commentOperations, +} from './CommentDescription'; + +import { + folderFields, + folderOperations, +} from './FolderDescription'; + +import { + goalFields, + goalOperations, +} from './GoalDescription'; + +import { + goalKeyResultFields, + goalKeyResultOperations, +} from './GoalKeyResultDescription'; + +// import { +// guestFields, +// guestOperations, +// } from './guestDescription'; + import { taskFields, taskOperations, } from './TaskDescription'; + +import { + taskDependencyFields, + taskDependencyOperations, +} from './TaskDependencyDescription'; + +import { + timeTrackingFields, + timeTrackingOperations, +} from './TimeTrackingDescription'; + import { listFields, listOperations, } from './ListDescription'; + import { ITask, } from './TaskInterface'; + import { + IList, + } from './ListInterface'; + export class ClickUp implements INodeType { description: INodeTypeDescription = { displayName: 'ClickUp', @@ -53,6 +107,34 @@ export class ClickUp implements INodeType { name: 'resource', type: 'options', options: [ + { + name: 'Checklist', + value: 'checklist', + }, + { + name: 'Checklist Item', + value: 'checklistItem', + }, + { + name: 'Comment', + value: 'comment', + }, + { + name: 'Folder', + value: 'folder', + }, + { + name: 'Goal', + value: 'goal', + }, + { + name: 'Goal Key Result', + value: 'goalKeyResult', + }, + // { + // name: 'Guest', + // value: 'guest', + // }, { name: 'List', value: 'list', @@ -61,12 +143,49 @@ export class ClickUp implements INodeType { name: 'Task', value: 'task', }, + { + name: 'Task Dependency', + value: 'taskDependency', + }, + { + name: 'Time Traking', + value: 'timeTracking', + }, ], default: 'task', description: 'Resource to consume.', }, + // CHECKLIST + ...checklistOperations, + ...checklistFields, + // CHECKLIST ITEM + ...checklistItemOperations, + ...checklistItemFields, + // COMMENT + ...commentOperations, + ...commentFields, + // FOLDER + ...folderOperations, + ...folderFields, + // GOAL + ...goalOperations, + ...goalFields, + // GOAL kEY RESULT + ...goalKeyResultOperations, + ...goalKeyResultFields, + // GUEST + // ...guestOperations, + // ...guestFields, + // TASK ...taskOperations, ...taskFields, + // TASK DEPENDENCY + ...taskDependencyOperations, + ...taskDependencyFields, + // TIME TRACKING + ...timeTrackingOperations, + ...timeTrackingFields, + // LIST ...listOperations, ...listFields, ], @@ -92,7 +211,7 @@ export class ClickUp implements INodeType { // Get all the available spaces to display them to user so that he can // select them easily async getSpaces(this: ILoadOptionsFunctions): Promise { - const teamId = this.getCurrentNodeParameter('team') as string; + const teamId = this.getCurrentNodeParameter('teamId') as string; const returnData: INodePropertyOptions[] = []; const { spaces } = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/space`); for (const space of spaces) { @@ -108,7 +227,7 @@ export class ClickUp implements INodeType { // Get all the available folders to display them to user so that he can // select them easily async getFolders(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('space') as string; + const spaceId = this.getCurrentNodeParameter('spaceId') as string; const returnData: INodePropertyOptions[] = []; const { folders } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/folder`); for (const folder of folders) { @@ -124,7 +243,7 @@ export class ClickUp implements INodeType { // Get all the available lists to display them to user so that he can // select them easily async getLists(this: ILoadOptionsFunctions): Promise { - const folderId = this.getCurrentNodeParameter('folder') as string; + const folderId = this.getCurrentNodeParameter('folderId') as string; const returnData: INodePropertyOptions[] = []; const { lists } = await clickupApiRequest.call(this, 'GET', `/folder/${folderId}/list`); for (const list of lists) { @@ -140,7 +259,7 @@ export class ClickUp implements INodeType { // Get all the available lists without a folder to display them to user so that he can // select them easily async getFolderlessLists(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('space') as string; + const spaceId = this.getCurrentNodeParameter('spaceId') as string; const returnData: INodePropertyOptions[] = []; const { lists } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/list`); for (const list of lists) { @@ -156,7 +275,7 @@ export class ClickUp implements INodeType { // Get all the available assignees to display them to user so that he can // select them easily async getAssignees(this: ILoadOptionsFunctions): Promise { - const listId = this.getCurrentNodeParameter('list') as string; + const listId = this.getCurrentNodeParameter('listId') as string; const returnData: INodePropertyOptions[] = []; const { members } = await clickupApiRequest.call(this, 'GET', `/list/${listId}/member`); for (const member of members) { @@ -172,7 +291,7 @@ export class ClickUp implements INodeType { // Get all the available tags to display them to user so that he can // select them easily async getTags(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('space') as string; + const spaceId = this.getCurrentNodeParameter('spaceId') as string; const returnData: INodePropertyOptions[] = []; const { tags } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/tag`); for (const tag of tags) { @@ -188,7 +307,7 @@ export class ClickUp implements INodeType { // Get all the available tags to display them to user so that he can // select them easily async getStatuses(this: ILoadOptionsFunctions): Promise { - const listId = this.getCurrentNodeParameter('list') as string; + const listId = this.getCurrentNodeParameter('listId') as string; const returnData: INodePropertyOptions[] = []; const { statuses } = await clickupApiRequest.call(this, 'GET', `/list/${listId}`); for (const status of statuses) { @@ -215,9 +334,349 @@ export class ClickUp implements INodeType { const operation = this.getNodeParameter('operation', 0) as string; for (let i = 0; i < length; i++) { + if (resource === 'checklist') { + if (operation === 'create') { + const taskId = this.getNodeParameter('taskId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const body: IDataObject = { + name, + }; + responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/checklist`, body); + responseData = responseData.checklist; + } + if (operation === 'delete') { + const checklistId = this.getNodeParameter('checklistId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/checklist/${checklistId}`); + responseData = { success: true }; + } + if (operation === 'update') { + const checklistId = this.getNodeParameter('checklistId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + if (updateFields.position) { + body.position = updateFields.position as number; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/checklist/${checklistId}`, body); + responseData = responseData.checklist; + } + } + if (resource === 'checklistItem') { + if (operation === 'create') { + const checklistId = this.getNodeParameter('checklistId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IDataObject = { + name, + }; + if (additionalFields.assigneeId) { + body.assignee = parseInt(additionalFields.assigneeId as string, 10); + } + responseData = await clickupApiRequest.call(this, 'POST', `/checklist/${checklistId}/checklist_item`, body); + responseData = responseData.checklist; + } + if (operation === 'delete') { + const checklistId = this.getNodeParameter('checklistId', i) as string; + const checklistItemId = this.getNodeParameter('checklistItemId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/checklist/${checklistId}/checklist_item/${checklistItemId}`); + responseData = { success: true }; + } + if (operation === 'update') { + const checklistId = this.getNodeParameter('checklistId', i) as string; + const checklistItemId = this.getNodeParameter('checklistItemId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + if (updateFields.parentId) { + body.parent = updateFields.parentId as string; + } + if (updateFields.assigneeId) { + body.assignee = parseInt(updateFields.assigneeId as string, 10); + } + if (updateFields.resolved) { + body.resolved = updateFields.resolved as boolean; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/checklist/${checklistId}/checklist_item/${checklistItemId}`, body); + responseData = responseData.checklist; + } + } + if (resource === 'comment') { + if (operation === 'create') { + const resource = this.getNodeParameter('commentOn', i) as string; + const id = this.getNodeParameter('id', i) as string; + const commentText = this.getNodeParameter('commentText', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IDataObject = { + comment_text: commentText, + }; + if (additionalFields.assigneeId) { + body.assigneeId = additionalFields.assigneeId as string; + } + if (additionalFields.notifyAll) { + body.notify_all = additionalFields.notifyAll as boolean; + } + responseData = await clickupApiRequest.call(this, 'POST', `/${resource}/${id}/comment`, body); + } + if (operation === 'delete') { + const commentId = this.getNodeParameter('commentId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/comment/${commentId}`); + responseData = { success: true }; + } + if (operation === 'getAll') { + const resource = this.getNodeParameter('commentsOn', i) as string; + const id = this.getNodeParameter('id', i) as string; + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequest.call(this, 'GET', `/${resource}/${id}/comment`, {}, qs); + responseData = responseData.comments; + responseData = responseData.splice(0, qs.limit); + } + if (operation === 'update') { + const commentId = this.getNodeParameter('commentId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.commentText) { + body.comment_text = updateFields.commentText as string; + } + if (updateFields.assigneeId) { + body.assignee = parseInt(updateFields.assigneeId as string, 10); + } + if (updateFields.resolved) { + body.resolved = updateFields.resolved as boolean; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/comment/${commentId}`, body); + } + } + if (resource === 'folder') { + if (operation === 'create') { + const spaceId = this.getNodeParameter('spaceId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const body: IDataObject = { + name, + }; + responseData = await clickupApiRequest.call(this, 'POST', `/space/${spaceId}/folder`, body); + } + if (operation === 'delete') { + const folderId = this.getNodeParameter('folderId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/folder/${folderId}`); + responseData = { success: true }; + } + if (operation === 'get') { + const folderId = this.getNodeParameter('folderId', i) as string; + responseData = await clickupApiRequest.call(this, 'GET', `/folder/${folderId}`); + } + if (operation === 'getAll') { + const filters = this.getNodeParameter('filters', i) as IDataObject; + const spaceId = this.getNodeParameter('spaceId', i) as string; + if (filters.archived) { + qs.archived = filters.archived as boolean; + } + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/folder`, {}, qs); + responseData = responseData.folders; + responseData = responseData.splice(0, qs.limit); + } + if (operation === 'update') { + const folderId = this.getNodeParameter('folderId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/folder/${folderId}`, body); + } + } + if (resource === 'goal') { + if (operation === 'create') { + const teamId = this.getNodeParameter('teamId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IDataObject = { + name, + }; + if (additionalFields.dueDate) { + body.due_date = new Date(additionalFields.dueDate as string).getTime(); + } + if (additionalFields.description) { + body.description = additionalFields.description as string; + } + if (additionalFields.multipleOwners) { + body.multiple_owners = additionalFields.multipleOwners as boolean; + } + if (additionalFields.color) { + body.color = additionalFields.color as string; + } + if (additionalFields.owners) { + body.owners = ((additionalFields.owners as string).split(',') as string[]).map((e: string) => parseInt(e, 10)); + } + responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/goal`, body); + responseData = responseData.goal; + } + if (operation === 'delete') { + const goalId = this.getNodeParameter('goalId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/goal/${goalId}`); + responseData = { success: true }; + } + if (operation === 'get') { + const goalId = this.getNodeParameter('goalId', i) as string; + responseData = await clickupApiRequest.call(this, 'GET', `/goal/${goalId}`); + responseData = responseData.goal; + } + if (operation === 'getAll') { + const teamId = this.getNodeParameter('teamId', i) as string; + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/goal`, {}, qs); + responseData = responseData.goals; + responseData = responseData.splice(0, qs.limit); + + } + if (operation === 'update') { + const goalId = this.getNodeParameter('goalId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + if (updateFields.dueDate) { + body.due_date = new Date(updateFields.dueDate as string).getTime(); + } + if (updateFields.description) { + body.description = updateFields.description as string; + } + if (updateFields.color) { + body.color = updateFields.color as string; + } + if (updateFields.addOwners) { + body.add_owners = ((updateFields.addOwners as string).split(',') as string[]).map((e: string) => parseInt(e, 10)) as number[]; + } + if (updateFields.removeOwners) { + body.rem_owners = ((updateFields.removeOwners as string).split(',') as string[]).map((e: string) => parseInt(e, 10)) as number[]; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/goal/${goalId}`, body); + responseData = responseData.goal; + } + } + if (resource === 'goalKeyResult') { + if (operation === 'create') { + const goalId = this.getNodeParameter('goalId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const type = this.getNodeParameter('type', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IDataObject = { + name, + type, + }; + if (additionalFields.unit) { + body.unit = additionalFields.unit as string; + } + if (additionalFields.stepsStart) { + body.steps_start = additionalFields.stepsStart as number; + } + if (additionalFields.stepsEnd) { + body.steps_end = additionalFields.stepsEnd as number; + } + if (additionalFields.taskIds) { + body.task_ids = (additionalFields.taskIds as string).split(','); + } + if (additionalFields.listIds) { + body.list_ids = (additionalFields.listIds as string).split(','); + } + if (additionalFields.owners) { + body.owners = ((additionalFields.owners as string).split(',') as string[]).map((e: string) => parseInt(e, 10)); + } + responseData = await clickupApiRequest.call(this, 'POST', `/goal/${goalId}/key_result`, body); + responseData = responseData.key_result; + } + if (operation === 'delete') { + const keyResultId = this.getNodeParameter('keyResultId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/key_result/${keyResultId}`); + responseData = { success: true }; + } + if (operation === 'update') { + const keyResultId = this.getNodeParameter('keyResultId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + if (updateFields.note) { + body.note = updateFields.note as string; + } + if (updateFields.stepsCurrent) { + body.steps_current = updateFields.stepsCurrent as number; + } + if (updateFields.stepsStart) { + body.steps_start = updateFields.stepsStart as number; + } + if (updateFields.stepsEnd) { + body.steps_end = updateFields.stepsEnd as number; + } + if (updateFields.unit) { + body.unit = updateFields.unit as string; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/key_result/${keyResultId}`, body); + responseData = responseData.key_result; + } + } + if (resource === 'guest') { + if (operation === 'create') { + const teamId = this.getNodeParameter('teamId', i) as string; + const email = this.getNodeParameter('email', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IDataObject = { + email, + }; + if (additionalFields.canEditTags) { + body.can_edit_tags = additionalFields.canEditTags as boolean; + } + if (additionalFields.canSeeTimeSpend) { + body.can_see_time_spend = additionalFields.canSeeTimeSpend as boolean; + } + if (additionalFields.canSeeTimeEstimated) { + body.can_see_time_estimated = additionalFields.canSeeTimeEstimated as boolean; + } + responseData = await clickupApiRequest.call(this, 'POST', `/team/${teamId}/guest`, body); + responseData = responseData.team; + } + if (operation === 'delete') { + const teamId = this.getNodeParameter('teamId', i) as string; + const guestId = this.getNodeParameter('guestId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/team/${teamId}/guest/${guestId}`); + responseData = { success: true }; + } + if (operation === 'get') { + const teamId = this.getNodeParameter('teamId', i) as string; + const guestId = this.getNodeParameter('guestId', i) as string; + responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/guest/${guestId}`); + responseData = responseData.team; + } + if (operation === 'update') { + const teamId = this.getNodeParameter('teamId', i) as string; + const guestId = this.getNodeParameter('guestId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IDataObject = {}; + if (updateFields.username) { + body.username = updateFields.username as string; + } + if (updateFields.canEditTags) { + body.can_edit_tags = updateFields.canEditTags as boolean; + } + if (updateFields.canSeeTimeSpend) { + body.can_see_time_spend = updateFields.canSeeTimeSpend as boolean; + } + if (updateFields.canSeeTimeEstimated) { + body.can_see_time_estimated = updateFields.canSeeTimeEstimated as boolean; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/team/${teamId}/guest/${guestId}`, body); + responseData = responseData.team; + } + } if (resource === 'task') { if (operation === 'create') { - const listId = this.getNodeParameter('list', i) as string; + const listId = this.getNodeParameter('listId', i) as string; const name = this.getNodeParameter('name', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: ITask = { @@ -273,7 +732,7 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/list/${listId}/task`, body); } if (operation === 'update') { - const taskId = this.getNodeParameter('id', i) as string; + const taskId = this.getNodeParameter('taskId', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: ITask = {}; if (updateFields.content) { @@ -313,12 +772,11 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'PUT', `/task/${taskId}`, body); } if (operation === 'get') { - const taskId = this.getNodeParameter('id', i) as string; + const taskId = this.getNodeParameter('taskId', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/task/${taskId}`); } if (operation === 'getAll') { - const returnAll = true; - //const returnAll = this.getNodeParameter('returnAll', i) as boolean; + const returnAll = this.getNodeParameter('returnAll', i) as boolean; const filters = this.getNodeParameter('filters', i) as IDataObject; if (filters.archived) { qs.archived = filters.archived as boolean; @@ -359,18 +817,18 @@ export class ClickUp implements INodeType { if (filters.dateUpdatedLt) { qs.date_updated_lt = new Date(filters.dateUpdatedLt as string).getTime(); } - const listId = this.getNodeParameter('list', i) as string; + const listId = this.getNodeParameter('listId', i) as string; if (returnAll === true) { responseData = await clickupApiRequestAllItems.call(this, 'tasks', 'GET', `/list/${listId}/task`, {}, qs); } else { - // qs.limit = this.getNodeParameter('limit', i) as number; - // responseData = await clickupApiRequest.call(this, 'GET', `/list/${listId}/task`, {}, qs); - // responseData = responseData.tasks; + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequestAllItems.call(this, 'tasks', 'GET', `/list/${listId}/task`, {}, qs); + responseData = responseData.splice(0, qs.limit); } } if (operation === 'setCustomField') { - const taskId = this.getNodeParameter('task', i) as string; - const fieldId = this.getNodeParameter('field', i) as string; + const taskId = this.getNodeParameter('taskId', i) as string; + const fieldId = this.getNodeParameter('fieldId', i) as string; const value = this.getNodeParameter('value', i) as string; const jsonParse = this.getNodeParameter('jsonParse', i) as boolean; @@ -390,16 +848,186 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/field/${fieldId}`, body); } if (operation === 'delete') { - const taskId = this.getNodeParameter('id', i) as string; + const taskId = this.getNodeParameter('taskId', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}`, {}); + responseData = { success: true }; + } + } + if (resource === 'taskDependency') { + if (operation === 'create') { + const taskId = this.getNodeParameter('taskId', i) as string; + const dependsOn = this.getNodeParameter('dependsOn', i) as string; + const dependencyOf = this.getNodeParameter('dependencyOf', i) as string; + if (dependencyOf !== '' && dependsOn !== '' ) { + throw new Error('Both can not be passed in the same request.'); + } + const body: IDataObject = {}; + if (dependsOn) { + body.depends_on = dependsOn; + } + if (dependencyOf) { + body.dependency_of = dependencyOf; + } + responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/dependency`, body); + responseData = { success: true }; + } + if (operation === 'delete') { + const taskId = this.getNodeParameter('taskId', i) as string; + const dependsOn = this.getNodeParameter('dependsOn', i) as string; + const dependencyOf = this.getNodeParameter('dependencyOf', i) as string; + if (dependencyOf !== '' && dependsOn !== '' ) { + throw new Error('Both can not be passed in the same request.'); + } + if (dependsOn) { + qs.depends_on = dependsOn; + } + if (dependencyOf) { + qs.dependency_of = dependencyOf; + } + responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/dependency`, {}, qs); + responseData = { success: true }; + } + } + if (resource === 'timeTracking') { + if (operation === 'log') { + const taskId = this.getNodeParameter('taskId', i) as string; + const type = this.getNodeParameter('type', i) as string; + const body: IDataObject = {}; + if (type === 'fromTo') { + const from = new Date(this.getNodeParameter('from', i) as string).getTime(); + const to = new Date(this.getNodeParameter('to', i) as string).getTime(); + body.from = from; + body.to = to; + } else { + const minutes = this.getNodeParameter('minutes', i) as number; + body.time = minutes * 60000; + } + responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/time`, body); + } + if (operation === 'delete') { + const taskId = this.getNodeParameter('taskId', i) as string; + const intervalId = this.getNodeParameter('intervalId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/time/${intervalId}`); + responseData = { success: true }; + } + if (operation === 'getAll') { + const taskId = this.getNodeParameter('taskId', i) as string; + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequest.call(this, 'GET', `/task/${taskId}/time`, {}, qs); + responseData = responseData.data; + responseData = responseData.splice(0, qs.limit); + } + if (operation === 'update') { + const taskId = this.getNodeParameter('taskId', i) as string; + const intervalId = this.getNodeParameter('intervalId', i) as string; + const type = this.getNodeParameter('type', i) as string; + const body: IDataObject = {}; + if (type === 'fromTo') { + const from = new Date(this.getNodeParameter('from', i) as string).getTime(); + const to = new Date(this.getNodeParameter('to', i) as string).getTime(); + body.from = from; + body.to = to; + } else { + const minutes = this.getNodeParameter('minutes', i) as number; + body.time = minutes * 60000; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/task/${taskId}/time/${intervalId}`, body); + responseData = { success: true }; } } if (resource === 'list') { + if (operation === 'create') { + const spaceId = this.getNodeParameter('spaceId', i) as string; + const folderless = this.getNodeParameter('folderless', i) as string; + const name = this.getNodeParameter('name', i) as string; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + const body: IList = { + name, + }; + if (additionalFields.content) { + body.content = additionalFields.content as string; + } + if (additionalFields.dueDate) { + body.due_date = new Date(additionalFields.dueDate as string).getTime(); + } + if (additionalFields.dueDateTime) { + body.due_date_time = additionalFields.dueDateTime as boolean; + } + if (additionalFields.priority) { + body.priority = additionalFields.priority as number; + } + if (additionalFields.assignee) { + body.assignee = parseInt(additionalFields.assignee as string, 10); + } + if (additionalFields.status) { + body.status = additionalFields.status as string; + } + if (folderless) { + responseData = await clickupApiRequest.call(this, 'POST', `/space/${spaceId}/list`, body); + } else { + const folderId = this.getNodeParameter('folderId', i) as string; + responseData = await clickupApiRequest.call(this, 'POST', `/folder/${folderId}/list`, body); + } + } if (operation === 'customFields') { - const listId = this.getNodeParameter('list', i) as string; + const listId = this.getNodeParameter('listId', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/list/${listId}/field`); responseData = responseData.fields; } + if (operation === 'delete') { + const listId = this.getNodeParameter('listId', i) as string; + responseData = await clickupApiRequest.call(this, 'DELETE', `/list/${listId}`); + responseData = { success: true }; + } + if (operation === 'get') { + const listId = this.getNodeParameter('listId', i) as string; + responseData = await clickupApiRequest.call(this, 'GET', `/list/${listId}`); + } + if (operation === 'getAll') { + const filters = this.getNodeParameter('filters', i) as IDataObject; + const spaceId = this.getNodeParameter('spaceId', i) as string; + const folderless = this.getNodeParameter('folderless', i) as boolean; + if (filters.archived) { + qs.archived = filters.archived as boolean; + } + let endpoint = `/space/${spaceId}/list`; + if (!folderless) { + const folderId = this.getNodeParameter('folderId', i) as string; + endpoint = `/folder/${folderId}/list`; + } + + qs.limit = this.getNodeParameter('limit', i) as number; + responseData = await clickupApiRequest.call(this, 'GET', endpoint, {}, qs); + responseData = responseData.lists; + responseData = responseData.splice(0, qs.limit); + } + if (operation === 'update') { + const listId = this.getNodeParameter('listId', i) as string; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + const body: IList = {}; + if (updateFields.name) { + body.name = updateFields.name as string; + } + if (updateFields.content) { + body.content = updateFields.content as string; + } + if (updateFields.dueDate) { + body.due_date = new Date(updateFields.dueDate as string).getTime(); + } + if (updateFields.dueDateTime) { + body.due_date_time = updateFields.dueDateTime as boolean; + } + if (updateFields.priority) { + body.priority = updateFields.priority as number; + } + if (updateFields.assignee) { + body.assignee = parseInt(updateFields.assignee as string, 10); + } + if (updateFields.unsetStatus) { + body.unset_status = updateFields.unsetStatus as boolean; + } + responseData = await clickupApiRequest.call(this, 'PUT', `/list/${listId}`, body); + } } if (Array.isArray(responseData)) { returnData.push.apply(returnData, responseData as IDataObject[]); diff --git a/packages/nodes-base/nodes/ClickUp/CommentDescription.ts b/packages/nodes-base/nodes/ClickUp/CommentDescription.ts new file mode 100644 index 0000000000..8c51de1b28 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/CommentDescription.ts @@ -0,0 +1,292 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const commentOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'comment', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a comment', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a comment', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all comments', + }, + { + name: 'Update', + value: 'update', + description: 'Update a comment', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const commentFields = [ + +/* -------------------------------------------------------------------------- */ +/* comment:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Comment On', + name: 'commentOn', + type: 'options', + options: [ + { + name: 'List', + value: 'list', + }, + { + name: 'Task', + value: 'task', + }, + { + name: 'View', + value: 'view', + }, + ], + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'create', + ], + }, + }, + }, + { + displayName: 'ID', + name: 'id', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Comment Text', + name: 'commentText', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'create', + ], + }, + }, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Assignee ID', + name: 'assigneeId', + type: 'string', + default: '', + }, + { + displayName: 'Notify All', + name: 'notifyAll', + type: 'boolean', + default: false, + description: 'If true, creation notifications will be sent to everyone including the creator of the comment.', + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* comment:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Comment ID', + name: 'commentId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* comment:getAll */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Comments On', + name: 'commentsOn', + type: 'options', + options: [ + { + name: 'List', + value: 'list', + }, + { + name: 'Task', + value: 'task', + }, + { + name: 'View', + value: 'view', + }, + ], + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'getAll', + ], + }, + }, + }, + { + displayName: 'ID', + name: 'id', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'getAll', + ], + }, + }, + required: true, + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, +/* -------------------------------------------------------------------------- */ +/* comment:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Comment ID', + name: 'commentId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'comment', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Assignee ID', + name: 'assigneeId', + type: 'string', + default: '', + }, + { + displayName: 'Comment Text', + name: 'commentText', + type: 'string', + default: '', + }, + { + displayName: 'Resolved', + name: 'resolved', + type: 'boolean', + default: false, + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/FolderDescription.ts b/packages/nodes-base/nodes/ClickUp/FolderDescription.ts new file mode 100644 index 0000000000..d73a908ec8 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/FolderDescription.ts @@ -0,0 +1,438 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const folderOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'folder', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a folder', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a folder', + }, + { + name: 'Get', + value: 'get', + description: 'Get a folder', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all folders', + }, + { + name: 'Update', + value: 'update', + description: 'Update a folder', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const folderFields = [ + +/* -------------------------------------------------------------------------- */ +/* folder:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* folder:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* folder:get */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* folder:getAll */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, + { + displayName: 'Filters', + name: 'filters', + type: 'collection', + placeholder: 'Add Filter', + default: {}, + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'getAll', + ], + }, + }, + options: [ + { + displayName: 'Archived', + name: 'archived', + type: 'boolean', + default: false, + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* folder:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'folder', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/GenericFunctions.ts b/packages/nodes-base/nodes/ClickUp/GenericFunctions.ts index 5ef1238b84..d836f7798e 100644 --- a/packages/nodes-base/nodes/ClickUp/GenericFunctions.ts +++ b/packages/nodes-base/nodes/ClickUp/GenericFunctions.ts @@ -1,4 +1,7 @@ -import { OptionsWithUri } from 'request'; +import { + OptionsWithUri, + } from 'request'; + import { IExecuteFunctions, IExecuteSingleFunctions, @@ -6,7 +9,10 @@ import { ILoadOptionsFunctions, IWebhookFunctions, } from 'n8n-core'; -import { IDataObject } from 'n8n-workflow'; + +import { + IDataObject, + } from 'n8n-workflow'; export async function clickupApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any const credentials = this.getCredentials('clickUpApi'); @@ -42,12 +48,14 @@ export async function clickupApiRequestAllItems(this: IHookFunctions | IExecuteF let responseData; query.page = 0; - query.limit = 100; do { responseData = await clickupApiRequest.call(this, method, resource, body, query); returnData.push.apply(returnData, responseData[propertyName]); query.page++; + if (query.limit && query.limit <= returnData.length) { + return returnData; + } } while ( responseData[propertyName] && responseData[propertyName].length !== 0 diff --git a/packages/nodes-base/nodes/ClickUp/GoalDescription.ts b/packages/nodes-base/nodes/ClickUp/GoalDescription.ts new file mode 100644 index 0000000000..ee8047c962 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/GoalDescription.ts @@ -0,0 +1,305 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const goalOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'goal', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a goal', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a goal', + }, + { + name: 'Get', + value: 'get', + description: 'Get a goal', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all goals', + }, + { + name: 'Update', + value: 'update', + description: 'Update a goal', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const goalFields = [ + +/* -------------------------------------------------------------------------- */ +/* goal:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Color', + name: 'color', + type: 'color', + default: '', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + }, + { + displayName: 'Due Date', + name: 'dueDate', + type: 'dateTime', + default: '', + }, + { + displayName: 'Multiple Owners', + name: 'multipleOwners', + type: 'boolean', + default: false, + }, + { + displayName: 'Owners', + name: 'owners', + type: 'string', + default: '', + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* goal:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Goal ID', + name: 'goalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* goal:get */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Goal ID', + name: 'goalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'get', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* goal:getAll */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, +/* -------------------------------------------------------------------------- */ +/* goal:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Goal ID', + name: 'goalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'goal', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Add Owners', + name: 'addOwners', + type: 'string', + default: '', + }, + { + displayName: 'Color', + name: 'color', + type: 'color', + default: '', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + }, + { + displayName: 'Due Date', + name: 'dueDate', + type: 'dateTime', + default: '', + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + { + displayName: 'Remove Owners', + name: 'removeOwners', + type: 'string', + default: '', + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts b/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts new file mode 100644 index 0000000000..d6df7e4236 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts @@ -0,0 +1,289 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const goalKeyResultOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a key result', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a key result', + }, + { + name: 'Update', + value: 'update', + description: 'Update a key result', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const goalKeyResultFields = [ + +/* -------------------------------------------------------------------------- */ +/* goalKeyResult:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Goal ID', + name: 'goalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Type', + name: 'type', + type: 'options', + options: [ + { + name: 'Automatic', + value: 'automatic', + }, + { + name: 'Boolean', + value: 'boolean', + }, + { + name: 'Currency', + value: 'currency', + }, + { + name: 'Number', + value: 'number', + }, + { + name: 'Percentage', + value: 'percentage', + }, + ], + default: '', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'List IDs', + name: 'listIds', + type: 'string', + default: '', + }, + { + displayName: 'Owners', + name: 'owners', + type: 'string', + default: '', + }, + { + displayName: 'Steps Start', + name: 'stepsStart', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: '', + description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency', + }, + { + displayName: 'Steps End', + name: 'stepsEnd', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: '', + description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency', + }, + { + displayName: 'Task IDs', + name: 'taskIds', + type: 'string', + default: '', + }, + { + displayName: 'Unit', + name: 'unit', + type: 'string', + default: '', + description: `Only matters for type Number and Currency. For Currency the unit must be a valid currency code.`, + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* goalKeyResult:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Key Result ID', + name: 'keyResultId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* goalKeyResult:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Key Result ID', + name: 'keyResultId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'goalKeyResult', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + { + displayName: 'Note', + name: 'note', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + }, + { + displayName: 'Steps Current', + name: 'stepsCurrent', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: '', + }, + { + displayName: 'Steps End', + name: 'stepsEnd', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: '', + }, + { + displayName: 'Steps Start', + name: 'stepsStart', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: '', + }, + { + displayName: 'Unit', + name: 'unit', + type: 'string', + default: '', + description: `Only matters for type Number and Currency. For Currency the unit must be a valid currency code.`, + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/GuestDescription.ts b/packages/nodes-base/nodes/ClickUp/GuestDescription.ts new file mode 100644 index 0000000000..db00a2fb9f --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/GuestDescription.ts @@ -0,0 +1,285 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const guestOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'guest', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a guest', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a guest', + }, + { + name: 'Get', + value: 'get', + description: 'Get a guest', + }, + { + name: 'Update', + value: 'update', + description: 'Update a guest', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const guestFields = [ + +/* -------------------------------------------------------------------------- */ +/* guest:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Email', + name: 'email', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'create', + ], + }, + }, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Can Edit Tags', + name: 'can_edit_tags', + type: 'boolean', + default: false, + }, + { + displayName: 'Can See Time Spend', + name: 'can_see_time_spend', + type: 'boolean', + default: false, + }, + { + displayName: 'Can See Time estimated', + name: 'can_see_time_estimated', + type: 'boolean', + default: false, + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* guest:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Guest ID', + name: 'guestId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* guest:get */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Guest ID', + name: 'guestId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'get', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* guest:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Guest ID', + name: 'guestId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'guest', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Can Edit Tags', + name: 'can_edit_tags', + type: 'boolean', + default: false, + }, + { + displayName: 'Can See Time Spend', + name: 'can_see_time_spend', + type: 'boolean', + default: false, + }, + { + displayName: 'Can See Time estimated', + name: 'can_see_time_estimated', + type: 'boolean', + default: false, + }, + { + displayName: 'Username', + name: 'username', + type: 'string', + default: '', + }, + ], + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/ListDescription.ts b/packages/nodes-base/nodes/ClickUp/ListDescription.ts index 517d8497f2..23eec7073c 100644 --- a/packages/nodes-base/nodes/ClickUp/ListDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/ListDescription.ts @@ -1,4 +1,6 @@ -import { INodeProperties } from 'n8n-workflow'; +import { + INodeProperties, + } from 'n8n-workflow'; export const listOperations = [ { @@ -13,11 +15,36 @@ export const listOperations = [ }, }, options: [ + { + name: 'Create', + value: 'create', + description: 'Create a list', + }, { name: 'Custom Fields', value: 'customFields', description: `Retrieve list's custom fields`, }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a list', + }, + { + name: 'Get', + value: 'get', + description: 'Get a list', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all lists', + }, + { + name: 'Update', + value: 'update', + description: 'Update a list', + }, ], default: 'customFields', description: 'The operation to perform.', @@ -26,12 +53,187 @@ export const listOperations = [ export const listFields = [ +/* -------------------------------------------------------------------------- */ +/* list:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folderless List', + name: 'folderless', + type: 'boolean', + default: false, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + folderless: [ + false, + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'create', + ], + }, + }, + options: [ + { + displayName: 'Assignee', + name: 'assignee', + type: 'string', + default: '', + }, + { + displayName: 'Content', + name: 'content', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + }, + { + displayName: 'Due Date', + name: 'dueDate', + type: 'dateTime', + default: '', + }, + { + displayName: 'Due Date Time', + name: 'dueDateTime', + type: 'boolean', + default: false, + }, + { + displayName: 'Priority', + name: 'priority', + type: 'number', + typeOptions: { + minValue: 1, + maxValue: 4, + }, + description: 'Integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low', + default: 3, + }, + { + displayName: 'Status', + name: 'status', + type: 'options', + loadOptionsDependsOn: [ + 'list', + ], + typeOptions: { + loadOptionsMethod: 'getStatuses', + }, + default: '', + }, + ], + }, /* -------------------------------------------------------------------------- */ /* list:customFields */ /* -------------------------------------------------------------------------- */ { displayName: 'Team', - name: 'team', + name: 'teamId', type: 'options', default: '', displayOptions: { @@ -51,7 +253,7 @@ export const listFields = [ }, { displayName: 'Space', - name: 'space', + name: 'spaceId', type: 'options', default: '', displayOptions: { @@ -67,7 +269,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'team', + 'teamId', ] }, required: true, @@ -91,7 +293,7 @@ export const listFields = [ }, { displayName: 'Folder', - name: 'folder', + name: 'folderId', type: 'options', default: '', displayOptions: { @@ -110,14 +312,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { displayName: 'List', - name: 'list', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -136,14 +338,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { displayName: 'List', - name: 'list', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -162,9 +364,538 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folder', + 'folderId', ] }, required: true, }, +/* -------------------------------------------------------------------------- */ +/* list:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'delete', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folderless List', + name: 'folderless', + type: 'boolean', + default: false, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'delete', + ], + folderless: [ + false, + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'List ID', + name: 'listId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* list:get */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'get', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folderless List', + name: 'folderless', + type: 'boolean', + default: false, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'get', + ], + }, + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'get', + ], + folderless: [ + false, + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'List ID', + name: 'listId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'get', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* list:getAll */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folderless List', + name: 'folderless', + type: 'boolean', + default: false, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + }, + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + folderless: [ + false, + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, + { + displayName: 'Filters', + name: 'filters', + type: 'collection', + placeholder: 'Add Filter', + default: {}, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'getAll', + ], + }, + }, + options: [ + { + displayName: 'Archived', + name: 'archived', + type: 'boolean', + default: false, + }, + ], + }, +/* -------------------------------------------------------------------------- */ +/* list:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Team ID', + name: 'teamId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getTeams', + }, + required: true, + }, + { + displayName: 'Space ID', + name: 'spaceId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getSpaces', + loadOptionsDependsOn: [ + 'teamId', + ] + }, + required: true, + }, + { + displayName: 'Folderless List', + name: 'folderless', + type: 'boolean', + default: false, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Folder ID', + name: 'folderId', + type: 'options', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + folderless: [ + false, + ], + }, + }, + typeOptions: { + loadOptionsMethod: 'getFolders', + loadOptionsDependsOn: [ + 'spaceId', + ], + }, + required: true, + }, + { + displayName: 'List ID', + name: 'listId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + resource: [ + 'list', + ], + operation: [ + 'update', + ], + }, + }, + options: [ + { + displayName: 'Assignee', + name: 'assignee', + type: 'options', + loadOptionsDependsOn: [ + 'list', + ], + typeOptions: { + loadOptionsMethod: 'getAssignees', + }, + + default: '', + }, + { + displayName: 'Content', + name: 'content', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + }, + { + displayName: 'Due Date', + name: 'dueDate', + type: 'dateTime', + default: '', + }, + { + displayName: 'Due Date Time', + name: 'dueDateTime', + type: 'boolean', + default: false, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + }, + { + displayName: 'Priority', + name: 'priority', + type: 'number', + typeOptions: { + minValue: 1, + maxValue: 4, + }, + description: 'Integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low', + default: 3, + }, + { + displayName: 'Unset Status', + name: 'unsetStatus', + type: 'boolean', + default: false, + }, + ], + }, ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/ListInterface.ts b/packages/nodes-base/nodes/ClickUp/ListInterface.ts new file mode 100644 index 0000000000..d8a6db8157 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/ListInterface.ts @@ -0,0 +1,11 @@ + +export interface IList { + name?: string; + content?: string; + assignee?: number; + status?: string; + priority?: number; + due_date?: number; + due_date_time?: boolean; + unset_status?: boolean; +} diff --git a/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts b/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts new file mode 100644 index 0000000000..97950263e8 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts @@ -0,0 +1,140 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const taskDependencyOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a task dependency', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a task dependency', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const taskDependencyFields = [ + +/* -------------------------------------------------------------------------- */ +/* taskDependency:create */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'create', + ], + }, + }, + required: true, + }, + { + displayName: 'Depends On', + name: 'dependsOn', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'create', + ], + }, + }, + }, + { + displayName: 'Dependency Of', + name: 'dependencyOf', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'create', + ], + }, + }, + }, +/* -------------------------------------------------------------------------- */ +/* taskDependency:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, + { + displayName: 'Depends On', + name: 'dependsOn', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'delete', + ], + }, + }, + }, + { + displayName: 'Dependency Of', + name: 'dependencyOf', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'taskDependency', + ], + operation: [ + 'delete', + ], + }, + }, + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ClickUp/TaskDescription.ts b/packages/nodes-base/nodes/ClickUp/TaskDescription.ts index 77a12ed07a..be0c7087f5 100644 --- a/packages/nodes-base/nodes/ClickUp/TaskDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/TaskDescription.ts @@ -1,4 +1,6 @@ -import { INodeProperties } from 'n8n-workflow'; +import { + INodeProperties, + } from 'n8n-workflow'; export const taskOperations = [ { @@ -55,8 +57,8 @@ export const taskFields = [ /* task:create */ /* -------------------------------------------------------------------------- */ { - displayName: 'Team', - name: 'team', + displayName: 'Team ID', + name: 'teamId', type: 'options', default: '', displayOptions: { @@ -75,8 +77,8 @@ export const taskFields = [ required: true, }, { - displayName: 'Space', - name: 'space', + displayName: 'Space ID', + name: 'spaceId', type: 'options', default: '', displayOptions: { @@ -92,7 +94,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'team', + 'teamId', ] }, required: true, @@ -115,8 +117,8 @@ export const taskFields = [ required: true, }, { - displayName: 'Folder', - name: 'folder', + displayName: 'Folder ID', + name: 'folderId', type: 'options', default: '', displayOptions: { @@ -135,14 +137,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { - displayName: 'List', - name: 'list', + displayName: 'List ID', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -161,14 +163,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { - displayName: 'List', - name: 'list', + displayName: 'List ID', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -187,7 +189,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folder', + 'folderId', ] }, required: true, @@ -232,7 +234,7 @@ export const taskFields = [ name: 'assignees', type: 'multiOptions', loadOptionsDependsOn: [ - 'list', + 'listId', ], typeOptions: { loadOptionsMethod: 'getAssignees', @@ -311,7 +313,7 @@ export const taskFields = [ name: 'status', type: 'options', loadOptionsDependsOn: [ - 'list', + 'listId', ], typeOptions: { loadOptionsMethod: 'getStatuses', @@ -323,7 +325,7 @@ export const taskFields = [ name: 'tags', type: 'multiOptions', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], typeOptions: { loadOptionsMethod: 'getTags', @@ -345,7 +347,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'id', + name: 'taskId', type: 'string', default: '', required: true, @@ -455,7 +457,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'id', + name: 'taskId', type: 'string', default: '', required: true, @@ -475,8 +477,8 @@ export const taskFields = [ /* task:getAll */ /* -------------------------------------------------------------------------- */ { - displayName: 'Team', - name: 'team', + displayName: 'Team ID', + name: 'teamId', type: 'options', default: '', displayOptions: { @@ -495,8 +497,8 @@ export const taskFields = [ required: true, }, { - displayName: 'Space', - name: 'space', + displayName: 'Space ID', + name: 'spaceId', type: 'options', default: '', displayOptions: { @@ -512,7 +514,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'team', + 'teamId', ] }, required: true, @@ -535,8 +537,8 @@ export const taskFields = [ required: true, }, { - displayName: 'Folder', - name: 'folder', + displayName: 'Folder ID', + name: 'folderId', type: 'options', default: '', displayOptions: { @@ -555,14 +557,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { - displayName: 'List', - name: 'list', + displayName: 'List ID', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -581,14 +583,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], }, required: true, }, { - displayName: 'List', - name: 'list', + displayName: 'List ID', + name: 'listId', type: 'options', default: '', displayOptions: { @@ -607,52 +609,52 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folder', + 'folderId', ] }, required: true, }, - // { - // displayName: 'Return All', - // name: 'returnAll', - // type: 'boolean', - // displayOptions: { - // show: { - // resource: [ - // 'task', - // ], - // operation: [ - // 'getAll', - // ], - // }, - // }, - // default: true, - // description: 'If all results should be returned or only up to a given limit.', - // }, - // { - // displayName: 'Limit', - // name: 'limit', - // type: 'number', - // displayOptions: { - // show: { - // resource: [ - // 'task', - // ], - // operation: [ - // 'getAll', - // ], - // returnAll: [ - // false, - // ], - // }, - // }, - // typeOptions: { - // minValue: 1, - // maxValue: 100, - // }, - // default: 50, - // description: 'How many results to return.', - // }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + resource: [ + 'task', + ], + operation: [ + 'getAll', + ], + }, + }, + default: true, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'task', + ], + operation: [ + 'getAll', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, { displayName: 'Filters', name: 'filters', @@ -681,7 +683,7 @@ export const taskFields = [ name: 'assignees', type: 'multiOptions', loadOptionsDependsOn: [ - 'list', + 'listId', ], typeOptions: { loadOptionsMethod: 'getAssignees', @@ -767,7 +769,7 @@ export const taskFields = [ name: 'statuses', type: 'multiOptions', loadOptionsDependsOn: [ - 'list', + 'listId', ], typeOptions: { loadOptionsMethod: 'getStatuses', @@ -786,7 +788,7 @@ export const taskFields = [ name: 'tags', type: 'multiOptions', loadOptionsDependsOn: [ - 'space', + 'spaceId', ], typeOptions: { loadOptionsMethod: 'getTags', @@ -800,8 +802,8 @@ export const taskFields = [ /* task:delete */ /* -------------------------------------------------------------------------- */ { - displayName: 'ID', - name: 'id', + displayName: 'Task ID', + name: 'taskId', type: 'string', default: '', required: true, @@ -822,7 +824,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'task', + name: 'taskId', type: 'string', default: '', required: true, @@ -840,7 +842,7 @@ export const taskFields = [ }, { displayName: 'Field ID', - name: 'field', + name: 'fieldId', type: 'string', default: '', required: true, diff --git a/packages/nodes-base/nodes/ClickUp/TaskInterface.ts b/packages/nodes-base/nodes/ClickUp/TaskInterface.ts index 44a61805f5..3a5c733796 100644 --- a/packages/nodes-base/nodes/ClickUp/TaskInterface.ts +++ b/packages/nodes-base/nodes/ClickUp/TaskInterface.ts @@ -1,4 +1,6 @@ -import { IDataObject } from "n8n-workflow"; +import { + IDataObject + } from 'n8n-workflow'; export interface ITask { name?: string; diff --git a/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts b/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts new file mode 100644 index 0000000000..b0f5abf9b1 --- /dev/null +++ b/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts @@ -0,0 +1,359 @@ +import { + INodeProperties, + } from 'n8n-workflow'; + +export const timeTrackingOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + }, + }, + options: [ + { + name: 'Log', + value: 'log', + description: 'Log time on task', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a logged time', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all loggin times on task', + }, + { + name: 'Update', + value: 'update', + description: 'Update a logged time', + }, + ], + default: 'log', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const timeTrackingFields = [ + +/* -------------------------------------------------------------------------- */ +/* timeTracking:log */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'log', + ], + }, + }, + required: true, + }, + { + displayName: 'Type', + name: 'type', + type: 'options', + default: '', + options: [ + { + name: 'Duration', + value: 'duration', + }, + { + name: 'From/To', + value: 'fromTo', + }, + ], + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'log', + ], + }, + }, + }, + { + displayName: 'Minutes', + name: 'minutes', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: 0, + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'log', + ], + type: [ + 'duration', + ], + }, + }, + required: true, + }, + { + displayName: 'From', + name: 'from', + type: 'dateTime', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'log', + ], + type: [ + 'fromTo', + ], + }, + }, + required: true, + }, + { + displayName: 'To', + name: 'to', + type: 'dateTime', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'log', + ], + type: [ + 'fromTo', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* timeTracking:delete */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, + { + displayName: 'Interval ID', + name: 'intervalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'delete', + ], + }, + }, + required: true, + }, +/* -------------------------------------------------------------------------- */ +/* timeTracking:getAll */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'getAll', + ], + }, + }, + required: true, + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'getAll', + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 100, + }, + default: 50, + description: 'How many results to return.', + }, +/* -------------------------------------------------------------------------- */ +/* timeTracking:update */ +/* -------------------------------------------------------------------------- */ + { + displayName: 'Task ID', + name: 'taskId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Interval ID', + name: 'intervalId', + type: 'string', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + }, + }, + required: true, + }, + { + displayName: 'Type', + name: 'type', + type: 'options', + default: '', + options: [ + { + name: 'Duration', + value: 'duration', + }, + { + name: 'From/To', + value: 'fromTo', + }, + ], + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + }, + }, + }, + { + displayName: 'Minutes', + name: 'minutes', + type: 'number', + typeOptions: { + minValue: 0, + }, + default: 0, + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + type: [ + 'duration', + ], + }, + }, + required: true, + }, + { + displayName: 'From', + name: 'from', + type: 'dateTime', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + type: [ + 'fromTo', + ], + }, + }, + required: true, + }, + { + displayName: 'To', + name: 'to', + type: 'dateTime', + default: '', + displayOptions: { + show: { + resource: [ + 'timeTracking', + ], + operation: [ + 'update', + ], + type: [ + 'fromTo', + ], + }, + }, + required: true, + }, +] as INodeProperties[]; From 86ab14088b1dfcb1e34c34c2be311b3ab0dfa887 Mon Sep 17 00:00:00 2001 From: ricardo Date: Mon, 20 Apr 2020 23:57:39 -0500 Subject: [PATCH 2/2] :zap: Updated names to keep backward compatibility --- .../nodes/ClickUp/ChecklistDescription.ts | 6 +- .../nodes/ClickUp/ChecklistItemDescription.ts | 16 +- .../nodes-base/nodes/ClickUp/ClickUp.node.ts | 155 ++++++++++-------- .../nodes/ClickUp/CommentDescription.ts | 8 +- .../nodes/ClickUp/FolderDescription.ts | 42 ++--- .../nodes/ClickUp/GoalDescription.ts | 10 +- .../nodes/ClickUp/GoalKeyResultDescription.ts | 16 +- .../nodes/ClickUp/GuestDescription.ts | 14 +- .../nodes/ClickUp/ListDescription.ts | 72 ++++---- .../ClickUp/TaskDependencyDescription.ts | 4 +- .../nodes/ClickUp/TaskDescription.ts | 79 +++++---- .../nodes-base/nodes/ClickUp/TaskInterface.ts | 2 +- .../nodes/ClickUp/TimeTrackingDescription.ts | 12 +- 13 files changed, 237 insertions(+), 199 deletions(-) diff --git a/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts b/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts index 3884a8ea47..517d2946b5 100644 --- a/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/ChecklistDescription.ts @@ -43,7 +43,7 @@ export const checklistFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -80,7 +80,7 @@ export const checklistFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Checklist ID', - name: 'checklistId', + name: 'checklist', type: 'string', default: '', displayOptions: { @@ -100,7 +100,7 @@ export const checklistFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Checklist ID', - name: 'checklistId', + name: 'checklist', type: 'string', default: '', displayOptions: { diff --git a/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts b/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts index 46d4de3bc7..e15fb52919 100644 --- a/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/ChecklistItemDescription.ts @@ -43,7 +43,7 @@ export const checklistItemFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Checklist ID', - name: 'checklistId', + name: 'checklist', type: 'string', default: '', displayOptions: { @@ -94,7 +94,7 @@ export const checklistItemFields = [ options: [ { displayName: 'Assignee ID', - name: 'assigneeId', + name: 'assignee', type: 'string', default: '', }, @@ -105,7 +105,7 @@ export const checklistItemFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Checklist ID', - name: 'checklistId', + name: 'checklist', type: 'string', default: '', displayOptions: { @@ -122,7 +122,7 @@ export const checklistItemFields = [ }, { displayName: 'Checklist Item ID', - name: 'checklistItemId', + name: 'checklistItem', type: 'string', default: '', displayOptions: { @@ -142,7 +142,7 @@ export const checklistItemFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Checklist ID', - name: 'checklistId', + name: 'checklist', type: 'string', default: '', displayOptions: { @@ -159,7 +159,7 @@ export const checklistItemFields = [ }, { displayName: 'Checklist Item ID', - name: 'checklistItemId', + name: 'checklistItem', type: 'string', default: '', displayOptions: { @@ -193,7 +193,7 @@ export const checklistItemFields = [ options: [ { displayName: 'Assignee ID', - name: 'assigneeId', + name: 'assignee', type: 'string', default: '', }, @@ -205,7 +205,7 @@ export const checklistItemFields = [ }, { displayName: 'Parent Checklist Item ID', - name: 'parentId', + name: 'parent', type: 'string', default: '', description: 'Checklist item that you want to nest the target checklist item underneath.', diff --git a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts index 8c7c006c5d..09d9d183b1 100644 --- a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts +++ b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts @@ -211,7 +211,7 @@ export class ClickUp implements INodeType { // Get all the available spaces to display them to user so that he can // select them easily async getSpaces(this: ILoadOptionsFunctions): Promise { - const teamId = this.getCurrentNodeParameter('teamId') as string; + const teamId = this.getCurrentNodeParameter('team') as string; const returnData: INodePropertyOptions[] = []; const { spaces } = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/space`); for (const space of spaces) { @@ -227,7 +227,7 @@ export class ClickUp implements INodeType { // Get all the available folders to display them to user so that he can // select them easily async getFolders(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('spaceId') as string; + const spaceId = this.getCurrentNodeParameter('space') as string; const returnData: INodePropertyOptions[] = []; const { folders } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/folder`); for (const folder of folders) { @@ -243,7 +243,7 @@ export class ClickUp implements INodeType { // Get all the available lists to display them to user so that he can // select them easily async getLists(this: ILoadOptionsFunctions): Promise { - const folderId = this.getCurrentNodeParameter('folderId') as string; + const folderId = this.getCurrentNodeParameter('folder') as string; const returnData: INodePropertyOptions[] = []; const { lists } = await clickupApiRequest.call(this, 'GET', `/folder/${folderId}/list`); for (const list of lists) { @@ -259,7 +259,7 @@ export class ClickUp implements INodeType { // Get all the available lists without a folder to display them to user so that he can // select them easily async getFolderlessLists(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('spaceId') as string; + const spaceId = this.getCurrentNodeParameter('space') as string; const returnData: INodePropertyOptions[] = []; const { lists } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/list`); for (const list of lists) { @@ -275,7 +275,7 @@ export class ClickUp implements INodeType { // Get all the available assignees to display them to user so that he can // select them easily async getAssignees(this: ILoadOptionsFunctions): Promise { - const listId = this.getCurrentNodeParameter('listId') as string; + const listId = this.getCurrentNodeParameter('list') as string; const returnData: INodePropertyOptions[] = []; const { members } = await clickupApiRequest.call(this, 'GET', `/list/${listId}/member`); for (const member of members) { @@ -291,7 +291,7 @@ export class ClickUp implements INodeType { // Get all the available tags to display them to user so that he can // select them easily async getTags(this: ILoadOptionsFunctions): Promise { - const spaceId = this.getCurrentNodeParameter('spaceId') as string; + const spaceId = this.getCurrentNodeParameter('space') as string; const returnData: INodePropertyOptions[] = []; const { tags } = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/tag`); for (const tag of tags) { @@ -307,7 +307,7 @@ export class ClickUp implements INodeType { // Get all the available tags to display them to user so that he can // select them easily async getStatuses(this: ILoadOptionsFunctions): Promise { - const listId = this.getCurrentNodeParameter('listId') as string; + const listId = this.getCurrentNodeParameter('list') as string; const returnData: INodePropertyOptions[] = []; const { statuses } = await clickupApiRequest.call(this, 'GET', `/list/${listId}`); for (const status of statuses) { @@ -336,7 +336,7 @@ export class ClickUp implements INodeType { for (let i = 0; i < length; i++) { if (resource === 'checklist') { if (operation === 'create') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; const name = this.getNodeParameter('name', i) as string; const body: IDataObject = { name, @@ -345,12 +345,12 @@ export class ClickUp implements INodeType { responseData = responseData.checklist; } if (operation === 'delete') { - const checklistId = this.getNodeParameter('checklistId', i) as string; + const checklistId = this.getNodeParameter('checklist', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/checklist/${checklistId}`); responseData = { success: true }; } if (operation === 'update') { - const checklistId = this.getNodeParameter('checklistId', i) as string; + const checklistId = this.getNodeParameter('checklist', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.name) { @@ -365,7 +365,7 @@ export class ClickUp implements INodeType { } if (resource === 'checklistItem') { if (operation === 'create') { - const checklistId = this.getNodeParameter('checklistId', i) as string; + const checklistId = this.getNodeParameter('checklist', i) as string; const name = this.getNodeParameter('name', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: IDataObject = { @@ -378,24 +378,24 @@ export class ClickUp implements INodeType { responseData = responseData.checklist; } if (operation === 'delete') { - const checklistId = this.getNodeParameter('checklistId', i) as string; - const checklistItemId = this.getNodeParameter('checklistItemId', i) as string; + const checklistId = this.getNodeParameter('checklist', i) as string; + const checklistItemId = this.getNodeParameter('checklistItem', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/checklist/${checklistId}/checklist_item/${checklistItemId}`); responseData = { success: true }; } if (operation === 'update') { - const checklistId = this.getNodeParameter('checklistId', i) as string; - const checklistItemId = this.getNodeParameter('checklistItemId', i) as string; + const checklistId = this.getNodeParameter('checklist', i) as string; + const checklistItemId = this.getNodeParameter('checklistItem', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.name) { body.name = updateFields.name as string; } - if (updateFields.parentId) { - body.parent = updateFields.parentId as string; + if (updateFields.parent) { + body.parent = updateFields.parent as string; } - if (updateFields.assigneeId) { - body.assignee = parseInt(updateFields.assigneeId as string, 10); + if (updateFields.assignee) { + body.assignee = parseInt(updateFields.assignee as string, 10); } if (updateFields.resolved) { body.resolved = updateFields.resolved as boolean; @@ -413,8 +413,8 @@ export class ClickUp implements INodeType { const body: IDataObject = { comment_text: commentText, }; - if (additionalFields.assigneeId) { - body.assigneeId = additionalFields.assigneeId as string; + if (additionalFields.assignee) { + body.assigneeId = additionalFields.assignee as string; } if (additionalFields.notifyAll) { body.notify_all = additionalFields.notifyAll as boolean; @@ -422,7 +422,7 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/${resource}/${id}/comment`, body); } if (operation === 'delete') { - const commentId = this.getNodeParameter('commentId', i) as string; + const commentId = this.getNodeParameter('comment', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/comment/${commentId}`); responseData = { success: true }; } @@ -435,24 +435,25 @@ export class ClickUp implements INodeType { responseData = responseData.splice(0, qs.limit); } if (operation === 'update') { - const commentId = this.getNodeParameter('commentId', i) as string; + const commentId = this.getNodeParameter('comment', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.commentText) { body.comment_text = updateFields.commentText as string; } - if (updateFields.assigneeId) { - body.assignee = parseInt(updateFields.assigneeId as string, 10); + if (updateFields.assignee) { + body.assignee = parseInt(updateFields.assignee as string, 10); } if (updateFields.resolved) { body.resolved = updateFields.resolved as boolean; } responseData = await clickupApiRequest.call(this, 'PUT', `/comment/${commentId}`, body); + responseData = { success: true }; } } if (resource === 'folder') { if (operation === 'create') { - const spaceId = this.getNodeParameter('spaceId', i) as string; + const spaceId = this.getNodeParameter('space', i) as string; const name = this.getNodeParameter('name', i) as string; const body: IDataObject = { name, @@ -460,17 +461,17 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/space/${spaceId}/folder`, body); } if (operation === 'delete') { - const folderId = this.getNodeParameter('folderId', i) as string; + const folderId = this.getNodeParameter('folder', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/folder/${folderId}`); responseData = { success: true }; } if (operation === 'get') { - const folderId = this.getNodeParameter('folderId', i) as string; + const folderId = this.getNodeParameter('folder', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/folder/${folderId}`); } if (operation === 'getAll') { const filters = this.getNodeParameter('filters', i) as IDataObject; - const spaceId = this.getNodeParameter('spaceId', i) as string; + const spaceId = this.getNodeParameter('space', i) as string; if (filters.archived) { qs.archived = filters.archived as boolean; } @@ -480,7 +481,7 @@ export class ClickUp implements INodeType { responseData = responseData.splice(0, qs.limit); } if (operation === 'update') { - const folderId = this.getNodeParameter('folderId', i) as string; + const folderId = this.getNodeParameter('folder', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.name) { @@ -491,7 +492,7 @@ export class ClickUp implements INodeType { } if (resource === 'goal') { if (operation === 'create') { - const teamId = this.getNodeParameter('teamId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; const name = this.getNodeParameter('name', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: IDataObject = { @@ -516,17 +517,17 @@ export class ClickUp implements INodeType { responseData = responseData.goal; } if (operation === 'delete') { - const goalId = this.getNodeParameter('goalId', i) as string; + const goalId = this.getNodeParameter('goal', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/goal/${goalId}`); responseData = { success: true }; } if (operation === 'get') { - const goalId = this.getNodeParameter('goalId', i) as string; + const goalId = this.getNodeParameter('goal', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/goal/${goalId}`); responseData = responseData.goal; } if (operation === 'getAll') { - const teamId = this.getNodeParameter('teamId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; qs.limit = this.getNodeParameter('limit', i) as number; responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/goal`, {}, qs); responseData = responseData.goals; @@ -534,7 +535,7 @@ export class ClickUp implements INodeType { } if (operation === 'update') { - const goalId = this.getNodeParameter('goalId', i) as string; + const goalId = this.getNodeParameter('goal', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.name) { @@ -561,7 +562,7 @@ export class ClickUp implements INodeType { } if (resource === 'goalKeyResult') { if (operation === 'create') { - const goalId = this.getNodeParameter('goalId', i) as string; + const goalId = this.getNodeParameter('goal', i) as string; const name = this.getNodeParameter('name', i) as string; const type = this.getNodeParameter('type', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; @@ -591,12 +592,12 @@ export class ClickUp implements INodeType { responseData = responseData.key_result; } if (operation === 'delete') { - const keyResultId = this.getNodeParameter('keyResultId', i) as string; + const keyResultId = this.getNodeParameter('keyResult', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/key_result/${keyResultId}`); responseData = { success: true }; } if (operation === 'update') { - const keyResultId = this.getNodeParameter('keyResultId', i) as string; + const keyResultId = this.getNodeParameter('keyResult', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.name) { @@ -623,7 +624,7 @@ export class ClickUp implements INodeType { } if (resource === 'guest') { if (operation === 'create') { - const teamId = this.getNodeParameter('teamId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; const email = this.getNodeParameter('email', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: IDataObject = { @@ -642,20 +643,20 @@ export class ClickUp implements INodeType { responseData = responseData.team; } if (operation === 'delete') { - const teamId = this.getNodeParameter('teamId', i) as string; - const guestId = this.getNodeParameter('guestId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; + const guestId = this.getNodeParameter('guest', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/team/${teamId}/guest/${guestId}`); responseData = { success: true }; } if (operation === 'get') { - const teamId = this.getNodeParameter('teamId', i) as string; - const guestId = this.getNodeParameter('guestId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; + const guestId = this.getNodeParameter('guest', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/team/${teamId}/guest/${guestId}`); responseData = responseData.team; } if (operation === 'update') { - const teamId = this.getNodeParameter('teamId', i) as string; - const guestId = this.getNodeParameter('guestId', i) as string; + const teamId = this.getNodeParameter('team', i) as string; + const guestId = this.getNodeParameter('guest', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IDataObject = {}; if (updateFields.username) { @@ -676,7 +677,7 @@ export class ClickUp implements INodeType { } if (resource === 'task') { if (operation === 'create') { - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; const name = this.getNodeParameter('name', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: ITask = { @@ -732,9 +733,14 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/list/${listId}/task`, body); } if (operation === 'update') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('id', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; - const body: ITask = {}; + const body: ITask = { + assignees: { + add: [], + rem: [], + }, + }; if (updateFields.content) { body.content = updateFields.content as string; } @@ -765,6 +771,17 @@ export class ClickUp implements INodeType { if (updateFields.parentId) { body.parent = updateFields.parentId as string; } + if (updateFields.addAssignees) { + //@ts-ignore + body.assignees.add = ((updateFields.addAssignees as string).split(',') as string[]).map((e: string) => parseInt(e, 10)); + } + if (updateFields.removeAssignees) { + //@ts-ignore + body.assignees.rem = ((updateFields.removeAssignees as string).split(',') as string[]).map((e: string) => parseInt(e, 10)); + } + if (updateFields.status) { + body.status = updateFields.status as string; + } if (updateFields.markdownContent) { delete body.content; body.markdown_content = updateFields.content as string; @@ -772,7 +789,7 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'PUT', `/task/${taskId}`, body); } if (operation === 'get') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('id', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/task/${taskId}`); } if (operation === 'getAll') { @@ -817,7 +834,7 @@ export class ClickUp implements INodeType { if (filters.dateUpdatedLt) { qs.date_updated_lt = new Date(filters.dateUpdatedLt as string).getTime(); } - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; if (returnAll === true) { responseData = await clickupApiRequestAllItems.call(this, 'tasks', 'GET', `/list/${listId}/task`, {}, qs); } else { @@ -827,8 +844,8 @@ export class ClickUp implements INodeType { } } if (operation === 'setCustomField') { - const taskId = this.getNodeParameter('taskId', i) as string; - const fieldId = this.getNodeParameter('fieldId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; + const fieldId = this.getNodeParameter('field', i) as string; const value = this.getNodeParameter('value', i) as string; const jsonParse = this.getNodeParameter('jsonParse', i) as boolean; @@ -848,14 +865,14 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/field/${fieldId}`, body); } if (operation === 'delete') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('id', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}`, {}); responseData = { success: true }; } } if (resource === 'taskDependency') { if (operation === 'create') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; const dependsOn = this.getNodeParameter('dependsOn', i) as string; const dependencyOf = this.getNodeParameter('dependencyOf', i) as string; if (dependencyOf !== '' && dependsOn !== '' ) { @@ -872,7 +889,7 @@ export class ClickUp implements INodeType { responseData = { success: true }; } if (operation === 'delete') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; const dependsOn = this.getNodeParameter('dependsOn', i) as string; const dependencyOf = this.getNodeParameter('dependencyOf', i) as string; if (dependencyOf !== '' && dependsOn !== '' ) { @@ -890,7 +907,7 @@ export class ClickUp implements INodeType { } if (resource === 'timeTracking') { if (operation === 'log') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; const type = this.getNodeParameter('type', i) as string; const body: IDataObject = {}; if (type === 'fromTo') { @@ -905,21 +922,21 @@ export class ClickUp implements INodeType { responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/time`, body); } if (operation === 'delete') { - const taskId = this.getNodeParameter('taskId', i) as string; - const intervalId = this.getNodeParameter('intervalId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; + const intervalId = this.getNodeParameter('interval', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/time/${intervalId}`); responseData = { success: true }; } if (operation === 'getAll') { - const taskId = this.getNodeParameter('taskId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; qs.limit = this.getNodeParameter('limit', i) as number; responseData = await clickupApiRequest.call(this, 'GET', `/task/${taskId}/time`, {}, qs); responseData = responseData.data; responseData = responseData.splice(0, qs.limit); } if (operation === 'update') { - const taskId = this.getNodeParameter('taskId', i) as string; - const intervalId = this.getNodeParameter('intervalId', i) as string; + const taskId = this.getNodeParameter('task', i) as string; + const intervalId = this.getNodeParameter('interval', i) as string; const type = this.getNodeParameter('type', i) as string; const body: IDataObject = {}; if (type === 'fromTo') { @@ -937,7 +954,7 @@ export class ClickUp implements INodeType { } if (resource === 'list') { if (operation === 'create') { - const spaceId = this.getNodeParameter('spaceId', i) as string; + const spaceId = this.getNodeParameter('space', i) as string; const folderless = this.getNodeParameter('folderless', i) as string; const name = this.getNodeParameter('name', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; @@ -965,34 +982,34 @@ export class ClickUp implements INodeType { if (folderless) { responseData = await clickupApiRequest.call(this, 'POST', `/space/${spaceId}/list`, body); } else { - const folderId = this.getNodeParameter('folderId', i) as string; + const folderId = this.getNodeParameter('folder', i) as string; responseData = await clickupApiRequest.call(this, 'POST', `/folder/${folderId}/list`, body); } } if (operation === 'customFields') { - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/list/${listId}/field`); responseData = responseData.fields; } if (operation === 'delete') { - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; responseData = await clickupApiRequest.call(this, 'DELETE', `/list/${listId}`); responseData = { success: true }; } if (operation === 'get') { - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; responseData = await clickupApiRequest.call(this, 'GET', `/list/${listId}`); } if (operation === 'getAll') { const filters = this.getNodeParameter('filters', i) as IDataObject; - const spaceId = this.getNodeParameter('spaceId', i) as string; + const spaceId = this.getNodeParameter('space', i) as string; const folderless = this.getNodeParameter('folderless', i) as boolean; if (filters.archived) { qs.archived = filters.archived as boolean; } let endpoint = `/space/${spaceId}/list`; if (!folderless) { - const folderId = this.getNodeParameter('folderId', i) as string; + const folderId = this.getNodeParameter('folder', i) as string; endpoint = `/folder/${folderId}/list`; } @@ -1002,7 +1019,7 @@ export class ClickUp implements INodeType { responseData = responseData.splice(0, qs.limit); } if (operation === 'update') { - const listId = this.getNodeParameter('listId', i) as string; + const listId = this.getNodeParameter('list', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IList = {}; if (updateFields.name) { diff --git a/packages/nodes-base/nodes/ClickUp/CommentDescription.ts b/packages/nodes-base/nodes/ClickUp/CommentDescription.ts index 8c51de1b28..a8ef00d2f4 100644 --- a/packages/nodes-base/nodes/ClickUp/CommentDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/CommentDescription.ts @@ -128,7 +128,7 @@ export const commentFields = [ options: [ { displayName: 'Assignee ID', - name: 'assigneeId', + name: 'assignee', type: 'string', default: '', }, @@ -146,7 +146,7 @@ export const commentFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Comment ID', - name: 'commentId', + name: 'comment', type: 'string', default: '', displayOptions: { @@ -237,7 +237,7 @@ export const commentFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Comment ID', - name: 'commentId', + name: 'comment', type: 'string', default: '', displayOptions: { @@ -271,7 +271,7 @@ export const commentFields = [ options: [ { displayName: 'Assignee ID', - name: 'assigneeId', + name: 'assignee', type: 'string', default: '', }, diff --git a/packages/nodes-base/nodes/ClickUp/FolderDescription.ts b/packages/nodes-base/nodes/ClickUp/FolderDescription.ts index d73a908ec8..af9803c13e 100644 --- a/packages/nodes-base/nodes/ClickUp/FolderDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/FolderDescription.ts @@ -53,7 +53,7 @@ export const folderFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -73,7 +73,7 @@ export const folderFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -89,7 +89,7 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -116,7 +116,7 @@ export const folderFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -136,7 +136,7 @@ export const folderFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -152,14 +152,14 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -175,7 +175,7 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, @@ -185,7 +185,7 @@ export const folderFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -205,7 +205,7 @@ export const folderFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -221,14 +221,14 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -244,7 +244,7 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, @@ -254,7 +254,7 @@ export const folderFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -274,7 +274,7 @@ export const folderFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -290,7 +290,7 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -346,7 +346,7 @@ export const folderFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -366,7 +366,7 @@ export const folderFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -382,14 +382,14 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -405,7 +405,7 @@ export const folderFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, diff --git a/packages/nodes-base/nodes/ClickUp/GoalDescription.ts b/packages/nodes-base/nodes/ClickUp/GoalDescription.ts index ee8047c962..06e0463f6c 100644 --- a/packages/nodes-base/nodes/ClickUp/GoalDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/GoalDescription.ts @@ -53,7 +53,7 @@ export const goalFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -145,7 +145,7 @@ export const goalFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Goal ID', - name: 'goalId', + name: 'goal', type: 'string', default: '', displayOptions: { @@ -165,7 +165,7 @@ export const goalFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Goal ID', - name: 'goalId', + name: 'goal', type: 'string', default: '', displayOptions: { @@ -185,7 +185,7 @@ export const goalFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -229,7 +229,7 @@ export const goalFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Goal ID', - name: 'goalId', + name: 'goal', type: 'string', default: '', displayOptions: { diff --git a/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts b/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts index d6df7e4236..41cb29cb17 100644 --- a/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/GoalKeyResultDescription.ts @@ -43,7 +43,7 @@ export const goalKeyResultFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Goal ID', - name: 'goalId', + name: 'goal', type: 'string', default: '', displayOptions: { @@ -150,7 +150,7 @@ export const goalKeyResultFields = [ typeOptions: { minValue: 0, }, - default: '', + default: 0, description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency', }, { @@ -160,7 +160,7 @@ export const goalKeyResultFields = [ typeOptions: { minValue: 0, }, - default: '', + default: 0, description: 'Required for Percentage, Automatic (when Task IDs or List IDs are filled), Number and Currency', }, { @@ -183,7 +183,7 @@ export const goalKeyResultFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Key Result ID', - name: 'keyResultId', + name: 'keyResult', type: 'string', default: '', displayOptions: { @@ -203,7 +203,7 @@ export const goalKeyResultFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Key Result ID', - name: 'keyResultId', + name: 'keyResult', type: 'string', default: '', displayOptions: { @@ -257,7 +257,7 @@ export const goalKeyResultFields = [ typeOptions: { minValue: 0, }, - default: '', + default: 0, }, { displayName: 'Steps End', @@ -266,7 +266,7 @@ export const goalKeyResultFields = [ typeOptions: { minValue: 0, }, - default: '', + default: 0, }, { displayName: 'Steps Start', @@ -275,7 +275,7 @@ export const goalKeyResultFields = [ typeOptions: { minValue: 0, }, - default: '', + default: 0, }, { displayName: 'Unit', diff --git a/packages/nodes-base/nodes/ClickUp/GuestDescription.ts b/packages/nodes-base/nodes/ClickUp/GuestDescription.ts index db00a2fb9f..2f6ebd6da1 100644 --- a/packages/nodes-base/nodes/ClickUp/GuestDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/GuestDescription.ts @@ -48,7 +48,7 @@ export const guestFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -124,7 +124,7 @@ export const guestFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -144,7 +144,7 @@ export const guestFields = [ }, { displayName: 'Guest ID', - name: 'guestId', + name: 'guest', type: 'string', default: '', displayOptions: { @@ -164,7 +164,7 @@ export const guestFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -184,7 +184,7 @@ export const guestFields = [ }, { displayName: 'Guest ID', - name: 'guestId', + name: 'guest', type: 'string', default: '', displayOptions: { @@ -204,7 +204,7 @@ export const guestFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -224,7 +224,7 @@ export const guestFields = [ }, { displayName: 'Guest ID', - name: 'guestId', + name: 'guest', type: 'string', default: '', displayOptions: { diff --git a/packages/nodes-base/nodes/ClickUp/ListDescription.ts b/packages/nodes-base/nodes/ClickUp/ListDescription.ts index 23eec7073c..8fd4a8a13f 100644 --- a/packages/nodes-base/nodes/ClickUp/ListDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/ListDescription.ts @@ -58,7 +58,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -78,7 +78,7 @@ export const listFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -94,7 +94,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -118,7 +118,7 @@ export const listFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -137,7 +137,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, @@ -233,7 +233,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -253,7 +253,7 @@ export const listFields = [ }, { displayName: 'Space', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -293,7 +293,7 @@ export const listFields = [ }, { displayName: 'Folder', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -312,14 +312,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -338,14 +338,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -364,7 +364,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folderId', + 'folder', ] }, required: true, @@ -374,7 +374,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -394,7 +394,7 @@ export const listFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -410,7 +410,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -434,7 +434,7 @@ export const listFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -453,14 +453,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'string', default: '', displayOptions: { @@ -480,7 +480,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -500,7 +500,7 @@ export const listFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -516,7 +516,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -540,7 +540,7 @@ export const listFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -559,14 +559,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'string', default: '', displayOptions: { @@ -586,7 +586,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -606,7 +606,7 @@ export const listFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -622,7 +622,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -646,7 +646,7 @@ export const listFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -665,7 +665,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, @@ -721,7 +721,7 @@ export const listFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -741,7 +741,7 @@ export const listFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -757,7 +757,7 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -781,7 +781,7 @@ export const listFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -800,14 +800,14 @@ export const listFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'string', default: '', displayOptions: { diff --git a/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts b/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts index 97950263e8..8150394f8c 100644 --- a/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/TaskDependencyDescription.ts @@ -38,7 +38,7 @@ export const taskDependencyFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -90,7 +90,7 @@ export const taskDependencyFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { diff --git a/packages/nodes-base/nodes/ClickUp/TaskDescription.ts b/packages/nodes-base/nodes/ClickUp/TaskDescription.ts index be0c7087f5..5d53390c1c 100644 --- a/packages/nodes-base/nodes/ClickUp/TaskDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/TaskDescription.ts @@ -58,7 +58,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -78,7 +78,7 @@ export const taskFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -94,7 +94,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -118,7 +118,7 @@ export const taskFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -137,14 +137,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -163,14 +163,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -189,7 +189,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folderId', + 'folder', ] }, required: true, @@ -234,7 +234,7 @@ export const taskFields = [ name: 'assignees', type: 'multiOptions', loadOptionsDependsOn: [ - 'listId', + 'list', ], typeOptions: { loadOptionsMethod: 'getAssignees', @@ -313,7 +313,7 @@ export const taskFields = [ name: 'status', type: 'options', loadOptionsDependsOn: [ - 'listId', + 'list', ], typeOptions: { loadOptionsMethod: 'getStatuses', @@ -325,7 +325,7 @@ export const taskFields = [ name: 'tags', type: 'multiOptions', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], typeOptions: { loadOptionsMethod: 'getTags', @@ -347,7 +347,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'id', type: 'string', default: '', required: true, @@ -380,6 +380,13 @@ export const taskFields = [ }, }, options: [ + { + displayName: 'Add Assignees', + name: 'addAssignees', + type: 'string', + default: '', + description: 'Assignees IDs. Multiple ca be added separated by comma' + }, { displayName: 'Content', name: 'content', @@ -436,6 +443,20 @@ export const taskFields = [ description: 'Integer mapping as 1 : Urgent, 2 : High, 3 : Normal, 4 : Low', default: 3, }, + { + displayName: 'Remove Assignees', + name: 'removeAssignees', + type: 'string', + default: '', + description: 'Assignees IDs. Multiple ca be added separated by comma' + }, + { + displayName: 'Status', + name: 'status', + type: 'string', + default: '', + description: 'status' + }, { displayName: 'Start Date Time', name: 'startDateTime', @@ -457,7 +478,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'id', type: 'string', default: '', required: true, @@ -478,7 +499,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', - name: 'teamId', + name: 'team', type: 'options', default: '', displayOptions: { @@ -498,7 +519,7 @@ export const taskFields = [ }, { displayName: 'Space ID', - name: 'spaceId', + name: 'space', type: 'options', default: '', displayOptions: { @@ -514,7 +535,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getSpaces', loadOptionsDependsOn: [ - 'teamId', + 'team', ] }, required: true, @@ -538,7 +559,7 @@ export const taskFields = [ }, { displayName: 'Folder ID', - name: 'folderId', + name: 'folder', type: 'options', default: '', displayOptions: { @@ -557,14 +578,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolders', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -583,14 +604,14 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getFolderlessLists', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], }, required: true, }, { displayName: 'List ID', - name: 'listId', + name: 'list', type: 'options', default: '', displayOptions: { @@ -609,7 +630,7 @@ export const taskFields = [ typeOptions: { loadOptionsMethod: 'getLists', loadOptionsDependsOn: [ - 'folderId', + 'folder', ] }, required: true, @@ -683,7 +704,7 @@ export const taskFields = [ name: 'assignees', type: 'multiOptions', loadOptionsDependsOn: [ - 'listId', + 'list', ], typeOptions: { loadOptionsMethod: 'getAssignees', @@ -769,7 +790,7 @@ export const taskFields = [ name: 'statuses', type: 'multiOptions', loadOptionsDependsOn: [ - 'listId', + 'list', ], typeOptions: { loadOptionsMethod: 'getStatuses', @@ -788,7 +809,7 @@ export const taskFields = [ name: 'tags', type: 'multiOptions', loadOptionsDependsOn: [ - 'spaceId', + 'space', ], typeOptions: { loadOptionsMethod: 'getTags', @@ -803,7 +824,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'id', type: 'string', default: '', required: true, @@ -824,7 +845,7 @@ export const taskFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', required: true, @@ -842,7 +863,7 @@ export const taskFields = [ }, { displayName: 'Field ID', - name: 'fieldId', + name: 'field', type: 'string', default: '', required: true, diff --git a/packages/nodes-base/nodes/ClickUp/TaskInterface.ts b/packages/nodes-base/nodes/ClickUp/TaskInterface.ts index 3a5c733796..a24f9b2851 100644 --- a/packages/nodes-base/nodes/ClickUp/TaskInterface.ts +++ b/packages/nodes-base/nodes/ClickUp/TaskInterface.ts @@ -5,7 +5,7 @@ import { export interface ITask { name?: string; content?: string; - assignees?: string[]; + assignees?: string[] | IDataObject; tags?: string[]; status?: string; priority?: number; diff --git a/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts b/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts index b0f5abf9b1..8f76b77a26 100644 --- a/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts +++ b/packages/nodes-base/nodes/ClickUp/TimeTrackingDescription.ts @@ -48,7 +48,7 @@ export const timeTrackingFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -157,7 +157,7 @@ export const timeTrackingFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -174,7 +174,7 @@ export const timeTrackingFields = [ }, { displayName: 'Interval ID', - name: 'intervalId', + name: 'interval', type: 'string', default: '', displayOptions: { @@ -194,7 +194,7 @@ export const timeTrackingFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -235,7 +235,7 @@ export const timeTrackingFields = [ /* -------------------------------------------------------------------------- */ { displayName: 'Task ID', - name: 'taskId', + name: 'task', type: 'string', default: '', displayOptions: { @@ -252,7 +252,7 @@ export const timeTrackingFields = [ }, { displayName: 'Interval ID', - name: 'intervalId', + name: 'interval', type: 'string', default: '', displayOptions: {