Skip to content

Commit 65a6098

Browse files
committed
Tettra new components
1 parent 0a7bc29 commit 65a6098

File tree

7 files changed

+153
-27
lines changed

7 files changed

+153
-27
lines changed

components/tettra/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import tettra from "../tettra.app.mjs";
2+
3+
export default {
4+
key: "tettra-create-page",
5+
name: "Create Page",
6+
description: "Creates a new page in Tettra. [See the documentation](https://support.tettra.co/api-overview/api-endpoint-create-page)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
tettra,
11+
title: {
12+
type: "string",
13+
label: "Title",
14+
description: "The title of the page",
15+
},
16+
body: {
17+
type: "string",
18+
label: "Body",
19+
description: "The body of the page formatted as HTML",
20+
},
21+
categoryId: {
22+
type: "string",
23+
label: "Category ID",
24+
description: "The category to publish the page to",
25+
optional: true,
26+
},
27+
subcategoryId: {
28+
type: "string",
29+
label: "Subcategory ID",
30+
description: "The subcategory to publish the page to",
31+
optional: true,
32+
},
33+
},
34+
async run({ $ }) {
35+
const response = await this.tettra.createPage({
36+
$,
37+
data: {
38+
title: this.title,
39+
body: this.body,
40+
category_id: this.categoryId,
41+
subcategory_id: this.subcategoryId,
42+
},
43+
});
44+
45+
$.export("$summary", `Successfully created page "${this.title}"`);
46+
return response;
47+
},
48+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import tettra from "../tettra.app.mjs";
2+
3+
export default {
4+
key: "tettra-suggest-page",
5+
name: "Suggest Page",
6+
description: "Creates a new page suggestion in Tettra. [See the documentation](https://support.tettra.co/api-overview/api-endpoint-suggest-a-new-page)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
tettra,
11+
title: {
12+
type: "string",
13+
label: "Title",
14+
description: "Title of the page suggestion",
15+
},
16+
description: {
17+
type: "string",
18+
label: "Description",
19+
description: "More context about the suggested page",
20+
optional: true,
21+
},
22+
category: {
23+
type: "string",
24+
label: "Category",
25+
description: "The category to publish the page to",
26+
optional: true,
27+
},
28+
assignableId: {
29+
type: "string",
30+
label: "Assignable ID",
31+
description: "The ID of the user to assign the suggestion",
32+
optional: true,
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.tettra.suggestPage({
37+
$,
38+
data: {
39+
title: this.title,
40+
description: this.description,
41+
category: this.category,
42+
assignable_id: this.assignableId,
43+
},
44+
});
45+
46+
$.export("$summary", `Successfully created page suggestion "${this.title}"`);
47+
return response;
48+
},
49+
};

components/tettra/app/tettra.app.ts

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

components/tettra/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "@pipedream/tettra",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Tettra Components",
5-
"main": "dist/app/tettra.app.mjs",
5+
"main": "tettra.app.mjs",
66
"keywords": [
77
"pipedream",
88
"tettra"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/tettra",
1211
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1312
"publishConfig": {
1413
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1517
}
1618
}

components/tettra/tettra.app.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "tettra",
6+
methods: {
7+
async _makeRequest({
8+
$ = this,
9+
data,
10+
...args
11+
}) {
12+
const response = await axios($, {
13+
baseURL: `https://app.tettra.co/api/teams/${this.$auth.team_id}`,
14+
headers: {
15+
"Content-Type": "application/json",
16+
},
17+
data: {
18+
...data,
19+
api_key: this.$auth.api_key,
20+
},
21+
...args,
22+
});
23+
return response;
24+
},
25+
async createPage(args) {
26+
return this._makeRequest({
27+
url: "/pages",
28+
method: "POST",
29+
...args,
30+
});
31+
},
32+
async suggestPage(args) {
33+
return this._makeRequest({
34+
url: "/suggestions",
35+
method: "POST",
36+
...args,
37+
});
38+
},
39+
},
40+
};

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)