Skip to content

Commit b5a9c78

Browse files
committed
Added actions
1 parent d9f1ce1 commit b5a9c78

File tree

6 files changed

+151
-23
lines changed

6 files changed

+151
-23
lines changed

components/upwave/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import app from "../../upwave.app.mjs";
2+
3+
export default {
4+
key: "upwave-create-card",
5+
name: "Create Card",
6+
description: "Create a new card. [See the documentation](https://upwavehq.github.io/api/#creating-a-new-card)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
workspaceId: {
12+
propDefinition: [
13+
app,
14+
"workspaceId",
15+
],
16+
},
17+
boardId: {
18+
propDefinition: [
19+
app,
20+
"boardId",
21+
(c) => ({
22+
workspaceId: c.workspaceId,
23+
}),
24+
],
25+
},
26+
dueDt: {
27+
propDefinition: [
28+
app,
29+
"dueDt",
30+
],
31+
},
32+
description: {
33+
propDefinition: [
34+
app,
35+
"description",
36+
],
37+
},
38+
},
39+
async run({ $ }) {
40+
const response = await this.app.createCard({
41+
$,
42+
workspaceId: this.workspaceId,
43+
data: {
44+
board: this.boardId,
45+
due_dt: this.dueDt,
46+
description: this.description,
47+
},
48+
});
49+
$.export("$summary", "Successfully created card with ID: " + response.id);
50+
return response;
51+
},
52+
};

components/upwave/app/upwave.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

components/upwave/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"name": "@pipedream/upwave",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Upwave Components",
5-
"main": "dist/app/upwave.app.mjs",
5+
"main": "upwave.app.mjs",
66
"keywords": [
77
"pipedream",
88
"upwave"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/upwave",
1211
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1312
"publishConfig": {

components/upwave/upwave.app.mjs

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "upwave",
6+
propDefinitions: {
7+
workspaceId: {
8+
type: "string",
9+
label: "Workspace ID",
10+
description: "Description for workspaceId",
11+
async options() {
12+
const response = await this.getWorkspaces();
13+
const workspaces = response.results;
14+
return workspaces.map(({
15+
title, id,
16+
}) => ({
17+
label: title,
18+
value: id,
19+
}));
20+
},
21+
},
22+
boardId: {
23+
type: "string",
24+
label: "Board ID",
25+
description: "Description for boardId",
26+
async options({ workspaceId }) {
27+
const response = await this.getBoards({
28+
workspaceId,
29+
});
30+
const boards = response.results;
31+
return boards.map(({
32+
title, id,
33+
}) => ({
34+
label: title,
35+
value: id,
36+
}));
37+
},
38+
},
39+
dueDt: {
40+
type: "string",
41+
label: "Due Date",
42+
description: "The due date of the card, i.e.: `2025-12-31`",
43+
optional: true,
44+
},
45+
description: {
46+
type: "string",
47+
label: "Description",
48+
description: "Description of the card",
49+
},
50+
},
51+
methods: {
52+
_baseUrl() {
53+
return "https://api.upwave.io";
54+
},
55+
async _makeRequest(opts = {}) {
56+
const {
57+
$ = this,
58+
path,
59+
headers,
60+
...otherOpts
61+
} = opts;
62+
return axios($, {
63+
...otherOpts,
64+
url: this._baseUrl() + path,
65+
headers: {
66+
"Authorization": `Token ${this.$auth.api_key}`,
67+
...headers,
68+
},
69+
});
70+
},
71+
async createCard({
72+
workspaceId, ...args
73+
}) {
74+
return this._makeRequest({
75+
path: `/workspaces/${workspaceId}/cards/`,
76+
method: "post",
77+
...args,
78+
});
79+
},
80+
async getWorkspaces(args = {}) {
81+
return this._makeRequest({
82+
path: "/workspaces",
83+
...args,
84+
});
85+
},
86+
async getBoards({
87+
workspaceId, ...args
88+
}) {
89+
return this._makeRequest({
90+
path: `/workspaces/${workspaceId}/boards`,
91+
...args,
92+
});
93+
},
94+
},
95+
};

pnpm-lock.yaml

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)