mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
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:
parent
71afcd6314
commit
1ef10dd23f
|
@ -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
|
// person:getAll
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -3980,6 +4020,7 @@ export class Pipedrive implements INodeType {
|
||||||
'deal': 'deals',
|
'deal': 'deals',
|
||||||
'activity': 'activity',
|
'activity': 'activity',
|
||||||
'person': 'people',
|
'person': 'people',
|
||||||
|
'organization': 'org',
|
||||||
} as { [id: string]: string };
|
} as { [id: string]: string };
|
||||||
|
|
||||||
const { data } = await pipedriveApiRequest.call(this, 'GET', '/filters', {}, { type: type[resource] as 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;
|
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`;
|
endpoint = `/organizations`;
|
||||||
|
|
||||||
} else if (operation === 'update') {
|
} else if (operation === 'update') {
|
||||||
|
|
Loading…
Reference in a new issue