Skip to content

Commit 7781048

Browse files
authored
New Components - whoisfreaks (#15453)
* new components * pnpm-lock.yaml * remove debug * add missing await
1 parent efb7584 commit 7781048

File tree

6 files changed

+214
-8
lines changed

6 files changed

+214
-8
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import whoisfreaks from "../../whoisfreaks.app.mjs";
2+
3+
export default {
4+
key: "whoisfreaks-domain-lookup",
5+
name: "Domain Lookup",
6+
description: "Retrieve details about a domain name. [See the documentation](https://whoisfreaks.com/products/whois-api#live_lookup)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
whoisfreaks,
11+
domainName: {
12+
propDefinition: [
13+
whoisfreaks,
14+
"domainName",
15+
],
16+
},
17+
lookupType: {
18+
type: "string",
19+
label: "Lookup Type",
20+
description: "Whether to perform a `live` or `historical` lookup",
21+
options: [
22+
"live",
23+
"historical",
24+
],
25+
},
26+
format: {
27+
propDefinition: [
28+
whoisfreaks,
29+
"format",
30+
],
31+
},
32+
},
33+
async run({ $ }) {
34+
const response = await this.whoisfreaks.domainLookup({
35+
$,
36+
params: {
37+
domainName: this.domainName,
38+
whois: this.lookupType,
39+
format: this.format,
40+
},
41+
});
42+
$.export("$summary", `Successfully performed lookup for domain ${this.domainName}`);
43+
return response;
44+
},
45+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import whoisfreaks from "../../whoisfreaks.app.mjs";
2+
3+
export default {
4+
key: "whoisfreaks-ip-lookup",
5+
name: "IP Lookup",
6+
description: "Retrieve information about an IP address. [See the documentation](https://whoisfreaks.com/products/whois-api#ip_lookup)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
whoisfreaks,
11+
ip: {
12+
type: "string",
13+
label: "IP",
14+
description: "IPv4 or IPv6 address for the requested whois",
15+
},
16+
format: {
17+
propDefinition: [
18+
whoisfreaks,
19+
"format",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.whoisfreaks.ipLookup({
25+
$,
26+
params: {
27+
ip: this.ip,
28+
format: this.format,
29+
},
30+
});
31+
$.export("$summary", `Successfully performed lookup for IP ${this.ip}`);
32+
return response;
33+
},
34+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import whoisfreaks from "../../whoisfreaks.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "whoisfreaks-reverse-lookup",
6+
name: "Reverse Lookup",
7+
description: "Retrieve details about a domain by keyword, email, registrant name or company. [See the documentation](https://whoisfreaks.com/products/whois-api#reverse_lookup)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
whoisfreaks,
12+
keyword: {
13+
type: "string",
14+
label: "Keyword",
15+
description: "Keyword search utilizes case-insensitive Pattern Matching search technique to search in our historical database. For example, `whoisfreaks` matches with any keyword that have the searched pattern like `mywhoisfreaks` and `whoisfreakscom`.",
16+
optional: true,
17+
},
18+
email: {
19+
type: "string",
20+
label: "Email",
21+
description: "Email search uses case-insensitive exact matching technique to search in our historical database. For example, `[email protected]` matches only with `[email protected]`.",
22+
optional: true,
23+
},
24+
owner: {
25+
type: "string",
26+
label: "Owner",
27+
description: "The owner name for requested whois",
28+
optional: true,
29+
},
30+
company: {
31+
type: "string",
32+
label: "Company",
33+
description: "Registrant name or Company search use full-text search technique to search in our historical database. For example, `whoisfreaks` matched with `whoisfreaks`, `whoisfreak`, `whois`, `mywhoisfreaks` and `whoisfreakscom`.",
34+
optional: true,
35+
},
36+
format: {
37+
propDefinition: [
38+
whoisfreaks,
39+
"format",
40+
],
41+
},
42+
page: {
43+
type: "integer",
44+
label: "Page",
45+
description: "For getting next or desired page of whois info. Default: `1`",
46+
default: 1,
47+
optional: true,
48+
},
49+
},
50+
async run({ $ }) {
51+
if ([
52+
this.keyword,
53+
this.email,
54+
this.owner,
55+
this.company,
56+
].filter((v) => v !== undefined).length !== 1) {
57+
throw new ConfigurationError("Must enter one and only one of `keyword`, `email`, `owner`, or `company`");
58+
}
59+
60+
const response = await this.whoisfreaks.domainLookup({
61+
$,
62+
params: {
63+
keyword: this.keyword,
64+
email: this.email,
65+
owner: this.owner,
66+
company: this.company,
67+
whois: "reverse",
68+
format: this.format,
69+
page: this.page,
70+
},
71+
});
72+
73+
$.export("$summary", "Successfully performed reverse lookup");
74+
return response;
75+
},
76+
};

components/whoisfreaks/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/whoisfreaks",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream WhoisFreaks Components",
55
"main": "whoisfreaks.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}
Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,55 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "whoisfreaks",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
domainName: {
8+
type: "string",
9+
label: "Domain Name",
10+
description: "The domain name to lookup",
11+
},
12+
format: {
13+
type: "string",
14+
label: "Format",
15+
description: "Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.",
16+
options: [
17+
"JSON",
18+
"XML",
19+
],
20+
optional: true,
21+
},
22+
},
523
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
24+
_baseUrl() {
25+
return "https://api.whoisfreaks.com/v1.0";
26+
},
27+
_makeRequest({
28+
$ = this,
29+
path,
30+
params,
31+
...opts
32+
}) {
33+
return axios($, {
34+
url: `${this._baseUrl()}${path}`,
35+
params: {
36+
...params,
37+
apiKey: this.$auth.api_key,
38+
},
39+
...opts,
40+
});
41+
},
42+
domainLookup(opts = {}) {
43+
return this._makeRequest({
44+
path: "/whois",
45+
...opts,
46+
});
47+
},
48+
ipLookup(opts = {}) {
49+
return this._makeRequest({
50+
path: "/ip-whois",
51+
...opts,
52+
});
953
},
1054
},
11-
};
55+
};

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)