-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Canny - new components #19474
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
Open
michelle0927
wants to merge
2
commits into
master
Choose a base branch
from
issue-13310
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Canny - new components #19474
Changes from all commits
Commits
Show all changes
2 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
72 changes: 72 additions & 0 deletions
72
components/canny/actions/change-post-status/change-post-status.mjs
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,72 @@ | ||
| import canny from "../../canny.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "canny-change-post-status", | ||
| name: "Change Post Status", | ||
| description: "Change the status of a post. [See the documentation](https://developers.canny.io/api-reference#change_post_status)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| canny, | ||
| boardId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "boardId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| postId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "postId", | ||
| (c) => ({ | ||
| boardId: c.boardId, | ||
| }), | ||
| ], | ||
| }, | ||
| changerId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "userId", | ||
| ], | ||
| label: "Changer ID", | ||
| description: "The identifier of the admin to record as having changed the post's status", | ||
| }, | ||
| shouldNotifyVoters: { | ||
| type: "boolean", | ||
| label: "Should Notify Voters", | ||
| description: "Whether or not to notify non-admin voters of the status change", | ||
| }, | ||
| status: { | ||
| type: "string", | ||
| label: "Status", | ||
| description: "The new status of the post", | ||
| options: [ | ||
| "open", | ||
| "under review", | ||
| "planned", | ||
| "in progress", | ||
| "complete", | ||
| "closed", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.canny.updatePostStatus({ | ||
| $, | ||
| data: { | ||
| postID: this.postId, | ||
| changerID: this.changerId, | ||
| shouldNotifyVoters: this.shouldNotifyVoters, | ||
| status: this.status, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully changed the status of post ${this.postId} to ${this.status}`); | ||
| return response; | ||
| }, | ||
| }; | ||
79 changes: 79 additions & 0 deletions
79
components/canny/actions/create-comment/create-comment.mjs
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,79 @@ | ||
| import canny from "../../canny.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "canny-create-comment", | ||
| name: "Create Comment", | ||
| description: "Create a comment. [See the documentation](https://developers.canny.io/api-reference#create_comment)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| canny, | ||
| authorId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "userId", | ||
| ], | ||
| label: "Author ID", | ||
| description: "The ID of the author of the comment", | ||
| }, | ||
| postId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "postId", | ||
| ], | ||
| description: "The ID of the post to comment on", | ||
| }, | ||
| value: { | ||
| type: "string", | ||
| label: "Value", | ||
| description: "The comment value. Optional if imageURLs are provided. Must be under 2500 characters.", | ||
| optional: true, | ||
| }, | ||
| imageUrls: { | ||
| type: "string[]", | ||
| label: "Image URLs", | ||
| description: "An array of the URLs of comment's images", | ||
| optional: true, | ||
| }, | ||
| parentId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "commentId", | ||
| ], | ||
| label: "Parent ID", | ||
| description: "The ID of the parent comment", | ||
| optional: true, | ||
| }, | ||
| shouldNotifyVoters: { | ||
| type: "boolean", | ||
| label: "Should Notify Voters", | ||
| description: "Whether this comment should be allowed to trigger email notifications. Default is false.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!this.value && !this.imageUrls) { | ||
| throw new ConfigurationError("Either value or imageUrls must be provided"); | ||
| } | ||
|
|
||
| const response = await this.canny.createComment({ | ||
| $, | ||
| data: { | ||
| authorID: this.authorId, | ||
| postID: this.postId, | ||
| value: this.value, | ||
| imageURLs: this.imageUrls, | ||
| parentID: this.parentId, | ||
| shouldNotifyVoters: this.shouldNotifyVoters, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created comment with ID ${response.id}`); | ||
| 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,101 @@ | ||
| import canny from "../../canny.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "canny-create-post", | ||
| name: "Create Post", | ||
| description: "Create a post. [See the documentation](https://developers.canny.io/api-reference#create_post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| canny, | ||
| authorId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "userId", | ||
| ], | ||
| label: "Author ID", | ||
| description: "The ID of the author of the post", | ||
| }, | ||
| boardId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "boardId", | ||
| ], | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title of the post", | ||
| }, | ||
| details: { | ||
| type: "string", | ||
| label: "Details", | ||
| description: "The details of the post", | ||
| }, | ||
| categoryId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "categoryId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| eta: { | ||
| type: "string", | ||
| label: "ETA", | ||
| description: "The estimated date of the post's completion. In the format of MM/YYYY, eg, 06/2022.", | ||
| optional: true, | ||
| }, | ||
| etaPublic: { | ||
| type: "boolean", | ||
| label: "ETA Public", | ||
| description: "If the ETA should be made visible to all users", | ||
| optional: true, | ||
| }, | ||
| ownerId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "userId", | ||
| ], | ||
| label: "Owner ID", | ||
| description: "The ID of the user responsible for the completion of the work described in the post", | ||
| optional: true, | ||
| }, | ||
| imageUrls: { | ||
| type: "string[]", | ||
| label: "Image URLs", | ||
| description: "An array of the URLs of post's images", | ||
| optional: true, | ||
| }, | ||
| customFields: { | ||
| type: "object", | ||
| label: "Custom Fields", | ||
| description: "Any custom fields associated with the post. Each field name (key) must be between 0 and 30 characters long. If field values are strings, they must be less than 200 characters long.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.canny.createPost({ | ||
| $, | ||
| data: { | ||
| authorID: this.authorId, | ||
| boardID: this.boardId, | ||
| title: this.title, | ||
| categoryID: this.categoryId, | ||
| details: this.details, | ||
| eta: this.eta, | ||
| etaPublic: this.etaPublic, | ||
| ownerID: this.ownerId, | ||
| imageURLs: this.imageUrls, | ||
| customFields: parseObject(this.customFields), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created a post with ID ${response.id}`); | ||
| 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,52 @@ | ||
| import canny from "../../canny.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "canny-get-post", | ||
| name: "Get Post", | ||
| description: "Get a post. [See the documentation](https://developers.canny.io/api-reference#retrieve_post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| canny, | ||
| boardId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "boardId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| postId: { | ||
| propDefinition: [ | ||
| canny, | ||
| "postId", | ||
| (c) => ({ | ||
| boardId: c.boardId, | ||
| }), | ||
| ], | ||
| optional: true, | ||
| }, | ||
| urlName: { | ||
| type: "string", | ||
| label: "URL Name", | ||
| description: "The post's unique urlName", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.canny.getPost({ | ||
| $, | ||
| data: { | ||
| boardID: this.boardId, | ||
| urlName: this.urlName, | ||
| id: this.postId, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved post ${this.postId}`); | ||
| return response; | ||
| }, | ||
| }; |
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.