Skip to content

Commit 0b62f17

Browse files
committed
wip
1 parent 738d2fb commit 0b62f17

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

components/stripo/actions/create-email/create-email.mjs

Whitespace-only changes.

components/stripo/package.json

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

components/stripo/stripo.app.mjs

Lines changed: 48 additions & 4 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: "stripo",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
templateId: {
8+
type: "string",
9+
label: "Template ID",
10+
description: "An ID of a template with the auto-generated area. Please note that this template should be yours (saved in the project you have access to), not a basic or a public one.",
11+
async options({ page }) {
12+
const { data } = await this.listTemplates({
13+
params: page,
14+
});
15+
return data?.map(({
16+
templateId: value, name: label,
17+
}) => ({
18+
value,
19+
label,
20+
})) || [];
21+
},
22+
},
23+
},
524
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
25+
_baseUrl() {
26+
return "https://my.stripo.email/emailgeneration/v1";
27+
},
28+
_makeRequest({
29+
$ = this,
30+
path,
31+
...opts
32+
}) {
33+
return axios($, {
34+
url: `${this._baseUrl()}${path}`,
35+
headers: {
36+
"Stripo-Api-Auth": this.$auth.api_key,
37+
},
38+
...opts,
39+
});
40+
},
41+
listTemplates(opts = {}) {
42+
return this._makeRequest({
43+
path: "/templates",
44+
...opts,
45+
});
46+
},
47+
createEmail(opts = {}) {
48+
return this._makeRequest({
49+
method: "POST",
50+
path: "/email",
51+
...opts,
52+
});
953
},
1054
},
1155
};

0 commit comments

Comments
 (0)