Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { ConfigurationError } from "@pipedream/platform";
import fs from "fs";
import FormData from "form-data";
import common from "../common.mjs";
import app from "../../trello.app.mjs";

export default {
...common,
key: "trello-add-attachment-to-card",
name: "Add Attachment To Card",
description: "Adds a file attachment on a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
...common.props,
app,
board: {
propDefinition: [
common.props.app,
app,
"board",
],
},
cardId: {
propDefinition: [
common.props.app,
app,
"cards",
(c) => ({
board: c.board,
Expand All @@ -33,49 +32,57 @@ export default {
},
name: {
propDefinition: [
common.props.app,
app,
"name",
],
},
url: {
fileType: {
propDefinition: [
common.props.app,
"url",
app,
"fileType",
],
reloadProps: true,
},
mimeType: {
url: {
propDefinition: [
common.props.app,
"mimeType",
app,
"url",
],
hidden: true,
},
file: {
propDefinition: [
common.props.app,
app,
"file",
],
hidden: true,
},
mimeType: {
propDefinition: [
app,
"mimeType",
],
hidden: true,
},
setCover: {
type: "boolean",
label: "Set Cover?",
description: "Determines whether to use the new attachment as a cover for the Card",
default: false,
optional: true,
},
},
methods: {
...common.methods,
addAttachmentToCard({
cardId, ...args
} = {}) {
return this.app.post({
path: `/cards/${cardId}/attachments`,
...args,
});
},
async additionalProps(props) {
const attachmentIsPath = this.fileType === "path";
const attachmentIsUrl = this.fileType === "url";
props.file.hidden = !attachmentIsPath;
props.mimeType.hidden = !attachmentIsPath;
props.url.hidden = !attachmentIsUrl;

return {};
},
async run({ $ }) {
const {
addAttachmentToCard,
cardId,
name,
url,
Expand All @@ -99,7 +106,7 @@ export default {
const form = new FormData();
form.append("file", fs.createReadStream(file));

response = await addAttachmentToCard({
response = await this.app.addAttachmentToCard({
$,
cardId,
params,
Expand All @@ -108,7 +115,7 @@ export default {
});

} else {
response = await addAttachmentToCard({
response = await this.app.addAttachmentToCard({
$,
cardId,
params: {
Expand Down
28 changes: 9 additions & 19 deletions components/trello/actions/add-checklist/add-checklist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import app from "../../trello.app.mjs";

export default {
key: "trello-add-checklist",
name: "Create a Checklist",
name: "Add Checklist",
description: "Adds a new checklist to a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-checklists-post).",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
app,
Expand Down Expand Up @@ -42,34 +42,24 @@ export default {
board: boardId,
}),
],
label: "Copy from Checklist",
},
pos: {
type: "string",
label: "Position",
description: "The position of the checklist on the card. One of: top, bottom, or a positive number.",
optional: true,
},
},
methods: {
addChecklist({
cardId, ...args
} = {}) {
return this.app.post({
path: `/cards/${cardId}/checklists`,
...args,
});
propDefinition: [
app,
"pos",
],
},
},
async run({ $ }) {
const {
addChecklist,
cardId,
name,
idChecklistSource,
pos,
} = this;

const response = await addChecklist({
const response = await this.app.addChecklist({
$,
cardId,
params: {
Expand All @@ -79,7 +69,7 @@ export default {
},
});

$.export("$summary", "Successfully added checklist.");
$.export("$summary", `Successfully added checklist with ID: ${response.id}`);

return response;
},
Expand Down
9 changes: 4 additions & 5 deletions components/trello/actions/add-comment/add-comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import app from "../../trello.app.mjs";

export default {
key: "trello-add-comment",
name: "Create a Comment",
name: "Add Comment",
description: "Create a new comment on a specific card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post).",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
app,
Expand Down Expand Up @@ -45,20 +45,19 @@ export default {
},
async run({ $ }) {
const {
addComment,
cardId,
text,
} = this;

const response = await addComment({
const response = await this.app.addComment({
$,
cardId,
params: {
text,
},
});

$.export("$summary", "Successfully added comment.");
$.export("$summary", `Successfully added comment with ID: ${response.id}`);

return response;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import common from "../common.mjs";
import app from "../../trello.app.mjs";

export default {
...common,
key: "trello-add-existing-label-to-card",
name: "Add Existing Label to Card",
description: "Adds an existing label to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post).",
version: "0.1.0",
version: "0.1.1",
type: "action",
props: {
...common.props,
app,
board: {
propDefinition: [
common.props.app,
app,
"board",
],
},
cardId: {
propDefinition: [
common.props.app,
app,
"cards",
(c) => ({
board: c.board,
Expand All @@ -30,27 +29,18 @@ export default {
},
value: {
propDefinition: [
common.props.app,
app,
"label",
(c) => ({
board: c.board,
card: c.cardId,
excludeCardLabels: true,
}),
],
},
},
methods: {
...common.methods,
addExistingLabelToCard({
cardId, ...args
} = {}) {
return this.app.post({
path: `/cards/${cardId}/idLabels`,
...args,
});
},
},
async run({ $ }) {
const res = await this.addExistingLabelToCard({
const res = await this.app.addExistingLabelToCard({
$,
cardId: this.cardId,
params: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import common from "../common.mjs";
import app from "../../trello.app.mjs";

export default {
...common,
key: "trello-add-member-to-card",
name: "Add Member to Card",
description: "Adds a member to the specified card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post).",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
...common.props,
app,
board: {
propDefinition: [
common.props.app,
app,
"board",
],
},
cardId: {
propDefinition: [
common.props.app,
app,
"cards",
(c) => ({
board: c.board,
Expand All @@ -30,27 +29,18 @@ export default {
},
value: {
propDefinition: [
common.props.app,
app,
"member",
(c) => ({
board: c.board,
card: c.cardId,
excludeCardMembers: true,
}),
],
},
},
methods: {
...common.methods,
addMemberToCard({
cardId, ...args
} = {}) {
return this.app.post({
path: `/cards/${cardId}/idMembers`,
...args,
});
},
},
async run({ $ }) {
const res = await this.addMemberToCard({
const res = await this.app.addMemberToCard({
$,
cardId: this.cardId,
params: {
Expand Down
11 changes: 5 additions & 6 deletions components/trello/actions/archive-card/archive-card.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import common from "../common.mjs";
import app from "../../trello.app.mjs";

export default {
...common,
key: "trello-archive-card",
name: "Archive Card",
description: "Archives a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put).",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
...common.props,
app,
board: {
propDefinition: [
common.props.app,
app,
"board",
],
},
cardId: {
propDefinition: [
common.props.app,
app,
"cards",
(c) => ({
board: c.board,
Expand Down
Loading
Loading