trello-node: Fix Create, Delete apis and docs

This commit is contained in:
trojanh 2020-01-17 18:50:29 +05:30
parent 03a15b31b6
commit 902f1c0f20

View file

@ -1329,7 +1329,6 @@ export class Trello implements INodeType {
// ---------------------------------- // ----------------------------------
// attachment // attachment
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
@ -1360,7 +1359,7 @@ export class Trello implements INodeType {
{ {
name: 'List', name: 'List',
value: 'list', value: 'list',
description: 'List all attachments', description: 'List all attachments for the card',
} }
], ],
default: 'list', default: 'list',
@ -1372,7 +1371,7 @@ export class Trello implements INodeType {
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Card ID', displayName: 'Card ID',
name: 'id', name: 'cardId',
type: 'string', type: 'string',
default: '', default: '',
required: true, required: true,
@ -1440,39 +1439,31 @@ export class Trello implements INodeType {
}, },
description: 'The ID of the attachment to get.', description: 'The ID of the attachment to get.',
}, },
// ----------------------------------
// attachment:delete
// ----------------------------------
{ {
displayName: 'Additional Fields', displayName: 'Card ID',
name: 'additionalFields', name: 'cardId',
type: 'collection', type: 'string',
placeholder: 'Add Field', default: '',
required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'create', 'delete',
], ],
resource: [ resource: [
'attachment', 'attachment',
], ],
}, },
}, },
default: {}, description: 'The ID of the Card to get attachments.',
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: 'all',
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
},
],
}, },
// ----------------------------------
// attachment:delete
// ----------------------------------
{ {
displayName: 'Attachment ID', displayName: 'Attachment ID',
name: 'attachmentId', name: 'id',
type: 'string', type: 'string',
default: '', default: '',
required: true, required: true,
@ -1494,7 +1485,7 @@ export class Trello implements INodeType {
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Card ID', displayName: 'Card ID',
name: 'id', name: 'cardId',
type: 'string', type: 'string',
default: '', default: '',
required: true, required: true,
@ -1542,7 +1533,7 @@ export class Trello implements INodeType {
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Card ID', displayName: 'Card ID',
name: 'id', name: 'cardId',
type: 'string', type: 'string',
default: '', default: '',
required: true, required: true,
@ -1560,7 +1551,7 @@ export class Trello implements INodeType {
}, },
{ {
displayName: 'Attachment ID', displayName: 'Attachment ID',
name: 'attachmentId', name: 'id',
type: 'string', type: 'string',
default: '', default: '',
required: true, required: true,
@ -1818,29 +1809,29 @@ export class Trello implements INodeType {
// ---------------------------------- // ----------------------------------
requestMethod = 'POST'; 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 name = this.getNodeParameter('name', i) as string;
const url = this.getNodeParameter('url', i) as string; const url = this.getNodeParameter('url', i) as string;
const mimeType = this.getNodeParameter('mimeType', 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, {
Object.assign(qs, additionalFields); name,
mimeType,
url
});
} else if (operation === 'delete') { } else if (operation === 'delete') {
// ---------------------------------- // ----------------------------------
// create // delete
// ---------------------------------- // ----------------------------------
requestMethod = 'DELETE'; requestMethod = 'DELETE';
const cardId = this.getNodeParameter('cardId', i) as string;
const id = this.getNodeParameter('id', 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 (operation === 'get') { } else if (operation === 'get') {
// ---------------------------------- // ----------------------------------
@ -1849,24 +1840,24 @@ export class Trello implements INodeType {
requestMethod = 'GET'; requestMethod = 'GET';
const cardId = this.getNodeParameter('cardId', i) as string;
const id = this.getNodeParameter('id', 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; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(qs, additionalFields); Object.assign(qs, additionalFields);
} else if { } else if (operation === 'list') {
// ---------------------------------- // ----------------------------------
// list // list
// ---------------------------------- // ----------------------------------
requestMethod = 'GET'; 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; const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(qs, additionalFields); Object.assign(qs, additionalFields);