Skip to content

Commit f638ae8

Browse files
Merging pull request #16288
* Added actions * paginate props --------- Co-authored-by: michelle0927 <[email protected]>
1 parent 1a67bfc commit f638ae8

File tree

5 files changed

+178
-19
lines changed

5 files changed

+178
-19
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: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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+
prevContext, page,
13+
}) {
14+
const params = prevContext?.next
15+
? {
16+
page: page + 1,
17+
}
18+
: {};
19+
const {
20+
results, next,
21+
} = await this.getWorkspaces({
22+
params,
23+
});
24+
return {
25+
options: results.map(({
26+
title, id,
27+
}) => ({
28+
label: title,
29+
value: id,
30+
})),
31+
context: {
32+
next,
33+
},
34+
};
35+
},
36+
},
37+
boardId: {
38+
type: "string",
39+
label: "Board ID",
40+
description: "Description for boardId",
41+
async options({
42+
workspaceId, prevContext, page,
43+
}) {
44+
const params = prevContext?.next
45+
? {
46+
page: page + 1,
47+
}
48+
: {};
49+
const {
50+
results, next,
51+
} = await this.getBoards({
52+
workspaceId,
53+
params,
54+
});
55+
return {
56+
options: results.map(({
57+
title, id,
58+
}) => ({
59+
label: title,
60+
value: id,
61+
})),
62+
context: {
63+
next,
64+
},
65+
};
66+
},
67+
},
68+
dueDt: {
69+
type: "string",
70+
label: "Due Date",
71+
description: "The due date of the card, i.e.: `2025-12-31`",
72+
optional: true,
73+
},
74+
description: {
75+
type: "string",
76+
label: "Description",
77+
description: "Description of the card",
78+
},
79+
},
80+
methods: {
81+
_baseUrl() {
82+
return "https://api.upwave.io";
83+
},
84+
async _makeRequest(opts = {}) {
85+
const {
86+
$ = this,
87+
path,
88+
headers,
89+
...otherOpts
90+
} = opts;
91+
return axios($, {
92+
...otherOpts,
93+
url: this._baseUrl() + path,
94+
headers: {
95+
"Authorization": `Token ${this.$auth.api_key}`,
96+
...headers,
97+
},
98+
});
99+
},
100+
async createCard({
101+
workspaceId, ...args
102+
}) {
103+
return this._makeRequest({
104+
path: `/workspaces/${workspaceId}/cards/`,
105+
method: "post",
106+
...args,
107+
});
108+
},
109+
async getWorkspaces(args = {}) {
110+
return this._makeRequest({
111+
path: "/workspaces",
112+
...args,
113+
});
114+
},
115+
async getBoards({
116+
workspaceId, ...args
117+
}) {
118+
return this._makeRequest({
119+
path: `/workspaces/${workspaceId}/boards`,
120+
...args,
121+
});
122+
},
123+
},
124+
};

0 commit comments

Comments
 (0)