Skip to content

Commit 6b9896a

Browse files
committed
wip
1 parent 3afd891 commit 6b9896a

File tree

5 files changed

+118
-6
lines changed

5 files changed

+118
-6
lines changed

components/asters/asters.app.mjs

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,71 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "asters",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
workspaceId: {
8+
type: "string",
9+
label: "Workspace ID",
10+
description: "The ID of a workspace",
11+
async options() {
12+
const { data: { workspaces = [] } } = await this.listWorkspaces();
13+
return workspaces.map((workspace) => ({
14+
label: workspace.name,
15+
value: workspace._id,
16+
}));
17+
},
18+
},
19+
socialAccountId: {
20+
type: "string",
21+
label: "Social Account ID",
22+
description: "The ID of a social account",
23+
async options({ workspaceId }) {
24+
const { data = [] } = await this.listSocialAccounts({
25+
workspaceId,
26+
});
27+
return data.map((account) => ({
28+
label: account.name,
29+
value: account.account_id,
30+
}));
31+
},
32+
},
33+
},
534
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
35+
_baseUrl() {
36+
return "https://api.asters.ai/api/external/v1.0";
37+
},
38+
_makeRequest({
39+
$ = this, path, ...opts
40+
}) {
41+
return axios($, {
42+
url: `${this._baseUrl()}${path}`,
43+
headers: {
44+
"x-api-key": `${this.$auth.api_key}`,
45+
},
46+
...opts,
47+
});
48+
},
49+
listWorkspaces(opts = {}) {
50+
return this._makeRequest({
51+
path: "/workspaces",
52+
...opts,
53+
});
54+
},
55+
listSocialAccounts({
56+
workspaceId, ...opts
57+
}) {
58+
return this._makeRequest({
59+
path: `/workspaces/${workspaceId}/socialAccounts`,
60+
...opts,
61+
});
62+
},
63+
listPosts(opts = {}) {
64+
return this._makeRequest({
65+
method: "POST",
66+
path: "/data/posts",
67+
...opts,
68+
});
969
},
1070
},
1171
};

components/asters/package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/asters",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Asters Components",
55
"main": "asters.app.mjs",
66
"keywords": [
@@ -11,5 +11,14 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
17+
},
18+
"actions": {
19+
"directory": "actions"
20+
},
21+
"sources": {
22+
"directory": "sources"
1423
}
15-
}
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import asters from "../../asters.app.mjs";
2+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3+
4+
export default {
5+
props: {
6+
asters,
7+
db: "$.service.db",
8+
timer: {
9+
label: "Polling interval",
10+
description: "Pipedream will poll the Trello API on this schedule",
11+
type: "$.interface.timer",
12+
default: {
13+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
14+
},
15+
},
16+
},
17+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "asters-label-edited",
6+
name: "Label Edited",
7+
description: "Emit new event when a label is edited on a post.",
8+
type: "source",
9+
version: "0.0.{{ts}}",
10+
dedupe: "unique",
11+
async run() {
12+
},
13+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "asters-new-label-added",
6+
name: "New Label Added",
7+
description: "Emit new event when a label is added to a post.",
8+
type: "source",
9+
version: "0.0.{{ts}}",
10+
dedupe: "unique",
11+
async run() {
12+
},
13+
};

0 commit comments

Comments
 (0)