Skip to content

Commit fdbfaaf

Browse files
authored
[Components] infolobby #13810 (#13933)
* Added actions * Added actions
1 parent d257a1b commit fdbfaaf

File tree

4 files changed

+119
-9
lines changed

4 files changed

+119
-9
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import app from "../../infolobby.app.mjs";
2+
3+
export default {
4+
key: "infolobby-create-comment",
5+
name: "Create Comment",
6+
description: "Create a new Comment for a record. [See the documentation](https://infolobby.com/site/apidocs/4/working-with-record-comments/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
tableId: {
12+
propDefinition: [
13+
app,
14+
"tableId",
15+
],
16+
},
17+
itemId: {
18+
propDefinition: [
19+
app,
20+
"itemId",
21+
(c) => ({
22+
tableId: c.tableId,
23+
}),
24+
],
25+
},
26+
comment: {
27+
propDefinition: [
28+
app,
29+
"comment",
30+
],
31+
},
32+
},
33+
async run({ $ }) {
34+
const response = await this.app.createComment({
35+
$,
36+
tableId: this.tableId,
37+
itemId: this.itemId,
38+
data: {
39+
comment: this.comment,
40+
},
41+
42+
});
43+
44+
$.export("$summary", `Successfully created Comment with ID '${response}'`);
45+
46+
return response;
47+
},
48+
};
Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,67 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "infolobby",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
itemId: {
8+
type: "string",
9+
label: "Item ID",
10+
description: "ID of the Item",
11+
async options({ tableId }) {
12+
const itemIds = await this.listItems({
13+
tableId,
14+
});
15+
return itemIds.map(({ item_id }) => ({
16+
value: item_id,
17+
}));
18+
},
19+
},
20+
tableId: {
21+
type: "string",
22+
label: "Table ID",
23+
description: "ID of the Table. You can get it from the developer tab in the table settings at InfoLobby",
24+
},
25+
comment: {
26+
type: "string",
27+
label: "Comment",
28+
description: "Comment to register in selected the item",
29+
},
30+
},
531
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
32+
_baseUrl() {
33+
return "https://infolobby.com/api";
34+
},
35+
async _makeRequest(opts = {}) {
36+
const {
37+
$ = this,
38+
path,
39+
...otherOpts
40+
} = opts;
41+
return axios($, {
42+
...otherOpts,
43+
url: this._baseUrl() + path,
44+
headers: {
45+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
46+
},
47+
});
48+
},
49+
async createComment({
50+
tableId, itemId, ...args
51+
}) {
52+
return this._makeRequest({
53+
method: "post",
54+
path: `/table/${tableId}/record/${itemId}/comments/create`,
55+
...args,
56+
});
57+
},
58+
async listItems({
59+
tableId, ...args
60+
}) {
61+
return this._makeRequest({
62+
path: `/table/${tableId}/records/query`,
63+
...args,
64+
});
965
},
1066
},
11-
};
67+
};

components/infolobby/package.json

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

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)