n8n-nodes-nextcloud-deck
Version:
n8n Node für die Integration mit Nextcloud Deck - AI Agent Tool Support
45 lines (44 loc) • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteComment = exports.updateComment = exports.createComment = exports.getComment = exports.getComments = void 0;
const api_1 = require("../helpers/api");
async function getComments(cardId) {
const endpoint = `/cards/${cardId}/comments`;
const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'GET', endpoint);
return response;
}
exports.getComments = getComments;
async function getComment(cardId, commentId) {
const comments = await getComments.call(this, cardId);
const comment = comments.find(c => c.id === commentId);
if (!comment) {
throw new Error(`Kommentar ${commentId} nicht gefunden`);
}
return comment;
}
exports.getComment = getComment;
async function createComment(cardId, commentData) {
const endpoint = `/cards/${cardId}/comments`;
const body = {
message: commentData.message,
parentId: null
};
const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'POST', endpoint, body);
return response;
}
exports.createComment = createComment;
async function updateComment(cardId, commentId, commentData) {
const endpoint = `/cards/${cardId}/comments/${commentId}`;
const body = {
message: commentData.message
};
const response = await api_1.nextcloudDeckOcsApiRequest.call(this, 'PUT', endpoint, body);
return response;
}
exports.updateComment = updateComment;
async function deleteComment(cardId, commentId) {
const endpoint = `/cards/${cardId}/comments/${commentId}`;
await api_1.nextcloudDeckOcsApiRequest.call(this, 'DELETE', endpoint);
return { success: true };
}
exports.deleteComment = deleteComment;