Skip to content

Commit ca3c233

Browse files
committed
new component
1 parent f004dcb commit ca3c233

File tree

3 files changed

+58
-7
lines changed

3 files changed

+58
-7
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import enrichley from "../../enrichley.app.mjs";
2+
3+
export default {
4+
key: "enrichley-validate-email",
5+
name: "Validate Email",
6+
description: "Checks the validity of a single email address using Enrichley. [See the documentation](https://enrichley.readme.io/reference/validatesingleemail)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
enrichley,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address to validate",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.enrichley.validateEmail({
19+
$,
20+
data: {
21+
email: this.email,
22+
},
23+
});
24+
$.export("$summary", `Successfully retrieved status for email: ${this.email}`);
25+
return response;
26+
},
27+
};
Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "enrichley",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
_baseUrl() {
8+
return "https://api.enrichley.io/api/v1";
9+
},
10+
_makeRequest({
11+
$ = this,
12+
path,
13+
...opts
14+
}) {
15+
return axios($, {
16+
url: `${this._baseUrl()}${path}`,
17+
headers: {
18+
"Accept": "application/json",
19+
"X-API-Key": `${this.$auth.api_key}`,
20+
},
21+
...opts,
22+
});
23+
},
24+
validateEmail(opts = {}) {
25+
return this._makeRequest({
26+
method: "POST",
27+
path: "/validate-single-email",
28+
...opts,
29+
});
930
},
1031
},
11-
};
32+
};

components/enrichley/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/enrichley",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Enrichley Components",
55
"main": "enrichley.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+
}

0 commit comments

Comments
 (0)