mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(HighLevel Node): Api v2 support, new node version (#9554)
This commit is contained in:
@@ -1,87 +1,25 @@
|
||||
import type { INodeProperties, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';
|
||||
import { VersionedNodeType } from 'n8n-workflow';
|
||||
|
||||
import { contactFields, contactNotes, contactOperations } from './description/ContactDescription';
|
||||
import { opportunityFields, opportunityOperations } from './description/OpportunityDescription';
|
||||
import { taskFields, taskOperations } from './description/TaskDescription';
|
||||
import {
|
||||
getPipelineStages,
|
||||
getTimezones,
|
||||
getUsers,
|
||||
highLevelApiPagination,
|
||||
} from './GenericFunctions';
|
||||
import { HighLevelV1 } from './v1/HighLevelV1.node';
|
||||
import { HighLevelV2 } from './v2/HighLevelV2.node';
|
||||
|
||||
const ressources: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Contact',
|
||||
value: 'contact',
|
||||
},
|
||||
{
|
||||
name: 'Opportunity',
|
||||
value: 'opportunity',
|
||||
},
|
||||
{
|
||||
name: 'Task',
|
||||
value: 'task',
|
||||
},
|
||||
],
|
||||
default: 'contact',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
export class HighLevel extends VersionedNodeType {
|
||||
constructor() {
|
||||
const baseDescription: INodeTypeBaseDescription = {
|
||||
displayName: 'HighLevel',
|
||||
name: 'highLevel',
|
||||
icon: 'file:highLevel.svg',
|
||||
group: ['transform'],
|
||||
defaultVersion: 2,
|
||||
description: 'Consume HighLevel API',
|
||||
};
|
||||
|
||||
export class HighLevel implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'HighLevel',
|
||||
name: 'highLevel',
|
||||
icon: 'file:highLevel.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
description: 'Consume HighLevel API',
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
defaults: {
|
||||
name: 'HighLevel',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'highLevelApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
requestDefaults: {
|
||||
baseURL: 'https://rest.gohighlevel.com/v1',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
requestOperations: {
|
||||
pagination: highLevelApiPagination,
|
||||
},
|
||||
properties: [
|
||||
...ressources,
|
||||
...contactOperations,
|
||||
...contactNotes,
|
||||
...contactFields,
|
||||
...opportunityOperations,
|
||||
...opportunityFields,
|
||||
...taskOperations,
|
||||
...taskFields,
|
||||
],
|
||||
};
|
||||
const nodeVersions: IVersionedNodeType['nodeVersions'] = {
|
||||
1: new HighLevelV1(baseDescription),
|
||||
2: new HighLevelV2(baseDescription),
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
getPipelineStages,
|
||||
getUsers,
|
||||
getTimezones,
|
||||
},
|
||||
};
|
||||
super(nodeVersions, baseDescription);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user