n8n-nodes-confirm8 0.6.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -2
- package/dist/credentials/{ApiCustomCredentials.credentials.d.ts → Confirm8Api.credentials.d.ts} +2 -2
- package/dist/credentials/Confirm8Api.credentials.js +63 -0
- package/dist/index.d.ts +2 -8
- package/dist/index.js +2 -11
- package/dist/nodes/Confirm8/ApiConfirm8.node.js +261 -0
- package/package.json +9 -19
- package/dist/credentials/ApiCustomCredentials.credentials.js +0 -66
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -17
- package/dist/nodes/ApiCustom/ApiAgentNode.node.d.ts +0 -9
- package/dist/nodes/ApiCustom/ApiAgentNode.node.js +0 -599
- package/dist/nodes/ApiCustom/ApiAgentTool.node.d.ts +0 -19
- package/dist/nodes/ApiCustom/ApiAgentTool.node.js +0 -170
- package/dist/nodes/ApiCustom/ApiCustom.node.d.ts +0 -5
- package/dist/nodes/ApiCustom/ApiCustom.node.js +0 -973
- package/dist/nodes/RegularNode.js +0 -976
- package/dist/nodes/index.d.ts +0 -4
- package/dist/nodes/index.js +0 -20
- /package/dist/nodes/{RegularNode.d.ts → Confirm8/ApiConfirm8.node.d.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Bill Hebert
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/credentials/{ApiCustomCredentials.credentials.d.ts → Confirm8Api.credentials.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ICredentialType, INodeProperties, ICredentialTestRequest, IHttpRequestOptions, ICredentialDataDecryptedObject } from
|
|
2
|
-
export declare class
|
|
1
|
+
import type { ICredentialType, INodeProperties, ICredentialTestRequest, IHttpRequestOptions, ICredentialDataDecryptedObject } from 'n8n-workflow';
|
|
2
|
+
export declare class Confirm8Api implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
documentationUrl: string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Confirm8Api = void 0;
|
|
4
|
+
class Confirm8Api {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'confirm8Api';
|
|
7
|
+
this.displayName = 'Confirm8 API';
|
|
8
|
+
this.documentationUrl = 'https://confirm8.com/api/docs';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Base URL',
|
|
12
|
+
name: 'baseUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
placeholder: 'https://api.confirm8.com',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Bearer Token',
|
|
20
|
+
name: 'bearerToken',
|
|
21
|
+
type: 'string',
|
|
22
|
+
typeOptions: {
|
|
23
|
+
password: true,
|
|
24
|
+
},
|
|
25
|
+
default: '',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: 'X-API-DOMAIN',
|
|
30
|
+
name: 'apiDomain',
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: '',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'X-APIKEY-TOKEN',
|
|
37
|
+
name: 'apiKeyToken',
|
|
38
|
+
type: 'string',
|
|
39
|
+
typeOptions: {
|
|
40
|
+
password: true,
|
|
41
|
+
},
|
|
42
|
+
default: '',
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
this.test = {
|
|
47
|
+
request: {
|
|
48
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
49
|
+
url: '/health',
|
|
50
|
+
method: 'GET',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async authenticate(credentials, requestOptions) {
|
|
55
|
+
requestOptions.baseURL = credentials.baseUrl;
|
|
56
|
+
requestOptions.headers = requestOptions.headers || {};
|
|
57
|
+
requestOptions.headers['Authorization'] = `Bearer ${credentials.bearerToken}`;
|
|
58
|
+
requestOptions.headers['X-API-DOMAIN'] = credentials.apiDomain;
|
|
59
|
+
requestOptions.headers['X-APIKEY-TOKEN'] = credentials.apiKeyToken;
|
|
60
|
+
return requestOptions;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Confirm8Api = Confirm8Api;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from "./nodes/ApiCustom/ApiAgentTool.node";
|
|
4
|
-
export * from "./credentials/ApiCustomCredentials.credentials";
|
|
5
|
-
import { ApiCustomNode } from "./nodes/ApiCustom/ApiCustom.node";
|
|
6
|
-
import { ApiCustomCredentials } from "./credentials/ApiCustomCredentials.credentials";
|
|
7
|
-
export declare const nodes: (typeof ApiCustomNode)[];
|
|
8
|
-
export declare const credentials: (typeof ApiCustomCredentials)[];
|
|
1
|
+
export * from './nodes/Confirm8/ApiConfirm8.node';
|
|
2
|
+
export * from './credentials/Confirm8Api.credentials';
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./nodes/ApiCustom/ApiAgentNode.node"), exports);
|
|
20
|
-
__exportStar(require("./nodes/ApiCustom/ApiAgentTool.node"), exports);
|
|
21
|
-
__exportStar(require("./credentials/ApiCustomCredentials.credentials"), exports);
|
|
22
|
-
const ApiCustom_node_1 = require("./nodes/ApiCustom/ApiCustom.node");
|
|
23
|
-
const ApiAgentNode_node_1 = require("./nodes/ApiCustom/ApiAgentNode.node");
|
|
24
|
-
const ApiAgentTool_node_1 = require("./nodes/ApiCustom/ApiAgentTool.node");
|
|
25
|
-
const ApiCustomCredentials_credentials_1 = require("./credentials/ApiCustomCredentials.credentials");
|
|
26
|
-
exports.nodes = [ApiCustom_node_1.ApiCustomNode, ApiAgentNode_node_1.ApiAgentNode, ApiAgentTool_node_1.ApiAgentTool];
|
|
27
|
-
exports.credentials = [ApiCustomCredentials_credentials_1.ApiCustomCredentials];
|
|
17
|
+
__exportStar(require("./nodes/Confirm8/ApiConfirm8.node"), exports);
|
|
18
|
+
__exportStar(require("./credentials/Confirm8Api.credentials"), exports);
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiConfirm8 = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class ApiConfirm8 {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'API Confirm8',
|
|
9
|
+
name: 'apiConfirm8',
|
|
10
|
+
icon: 'file:api.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
14
|
+
description: 'Interact with Confirm8 API',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'API Confirm8',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
credentials: [
|
|
21
|
+
{
|
|
22
|
+
name: 'confirm8Api',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Resource',
|
|
29
|
+
name: 'resource',
|
|
30
|
+
type: 'options',
|
|
31
|
+
noDataExpression: true,
|
|
32
|
+
options: [
|
|
33
|
+
{
|
|
34
|
+
name: 'User',
|
|
35
|
+
value: 'user',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Client',
|
|
39
|
+
value: 'client',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
default: 'user',
|
|
43
|
+
},
|
|
44
|
+
// USER OPERATIONS
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Operation',
|
|
47
|
+
name: 'operation',
|
|
48
|
+
type: 'options',
|
|
49
|
+
noDataExpression: true,
|
|
50
|
+
displayOptions: {
|
|
51
|
+
show: {
|
|
52
|
+
resource: ['user'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
name: 'Get',
|
|
58
|
+
value: 'get',
|
|
59
|
+
description: 'Get a user',
|
|
60
|
+
action: 'Get a user',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Get All',
|
|
64
|
+
value: 'getAll',
|
|
65
|
+
description: 'Get all users',
|
|
66
|
+
action: 'Get all users',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Create',
|
|
70
|
+
value: 'create',
|
|
71
|
+
description: 'Create a new user',
|
|
72
|
+
action: 'Create a user',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Update',
|
|
76
|
+
value: 'update',
|
|
77
|
+
description: 'Update a user',
|
|
78
|
+
action: 'Update a user',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
default: 'getAll',
|
|
82
|
+
},
|
|
83
|
+
// User ID
|
|
84
|
+
{
|
|
85
|
+
displayName: 'User ID',
|
|
86
|
+
name: 'userId',
|
|
87
|
+
type: 'string',
|
|
88
|
+
required: true,
|
|
89
|
+
displayOptions: {
|
|
90
|
+
show: {
|
|
91
|
+
resource: ['user'],
|
|
92
|
+
operation: ['get', 'update'],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
default: '',
|
|
96
|
+
description: 'The ID of the user',
|
|
97
|
+
},
|
|
98
|
+
// Username for create
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Username',
|
|
101
|
+
name: 'username',
|
|
102
|
+
type: 'string',
|
|
103
|
+
required: true,
|
|
104
|
+
displayOptions: {
|
|
105
|
+
show: {
|
|
106
|
+
resource: ['user'],
|
|
107
|
+
operation: ['create'],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
default: '',
|
|
111
|
+
description: 'Username for the new user',
|
|
112
|
+
},
|
|
113
|
+
// Additional fields
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Additional Fields',
|
|
116
|
+
name: 'additionalFields',
|
|
117
|
+
type: 'collection',
|
|
118
|
+
placeholder: 'Add Field',
|
|
119
|
+
default: {},
|
|
120
|
+
displayOptions: {
|
|
121
|
+
show: {
|
|
122
|
+
resource: ['user'],
|
|
123
|
+
operation: ['create', 'update'],
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
options: [
|
|
127
|
+
{
|
|
128
|
+
displayName: 'Email',
|
|
129
|
+
name: 'email',
|
|
130
|
+
type: 'string',
|
|
131
|
+
default: '',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Name',
|
|
135
|
+
name: 'name',
|
|
136
|
+
type: 'string',
|
|
137
|
+
default: '',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
// CLIENT OPERATIONS
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Operation',
|
|
144
|
+
name: 'operation',
|
|
145
|
+
type: 'options',
|
|
146
|
+
noDataExpression: true,
|
|
147
|
+
displayOptions: {
|
|
148
|
+
show: {
|
|
149
|
+
resource: ['client'],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
options: [
|
|
153
|
+
{
|
|
154
|
+
name: 'Get',
|
|
155
|
+
value: 'get',
|
|
156
|
+
description: 'Get a client',
|
|
157
|
+
action: 'Get a client',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'Get All',
|
|
161
|
+
value: 'getAll',
|
|
162
|
+
description: 'Get all clients',
|
|
163
|
+
action: 'Get all clients',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
default: 'getAll',
|
|
167
|
+
},
|
|
168
|
+
// Client ID
|
|
169
|
+
{
|
|
170
|
+
displayName: 'Client ID',
|
|
171
|
+
name: 'clientId',
|
|
172
|
+
type: 'string',
|
|
173
|
+
required: true,
|
|
174
|
+
displayOptions: {
|
|
175
|
+
show: {
|
|
176
|
+
resource: ['client'],
|
|
177
|
+
operation: ['get'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
default: '',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
async execute() {
|
|
186
|
+
const items = this.getInputData();
|
|
187
|
+
const returnData = [];
|
|
188
|
+
for (let i = 0; i < items.length; i++) {
|
|
189
|
+
try {
|
|
190
|
+
const resource = this.getNodeParameter('resource', i);
|
|
191
|
+
const operation = this.getNodeParameter('operation', i);
|
|
192
|
+
let endpoint = '';
|
|
193
|
+
let method = 'GET';
|
|
194
|
+
let body = {};
|
|
195
|
+
// USER OPERATIONS
|
|
196
|
+
if (resource === 'user') {
|
|
197
|
+
if (operation === 'getAll') {
|
|
198
|
+
endpoint = '/users';
|
|
199
|
+
}
|
|
200
|
+
else if (operation === 'get') {
|
|
201
|
+
const userId = this.getNodeParameter('userId', i);
|
|
202
|
+
endpoint = `/users/${userId}`;
|
|
203
|
+
}
|
|
204
|
+
else if (operation === 'create') {
|
|
205
|
+
endpoint = '/users';
|
|
206
|
+
method = 'POST';
|
|
207
|
+
const username = this.getNodeParameter('username', i);
|
|
208
|
+
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
209
|
+
body = { username, ...additionalFields };
|
|
210
|
+
}
|
|
211
|
+
else if (operation === 'update') {
|
|
212
|
+
const userId = this.getNodeParameter('userId', i);
|
|
213
|
+
endpoint = `/users/${userId}`;
|
|
214
|
+
method = 'PUT';
|
|
215
|
+
body = this.getNodeParameter('additionalFields', i, {});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// CLIENT OPERATIONS
|
|
219
|
+
else if (resource === 'client') {
|
|
220
|
+
if (operation === 'getAll') {
|
|
221
|
+
endpoint = '/clients';
|
|
222
|
+
}
|
|
223
|
+
else if (operation === 'get') {
|
|
224
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
225
|
+
endpoint = `/clients/${clientId}`;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const requestOptions = {
|
|
229
|
+
method: method,
|
|
230
|
+
url: endpoint,
|
|
231
|
+
json: true,
|
|
232
|
+
headers: {
|
|
233
|
+
'Content-Type': 'application/json',
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
if (method !== 'GET' && Object.keys(body).length > 0) {
|
|
237
|
+
requestOptions.body = body;
|
|
238
|
+
}
|
|
239
|
+
const responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'confirm8Api', requestOptions);
|
|
240
|
+
returnData.push({
|
|
241
|
+
json: responseData,
|
|
242
|
+
pairedItem: { item: i },
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
if (this.continueOnFail()) {
|
|
247
|
+
returnData.push({
|
|
248
|
+
json: {
|
|
249
|
+
error: error instanceof Error ? error.message : String(error),
|
|
250
|
+
},
|
|
251
|
+
pairedItem: { item: i },
|
|
252
|
+
});
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return [returnData];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.ApiConfirm8 = ApiConfirm8;
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-confirm8",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "n8n node for Confirm8 API",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "Bill
|
|
6
|
+
"author": "Bill Hebert",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"n8n-community-node-package",
|
|
9
9
|
"n8n",
|
|
10
|
-
"
|
|
11
|
-
"tool",
|
|
10
|
+
"confirm8",
|
|
12
11
|
"api"
|
|
13
12
|
],
|
|
14
13
|
"main": "dist/index.js",
|
|
@@ -17,32 +16,23 @@
|
|
|
17
16
|
"dist"
|
|
18
17
|
],
|
|
19
18
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"dev": "
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch"
|
|
23
21
|
},
|
|
24
22
|
"n8n": {
|
|
25
23
|
"credentials": [
|
|
26
|
-
"dist/credentials/
|
|
24
|
+
"dist/credentials/Confirm8Api.credentials.js"
|
|
27
25
|
],
|
|
28
26
|
"nodes": [
|
|
29
|
-
"dist/nodes/
|
|
30
|
-
"dist/nodes/ApiCustom/ApiAgentNode.node.js",
|
|
31
|
-
"dist/nodes/ApiCustom/ApiAgentTool.node.js"
|
|
27
|
+
"dist/nodes/Confirm8/ApiConfirm8.node.js"
|
|
32
28
|
]
|
|
33
29
|
},
|
|
34
30
|
"peerDependencies": {
|
|
35
|
-
"n8n-core": "*",
|
|
36
31
|
"n8n-workflow": "*"
|
|
37
32
|
},
|
|
38
33
|
"devDependencies": {
|
|
39
34
|
"@types/node": "^18.0.0",
|
|
40
|
-
"del": "^7.0.0",
|
|
41
|
-
"gulp": "^4.0.2",
|
|
42
|
-
"gulp-cli": "^2.3.0",
|
|
43
|
-
"gulp-typescript": "^6.0.0-alpha.1",
|
|
44
35
|
"typescript": "^5.0.0",
|
|
45
|
-
"n8n-
|
|
46
|
-
"n8n-workflow": "*"
|
|
36
|
+
"n8n-workflow": "^1.0.0"
|
|
47
37
|
}
|
|
48
38
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiCustomCredentials = void 0;
|
|
4
|
-
class ApiCustomCredentials {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = "apiCustomCredentials";
|
|
7
|
-
this.displayName = "Custom API Credentials";
|
|
8
|
-
this.documentationUrl = "https://your-api-documentation-url.com";
|
|
9
|
-
this.properties = [
|
|
10
|
-
{
|
|
11
|
-
displayName: "Base URL",
|
|
12
|
-
name: "baseUrl",
|
|
13
|
-
type: "string",
|
|
14
|
-
default: "",
|
|
15
|
-
placeholder: "https://api.example.com",
|
|
16
|
-
required: true,
|
|
17
|
-
description: "The base URL of your API endpoint (without trailing slash)",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
displayName: "Bearer Token",
|
|
21
|
-
name: "bearerToken",
|
|
22
|
-
type: "string",
|
|
23
|
-
typeOptions: { password: true },
|
|
24
|
-
default: "",
|
|
25
|
-
required: true,
|
|
26
|
-
description: "Bearer token for Authorization header",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
displayName: "X-API-DOMAIN",
|
|
30
|
-
name: "apiDomain",
|
|
31
|
-
type: "string",
|
|
32
|
-
default: "",
|
|
33
|
-
required: true,
|
|
34
|
-
description: "Value for X-API-DOMAIN header",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
displayName: "X-APIKEY-TOKEN",
|
|
38
|
-
name: "apiKeyToken",
|
|
39
|
-
type: "string",
|
|
40
|
-
typeOptions: { password: true },
|
|
41
|
-
default: "",
|
|
42
|
-
required: true,
|
|
43
|
-
description: "Value for X-APIKEY-TOKEN header",
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
// Used by the UI "Test" button
|
|
47
|
-
this.test = {
|
|
48
|
-
request: {
|
|
49
|
-
baseURL: "={{$credentials.baseUrl}}",
|
|
50
|
-
url: "/health",
|
|
51
|
-
method: "GET",
|
|
52
|
-
headers: {
|
|
53
|
-
Authorization: '={{"Bearer " + $credentials.bearerToken}}',
|
|
54
|
-
"X-API-DOMAIN": "={{$credentials.apiDomain}}",
|
|
55
|
-
"X-APIKEY-TOKEN": "={{$credentials.apiKeyToken}}",
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
async authenticate(credentials, requestOptions) {
|
|
61
|
-
requestOptions.headers = requestOptions.headers || {};
|
|
62
|
-
requestOptions.headers.Authorization = `Bearer ${credentials.apiKey}`;
|
|
63
|
-
return requestOptions;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.ApiCustomCredentials = ApiCustomCredentials;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ApiCustomCredentials.credentials';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ApiCustomCredentials.credentials"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, IDataObject } from 'n8n-workflow';
|
|
2
|
-
export declare class ApiAgentNode implements INodeType {
|
|
3
|
-
description: INodeTypeDescription;
|
|
4
|
-
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
-
executeSimpleMode(itemIndex: number, baseUrl: string, customHeaders: IDataObject, options: IDataObject, executeFunctions: IExecuteFunctions): Promise<IDataObject>;
|
|
6
|
-
executeAdvancedMode(itemIndex: number, baseUrl: string, customHeaders: IDataObject, options: IDataObject, executeFunctions: IExecuteFunctions): Promise<IDataObject>;
|
|
7
|
-
executeBatchMode(itemIndex: number, baseUrl: string, customHeaders: IDataObject, options: IDataObject, executeFunctions: IExecuteFunctions): Promise<IDataObject[]>;
|
|
8
|
-
makeRequest(baseUrl: string, endpoint: string, method: string, body: IDataObject, queryParams: IDataObject, customHeaders: IDataObject, options: IDataObject, executeFunctions: IExecuteFunctions): Promise<IDataObject>;
|
|
9
|
-
}
|