n8n-nodes-apiinfo 0.1.1 → 0.1.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.
package/README.md
CHANGED
|
@@ -23,4 +23,21 @@ No credentials are required for this node.
|
|
|
23
23
|
## Resources
|
|
24
24
|
|
|
25
25
|
- [n8n Community Nodes](https://n8n.io/integrations/community-nodes/)
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
## API Documentation
|
|
28
|
+
|
|
29
|
+
### GET /{ip_address}
|
|
30
|
+
**Get details for IP**
|
|
31
|
+
Retrieve details for a specific IPv4 or IPv6 address.
|
|
32
|
+
|
|
33
|
+
### GET /{ip_address}/org
|
|
34
|
+
**Filter response by org field**
|
|
35
|
+
Get the organization field as plaintext for a specific IP address.
|
|
36
|
+
|
|
37
|
+
### GET /{ip_address}/city
|
|
38
|
+
**Filter response by city field**
|
|
39
|
+
Get the city as plaintext for a specific IP address.
|
|
40
|
+
|
|
41
|
+
### GET /{ip_address}/country
|
|
42
|
+
**Filter response by country field**
|
|
43
|
+
Get country ISO code as plaintext for a specific IP address.
|
|
@@ -53,6 +53,59 @@ class ApiInfo {
|
|
|
53
53
|
],
|
|
54
54
|
default: 'get',
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
displayName: 'IP Address',
|
|
58
|
+
name: 'ip',
|
|
59
|
+
type: 'string',
|
|
60
|
+
default: '',
|
|
61
|
+
placeholder: '1.1.1.1',
|
|
62
|
+
description: 'The IP address to lookup',
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: [
|
|
66
|
+
'info',
|
|
67
|
+
],
|
|
68
|
+
operation: [
|
|
69
|
+
'get',
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Field',
|
|
76
|
+
name: 'field',
|
|
77
|
+
type: 'options',
|
|
78
|
+
default: 'all',
|
|
79
|
+
description: 'Specific field to retrieve',
|
|
80
|
+
displayOptions: {
|
|
81
|
+
show: {
|
|
82
|
+
resource: [
|
|
83
|
+
'info',
|
|
84
|
+
],
|
|
85
|
+
operation: [
|
|
86
|
+
'get',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
name: 'All Details',
|
|
93
|
+
value: 'all',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Organization',
|
|
97
|
+
value: 'org',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'City',
|
|
101
|
+
value: 'city',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Country',
|
|
105
|
+
value: 'country',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
56
109
|
],
|
|
57
110
|
};
|
|
58
111
|
}
|
|
@@ -60,26 +113,37 @@ class ApiInfo {
|
|
|
60
113
|
const items = this.getInputData();
|
|
61
114
|
const returnData = [];
|
|
62
115
|
const length = items.length;
|
|
63
|
-
const qs = {};
|
|
64
116
|
let responseData;
|
|
65
117
|
const resource = this.getNodeParameter('resource', 0);
|
|
66
118
|
const operation = this.getNodeParameter('operation', 0);
|
|
67
119
|
for (let i = 0; i < length; i++) {
|
|
68
|
-
|
|
69
|
-
if (operation === 'get') {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
120
|
+
try {
|
|
121
|
+
if (resource === 'info' && operation === 'get') {
|
|
122
|
+
const ip = this.getNodeParameter('ip', i);
|
|
123
|
+
const field = this.getNodeParameter('field', i);
|
|
124
|
+
let path = `/${ip}`;
|
|
125
|
+
if (field !== 'all') {
|
|
126
|
+
path += `/${field}`;
|
|
127
|
+
}
|
|
128
|
+
responseData = await this.helpers.httpRequest({
|
|
129
|
+
method: 'GET',
|
|
130
|
+
url: `https://ipinfo.io${path}`,
|
|
131
|
+
json: true,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (Array.isArray(responseData)) {
|
|
135
|
+
returnData.push.apply(returnData, responseData);
|
|
136
|
+
}
|
|
137
|
+
else if (responseData !== undefined) {
|
|
138
|
+
returnData.push({ json: responseData });
|
|
76
139
|
}
|
|
77
140
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
141
|
+
catch (error) {
|
|
142
|
+
if (this.continueOnFail()) {
|
|
143
|
+
returnData.push({ json: { error: error.message } });
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
throw error;
|
|
83
147
|
}
|
|
84
148
|
}
|
|
85
149
|
return [returnData];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiInfo.node.js","sourceRoot":"","sources":["../../../nodes/ApiInfo/ApiInfo.node.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ApiInfo.node.js","sourceRoot":"","sources":["../../../nodes/ApiInfo/ApiInfo.node.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE;gBACN,IAAI,EAAE,UAAU;aACnB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,EAAE;YACf,UAAU,EAAE;gBACR;oBACI,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,MAAM;4BACZ,KAAK,E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C,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAwB,CAAC,CAAC;iBACjE;aACJ;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE;oBACvB,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;oBAC/D,SAAS;iBACZ;gBACD,MAAM,KAAK,CAAC;aACf;SACJ;QACD,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;CACJ;AApJD,0BAoJC"}
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 6.3499999 6.3500002"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
xml:space="preserve"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
|
13
|
+
id="defs1" /><g
|
|
14
|
+
id="layer1"><g
|
|
15
|
+
id="g2"
|
|
16
|
+
transform="matrix(0.01249767,0,0,0.01249767,-0.00311225,0.00762118)"><path
|
|
17
|
+
d="m 254.341,402.054 c -7.865,0 -15.65,-2.996 -21.65,-8.995 L 8.995,229.363 C -3,217.368 -3,197.915 8.995,185.92 l 223.696,-223.696 c 11.995,-11.995 31.448,-11.995 43.443,0 l 223.696,223.696 c 11.995,11.995 11.995,31.448 0,43.443 L 276.134,393.202 c -6,5.999 -13.864,8.852 -21.793,8.852 z M 54.129,207.642 254.42,407.933 454.71,207.642 254.42,7.351 Z"
|
|
18
|
+
id="path1"
|
|
19
|
+
style="fill:#ea475b;fill-opacity:1" /><path
|
|
20
|
+
d="M 254.341,508.311 C 114.07,508.311 0,394.241 0,253.97 0,113.7 114.07,0 254.341,0 c 140.271,0 254.341,114.07 254.341,253.97 0,140.271 -114.07,254.341 -254.341,254.341 z m 0,-477.591 c -123.298,0 -223.621,100.323 -223.621,223.621 0,123.298 100.323,223.621 223.621,223.621 123.298,0 223.621,-100.323 223.621,-223.621 C 477.962,131.043 377.639,30.72 254.341,30.72 Z"
|
|
21
|
+
id="path2"
|
|
22
|
+
style="fill:#ea475b;fill-opacity:1" /><g
|
|
23
|
+
id="g1"><path
|
|
24
|
+
d="m 171.181,337.899 c 0,-32.843 38.62,-58.583 66.864,-82.723 23.906,-25.134 22.985,-38.334 22.985,-46.315 0,-14.735 -9.517,-22.099 -24.25,-22.099 -17.804,0 -24.558,11.665 -25.172,27.318 l -57.098,-8.597 c 1.229,-36.837 26.706,-63.509 82.269,-63.509 52.179,0 80.735,28.85 80.735,68.106 0,27.625 -18.725,56.772 -47.28,81.187 -23.018,19.339 -28.528,31.311 -28.528,46.623 h -70.525 z"
|
|
25
|
+
id="path3"
|
|
26
|
+
style="fill:#ea475b;fill-opacity:1" /><rect
|
|
27
|
+
x="171.181"
|
|
28
|
+
y="359.38599"
|
|
29
|
+
width="70.525002"
|
|
30
|
+
height="70.525002"
|
|
31
|
+
id="rect1"
|
|
32
|
+
style="fill:#ea475b;fill-opacity:1" /></g></g></g></svg>
|