Add Deal.duplicate functionality to Pipedrive-Node

This commit is contained in:
Jan Oberhauser 2019-11-02 21:41:13 +01:00
parent b5918c6bfe
commit d6134ec405

View file

@ -171,6 +171,11 @@ export class Pipedrive implements INodeType {
value: 'delete',
description: 'Delete a deal',
},
{
name: 'Duplicate',
value: 'duplicate',
description: 'Duplicate a deal',
},
{
name: 'Get',
value: 'get',
@ -947,6 +952,28 @@ export class Pipedrive implements INodeType {
description: 'ID of the deal to delete.',
},
// ----------------------------------
// deal:duplicate
// ----------------------------------
{
displayName: 'Deal ID',
name: 'dealId',
type: 'number',
displayOptions: {
show: {
operation: [
'duplicate',
],
resource: [
'deal',
],
},
},
default: 0,
required: true,
description: 'ID of the deal to duplicate.',
},
// ----------------------------------
// deal:get
// ----------------------------------
@ -2157,6 +2184,16 @@ export class Pipedrive implements INodeType {
const dealId = this.getNodeParameter('dealId', i) as number;
endpoint = `/deals/${dealId}`;
} else if (operation === 'duplicate') {
// ----------------------------------
// deal:duplicate
// ----------------------------------
requestMethod = 'POST';
const dealId = this.getNodeParameter('dealId', i) as number;
endpoint = `/deals/${dealId}/duplicate`;
} else if (operation === 'get') {
// ----------------------------------
// deal:get