mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
feat(Webflow Node): Update to use the v2 API (#9996)
This commit is contained in:
35
packages/nodes-base/nodes/Webflow/V2/actions/router.ts
Normal file
35
packages/nodes-base/nodes/Webflow/V2/actions/router.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
import type { WebflowType } from './node.type';
|
||||
|
||||
import * as item from './Item/Item.resource';
|
||||
|
||||
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
let returnData: INodeExecutionData[] = [];
|
||||
|
||||
const items = this.getInputData();
|
||||
const resource = this.getNodeParameter<WebflowType>('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
const webflowNodeData = {
|
||||
resource,
|
||||
operation,
|
||||
} as WebflowType;
|
||||
|
||||
try {
|
||||
switch (webflowNodeData.resource) {
|
||||
case 'item':
|
||||
returnData = await item[webflowNodeData.operation].execute.call(this, items);
|
||||
break;
|
||||
default:
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The operation "${operation}" is not supported!`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
Reference in New Issue
Block a user