-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Tettra new components #17264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Tettra new components #17264
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import tettra from "../../tettra.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tettra-create-page", | ||
| name: "Create Page", | ||
| description: "Creates a new page in Tettra. [See the documentation](https://support.tettra.co/api-overview/api-endpoint-create-page)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tettra, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title of the page", | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "The body of the page formatted as HTML", | ||
| }, | ||
| categoryId: { | ||
| propDefinition: [ | ||
| tettra, | ||
| "categoryId", | ||
| ], | ||
| }, | ||
| subcategoryId: { | ||
| propDefinition: [ | ||
| tettra, | ||
| "subcategoryId", | ||
| ({ categoryId }) => ({ | ||
| categoryId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.tettra.createPage({ | ||
| $, | ||
| data: { | ||
| title: this.title, | ||
| body: this.body, | ||
| category_id: this.categoryId, | ||
| subcategory_id: this.subcategoryId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created page "${this.title}"`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import tettra from "../../tettra.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tettra-suggest-page", | ||
| name: "Suggest Page", | ||
| description: "Creates a new page suggestion in Tettra. [See the documentation](https://support.tettra.co/api-overview/api-endpoint-suggest-a-new-page)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tettra, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Title of the page suggestion", | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "More context about the suggested page", | ||
| optional: true, | ||
| }, | ||
| category: { | ||
| propDefinition: [ | ||
| tettra, | ||
| "categoryId", | ||
| ], | ||
| }, | ||
| assignableId: { | ||
| propDefinition: [ | ||
| tettra, | ||
| "userId", | ||
| ], | ||
| label: "Assignable ID", | ||
| description: "Select a user to assign the suggestion, or provide a user ID", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.tettra.suggestPage({ | ||
| $, | ||
| data: { | ||
| title: this.title, | ||
| description: this.description, | ||
| category: this.category, | ||
| assignable_id: this.assignableId, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created page suggestion "${this.title}"`); | ||
| return response; | ||
| }, | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,18 @@ | ||
| { | ||
| "name": "@pipedream/tettra", | ||
| "version": "0.0.2", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Tettra Components", | ||
| "main": "dist/app/tettra.app.mjs", | ||
| "main": "tettra.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "tettra" | ||
| ], | ||
| "files": ["dist"], | ||
| "homepage": "https://pipedream.com/apps/tettra", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "tettra", | ||
| propDefinitions: { | ||
| categoryId: { | ||
| type: "string", | ||
| label: "Category ID", | ||
| description: "Select a category or provide a category ID", | ||
| optional: true, | ||
| async options() { | ||
| const { categories } = await this.getCategories(); | ||
| return categories.map((category) => ({ | ||
| label: category.name, | ||
| value: category.id, | ||
| })); | ||
| }, | ||
| }, | ||
| subcategoryId: { | ||
| type: "string", | ||
| label: "Subcategory ID", | ||
| description: "Select a subcategory or provide a subcategory ID", | ||
| optional: true, | ||
| async options({ categoryId }) { | ||
| const { categoryItems } = await this.getCategory(categoryId); | ||
| return categoryItems.filter((item) => item.type === "Subcategory").map((item) => ({ | ||
| label: item.title, | ||
| value: item.id, | ||
| })); | ||
| }, | ||
GTFalcao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| userId: { | ||
| type: "string", | ||
| label: "User ID", | ||
| description: "Select a user or provide a user ID", | ||
| optional: true, | ||
| async options() { | ||
| const { users } = await this.getUsers(); | ||
| return users.map((user) => ({ | ||
| label: user.display_name ?? user.email, | ||
| value: user.id, | ||
| })); | ||
| }, | ||
GTFalcao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| methods: { | ||
| async _makeRequest({ | ||
| $ = this, | ||
| data, | ||
| ...args | ||
| }) { | ||
| const response = await axios($, { | ||
| baseURL: `https://app.tettra.co/api/teams/${this.$auth.team_id}`, | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| data: { | ||
| ...data, | ||
| api_key: this.$auth.api_key, | ||
| }, | ||
| ...args, | ||
| }); | ||
| return response; | ||
| }, | ||
| async createPage(args) { | ||
| return this._makeRequest({ | ||
| url: "/pages", | ||
| method: "POST", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async suggestPage(args) { | ||
| return this._makeRequest({ | ||
| url: "/suggestions", | ||
| method: "POST", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getCategories() { | ||
| return this._makeRequest({ | ||
| url: "/categories", | ||
| }); | ||
| }, | ||
| async getCategory(categoryId) { | ||
| return this._makeRequest({ | ||
| url: `/categories/${categoryId}`, | ||
| }); | ||
| }, | ||
| async getUsers() { | ||
| return this._makeRequest({ | ||
| url: "/users", | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.