diff --git a/examples/javascript/cards/addAttachement.js b/examples/javascript/cards/addAttachement.js new file mode 100644 index 0000000..4ba54dc --- /dev/null +++ b/examples/javascript/cards/addAttachement.js @@ -0,0 +1,20 @@ +var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY'; +var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN'; + +var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken); + +var cardAttachementRequest = function () { + var data = { + name: 'Attachement name', + url: 'Attachement url', + file: 'Attachement file', + mimeType: 'Attachement url', + }; + Trello.card.addAttachment('idCard', data).then(function (response) { + console.log('response ', response); + }).catch(function (error) { + console.log('error', error); + }); +}; + +cardRequest(); \ No newline at end of file diff --git a/lib/resources/Cards.js b/lib/resources/Cards.js index adb0667..cf9f5da 100644 --- a/lib/resources/Cards.js +++ b/lib/resources/Cards.js @@ -16,6 +16,12 @@ module.exports = TrelloResource.extend({ urlParams: [ 'idCard', 'idCustomField' ] }), + addAttachment: trelloMethod({ + method: 'POST', + path: '/{idCard}/attachments', + urlParams: [ 'idCard' ] + }), + searchActions: trelloMethod({ method: 'GET', path: '/{id}/actions',