mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add resources Task Tag, Space Tag & Task List to ClickUp Node (#1539)
* ⚡ Add resources Task Tag and Space Tag to ClickUp Node * ⚡ Add Task List resource * ⚡ Fix spaceTag:update * ⚡ Fix icon and formatting Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -57,6 +57,21 @@ import {
|
||||
taskOperations,
|
||||
} from './TaskDescription';
|
||||
|
||||
import {
|
||||
taskListFields,
|
||||
taskListOperations,
|
||||
} from './TaskListDescription';
|
||||
|
||||
import {
|
||||
taskTagFields,
|
||||
taskTagOperations,
|
||||
} from './TaskTagDescription';
|
||||
|
||||
import {
|
||||
spaceTagFields,
|
||||
spaceTagOperations,
|
||||
} from './SpaceTagDescription';
|
||||
|
||||
import {
|
||||
taskDependencyFields,
|
||||
taskDependencyOperations,
|
||||
@@ -91,7 +106,7 @@ export class ClickUp implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'ClickUp',
|
||||
name: 'clickUp',
|
||||
icon: 'file:clickup.png',
|
||||
icon: 'file:clickup.svg',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
|
||||
@@ -180,10 +195,22 @@ export class ClickUp implements INodeType {
|
||||
name: 'List',
|
||||
value: 'list',
|
||||
},
|
||||
{
|
||||
name: 'Space Tag',
|
||||
value: 'spaceTag',
|
||||
},
|
||||
{
|
||||
name: 'Task',
|
||||
value: 'task',
|
||||
},
|
||||
{
|
||||
name: 'Task List',
|
||||
value: 'taskList',
|
||||
},
|
||||
{
|
||||
name: 'Task Tag',
|
||||
value: 'taskTag',
|
||||
},
|
||||
{
|
||||
name: 'Task Dependency',
|
||||
value: 'taskDependency',
|
||||
@@ -221,6 +248,15 @@ export class ClickUp implements INodeType {
|
||||
// GUEST
|
||||
// ...guestOperations,
|
||||
// ...guestFields,
|
||||
// TASK TAG
|
||||
...taskTagOperations,
|
||||
...taskTagFields,
|
||||
// TASK LIST
|
||||
...taskListOperations,
|
||||
...taskListFields,
|
||||
// SPACE TAG
|
||||
...spaceTagOperations,
|
||||
...spaceTagFields,
|
||||
// TASK
|
||||
...taskOperations,
|
||||
...taskFields,
|
||||
@@ -1022,6 +1058,40 @@ export class ClickUp implements INodeType {
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
if (resource === 'taskTag') {
|
||||
if (operation === 'add') {
|
||||
const taskId = this.getNodeParameter('taskId', i) as string;
|
||||
const name = this.getNodeParameter('tagName', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const qs: IDataObject = {};
|
||||
Object.assign(qs, additionalFields);
|
||||
responseData = await clickupApiRequest.call(this, 'POST', `/task/${taskId}/tag/${name}`, {}, qs);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'remove') {
|
||||
const taskId = this.getNodeParameter('taskId', i) as string;
|
||||
const name = this.getNodeParameter('tagName', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const qs: IDataObject = {};
|
||||
Object.assign(qs, additionalFields);
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/task/${taskId}/tag/${name}`, {}, qs);
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
if (resource === 'taskList') {
|
||||
if (operation === 'add') {
|
||||
const taskId = this.getNodeParameter('taskId', i) as string;
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
responseData = await clickupApiRequest.call(this, 'POST', `/list/${listId}/task/${taskId}`);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'remove') {
|
||||
const taskId = this.getNodeParameter('taskId', i) as string;
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/list/${listId}/task/${taskId}`);
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
if (resource === 'taskDependency') {
|
||||
if (operation === 'create') {
|
||||
const taskId = this.getNodeParameter('task', i) as string;
|
||||
@@ -1195,6 +1265,55 @@ export class ClickUp implements INodeType {
|
||||
}
|
||||
|
||||
}
|
||||
if (resource === 'spaceTag') {
|
||||
if (operation === 'create') {
|
||||
const spaceId = this.getNodeParameter('space', i) as string;
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const foregroundColor = this.getNodeParameter('foregroundColor', i) as string;
|
||||
const backgroundColor = this.getNodeParameter('backgroundColor', i) as string;
|
||||
const body: IDataObject = {
|
||||
tag: {
|
||||
name,
|
||||
tag_bg: backgroundColor,
|
||||
tag_fg: foregroundColor,
|
||||
},
|
||||
};
|
||||
responseData = await clickupApiRequest.call(this, 'POST', `/space/${spaceId}/tag`, body);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const spaceId = this.getNodeParameter('space', i) as string;
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
responseData = await clickupApiRequest.call(this, 'DELETE', `/space/${spaceId}/tag/${name}`);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const spaceId = this.getNodeParameter('space', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
responseData = await clickupApiRequest.call(this, 'GET', `/space/${spaceId}/tag`);
|
||||
responseData = responseData.tags;
|
||||
if (returnAll === false) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
}
|
||||
if (operation === 'update') {
|
||||
const spaceId = this.getNodeParameter('space', i) as string;
|
||||
const tagName = this.getNodeParameter('name', i) as string;
|
||||
const newTagName = this.getNodeParameter('newName', i) as string;
|
||||
const foregroundColor = this.getNodeParameter('foregroundColor', i) as string;
|
||||
const backgroundColor = this.getNodeParameter('backgroundColor', i) as string;
|
||||
const body: IDataObject = {
|
||||
tag: {
|
||||
name: newTagName,
|
||||
tag_bg: backgroundColor,
|
||||
tag_fg: foregroundColor,
|
||||
},
|
||||
};
|
||||
await clickupApiRequest.call(this, 'PUT', `/space/${spaceId}/tag/${tagName}`, body);
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
if (resource === 'list') {
|
||||
if (operation === 'create') {
|
||||
const spaceId = this.getNodeParameter('space', i) as string;
|
||||
|
||||
Reference in New Issue
Block a user