Skip to content

Commit 4090039

Browse files
authored
Added actions (#13513)
1 parent 07f4dd5 commit 4090039

File tree

4 files changed

+71
-7
lines changed

4 files changed

+71
-7
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../mails_so.app.mjs";
2+
3+
export default {
4+
key: "mails_so-validate-email",
5+
name: "Validate Email",
6+
description: "Send an email address to be validated by the API. [See the documentation](https://www.postman.com/joint-operations-engineer-25774813/workspace/mails-so/request/36028084-aa3b6359-bbdd-451b-8596-548a4d913f38)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
email: {
12+
propDefinition: [
13+
app,
14+
"email",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.validateEmail({
20+
$,
21+
params: {
22+
email: this.email,
23+
},
24+
});
25+
$.export("$summary", `Email validation result: '${response.data.result}'`);
26+
return response;
27+
},
28+
};
Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "mails_so",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
email: {
8+
type: "string",
9+
label: "Email",
10+
description: "Email to validate",
11+
},
12+
},
513
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
14+
_baseUrl() {
15+
return "https://api.mails.so/v1";
16+
},
17+
async _makeRequest(opts = {}) {
18+
const {
19+
$ = this,
20+
path,
21+
headers,
22+
...otherOpts
23+
} = opts;
24+
return axios($, {
25+
...otherOpts,
26+
url: this._baseUrl() + path,
27+
headers: {
28+
...headers,
29+
"x-mails-api-key": `${this.$auth.api_key}`,
30+
},
31+
});
32+
},
33+
async validateEmail(args = {}) {
34+
return this._makeRequest({
35+
method: "post",
36+
path: "/validate",
37+
...args,
38+
});
939
},
1040
},
1141
};

components/mails_so/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/mails_so",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream mails.so Components",
55
"main": "mails_so.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.0"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 4 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)