n8n-nodes-nextcloud-deck
Version:
n8n Node für die Integration mit Nextcloud Deck - AI Agent Tool Support
164 lines (163 loc) • 6.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NextcloudDeck = void 0;
const resource_handlers_1 = require("./handlers/resource.handlers");
const node_methods_1 = require("./helpers/node.methods");
const board_1 = require("./descriptions/board");
const stack_1 = require("./descriptions/stack");
const card_1 = require("./descriptions/card");
const comment_1 = require("./descriptions/comment");
const attachment_1 = require("./descriptions/attachment");
class NextcloudDeck {
constructor() {
this.description = {
displayName: 'Nextcloud Deck',
name: 'nextcloudDeck',
icon: 'file:nextcloud-deck.svg',
group: ['transform'],
version: 1,
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
description: 'Verwalten Sie Ihre Nextcloud Deck-Boards, Stacks, Karten und mehr',
defaults: {
name: 'Nextcloud Deck',
},
inputs: ["main"],
outputs: ["main"],
credentials: [
{
name: 'nextcloudDeckApi',
required: true,
},
],
usableAsTool: true,
aiEnabled: true,
requestDefaults: {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Board',
value: 'board',
description: 'Operationen mit Deck-Boards',
},
{
name: 'Stack',
value: 'stack',
description: 'Operationen mit Deck-Stacks',
},
{
name: 'Karte',
value: 'card',
description: 'Operationen mit Deck-Karten',
},
{
name: 'Kommentar',
value: 'comment',
description: 'Operationen mit Karten-Kommentaren',
},
{
name: 'Anhang',
value: 'attachment',
description: 'Operationen mit Karten-Anhängen',
},
],
default: 'board',
description: 'Die Ressource für diese Operation',
},
...board_1.boardOperations,
...board_1.boardFields,
...stack_1.stackOperations,
...stack_1.stackFields,
...card_1.cardOperations,
...card_1.cardFields,
...comment_1.commentOperations,
...comment_1.commentFields,
...attachment_1.attachmentOperations,
...attachment_1.attachmentFields,
],
};
this.methods = {
loadOptions: {
async getBoards() {
return node_methods_1.NodeLoadOptions.getBoards.call(this);
},
async getStacks() {
return node_methods_1.NodeLoadOptions.getStacks.call(this);
},
async getLabels() {
return node_methods_1.NodeLoadOptions.getLabels.call(this);
},
},
listSearch: {
async getBoards(filter) {
return node_methods_1.NodeListSearch.getBoards.call(this, filter);
},
async getStacks(filter) {
return node_methods_1.NodeListSearch.getStacks.call(this, filter);
},
async getCards(filter) {
return node_methods_1.NodeListSearch.getCards.call(this, filter);
},
async getUsers(filter) {
return node_methods_1.NodeListSearch.getUsers.call(this, filter);
},
async getLabels(filter) {
return node_methods_1.NodeListSearch.getLabels.call(this, filter);
},
},
};
}
async execute() {
const items = this.getInputData();
const returnData = [];
for (let i = 0; i < items.length; i++) {
try {
const resource = this.getNodeParameter('resource', i);
const operation = this.getNodeParameter('operation', i);
let result;
switch (resource) {
case 'board':
result = await resource_handlers_1.BoardHandler.execute.call(this, operation, i);
break;
case 'stack':
result = await resource_handlers_1.StackHandler.execute.call(this, operation, i);
break;
case 'card':
result = await resource_handlers_1.CardHandler.execute.call(this, operation, i);
break;
case 'comment':
result = await resource_handlers_1.CommentHandler.execute.call(this, operation, i);
break;
case 'attachment':
result = await resource_handlers_1.AttachmentHandler.execute.call(this, operation, i);
break;
default:
throw new Error(`Unbekannte Ressource: ${resource}`);
}
returnData.push({ json: result });
}
catch (error) {
const nodeError = error;
if (this.continueOnFail()) {
returnData.push({
json: { error: nodeError.message },
});
}
else {
throw error;
}
}
}
return this.prepareOutputData(returnData);
}
}
exports.NextcloudDeck = NextcloudDeck;