diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index 89b8079323..f4bb7da1a0 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!`); }