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
44 changes: 30 additions & 14 deletions components/asana/actions/search-tasks/search-tasks.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import asana from "../../asana.app.mjs";
import common from "../common/common.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "asana-search-tasks",
name: "Search Tasks",
description: "Searches for a Task by name within a Project. [See the documentation](https://developers.asana.com/docs/get-multiple-tasks)",
version: "0.3.1",
version: "0.3.2",
type: "action",
props: {
...common.props,
project: {

Check warning on line 13 in components/asana/actions/search-tasks/search-tasks.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop project must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 13 in components/asana/actions/search-tasks/search-tasks.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop project must have a description. See https://pipedream.com/docs/components/guidelines/#props
...common.props.project,
optional: true,
},
name: {
label: "Name",
description: "The task name to search for.",
Expand All @@ -30,7 +35,7 @@
section: {
label: "Section",
type: "string",
description: "The section to filter tasks on.",
description: "The section to filter tasks on. Must specify Project to list options.",
optional: true,
propDefinition: [
asana,
Expand All @@ -40,33 +45,44 @@
}),
],
},
completed_since: {
completedSince: {
label: "Completed Since",
type: "string",
description: "Only return tasks that are either incomplete or that have been completed since this time. ISO 8601 date string",
optional: true,
},
modified_since: {
modifiedSince: {
label: "Modified Since",
type: "string",
description: "Only return tasks that have been modified since the given time. ISO 8601 date string",
optional: true,
},
},
async run({ $ }) {
if ((!this.workspace || !this.assignee) && !this.project && !this.section) {
throw new Error("You must specify a Project or Section if you do not specify Assignee and Workspace");
if (!this.project && !this.section && !this.assignee) {
throw new ConfigurationError("Must specify one of Project, Section, or Assignee");
}

if ((this.project || this.section) && this.assignee) {
throw new ConfigurationError("Must specify only one of Assignee, Project, or Project + Section");
}

const params = {
completed_since: this.completedSince,
modified_since: this.modifiedSince,
};

if (this.assignee) {
params.assignee = this.assignee;
params.workspace = this.workspace;
} else if (this.section) {
params.section = this.section;
} else {
params.project = this.project;
}

const { data: tasks } = await this.asana.getTasks({
params: {
assignee: this.assignee,
project: this.project,
section: this.section,
workspace: this.workspace,
completed_since: this.completed_since,
modified_since: this.modified_since,
},
params,
$,
});

Expand Down
2 changes: 1 addition & 1 deletion components/asana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/asana",
"version": "0.7.1",
"version": "0.7.2",
"description": "Pipedream Asana Components",
"main": "asana.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "freshdesk-create-company",
name: "Create a Company",
description: "Create a company. [See the documentation](https://developers.freshdesk.com/api/#create_company)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
freshdesk,
Expand Down
12 changes: 9 additions & 3 deletions components/freshdesk/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import freshdesk from "../../freshdesk.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "freshdesk-create-contact",
name: "Create a Contact",
description: "Create a contact. [See the documentation](https://developers.freshdesk.com/api/#create_contact)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
freshdesk,
Expand Down Expand Up @@ -41,9 +42,14 @@ export default {
},
async run({ $ }) {
const {
companyId, otherEmails, ...data
freshdesk, companyId, otherEmails, ...data
} = this;
const response = await this.freshdesk.createContact({

if (!this.email && !this.phone) {
throw new ConfigurationError("Must specify `email` and/or `phone`");
}

const response = await freshdesk.createContact({
$,
data: {
other_emails: otherEmails,
Expand Down
15 changes: 3 additions & 12 deletions components/freshdesk/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "freshdesk-create-ticket",
name: "Create a Ticket",
description: "Create a ticket. [See the documentation](https://developers.freshdesk.com/api/#create_ticket)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
freshdesk,
Expand All @@ -22,32 +22,24 @@ export default {
companyId,
}),
],
optional: true,
},
priority: {
propDefinition: [
freshdesk,
"ticketPriority",
],
default: 1,
optional: true,
},
subject: {
type: "string",
label: "Subject",
description: "Subject of the ticket",
optional: true,
},
description: {
type: "string",
label: "Description",
description: "HTML content of the ticket",
optional: true,
},
descriptionText: {
type: "string",
label: "Description text",
description: "Content of the ticket in plain text",
optional: true,
},
phone: {
type: "string",
Expand All @@ -66,13 +58,12 @@ export default {
},
async run({ $ }) {
const {
freshdesk, companyId, descriptionText, ...data
freshdesk, companyId, ...data
} = this;
const response = await freshdesk.createTicket({
$,
data: {
company_id: Number(companyId),
description_text: descriptionText,
...data,
},
});
Expand Down
2 changes: 1 addition & 1 deletion components/freshdesk/actions/get-ticket/get-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "freshdesk-get-ticket",
name: "Get Ticket Details",
description: "Get details of a Ticket. [See the documentation](https://developers.freshdesk.com/api/#view_a_ticket)",
version: "0.1.0",
version: "0.1.1",
type: "action",
props: {
freshdesk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "List Tickets",
description:
"Fetch up to 100 tickets according to the selected filters. [See the documentation](https://developers.freshdesk.com/api/#list_all_tickets)",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
freshdesk,
Expand Down
9 changes: 6 additions & 3 deletions components/freshdesk/freshdesk.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ export default {
label: "Email",
description: "Select a contact or provide a contact's email",
async options({ companyId }) {
const contacts = await this.getContacts();
const numId = Number(companyId);
const contacts = await this.getContacts({
params: {
company_id: companyId,
},
});
return contacts
.filter((contact) => contact.company_id === numId)
.filter(({ email }) => email)
.map(({
email, name,
}) => ({
Expand Down
2 changes: 1 addition & 1 deletion components/freshdesk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/freshdesk",
"version": "0.1.0",
"version": "0.1.1",
"description": "Pipedream Freshdesk Components",
"main": "freshdesk.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/freshdesk/sources/new-contact/new-contact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "freshdesk-new-contact",
name: "New Contact Created",
description: "Emit new event when a contact is created. [See the documentation](https://developers.freshdesk.com/api/#filter_contacts)",
version: "0.0.3",
version: "0.0.4",
type: "source",
props: {
freshdesk,
Expand Down
2 changes: 1 addition & 1 deletion components/freshdesk/sources/new-ticket/new-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "freshdesk-new-ticket",
name: "New Ticket Created",
description: "Emit new event when a ticket is created. [See the documentation](https://developers.freshdesk.com/api/#filter_tickets)",
version: "0.0.3",
version: "0.0.4",
type: "source",
props: {
freshdesk,
Expand Down
Loading