diff --git a/components/freshdesk/actions/get-ticket/get-ticket.mjs b/components/freshdesk/actions/get-ticket/get-ticket.mjs index c6ae0f736a685..d02fb99c35488 100644 --- a/components/freshdesk/actions/get-ticket/get-ticket.mjs +++ b/components/freshdesk/actions/get-ticket/get-ticket.mjs @@ -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.6", + version: "0.1.7", annotations: { destructiveHint: false, openWorldHint: true, @@ -19,14 +19,31 @@ export default { "ticketId", ], }, + include: { + type: "string[]", + label: "Include", + description: "Include additional data in the response", + optional: true, + options: [ + "conversations", + "requester", + "company", + "stats", + ], + }, }, async run({ $ }) { const { - freshdesk, ticketId, + freshdesk, ticketId, include, } = this; const response = await freshdesk.getTicket({ $, ticketId, + params: include + ? { + include: include.join(","), + } + : undefined, }); response && $.export("$summary", "Successfully retrieved ticket"); return response; diff --git a/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs b/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs new file mode 100644 index 0000000000000..e7655c8836a18 --- /dev/null +++ b/components/freshdesk/actions/list-ticket-conversations/list-ticket-conversations.mjs @@ -0,0 +1,54 @@ +import freshdesk from "../../freshdesk.app.mjs"; + +export default { + key: "freshdesk-list-ticket-conversations", + name: "List Conversations of a Ticket", + description: "List all conversations for a ticket. [See the documentation](https://developers.freshdesk.com/api/#list_all_ticket_notes)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + freshdesk, + ticketId: { + propDefinition: [ + freshdesk, + "ticketId", + ], + }, + maxResults: { + propDefinition: [ + freshdesk, + "maxResults", + ], + }, + }, + methods: { + async listTicketConversations({ + ticketId, ...args + }) { + return this.freshdesk._makeRequest({ + url: `/tickets/${ticketId}/conversations`, + ...args, + }); + }, + }, + async run({ $ }) { + const results = await this.freshdesk.getPaginatedResources({ + fn: this.listTicketConversations, + args: { + $, + ticketId: this.ticketId, + }, + max: this.maxResults, + }); + + $.export("$summary", `Successfully listed ${results.length} conversation${results.length === 1 + ? "" + : "s"}`); + return results; + }, +}; diff --git a/components/freshdesk/package.json b/components/freshdesk/package.json index 6189aa3119732..533be411735b8 100644 --- a/components/freshdesk/package.json +++ b/components/freshdesk/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/freshdesk", - "version": "0.5.0", + "version": "0.6.0", "description": "Pipedream Freshdesk Components", "main": "freshdesk.app.mjs", "keywords": [