UNPKG

n8n-nodes-chatwork

Version:

Provides an n8n community node for integrating Chatwork messaging and task APIs into automated workflows.

24 lines 967 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRooms = getRooms; const transport_1 = require("../shared/transport"); async function getRooms(query) { const rooms = (await transport_1.chatworkApiRequest.call(this, 'GET', '/rooms')); const normalizedQuery = query === null || query === void 0 ? void 0 : query.toLowerCase(); return { results: rooms .filter((room) => { var _a; if (!normalizedQuery) return true; return (((_a = room.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(normalizedQuery)) || String(room.room_id).includes(normalizedQuery)); }) .map((room) => ({ name: `${room.name || '(No name)'} [${room.room_id}]`, value: room.room_id, })) .sort((a, b) => a.name.localeCompare(b.name)), }; } //# sourceMappingURL=getRooms.js.map