@finlight/n8n-nodes-finlight 0.2.0 → 0.2.2
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.
|
@@ -315,11 +315,6 @@ class FinlightApi {
|
|
|
315
315
|
async execute() {
|
|
316
316
|
const items = this.getInputData();
|
|
317
317
|
const returnData = [];
|
|
318
|
-
const apiKey = (await this.getCredentials('finlightApi'));
|
|
319
|
-
const headers = {
|
|
320
|
-
'Content-Type': 'application/json',
|
|
321
|
-
'x-api-key': apiKey.apiKey,
|
|
322
|
-
};
|
|
323
318
|
for (let i = 0; i < items.length; i++) {
|
|
324
319
|
const operation = this.getNodeParameter('operation', i);
|
|
325
320
|
if (operation === 'search') {
|
|
@@ -365,10 +360,9 @@ class FinlightApi {
|
|
|
365
360
|
body.includeEntities = additional.includeEntities;
|
|
366
361
|
if (typeof additional.excludeEmptyContent === 'boolean')
|
|
367
362
|
body.excludeEmptyContent = additional.excludeEmptyContent;
|
|
368
|
-
const response = await this.helpers.
|
|
363
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'finlightApi', {
|
|
369
364
|
method: 'POST',
|
|
370
365
|
url: 'https://api.finlight.me/v2/articles',
|
|
371
|
-
headers,
|
|
372
366
|
body,
|
|
373
367
|
json: true,
|
|
374
368
|
});
|
|
@@ -383,20 +377,18 @@ class FinlightApi {
|
|
|
383
377
|
qs.includeContent = true;
|
|
384
378
|
if (includeEntities)
|
|
385
379
|
qs.includeEntities = true;
|
|
386
|
-
const response = await this.helpers.
|
|
380
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'finlightApi', {
|
|
387
381
|
method: 'GET',
|
|
388
382
|
url: 'https://api.finlight.me/v2/articles/by-link',
|
|
389
|
-
headers,
|
|
390
383
|
qs,
|
|
391
384
|
json: true,
|
|
392
385
|
});
|
|
393
386
|
returnData.push(response?.article ?? response);
|
|
394
387
|
}
|
|
395
388
|
else if (operation === 'listSources') {
|
|
396
|
-
const response = await this.helpers.
|
|
389
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'finlightApi', {
|
|
397
390
|
method: 'GET',
|
|
398
391
|
url: 'https://api.finlight.me/v2/sources',
|
|
399
|
-
headers,
|
|
400
392
|
json: true,
|
|
401
393
|
});
|
|
402
394
|
if (Array.isArray(response)) {
|
|
@@ -9,10 +9,19 @@ class FinlightApi {
|
|
|
9
9
|
{
|
|
10
10
|
displayName: 'API Key',
|
|
11
11
|
name: 'apiKey',
|
|
12
|
-
type: '
|
|
12
|
+
type: 'string',
|
|
13
|
+
typeOptions: { password: true },
|
|
13
14
|
default: '',
|
|
14
15
|
},
|
|
15
16
|
];
|
|
17
|
+
this.authenticate = {
|
|
18
|
+
type: 'generic',
|
|
19
|
+
properties: {
|
|
20
|
+
headers: {
|
|
21
|
+
'x-api-key': '={{$credentials.apiKey}}',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
16
25
|
this.test = {
|
|
17
26
|
request: {
|
|
18
27
|
baseURL: 'https://api.finlight.me/',
|
|
@@ -20,7 +29,6 @@ class FinlightApi {
|
|
|
20
29
|
method: 'POST',
|
|
21
30
|
headers: {
|
|
22
31
|
'Content-Type': 'application/json',
|
|
23
|
-
'x-api-key': '={{$credentials.apiKey}}',
|
|
24
32
|
},
|
|
25
33
|
body: {
|
|
26
34
|
pageSize: 1,
|
|
@@ -111,12 +111,22 @@ class FinlightWebhookTrigger {
|
|
|
111
111
|
output.content = payload.content;
|
|
112
112
|
if (payload.sentiment)
|
|
113
113
|
output.sentiment = payload.sentiment;
|
|
114
|
-
if (payload.confidence)
|
|
114
|
+
if (payload.confidence !== undefined)
|
|
115
115
|
output.confidence = payload.confidence;
|
|
116
116
|
if (payload.images?.length)
|
|
117
117
|
output.images = payload.images;
|
|
118
118
|
if (payload.companies?.length)
|
|
119
119
|
output.companies = payload.companies;
|
|
120
|
+
if (payload.createdAt)
|
|
121
|
+
output.createdAt = payload.createdAt;
|
|
122
|
+
if (payload.categories?.length)
|
|
123
|
+
output.categories = payload.categories;
|
|
124
|
+
if (payload.countries?.length)
|
|
125
|
+
output.countries = payload.countries;
|
|
126
|
+
if (payload.isUpdate !== undefined)
|
|
127
|
+
output.isUpdate = payload.isUpdate;
|
|
128
|
+
if (payload.revisedDate)
|
|
129
|
+
output.revisedDate = payload.revisedDate;
|
|
120
130
|
return {
|
|
121
131
|
workflowData: [[{ json: output }]],
|
|
122
132
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finlight/n8n-nodes-finlight",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Official n8n integration for finlight: real-time finance and news API",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ali Büyükkakac",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"node": ">=20.15"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/jubeiargh/n8n-nodes-finlight#readme",
|
|
17
18
|
"main": "index.js",
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsc && cp nodes/finlight/finlight.svg dist/nodes/finlight/",
|