๐Ÿ“ฆ n8n-io / n8n

๐Ÿ“„ Airtop.node.ts ยท 91 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91import { NodeConnectionTypes } from 'n8n-workflow';
import type { IExecuteFunctions, INodeType, INodeTypeDescription } from 'n8n-workflow';

import * as agent from './actions/agent/Agent.resource';
import * as extraction from './actions/extraction/Extraction.resource';
import * as file from './actions/file/File.resource';
import * as interaction from './actions/interaction/Interaction.resource';
import { router } from './actions/router';
import * as session from './actions/session/Session.resource';
import * as window from './actions/window/Window.resource';
import { agentsResourceMapping, listSearchAgents } from './methods';

export class Airtop implements INodeType {
	description: INodeTypeDescription = {
		displayName: 'Airtop',
		name: 'airtop',
		icon: 'file:airtop.svg',
		group: ['transform'],
		defaultVersion: 1,
		version: [1, 1.1],
		subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
		description: 'Scrape and control any site with Airtop',
		usableAsTool: true,
		defaults: {
			name: 'Airtop',
		},
		inputs: [NodeConnectionTypes.Main],
		outputs: [NodeConnectionTypes.Main],
		credentials: [
			{
				name: 'airtopApi',
				required: true,
			},
		],
		properties: [
			{
				displayName: 'Resource',
				name: 'resource',
				type: 'options',
				noDataExpression: true,
				options: [
					{
						name: 'Agent',
						value: 'agent',
					},
					{
						name: 'Extraction',
						value: 'extraction',
					},
					{
						name: 'File',
						value: 'file',
					},
					{
						name: 'Interaction',
						value: 'interaction',
					},
					{
						name: 'Session',
						value: 'session',
					},
					{
						name: 'Window',
						value: 'window',
					},
				],
				default: 'session',
			},
			...agent.description,
			...session.description,
			...window.description,
			...file.description,
			...extraction.description,
			...interaction.description,
		],
	};

	methods = {
		listSearch: {
			listSearchAgents,
		},
		resourceMapping: {
			agentsResourceMapping,
		},
	};

	async execute(this: IExecuteFunctions) {
		return await router.call(this);
	}
}