n8n-nodes-fizzy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/dist/credentials/FizzyApi.credentials.d.ts +14 -0
  4. package/dist/credentials/FizzyApi.credentials.d.ts.map +1 -0
  5. package/dist/credentials/FizzyApi.credentials.js +48 -0
  6. package/dist/credentials/FizzyApi.credentials.js.map +1 -0
  7. package/dist/credentials/fizzy.svg +21 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +20 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/nodes/Fizzy/Fizzy.node.d.ts +19 -0
  13. package/dist/nodes/Fizzy/Fizzy.node.d.ts.map +1 -0
  14. package/dist/nodes/Fizzy/Fizzy.node.js +662 -0
  15. package/dist/nodes/Fizzy/Fizzy.node.js.map +1 -0
  16. package/dist/nodes/Fizzy/FizzyTrigger.node.d.ts +19 -0
  17. package/dist/nodes/Fizzy/FizzyTrigger.node.d.ts.map +1 -0
  18. package/dist/nodes/Fizzy/FizzyTrigger.node.js +246 -0
  19. package/dist/nodes/Fizzy/FizzyTrigger.node.js.map +1 -0
  20. package/dist/nodes/Fizzy/GenericFunctions.d.ts +62 -0
  21. package/dist/nodes/Fizzy/GenericFunctions.d.ts.map +1 -0
  22. package/dist/nodes/Fizzy/GenericFunctions.js +171 -0
  23. package/dist/nodes/Fizzy/GenericFunctions.js.map +1 -0
  24. package/dist/nodes/Fizzy/descriptions/BoardDescription.d.ts +4 -0
  25. package/dist/nodes/Fizzy/descriptions/BoardDescription.d.ts.map +1 -0
  26. package/dist/nodes/Fizzy/descriptions/BoardDescription.js +225 -0
  27. package/dist/nodes/Fizzy/descriptions/BoardDescription.js.map +1 -0
  28. package/dist/nodes/Fizzy/descriptions/CardDescription.d.ts +4 -0
  29. package/dist/nodes/Fizzy/descriptions/CardDescription.d.ts.map +1 -0
  30. package/dist/nodes/Fizzy/descriptions/CardDescription.js +442 -0
  31. package/dist/nodes/Fizzy/descriptions/CardDescription.js.map +1 -0
  32. package/dist/nodes/Fizzy/descriptions/ColumnDescription.d.ts +4 -0
  33. package/dist/nodes/Fizzy/descriptions/ColumnDescription.d.ts.map +1 -0
  34. package/dist/nodes/Fizzy/descriptions/ColumnDescription.js +178 -0
  35. package/dist/nodes/Fizzy/descriptions/ColumnDescription.js.map +1 -0
  36. package/dist/nodes/Fizzy/descriptions/CommentDescription.d.ts +4 -0
  37. package/dist/nodes/Fizzy/descriptions/CommentDescription.d.ts.map +1 -0
  38. package/dist/nodes/Fizzy/descriptions/CommentDescription.js +210 -0
  39. package/dist/nodes/Fizzy/descriptions/CommentDescription.js.map +1 -0
  40. package/dist/nodes/Fizzy/descriptions/NotificationDescription.d.ts +4 -0
  41. package/dist/nodes/Fizzy/descriptions/NotificationDescription.d.ts.map +1 -0
  42. package/dist/nodes/Fizzy/descriptions/NotificationDescription.js +123 -0
  43. package/dist/nodes/Fizzy/descriptions/NotificationDescription.js.map +1 -0
  44. package/dist/nodes/Fizzy/descriptions/ReactionDescription.d.ts +4 -0
  45. package/dist/nodes/Fizzy/descriptions/ReactionDescription.d.ts.map +1 -0
  46. package/dist/nodes/Fizzy/descriptions/ReactionDescription.js +176 -0
  47. package/dist/nodes/Fizzy/descriptions/ReactionDescription.js.map +1 -0
  48. package/dist/nodes/Fizzy/descriptions/StepDescription.d.ts +4 -0
  49. package/dist/nodes/Fizzy/descriptions/StepDescription.d.ts.map +1 -0
  50. package/dist/nodes/Fizzy/descriptions/StepDescription.js +180 -0
  51. package/dist/nodes/Fizzy/descriptions/StepDescription.js.map +1 -0
  52. package/dist/nodes/Fizzy/descriptions/TagDescription.d.ts +4 -0
  53. package/dist/nodes/Fizzy/descriptions/TagDescription.d.ts.map +1 -0
  54. package/dist/nodes/Fizzy/descriptions/TagDescription.js +62 -0
  55. package/dist/nodes/Fizzy/descriptions/TagDescription.js.map +1 -0
  56. package/dist/nodes/Fizzy/descriptions/UserDescription.d.ts +4 -0
  57. package/dist/nodes/Fizzy/descriptions/UserDescription.d.ts.map +1 -0
  58. package/dist/nodes/Fizzy/descriptions/UserDescription.js +144 -0
  59. package/dist/nodes/Fizzy/descriptions/UserDescription.js.map +1 -0
  60. package/dist/nodes/Fizzy/descriptions/index.d.ts +10 -0
  61. package/dist/nodes/Fizzy/descriptions/index.d.ts.map +1 -0
  62. package/dist/nodes/Fizzy/descriptions/index.js +26 -0
  63. package/dist/nodes/Fizzy/descriptions/index.js.map +1 -0
  64. package/dist/nodes/Fizzy/fizzy.svg +23 -0
  65. package/package.json +59 -0
@@ -0,0 +1,662 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fizzy = void 0;
4
+ const GenericFunctions_1 = require("./GenericFunctions");
5
+ const descriptions_1 = require("./descriptions");
6
+ class Fizzy {
7
+ description = {
8
+ displayName: 'Fizzy',
9
+ name: 'fizzy',
10
+ icon: 'file:fizzy.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
14
+ description: 'Interact with Fizzy API',
15
+ defaults: {
16
+ name: 'Fizzy',
17
+ },
18
+ inputs: ['main'],
19
+ outputs: ['main'],
20
+ usableAsTool: true,
21
+ credentials: [
22
+ {
23
+ name: 'fizzyApi',
24
+ required: true,
25
+ },
26
+ ],
27
+ properties: [
28
+ {
29
+ displayName: 'Account Name or ID',
30
+ name: 'accountSlug',
31
+ type: 'options',
32
+ typeOptions: {
33
+ loadOptionsMethod: 'getAccounts',
34
+ },
35
+ default: '',
36
+ required: true,
37
+ description: 'The Fizzy account to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
38
+ },
39
+ {
40
+ displayName: 'Resource',
41
+ name: 'resource',
42
+ type: 'options',
43
+ noDataExpression: true,
44
+ options: [
45
+ { name: 'Board', value: 'board' },
46
+ { name: 'Card', value: 'card' },
47
+ { name: 'Column', value: 'column' },
48
+ { name: 'Comment', value: 'comment' },
49
+ { name: 'Notification', value: 'notification' },
50
+ { name: 'Reaction', value: 'reaction' },
51
+ { name: 'Step', value: 'step' },
52
+ { name: 'Tag', value: 'tag' },
53
+ { name: 'User', value: 'user' },
54
+ ],
55
+ default: 'card',
56
+ },
57
+ // Operations
58
+ ...descriptions_1.boardOperations,
59
+ ...descriptions_1.cardOperations,
60
+ ...descriptions_1.columnOperations,
61
+ ...descriptions_1.commentOperations,
62
+ ...descriptions_1.notificationOperations,
63
+ ...descriptions_1.reactionOperations,
64
+ ...descriptions_1.stepOperations,
65
+ ...descriptions_1.tagOperations,
66
+ ...descriptions_1.userOperations,
67
+ // Fields
68
+ ...descriptions_1.boardFields,
69
+ ...descriptions_1.cardFields,
70
+ ...descriptions_1.columnFields,
71
+ ...descriptions_1.commentFields,
72
+ ...descriptions_1.notificationFields,
73
+ ...descriptions_1.reactionFields,
74
+ ...descriptions_1.stepFields,
75
+ ...descriptions_1.tagFields,
76
+ ...descriptions_1.userFields,
77
+ ],
78
+ };
79
+ methods = {
80
+ loadOptions: {
81
+ async getAccounts() {
82
+ return GenericFunctions_1.getAccounts.call(this);
83
+ },
84
+ async getColumns() {
85
+ const accountSlug = this.getNodeParameter('accountSlug');
86
+ const boardId = this.getNodeParameter('boardId');
87
+ const boardIdValue = boardId.value || boardId;
88
+ if (!boardIdValue)
89
+ return [];
90
+ return GenericFunctions_1.getColumns.call(this, accountSlug, boardIdValue);
91
+ },
92
+ async getTags() {
93
+ const accountSlug = this.getNodeParameter('accountSlug');
94
+ const boardId = this.getNodeParameter('boardId');
95
+ const boardIdValue = boardId.value || boardId;
96
+ if (!boardIdValue)
97
+ return [];
98
+ return GenericFunctions_1.getTags.call(this, accountSlug, boardIdValue);
99
+ },
100
+ async getUsers() {
101
+ const accountSlug = this.getNodeParameter('accountSlug');
102
+ return GenericFunctions_1.getUsers.call(this, accountSlug);
103
+ },
104
+ },
105
+ listSearch: {
106
+ async searchBoards(filter) {
107
+ const accountSlug = this.getNodeParameter('accountSlug');
108
+ const boards = await GenericFunctions_1.getBoards.call(this, accountSlug);
109
+ const results = boards
110
+ .filter((board) => !filter || board.name.toLowerCase().includes(filter.toLowerCase()))
111
+ .map((board) => ({
112
+ name: board.name,
113
+ value: board.value,
114
+ }));
115
+ return { results };
116
+ },
117
+ async searchCards(filter) {
118
+ const accountSlug = this.getNodeParameter('accountSlug');
119
+ const boardId = this.getNodeParameter('boardId');
120
+ const boardIdValue = boardId.value || boardId;
121
+ if (!boardIdValue) {
122
+ return { results: [] };
123
+ }
124
+ // Cards endpoint is /:account_slug/cards with optional board_id filter
125
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards');
126
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, { board_id: boardIdValue });
127
+ // API returns array directly
128
+ const cards = response;
129
+ const results = cards
130
+ .filter((card) => !filter || card.title.toLowerCase().includes(filter.toLowerCase()))
131
+ .map((card) => ({
132
+ name: `#${card.number} - ${card.title}`,
133
+ // Use card number for API calls (not id)
134
+ value: String(card.number),
135
+ }));
136
+ return { results };
137
+ },
138
+ async searchComments(filter) {
139
+ const accountSlug = this.getNodeParameter('accountSlug');
140
+ const cardId = this.getNodeParameter('cardId');
141
+ const cardIdValue = cardId.value || cardId;
142
+ if (!cardIdValue) {
143
+ return { results: [] };
144
+ }
145
+ // Comments endpoint is /:account_slug/cards/:card_number/comments
146
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments';
147
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
148
+ // API returns array directly
149
+ const comments = response;
150
+ const results = comments
151
+ .filter((comment) => {
152
+ if (!filter)
153
+ return true;
154
+ const body = comment.body;
155
+ const plainText = body?.plain_text || '';
156
+ return plainText.toLowerCase().includes(filter.toLowerCase());
157
+ })
158
+ .map((comment) => {
159
+ const body = comment.body;
160
+ const plainText = body?.plain_text || 'No content';
161
+ // Truncate long comments for display
162
+ const displayText = plainText.length > 50 ? plainText.substring(0, 47) + '...' : plainText;
163
+ return {
164
+ name: displayText,
165
+ value: comment.id,
166
+ };
167
+ });
168
+ return { results };
169
+ },
170
+ },
171
+ };
172
+ async execute() {
173
+ const items = this.getInputData();
174
+ const returnData = [];
175
+ const resource = this.getNodeParameter('resource', 0);
176
+ const operation = this.getNodeParameter('operation', 0);
177
+ const accountSlug = this.getNodeParameter('accountSlug', 0);
178
+ for (let i = 0; i < items.length; i++) {
179
+ try {
180
+ let responseData;
181
+ // ----------------------------------------
182
+ // Board
183
+ // ----------------------------------------
184
+ if (resource === 'board') {
185
+ if (operation === 'create') {
186
+ const title = this.getNodeParameter('title', i);
187
+ const additionalFields = this.getNodeParameter('additionalFields', i);
188
+ // Rails expects nested params: board: { name: "..." }
189
+ const body = { board: { name: title, ...additionalFields } };
190
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards');
191
+ // POST returns 201 with Location header but no body, so we need to list boards and find the new one
192
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, body);
193
+ // Get all boards and find the one we just created by name
194
+ const boards = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
195
+ responseData = boards.find((b) => b.name === title) || { success: true, name: title };
196
+ }
197
+ else if (operation === 'delete') {
198
+ const boardId = this.getNodeParameter('boardId', i);
199
+ const boardIdValue = boardId.value || boardId;
200
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue);
201
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
202
+ }
203
+ else if (operation === 'get') {
204
+ const boardId = this.getNodeParameter('boardId', i);
205
+ const boardIdValue = boardId.value || boardId;
206
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue);
207
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
208
+ }
209
+ else if (operation === 'getMany') {
210
+ const returnAll = this.getNodeParameter('returnAll', i);
211
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards');
212
+ if (returnAll) {
213
+ // API returns array directly
214
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
215
+ }
216
+ else {
217
+ const limit = this.getNodeParameter('limit', i);
218
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, { per_page: limit });
219
+ // API returns array directly
220
+ responseData = response.slice(0, limit);
221
+ }
222
+ }
223
+ else if (operation === 'update') {
224
+ const boardId = this.getNodeParameter('boardId', i);
225
+ const boardIdValue = boardId.value || boardId;
226
+ const updateFields = this.getNodeParameter('updateFields', i);
227
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue);
228
+ // Rails expects nested params: board: { ... }
229
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PATCH', endpoint, { board: updateFields });
230
+ }
231
+ else {
232
+ responseData = {};
233
+ }
234
+ }
235
+ // ----------------------------------------
236
+ // Card
237
+ // ----------------------------------------
238
+ else if (resource === 'card') {
239
+ const boardId = this.getNodeParameter('boardId', i);
240
+ const boardIdValue = boardId.value || boardId;
241
+ if (operation === 'create') {
242
+ const title = this.getNodeParameter('title', i);
243
+ const additionalFields = this.getNodeParameter('additionalFields', i);
244
+ // Rails expects nested params: card: { title: "...", ... }
245
+ const body = { card: { title, ...additionalFields } };
246
+ // POST to /:account_slug/boards/:board_id/cards
247
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/cards';
248
+ // POST returns 201 with Location header but no body
249
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, body);
250
+ // Get all cards for this board and find the one we just created by title (most recent)
251
+ const cardsEndpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards');
252
+ const cards = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', cardsEndpoint, {}, { board_id: boardIdValue });
253
+ responseData = cards.find((c) => c.title === title) || { success: true, title };
254
+ }
255
+ else if (operation === 'delete') {
256
+ const cardId = this.getNodeParameter('cardId', i);
257
+ const cardIdValue = cardId.value || cardId;
258
+ // DELETE /:account_slug/cards/:card_number
259
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue);
260
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
261
+ }
262
+ else if (operation === 'get') {
263
+ const cardId = this.getNodeParameter('cardId', i);
264
+ const cardIdValue = cardId.value || cardId;
265
+ // GET /:account_slug/cards/:card_number
266
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue);
267
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
268
+ }
269
+ else if (operation === 'getMany') {
270
+ const returnAll = this.getNodeParameter('returnAll', i);
271
+ const filters = this.getNodeParameter('filters', i);
272
+ // GET /:account_slug/cards with board_id filter
273
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards');
274
+ const query = { board_id: boardIdValue, ...filters };
275
+ if (returnAll) {
276
+ // API returns array directly
277
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, query);
278
+ }
279
+ else {
280
+ const limit = this.getNodeParameter('limit', i);
281
+ query.per_page = limit;
282
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, query);
283
+ // API returns array directly
284
+ responseData = response.slice(0, limit);
285
+ }
286
+ }
287
+ else if (operation === 'update') {
288
+ const cardId = this.getNodeParameter('cardId', i);
289
+ const cardIdValue = cardId.value || cardId;
290
+ const updateFields = this.getNodeParameter('updateFields', i);
291
+ // PUT /:account_slug/cards/:card_number
292
+ // Rails expects nested params: card: { ... }
293
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue);
294
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PUT', endpoint, { card: updateFields });
295
+ }
296
+ else if (operation === 'close') {
297
+ const cardId = this.getNodeParameter('cardId', i);
298
+ const cardIdValue = cardId.value || cardId;
299
+ // POST /cards/:id/closure (create action)
300
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/closure';
301
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint);
302
+ }
303
+ else if (operation === 'reopen') {
304
+ const cardId = this.getNodeParameter('cardId', i);
305
+ const cardIdValue = cardId.value || cardId;
306
+ // DELETE /cards/:id/closure (destroy action)
307
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/closure';
308
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
309
+ }
310
+ else if (operation === 'moveToColumn') {
311
+ const cardId = this.getNodeParameter('cardId', i);
312
+ const cardIdValue = cardId.value || cardId;
313
+ const columnId = this.getNodeParameter('columnId', i);
314
+ // POST /cards/:id/triage with column_id param
315
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/triage';
316
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { column_id: columnId });
317
+ }
318
+ else if (operation === 'moveToNotNow') {
319
+ const cardId = this.getNodeParameter('cardId', i);
320
+ const cardIdValue = cardId.value || cardId;
321
+ // POST /cards/:id/not_now
322
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/not_now';
323
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint);
324
+ }
325
+ else if (operation === 'sendToTriage') {
326
+ const cardId = this.getNodeParameter('cardId', i);
327
+ const cardIdValue = cardId.value || cardId;
328
+ // DELETE /cards/:id/triage (destroy action sends back to triage/Maybe?)
329
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/triage';
330
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
331
+ }
332
+ else if (operation === 'toggleAssignment') {
333
+ const cardId = this.getNodeParameter('cardId', i);
334
+ const cardIdValue = cardId.value || cardId;
335
+ const userId = this.getNodeParameter('userId', i);
336
+ // POST to /:account_slug/cards/:card_number/assignments with assignee_id in body
337
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/assignments';
338
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { assignee_id: userId });
339
+ }
340
+ else if (operation === 'toggleTag') {
341
+ const cardId = this.getNodeParameter('cardId', i);
342
+ const cardIdValue = cardId.value || cardId;
343
+ const tagId = this.getNodeParameter('tagId', i);
344
+ // POST to /:account_slug/cards/:card_number/taggings with tag_title in body
345
+ // Need to get the tag name from the tag ID first
346
+ const tagsEndpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/tags';
347
+ const tags = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', tagsEndpoint);
348
+ const tag = tags.find((t) => t.id === tagId);
349
+ const tagTitle = tag?.name || tagId;
350
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/taggings';
351
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { tag_title: tagTitle });
352
+ }
353
+ else if (operation === 'watch') {
354
+ const cardId = this.getNodeParameter('cardId', i);
355
+ const cardIdValue = cardId.value || cardId;
356
+ // POST /cards/:id/watch (create action)
357
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/watch';
358
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint);
359
+ }
360
+ else if (operation === 'unwatch') {
361
+ const cardId = this.getNodeParameter('cardId', i);
362
+ const cardIdValue = cardId.value || cardId;
363
+ // DELETE /cards/:id/watch (destroy action)
364
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/watch';
365
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
366
+ }
367
+ else {
368
+ responseData = {};
369
+ }
370
+ }
371
+ // ----------------------------------------
372
+ // Column
373
+ // ----------------------------------------
374
+ else if (resource === 'column') {
375
+ const boardId = this.getNodeParameter('boardId', i);
376
+ const boardIdValue = boardId.value || boardId;
377
+ if (operation === 'create') {
378
+ const title = this.getNodeParameter('title', i);
379
+ const additionalFields = this.getNodeParameter('additionalFields', i);
380
+ // Rails expects nested params: column: { name: "...", ... }
381
+ const body = { column: { name: title, ...additionalFields } };
382
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/columns';
383
+ // POST returns 201 with Location header but no body
384
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, body);
385
+ // Get all columns and find the one we just created by name
386
+ const columns = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
387
+ responseData = columns.find((c) => c.name === title) || { success: true, name: title };
388
+ }
389
+ else if (operation === 'delete') {
390
+ const columnId = this.getNodeParameter('columnId', i);
391
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/columns/' + columnId;
392
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
393
+ }
394
+ else if (operation === 'get') {
395
+ const columnId = this.getNodeParameter('columnId', i);
396
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/columns/' + columnId;
397
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
398
+ }
399
+ else if (operation === 'getMany') {
400
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/columns';
401
+ // API returns array directly
402
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
403
+ }
404
+ else if (operation === 'update') {
405
+ const columnId = this.getNodeParameter('columnId', i);
406
+ const updateFields = this.getNodeParameter('updateFields', i);
407
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/columns/' + columnId;
408
+ // Rails expects nested params: column: { ... }
409
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PATCH', endpoint, { column: updateFields });
410
+ }
411
+ else {
412
+ responseData = {};
413
+ }
414
+ }
415
+ // ----------------------------------------
416
+ // Comment
417
+ // ----------------------------------------
418
+ else if (resource === 'comment') {
419
+ // Comments endpoint is /:account_slug/cards/:card_number/comments
420
+ const cardId = this.getNodeParameter('cardId', i);
421
+ const cardIdValue = cardId.value || cardId;
422
+ if (operation === 'create') {
423
+ const content = this.getNodeParameter('content', i);
424
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments';
425
+ // Rails expects nested params: comment: { body: "..." }
426
+ // POST returns 201 with Location header but no body
427
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { comment: { body: content } });
428
+ // Get all comments and find the one we just created (most recent with matching body)
429
+ const comments = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
430
+ responseData = comments.find((c) => {
431
+ const body = c.body;
432
+ return body?.plain_text === content;
433
+ }) || { success: true, body: content };
434
+ }
435
+ else if (operation === 'delete') {
436
+ const commentId = this.getNodeParameter('commentId', i);
437
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentId;
438
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
439
+ }
440
+ else if (operation === 'get') {
441
+ const commentId = this.getNodeParameter('commentId', i);
442
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentId;
443
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
444
+ }
445
+ else if (operation === 'getMany') {
446
+ const returnAll = this.getNodeParameter('returnAll', i);
447
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments';
448
+ if (returnAll) {
449
+ // API returns array directly
450
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
451
+ }
452
+ else {
453
+ const limit = this.getNodeParameter('limit', i);
454
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, { per_page: limit });
455
+ // API returns array directly
456
+ responseData = response.slice(0, limit);
457
+ }
458
+ }
459
+ else if (operation === 'update') {
460
+ const commentId = this.getNodeParameter('commentId', i);
461
+ const content = this.getNodeParameter('content', i);
462
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentId;
463
+ // Rails expects nested params: comment: { body: "..." }
464
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PATCH', endpoint, { comment: { body: content } });
465
+ }
466
+ else {
467
+ responseData = {};
468
+ }
469
+ }
470
+ // ----------------------------------------
471
+ // Notification
472
+ // ----------------------------------------
473
+ else if (resource === 'notification') {
474
+ if (operation === 'getMany') {
475
+ const returnAll = this.getNodeParameter('returnAll', i);
476
+ const filters = this.getNodeParameter('filters', i);
477
+ // GET /notifications
478
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'notifications');
479
+ const query = {};
480
+ if (filters.read && filters.read !== 'all') {
481
+ query.read = filters.read;
482
+ }
483
+ if (returnAll) {
484
+ // API returns array directly
485
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, query);
486
+ }
487
+ else {
488
+ const limit = this.getNodeParameter('limit', i);
489
+ query.per_page = limit;
490
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, query);
491
+ // API returns array directly
492
+ responseData = response.slice(0, limit);
493
+ }
494
+ }
495
+ else if (operation === 'markAsRead') {
496
+ const notificationId = this.getNodeParameter('notificationId', i);
497
+ // POST /notifications/:id/reading (create action)
498
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'notifications', notificationId) + '/reading';
499
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint);
500
+ }
501
+ else if (operation === 'markAsUnread') {
502
+ const notificationId = this.getNodeParameter('notificationId', i);
503
+ // DELETE /notifications/:id/reading (destroy action)
504
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'notifications', notificationId) + '/reading';
505
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
506
+ }
507
+ else if (operation === 'markAllAsRead') {
508
+ // POST /notifications/bulk_reading
509
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'notifications') + '/bulk_reading';
510
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint);
511
+ }
512
+ else {
513
+ responseData = {};
514
+ }
515
+ }
516
+ // ----------------------------------------
517
+ // Reaction
518
+ // ----------------------------------------
519
+ else if (resource === 'reaction') {
520
+ // Reactions endpoint is /:account_slug/cards/:card_number/comments/:comment_id/reactions
521
+ const cardId = this.getNodeParameter('cardId', i);
522
+ const cardIdValue = cardId.value || cardId;
523
+ const commentId = this.getNodeParameter('commentId', i);
524
+ const commentIdValue = commentId.value || commentId;
525
+ if (operation === 'create') {
526
+ const emoji = this.getNodeParameter('emoji', i);
527
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentIdValue + '/reactions';
528
+ // Rails expects nested params: reaction: { content: "emoji" }
529
+ // POST returns 201 with no body or location header
530
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { reaction: { content: emoji } });
531
+ // Get all reactions and find the one we just created by emoji
532
+ const reactions = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
533
+ responseData = reactions.find((r) => r.content === emoji) || { success: true, content: emoji };
534
+ }
535
+ else if (operation === 'delete') {
536
+ const reactionId = this.getNodeParameter('reactionId', i);
537
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentIdValue + '/reactions/' + reactionId;
538
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
539
+ }
540
+ else if (operation === 'getMany') {
541
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/comments/' + commentIdValue + '/reactions';
542
+ // API returns array directly
543
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
544
+ }
545
+ else {
546
+ responseData = {};
547
+ }
548
+ }
549
+ // ----------------------------------------
550
+ // Step
551
+ // ----------------------------------------
552
+ else if (resource === 'step') {
553
+ // Steps endpoint is /:account_slug/cards/:card_number/steps
554
+ const cardId = this.getNodeParameter('cardId', i);
555
+ const cardIdValue = cardId.value || cardId;
556
+ if (operation === 'create') {
557
+ const title = this.getNodeParameter('title', i);
558
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/steps';
559
+ // Rails expects nested params: step: { content: "..." }
560
+ // POST returns 201 with Location header but no body
561
+ await GenericFunctions_1.fizzyApiRequest.call(this, 'POST', endpoint, { step: { content: title } });
562
+ // Steps are included in card response, so get the card and find the new step
563
+ const cardEndpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue);
564
+ const card = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', cardEndpoint);
565
+ const steps = card.steps;
566
+ responseData = steps?.find((s) => s.content === title) || { success: true, content: title };
567
+ }
568
+ else if (operation === 'delete') {
569
+ const stepId = this.getNodeParameter('stepId', i);
570
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/steps/' + stepId;
571
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
572
+ }
573
+ else if (operation === 'get') {
574
+ const stepId = this.getNodeParameter('stepId', i);
575
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/steps/' + stepId;
576
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
577
+ }
578
+ else if (operation === 'update') {
579
+ const stepId = this.getNodeParameter('stepId', i);
580
+ const updateFields = this.getNodeParameter('updateFields', i);
581
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'cards', cardIdValue) + '/steps/' + stepId;
582
+ // Rails expects nested params: step: { ... }
583
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PATCH', endpoint, { step: updateFields });
584
+ }
585
+ else {
586
+ responseData = {};
587
+ }
588
+ }
589
+ // ----------------------------------------
590
+ // Tag
591
+ // ----------------------------------------
592
+ else if (resource === 'tag') {
593
+ const boardId = this.getNodeParameter('boardId', i);
594
+ const boardIdValue = boardId.value || boardId;
595
+ if (operation === 'getMany') {
596
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'boards', boardIdValue) + '/tags';
597
+ // API returns array directly
598
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
599
+ }
600
+ else {
601
+ responseData = {};
602
+ }
603
+ }
604
+ // ----------------------------------------
605
+ // User
606
+ // ----------------------------------------
607
+ else if (resource === 'user') {
608
+ if (operation === 'deactivate') {
609
+ const userId = this.getNodeParameter('userId', i);
610
+ // DELETE /users/:id (destroy action deactivates user)
611
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'users', userId);
612
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'DELETE', endpoint);
613
+ }
614
+ else if (operation === 'get') {
615
+ const userId = this.getNodeParameter('userId', i);
616
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'users', userId);
617
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
618
+ }
619
+ else if (operation === 'getMany') {
620
+ const returnAll = this.getNodeParameter('returnAll', i);
621
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'users');
622
+ if (returnAll) {
623
+ // API returns array directly
624
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint);
625
+ }
626
+ else {
627
+ const limit = this.getNodeParameter('limit', i);
628
+ const response = await GenericFunctions_1.fizzyApiRequest.call(this, 'GET', endpoint, {}, { per_page: limit });
629
+ // API returns array directly
630
+ responseData = response.slice(0, limit);
631
+ }
632
+ }
633
+ else if (operation === 'update') {
634
+ const userId = this.getNodeParameter('userId', i);
635
+ const updateFields = this.getNodeParameter('updateFields', i);
636
+ const endpoint = (0, GenericFunctions_1.buildApiEndpoint)(accountSlug, 'users', userId);
637
+ // Rails expects nested params: user: { ... }
638
+ responseData = await GenericFunctions_1.fizzyApiRequest.call(this, 'PATCH', endpoint, { user: updateFields });
639
+ }
640
+ else {
641
+ responseData = {};
642
+ }
643
+ }
644
+ else {
645
+ responseData = {};
646
+ }
647
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
648
+ returnData.push(...executionData);
649
+ }
650
+ catch (error) {
651
+ if (this.continueOnFail()) {
652
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
653
+ continue;
654
+ }
655
+ throw error;
656
+ }
657
+ }
658
+ return [returnData];
659
+ }
660
+ }
661
+ exports.Fizzy = Fizzy;
662
+ //# sourceMappingURL=Fizzy.node.js.map