Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions components/canny/actions/change-post-status/change-post-status.mjs
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 components/canny/actions/create-comment/create-comment.mjs
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;
},
};
101 changes: 101 additions & 0 deletions components/canny/actions/create-post/create-post.mjs
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;
},
};
52 changes: 52 additions & 0 deletions components/canny/actions/get-post/get-post.mjs
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;
},
};
Loading
Loading