feat(Pipedrive Node): Add support for filters to getAll:organization (#3211)

* feat(Pipedrive Node): Add support for filters to getAll:organization

* Fixed lint issue

*  Small improvement

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Tom 2022-05-06 17:42:26 +02:00 committed by GitHub
parent 71afcd6314
commit 1ef10dd23f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3628,6 +3628,46 @@ export class Pipedrive implements INodeType {
],
},
// ----------------------------------
// organization:getAll
// ----------------------------------
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'organization',
],
},
},
default: {},
options: [
{
displayName: 'First Char',
name: 'firstChar',
type: 'string',
default: '',
description: 'If supplied, only organizations whose name starts with the specified letter will be returned',
},
{
displayName: 'Predefined Filter',
name: 'filterId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getFilters',
},
default: '',
description: 'ID of the filter to use.',
},
],
},
// ----------------------------------
// person:getAll
// ----------------------------------
@ -3980,6 +4020,7 @@ export class Pipedrive implements INodeType {
'deal': 'deals',
'activity': 'activity',
'person': 'people',
'organization': 'org',
} as { [id: string]: string };
const { data } = await pipedriveApiRequest.call(this, 'GET', '/filters', {}, { type: type[resource] as string });
@ -4865,6 +4906,17 @@ export class Pipedrive implements INodeType {
qs.limit = this.getNodeParameter('limit', i) as number;
}
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (filters.filterId) {
qs.filter_id = filters.filterId as string;
}
if (filters.firstChar) {
qs.first_char = filters.firstChar as string;
qs.first_char = qs.first_char.substring(0, 1);
}
endpoint = `/organizations`;
} else if (operation === 'update') {