UNPKG

n8n-nodes-nextcloud-deck

Version:

n8n Node für die Integration mit Nextcloud Deck - AI Agent Tool Support

85 lines (84 loc) 4.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteComment = exports.updateComment = exports.createComment = exports.getComments = exports.removeLabelFromCard = exports.addLabelToCard = exports.unassignUserFromCard = exports.assignUserToCard = exports.deleteCard = exports.updateCard = exports.createCard = exports.getCard = exports.getCards = void 0; const api_1 = require("../helpers/api"); async function getCards(boardId, stackId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'GET', `/boards/${boardId}/stacks/${stackId}`); const stack = response; return stack.cards || []; } exports.getCards = getCards; async function getCard(boardId, stackId, cardId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'GET', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}`); return response; } exports.getCard = getCard; async function createCard(boardId, stackId, cardData) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'POST', `/boards/${boardId}/stacks/${stackId}/cards`, cardData); return response; } exports.createCard = createCard; async function updateCard(boardId, stackId, cardData) { const { id, ...updateData } = cardData; const currentCard = await getCard.call(this, boardId, stackId, id); const updateDataWithOwner = { ...updateData, owner: currentCard.owner || '', }; const response = await api_1.nextcloudDeckApiRequest.call(this, 'PUT', `/boards/${boardId}/stacks/${stackId}/cards/${id}`, updateDataWithOwner); return response; } exports.updateCard = updateCard; async function deleteCard(boardId, stackId, cardId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'DELETE', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}`); return response; } exports.deleteCard = deleteCard; async function assignUserToCard(boardId, stackId, cardId, userId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'PUT', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}/assignUser`, { userId }); return response; } exports.assignUserToCard = assignUserToCard; async function unassignUserFromCard(boardId, stackId, cardId, userId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'PUT', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}/unassignUser`, { userId }); return response; } exports.unassignUserFromCard = unassignUserFromCard; async function addLabelToCard(boardId, stackId, cardId, labelId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'PUT', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}/assignLabel`, { labelId }); return response; } exports.addLabelToCard = addLabelToCard; async function removeLabelFromCard(boardId, stackId, cardId, labelId) { const response = await api_1.nextcloudDeckApiRequest.call(this, 'PUT', `/boards/${boardId}/stacks/${stackId}/cards/${cardId}/removeLabel`, { labelId }); return response; } exports.removeLabelFromCard = removeLabelFromCard; async function getComments(cardId, limit, offset) { let endpoint = `/cards/${cardId}/comments`; const params = []; if (limit) params.push(`limit=${limit}`); if (offset) params.push(`offset=${offset}`); if (params.length > 0) endpoint += `?${params.join('&')}`; const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'GET', endpoint); return response; } exports.getComments = getComments; async function createComment(cardId, commentData) { const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'POST', `/cards/${cardId}/comments`, commentData); return response; } exports.createComment = createComment; async function updateComment(cardId, commentId, message) { const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'PUT', `/cards/${cardId}/comments/${commentId}`, { message }); return response; } exports.updateComment = updateComment; async function deleteComment(cardId, commentId) { const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'DELETE', `/cards/${cardId}/comments/${commentId}`); return response; } exports.deleteComment = deleteComment;