Add more functionality to Pipedrive-Node

This commit is contained in:
Jan Oberhauser 2019-07-10 08:40:59 +02:00
parent f74a067c17
commit 1cc00d9101

View file

@ -81,15 +81,30 @@ export class Pipedrive implements INodeType {
description: 'Get data of a deal',
},
{
name: 'Get All Persons',
value: 'getAllPersons',
description: 'Get data of all persons',
name: 'Get Organization',
value: 'getOrganization',
description: 'Get data of an organization',
},
{
name: 'Get Person',
value: 'getPerson',
description: 'Get data of a person',
},
{
name: 'Get All Organizations',
value: 'getAllOrganizations',
description: 'Get data of all organizations',
},
{
name: 'Get All Persons',
value: 'getAllPersons',
description: 'Get data of all persons',
},
{
name: 'Get All Products',
value: 'getAllProducts',
description: 'Get data of all products',
},
{
name: 'Update Activity',
value: 'updateActivity',
@ -501,6 +516,46 @@ export class Pipedrive implements INodeType {
},
// ----------------------------------
// getAllOrganizations
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAllOrganizations',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAllOrganizations',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'How many results to return.',
},
// ----------------------------------
// getAllPersons
// ----------------------------------
@ -540,6 +595,47 @@ export class Pipedrive implements INodeType {
description: 'How many results to return.',
},
// ----------------------------------
// getAllProducts
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAllProducts',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAllProducts',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'How many results to return.',
},
// ----------------------------------
// getActivity
// ----------------------------------
@ -580,6 +676,26 @@ export class Pipedrive implements INodeType {
},
// ----------------------------------
// getOrganization
// ----------------------------------
{
displayName: 'Organization ID',
name: 'organizationId',
type: 'number',
displayOptions: {
show: {
operation: [
'getOrganization'
],
},
},
default: 0,
required: true,
description: 'ID of the organization to get.',
},
// ----------------------------------
// getPerson
// ----------------------------------
@ -1025,6 +1141,20 @@ export class Pipedrive implements INodeType {
const personId = this.getNodeParameter('personId', i) as number;
endpoint = `/persons/${personId}`;
} else if (operation === 'getAllOrganizations') {
// ----------------------------------
// getAllOrganizations
// ----------------------------------
requestMethod = 'GET';
returnAll = this.getNodeParameter('returnAll', i) as boolean;
if (returnAll === false) {
qs.limit = this.getNodeParameter('limit', i) as number;
}
endpoint = `/organizations`;
} else if (operation === 'getAllPersons') {
// ----------------------------------
// getAllPersons
@ -1039,6 +1169,20 @@ export class Pipedrive implements INodeType {
endpoint = `/persons`;
} else if (operation === 'getAllProducts') {
// ----------------------------------
// getAllProducts
// ----------------------------------
requestMethod = 'GET';
returnAll = this.getNodeParameter('returnAll', i) as boolean;
if (returnAll === false) {
qs.limit = this.getNodeParameter('limit', i) as number;
}
endpoint = `/products`;
} else if (operation === 'getActivity') {
// ----------------------------------
// getActivity
@ -1059,6 +1203,16 @@ export class Pipedrive implements INodeType {
const dealId = this.getNodeParameter('dealId', i) as number;
endpoint = `/deals/${dealId}`;
} else if (operation === 'getOrganization') {
// ----------------------------------
// getOrganization
// ----------------------------------
requestMethod = 'GET';
const organizationId = this.getNodeParameter('organizationId', i) as number;
endpoint = `/organizations/${organizationId}`;
} else if (operation === 'getPerson') {
// ----------------------------------
// getPerson