From a1972c2d61ba85f26b77fdda8ef93c7ef41e885e Mon Sep 17 00:00:00 2001 From: trojanh Date: Thu, 16 Jan 2020 19:24:01 +0530 Subject: [PATCH 1/6] Add Attachment listing API --- .../nodes-base/nodes/Trello/Trello.node.ts | 209 +++++++++++++++++- 1 file changed, 207 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index 89b807932..f4bb7da1a 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -50,7 +50,11 @@ export class Trello implements INodeType { { name: 'List', value: 'list', - }, + }, + { + name: "Attachment", + value: "attachment" + } ], default: 'card', description: 'The resource to operate on.', @@ -544,10 +548,119 @@ export class Trello implements INodeType { name: 'Update', value: 'update', description: 'Update a card', + }, + { + name: 'AttachmentList', + value: 'attachmentList', + description: 'List all attachments', }, ], default: 'create', description: 'The operation to perform.', + }, + + // ---------------------------------- + // card:attachmentList + // ---------------------------------- + { + displayName: 'Card ID', + name: 'id', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'attachmentList', + ], + resource: [ + 'card', + ], + }, + }, + description: 'The ID of the card to get.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'attachmentList', + ], + resource: [ + 'card', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Fields', + name: 'fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list:
badges, checkItemStates, closed, dateLastActivity, desc,
descData, due, email, idBoard, idChecklists, idLabels, idList,
idMembers, idShort, idAttachmentCover, manualCoverAttachment
, labels, name, pos, shortUrl, url', + }, + { + displayName: 'Board', + name: 'board', + type: 'boolean', + default: false, + description: 'Whether to return the board object the card is on.', + }, + { + displayName: 'Board Fields', + name: 'board_fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list:
name, desc, descData, closed, idOrganization, pinned, url, prefs', + }, + { + displayName: 'Custom Field Items', + name: 'customFieldItems', + type: 'boolean', + default: false, + description: 'Whether to include the customFieldItems.', + }, + { + displayName: 'Members', + name: 'members', + type: 'boolean', + default: false, + description: 'Whether to return member objects for members on the card.', + }, + { + displayName: 'Member Fields', + name: 'member_fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list:
avatarHash, fullName, initials, username', + }, + { + displayName: 'Plugin Data', + name: 'pluginData', + type: 'boolean', + default: false, + description: 'Whether to include pluginData on the card with the response.', + }, + { + displayName: 'Stickers', + name: 'stickers', + type: 'boolean', + default: false, + description: 'Whether to include sticker models with the response.', + }, + { + displayName: 'Sticker Fields', + name: 'sticker_fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list of sticker fields.', + }, + ], }, // ---------------------------------- @@ -1211,6 +1324,80 @@ export class Trello implements INodeType { description: 'Whether the acting user is subscribed to the list.', }, ], + }, + + // ---------------------------------- + // attachment + // ---------------------------------- + + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'attachment', + ], + }, + }, + options: [ + { + name: 'List', + value: 'list', + description: 'List all attachments', + }, + ], + default: 'list', + description: 'The operation to perform.', + }, + + // ---------------------------------- + // attachment:list + // ---------------------------------- + { + displayName: 'Card ID', + name: 'id', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'list', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the list to get.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'list', + ], + resource: [ + 'attachment', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Fields', + name: 'fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list of fields.', + }, + ], }, ], @@ -1420,7 +1607,25 @@ export class Trello implements INodeType { throw new Error(`The operation "${operation}" is not known!`); } - } else { + } else if (resource === 'attachment') { + + if (operation === 'list') { + // ---------------------------------- + // list + // ---------------------------------- + + requestMethod = 'GET'; + + const id = this.getNodeParameter('id', i) as string; + + endpoint = `cards/${id}/attachments`; + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + } else { + throw new Error(`The operation "${operation}" is not known!`); + } + } else { throw new Error(`The resource "${resource}" is not known!`); } From 995297f87e17c8043063fede59e1249763e89b29 Mon Sep 17 00:00:00 2001 From: trojanh Date: Thu, 16 Jan 2020 19:41:54 +0530 Subject: [PATCH 2/6] Add GET attachment API --- .../nodes-base/nodes/Trello/Trello.node.ts | 173 +++++++++++++++++- 1 file changed, 163 insertions(+), 10 deletions(-) diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index f4bb7da1a..0621a7046 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -1346,12 +1346,83 @@ export class Trello implements INodeType { name: 'List', value: 'list', description: 'List all attachments', + }, + { + name: 'Get', + value: 'get', + description: 'Get the data of an attachments', }, ], default: 'list', description: 'The operation to perform.', }, + // ---------------------------------- + // attachment:create + // ---------------------------------- + { + displayName: 'Card ID', + name: 'id', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the Card to get attachment.', + }, + { + displayName: 'Attachment ID', + name: 'attachmentId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the attachment to get.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Fields', + name: 'fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list of fields.', + }, + ], + }, + // ---------------------------------- // attachment:list // ---------------------------------- @@ -1371,7 +1442,7 @@ export class Trello implements INodeType { ], }, }, - description: 'The ID of the list to get.', + description: 'The ID of the Card to get attachments.', }, { displayName: 'Additional Fields', @@ -1398,6 +1469,72 @@ export class Trello implements INodeType { description: 'Fields to return. Either "all" or a comma-separated list of fields.', }, ], + }, + + // ---------------------------------- + // attachment:get + // ---------------------------------- + { + displayName: 'Card ID', + name: 'id', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the Card to get attachment.', + }, + { + displayName: 'Attachment ID', + name: 'attachmentId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the attachment to get.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'attachment', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Fields', + name: 'fields', + type: 'string', + default: 'all', + description: 'Fields to return. Either "all" or a comma-separated list of fields.', + }, + ], }, ], @@ -1610,19 +1747,35 @@ export class Trello implements INodeType { } else if (resource === 'attachment') { if (operation === 'list') { - // ---------------------------------- - // list - // ---------------------------------- + // ---------------------------------- + // list + // ---------------------------------- - requestMethod = 'GET'; + requestMethod = 'GET'; - const id = this.getNodeParameter('id', i) as string; + const id = this.getNodeParameter('id', i) as string; - endpoint = `cards/${id}/attachments`; + endpoint = `cards/${id}/attachments`; - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - Object.assign(qs, additionalFields); - } else { + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + + } else if (operation === 'get') { + // ---------------------------------- + // get + // ---------------------------------- + + requestMethod = 'GET'; + + const id = this.getNodeParameter('id', i) as string; + const attachmentId = this.getNodeParameter('attachmentId', i) as string; + + endpoint = `cards/${id}/attachments/${attachmentId}`; + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + + } else { throw new Error(`The operation "${operation}" is not known!`); } } else { From 03a15b31b6ea8fb66ab23813a6a26fd693acf18e Mon Sep 17 00:00:00 2001 From: trojanh Date: Thu, 16 Jan 2020 20:06:45 +0530 Subject: [PATCH 3/6] Add Create and Delete API for attachment --- .../nodes-base/nodes/Trello/Trello.node.ts | 127 +++++++++++++++--- test.json | 4 + 2 files changed, 115 insertions(+), 16 deletions(-) create mode 100644 test.json diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index 0621a7046..cd3b0a87c 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -1343,15 +1343,25 @@ export class Trello implements INodeType { }, options: [ { - name: 'List', - value: 'list', - description: 'List all attachments', - }, + name: 'Create', + value: 'create', + description: 'Create a new board', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a board', + }, { name: 'Get', value: 'get', description: 'Get the data of an attachments', }, + { + name: 'List', + value: 'list', + description: 'List all attachments', + } ], default: 'list', description: 'The operation to perform.', @@ -1369,7 +1379,7 @@ export class Trello implements INodeType { displayOptions: { show: { operation: [ - 'get', + 'create', ], resource: [ 'attachment', @@ -1379,15 +1389,49 @@ export class Trello implements INodeType { description: 'The ID of the Card to get attachment.', }, { - displayName: 'Attachment ID', - name: 'attachmentId', + displayName: 'Attachment URL', + name: 'url', type: 'string', default: '', required: true, displayOptions: { show: { operation: [ - 'get', + 'create', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the attachment to get.', + }, + { + displayName: 'Attachment Name', + name: 'name', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the attachment to get.', + }, + { + displayName: 'Attachment mimeType', + name: 'mimeType', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', ], resource: [ 'attachment', @@ -1404,7 +1448,7 @@ export class Trello implements INodeType { displayOptions: { show: { operation: [ - 'get', + 'create', ], resource: [ 'attachment', @@ -1421,7 +1465,29 @@ export class Trello implements INodeType { description: 'Fields to return. Either "all" or a comma-separated list of fields.', }, ], - }, + }, + + // ---------------------------------- + // attachment:delete + // ---------------------------------- + { + displayName: 'Attachment ID', + name: 'attachmentId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'attachment', + ], + }, + }, + description: 'The ID of the attachment to get.', + }, // ---------------------------------- // attachment:list @@ -1746,21 +1812,37 @@ export class Trello implements INodeType { } else if (resource === 'attachment') { - if (operation === 'list') { + if (operation === 'create') { // ---------------------------------- - // list + // create // ---------------------------------- - - requestMethod = 'GET'; + requestMethod = 'POST'; const id = this.getNodeParameter('id', i) as string; + const name = this.getNodeParameter('name', i) as string; + const url = this.getNodeParameter('url', i) as string; + const mimeType = this.getNodeParameter('mimeType', i) as string; endpoint = `cards/${id}/attachments`; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; Object.assign(qs, additionalFields); - } else if (operation === 'get') { + } else if (operation === 'delete') { + // ---------------------------------- + // create + // ---------------------------------- + requestMethod = 'DELETE'; + + const id = this.getNodeParameter('id', i) as string; + const attachmentId = this.getNodeParameter('attachmentId', i) as string; + + endpoint = `cards/${id}/attachments/${attachmentId}`; + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + + } else if (operation === 'get') { // ---------------------------------- // get // ---------------------------------- @@ -1775,7 +1857,20 @@ export class Trello implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; Object.assign(qs, additionalFields); - } else { + } else if { + // ---------------------------------- + // list + // ---------------------------------- + + requestMethod = 'GET'; + + const id = this.getNodeParameter('id', i) as string; + + endpoint = `cards/${id}/attachments`; + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + } else { throw new Error(`The operation "${operation}" is not known!`); } } else { diff --git a/test.json b/test.json new file mode 100644 index 000000000..e85f76d1f --- /dev/null +++ b/test.json @@ -0,0 +1,4 @@ +{ + "text": "asdf", + "number": 1 +} \ No newline at end of file From 902f1c0f20d8806098658f03aded1841570b87a9 Mon Sep 17 00:00:00 2001 From: trojanh Date: Fri, 17 Jan 2020 18:50:29 +0530 Subject: [PATCH 4/6] trello-node: Fix Create, Delete apis and docs --- .../nodes-base/nodes/Trello/Trello.node.ts | 73 ++++++++----------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index cd3b0a87c..3a1e10e09 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -1329,7 +1329,6 @@ export class Trello implements INodeType { // ---------------------------------- // attachment // ---------------------------------- - { displayName: 'Operation', name: 'operation', @@ -1360,7 +1359,7 @@ export class Trello implements INodeType { { name: 'List', value: 'list', - description: 'List all attachments', + description: 'List all attachments for the card', } ], default: 'list', @@ -1372,7 +1371,7 @@ export class Trello implements INodeType { // ---------------------------------- { displayName: 'Card ID', - name: 'id', + name: 'cardId', type: 'string', default: '', required: true, @@ -1440,39 +1439,31 @@ export class Trello implements INodeType { }, description: 'The ID of the attachment to get.', }, + + // ---------------------------------- + // attachment:delete + // ---------------------------------- { - displayName: 'Additional Fields', - name: 'additionalFields', - type: 'collection', - placeholder: 'Add Field', + displayName: 'Card ID', + name: 'cardId', + type: 'string', + default: '', + required: true, displayOptions: { show: { operation: [ - 'create', + 'delete', ], resource: [ 'attachment', ], }, }, - default: {}, - options: [ - { - displayName: 'Fields', - name: 'fields', - type: 'string', - default: 'all', - description: 'Fields to return. Either "all" or a comma-separated list of fields.', - }, - ], + description: 'The ID of the Card to get attachments.', }, - - // ---------------------------------- - // attachment:delete - // ---------------------------------- { displayName: 'Attachment ID', - name: 'attachmentId', + name: 'id', type: 'string', default: '', required: true, @@ -1494,7 +1485,7 @@ export class Trello implements INodeType { // ---------------------------------- { displayName: 'Card ID', - name: 'id', + name: 'cardId', type: 'string', default: '', required: true, @@ -1542,7 +1533,7 @@ export class Trello implements INodeType { // ---------------------------------- { displayName: 'Card ID', - name: 'id', + name: 'cardId', type: 'string', default: '', required: true, @@ -1560,7 +1551,7 @@ export class Trello implements INodeType { }, { displayName: 'Attachment ID', - name: 'attachmentId', + name: 'id', type: 'string', default: '', required: true, @@ -1818,29 +1809,29 @@ export class Trello implements INodeType { // ---------------------------------- requestMethod = 'POST'; - const id = this.getNodeParameter('id', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; const name = this.getNodeParameter('name', i) as string; const url = this.getNodeParameter('url', i) as string; const mimeType = this.getNodeParameter('mimeType', i) as string; - endpoint = `cards/${id}/attachments`; + endpoint = `cards/${cardId}/attachments`; - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - Object.assign(qs, additionalFields); + Object.assign(qs, { + name, + mimeType, + url + }); } else if (operation === 'delete') { // ---------------------------------- - // create + // delete // ---------------------------------- requestMethod = 'DELETE'; + const cardId = this.getNodeParameter('cardId', i) as string; const id = this.getNodeParameter('id', i) as string; - const attachmentId = this.getNodeParameter('attachmentId', i) as string; - endpoint = `cards/${id}/attachments/${attachmentId}`; - - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - Object.assign(qs, additionalFields); + endpoint = `cards/${cardId}/attachments/${id}`; } else if (operation === 'get') { // ---------------------------------- @@ -1849,24 +1840,24 @@ export class Trello implements INodeType { requestMethod = 'GET'; + const cardId = this.getNodeParameter('cardId', i) as string; const id = this.getNodeParameter('id', i) as string; - const attachmentId = this.getNodeParameter('attachmentId', i) as string; - endpoint = `cards/${id}/attachments/${attachmentId}`; + endpoint = `cards/${cardId}/attachments/${id}`; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; Object.assign(qs, additionalFields); - } else if { + } else if (operation === 'list') { // ---------------------------------- // list // ---------------------------------- requestMethod = 'GET'; - const id = this.getNodeParameter('id', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; - endpoint = `cards/${id}/attachments`; + endpoint = `cards/${cardId}/attachments`; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; Object.assign(qs, additionalFields); From 6510bb2da7e42486dcd8e066dd1e7cb6476998e1 Mon Sep 17 00:00:00 2001 From: trojanh Date: Fri, 17 Jan 2020 18:53:04 +0530 Subject: [PATCH 5/6] trello-node: remove attachmentList operation --- .../nodes-base/nodes/Trello/Trello.node.ts | 109 ------------------ test.json | 4 - 2 files changed, 113 deletions(-) delete mode 100644 test.json diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index 3a1e10e09..f9e6357c1 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -549,120 +549,11 @@ export class Trello implements INodeType { value: 'update', description: 'Update a card', }, - { - name: 'AttachmentList', - value: 'attachmentList', - description: 'List all attachments', - }, ], default: 'create', description: 'The operation to perform.', }, - // ---------------------------------- - // card:attachmentList - // ---------------------------------- - { - displayName: 'Card ID', - name: 'id', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'attachmentList', - ], - resource: [ - 'card', - ], - }, - }, - description: 'The ID of the card to get.', - }, - { - displayName: 'Additional Fields', - name: 'additionalFields', - type: 'collection', - placeholder: 'Add Field', - displayOptions: { - show: { - operation: [ - 'attachmentList', - ], - resource: [ - 'card', - ], - }, - }, - default: {}, - options: [ - { - displayName: 'Fields', - name: 'fields', - type: 'string', - default: 'all', - description: 'Fields to return. Either "all" or a comma-separated list:
badges, checkItemStates, closed, dateLastActivity, desc,
descData, due, email, idBoard, idChecklists, idLabels, idList,
idMembers, idShort, idAttachmentCover, manualCoverAttachment
, labels, name, pos, shortUrl, url', - }, - { - displayName: 'Board', - name: 'board', - type: 'boolean', - default: false, - description: 'Whether to return the board object the card is on.', - }, - { - displayName: 'Board Fields', - name: 'board_fields', - type: 'string', - default: 'all', - description: 'Fields to return. Either "all" or a comma-separated list:
name, desc, descData, closed, idOrganization, pinned, url, prefs', - }, - { - displayName: 'Custom Field Items', - name: 'customFieldItems', - type: 'boolean', - default: false, - description: 'Whether to include the customFieldItems.', - }, - { - displayName: 'Members', - name: 'members', - type: 'boolean', - default: false, - description: 'Whether to return member objects for members on the card.', - }, - { - displayName: 'Member Fields', - name: 'member_fields', - type: 'string', - default: 'all', - description: 'Fields to return. Either "all" or a comma-separated list:
avatarHash, fullName, initials, username', - }, - { - displayName: 'Plugin Data', - name: 'pluginData', - type: 'boolean', - default: false, - description: 'Whether to include pluginData on the card with the response.', - }, - { - displayName: 'Stickers', - name: 'stickers', - type: 'boolean', - default: false, - description: 'Whether to include sticker models with the response.', - }, - { - displayName: 'Sticker Fields', - name: 'sticker_fields', - type: 'string', - default: 'all', - description: 'Fields to return. Either "all" or a comma-separated list of sticker fields.', - }, - ], - }, - // ---------------------------------- // card:create // ---------------------------------- diff --git a/test.json b/test.json deleted file mode 100644 index e85f76d1f..000000000 --- a/test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "text": "asdf", - "number": 1 -} \ No newline at end of file From 89b9d7f076662deb5773e4b5249faf83f1dd99f8 Mon Sep 17 00:00:00 2001 From: trojanh Date: Fri, 17 Jan 2020 20:16:13 +0530 Subject: [PATCH 6/6] Fix indentation issues --- .../nodes-base/nodes/Trello/Trello.node.ts | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index f9e6357c1..29a00e3eb 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -50,11 +50,11 @@ export class Trello implements INodeType { { name: 'List', value: 'list', - }, - { - name: "Attachment", - value: "attachment" - } + }, + { + name: "Attachment", + value: "attachment" + } ], default: 'card', description: 'The resource to operate on.', @@ -548,11 +548,11 @@ export class Trello implements INodeType { name: 'Update', value: 'update', description: 'Update a card', - }, + }, ], default: 'create', description: 'The operation to perform.', - }, + }, // ---------------------------------- // card:create @@ -1215,11 +1215,11 @@ export class Trello implements INodeType { description: 'Whether the acting user is subscribed to the list.', }, ], - }, + }, - // ---------------------------------- + // ---------------------------------- // attachment - // ---------------------------------- + // ---------------------------------- { displayName: 'Operation', name: 'operation', @@ -1232,7 +1232,7 @@ export class Trello implements INodeType { }, }, options: [ - { + { name: 'Create', value: 'create', description: 'Create a new board', @@ -1242,22 +1242,22 @@ export class Trello implements INodeType { value: 'delete', description: 'Delete a board', }, - { + { name: 'Get', value: 'get', description: 'Get the data of an attachments', }, - { + { name: 'List', value: 'list', description: 'List all attachments for the card', - } + } ], default: 'list', description: 'The operation to perform.', - }, + }, - // ---------------------------------- + // ---------------------------------- // attachment:create // ---------------------------------- { @@ -1277,8 +1277,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the Card to get attachment.', - }, - { + }, + { displayName: 'Attachment URL', name: 'url', type: 'string', @@ -1295,8 +1295,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the attachment to get.', - }, - { + }, + { displayName: 'Attachment Name', name: 'name', type: 'string', @@ -1312,8 +1312,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the attachment to get.', - }, - { + }, + { displayName: 'Attachment mimeType', name: 'mimeType', type: 'string', @@ -1329,12 +1329,12 @@ export class Trello implements INodeType { }, }, description: 'The ID of the attachment to get.', - }, + }, - // ---------------------------------- + // ---------------------------------- // attachment:delete - // ---------------------------------- - { + // ---------------------------------- + { displayName: 'Card ID', name: 'cardId', type: 'string', @@ -1351,8 +1351,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the Card to get attachments.', - }, - { + }, + { displayName: 'Attachment ID', name: 'id', type: 'string', @@ -1369,9 +1369,9 @@ export class Trello implements INodeType { }, }, description: 'The ID of the attachment to get.', - }, + }, - // ---------------------------------- + // ---------------------------------- // attachment:list // ---------------------------------- { @@ -1391,8 +1391,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the Card to get attachments.', - }, - { + }, + { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', @@ -1417,9 +1417,9 @@ export class Trello implements INodeType { description: 'Fields to return. Either "all" or a comma-separated list of fields.', }, ], - }, + }, - // ---------------------------------- + // ---------------------------------- // attachment:get // ---------------------------------- { @@ -1439,8 +1439,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the Card to get attachment.', - }, - { + }, + { displayName: 'Attachment ID', name: 'id', type: 'string', @@ -1457,8 +1457,8 @@ export class Trello implements INodeType { }, }, description: 'The ID of the attachment to get.', - }, - { + }, + { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', @@ -1692,70 +1692,70 @@ export class Trello implements INodeType { throw new Error(`The operation "${operation}" is not known!`); } - } else if (resource === 'attachment') { + } else if (resource === 'attachment') { - if (operation === 'create') { - // ---------------------------------- - // create - // ---------------------------------- - requestMethod = 'POST'; + if (operation === 'create') { + // ---------------------------------- + // create + // ---------------------------------- + requestMethod = 'POST'; - const cardId = this.getNodeParameter('cardId', i) as string; - const name = this.getNodeParameter('name', i) as string; - const url = this.getNodeParameter('url', i) as string; - const mimeType = this.getNodeParameter('mimeType', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; + const name = this.getNodeParameter('name', i) as string; + const url = this.getNodeParameter('url', i) as string; + const mimeType = this.getNodeParameter('mimeType', i) as string; - endpoint = `cards/${cardId}/attachments`; + endpoint = `cards/${cardId}/attachments`; - Object.assign(qs, { - name, - mimeType, - url - }); + Object.assign(qs, { + name, + mimeType, + url + }); - } else if (operation === 'delete') { - // ---------------------------------- - // delete - // ---------------------------------- - requestMethod = 'DELETE'; + } else if (operation === 'delete') { + // ---------------------------------- + // delete + // ---------------------------------- + requestMethod = 'DELETE'; - const cardId = this.getNodeParameter('cardId', i) as string; - const id = this.getNodeParameter('id', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; + const id = this.getNodeParameter('id', i) as string; - endpoint = `cards/${cardId}/attachments/${id}`; + endpoint = `cards/${cardId}/attachments/${id}`; - } else if (operation === 'get') { + } else if (operation === 'get') { // ---------------------------------- // get // ---------------------------------- requestMethod = 'GET'; - const cardId = this.getNodeParameter('cardId', i) as string; - const id = this.getNodeParameter('id', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; + const id = this.getNodeParameter('id', i) as string; - endpoint = `cards/${cardId}/attachments/${id}`; + endpoint = `cards/${cardId}/attachments/${id}`; - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - Object.assign(qs, additionalFields); + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); } else if (operation === 'list') { - // ---------------------------------- - // list - // ---------------------------------- + // ---------------------------------- + // list + // ---------------------------------- - requestMethod = 'GET'; + requestMethod = 'GET'; - const cardId = this.getNodeParameter('cardId', i) as string; + const cardId = this.getNodeParameter('cardId', i) as string; - endpoint = `cards/${cardId}/attachments`; + endpoint = `cards/${cardId}/attachments`; - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - Object.assign(qs, additionalFields); - } else { - throw new Error(`The operation "${operation}" is not known!`); - } - } else { + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + Object.assign(qs, additionalFields); + } else { + throw new Error(`The operation "${operation}" is not known!`); + } + } else { throw new Error(`The resource "${resource}" is not known!`); }