mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
⚡ Add card comment operation
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { IExecuteFunctions } from "n8n-core";
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
@@ -6,13 +9,44 @@ import {
|
||||
INodeType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from "./GenericFunctions";
|
||||
import { attachmentOperations, attachmentFields } from './AttachmentDescription';
|
||||
import { boardOperations, boardFields } from './BoardDescription';
|
||||
import { cardOperations, cardFields } from './CardDescription';
|
||||
import { checklistOperations, checklistFields } from './ChecklistDescription';
|
||||
import { labelOperations, labelFields } from './LabelDescription';
|
||||
import { listOperations, listFields } from './ListDescription';
|
||||
import {
|
||||
apiRequest,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
attachmentOperations,
|
||||
attachmentFields,
|
||||
} from './AttachmentDescription';
|
||||
|
||||
import {
|
||||
boardOperations,
|
||||
boardFields,
|
||||
} from './BoardDescription';
|
||||
|
||||
import {
|
||||
cardOperations,
|
||||
cardFields,
|
||||
} from './CardDescription';
|
||||
|
||||
import {
|
||||
cardCommentOperations,
|
||||
cardCommentFields,
|
||||
} from './CardCommentDescription';
|
||||
|
||||
import {
|
||||
checklistOperations,
|
||||
checklistFields,
|
||||
} from './ChecklistDescription';
|
||||
|
||||
import {
|
||||
labelOperations,
|
||||
labelFields,
|
||||
} from './LabelDescription';
|
||||
|
||||
import {
|
||||
listOperations,
|
||||
listFields,
|
||||
} from './ListDescription';
|
||||
|
||||
export class Trello implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -33,7 +67,7 @@ export class Trello implements INodeType {
|
||||
{
|
||||
name: 'trelloApi',
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
@@ -53,6 +87,10 @@ export class Trello implements INodeType {
|
||||
name: 'Card',
|
||||
value: 'card',
|
||||
},
|
||||
{
|
||||
name: 'Card Comment',
|
||||
value: 'cardComment',
|
||||
},
|
||||
{
|
||||
name: 'Checklist',
|
||||
value: 'checklist',
|
||||
@@ -76,6 +114,7 @@ export class Trello implements INodeType {
|
||||
...attachmentOperations,
|
||||
...boardOperations,
|
||||
...cardOperations,
|
||||
...cardCommentOperations,
|
||||
...checklistOperations,
|
||||
...labelOperations,
|
||||
...listOperations,
|
||||
@@ -86,15 +125,14 @@ export class Trello implements INodeType {
|
||||
...attachmentFields,
|
||||
...boardFields,
|
||||
...cardFields,
|
||||
...cardCommentFields,
|
||||
...checklistFields,
|
||||
...labelFields,
|
||||
...listFields
|
||||
|
||||
],
|
||||
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
@@ -236,6 +274,54 @@ export class Trello implements INodeType {
|
||||
throw new Error(`The operation "${operation}" is not known!`);
|
||||
}
|
||||
|
||||
} else if (resource === 'cardComment') {
|
||||
|
||||
if (operation === 'add') {
|
||||
// ----------------------------------
|
||||
// add
|
||||
// ----------------------------------
|
||||
|
||||
const cardId = this.getNodeParameter('cardId', i) as string;
|
||||
|
||||
qs.text = this.getNodeParameter('text', i) as string;
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = `cards/${cardId}/actions/comments`;
|
||||
|
||||
|
||||
} else if (operation === 'remove') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const cardId = this.getNodeParameter('cardId', i) as string;
|
||||
|
||||
const commentId = this.getNodeParameter('commentId', i) as string;
|
||||
|
||||
endpoint = `/cards/${cardId}/actions/${commentId}/comments`;
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const cardId = this.getNodeParameter('cardId', i) as string;
|
||||
|
||||
const commentId = this.getNodeParameter('commentId', i) as string;
|
||||
|
||||
qs.text = this.getNodeParameter('text', i) as string;
|
||||
|
||||
endpoint = `cards/${cardId}/actions/${commentId}/comments`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known!`);
|
||||
}
|
||||
|
||||
} else if (resource === 'list') {
|
||||
|
||||
if (operation === 'archive') {
|
||||
|
||||
Reference in New Issue
Block a user