File tree Expand file tree Collapse file tree 3 files changed +75
-1
lines changed Expand file tree Collapse file tree 3 files changed +75
-1
lines changed Original file line number Diff line number Diff line change 1+ import app from "../../trengo.app.mjs" ;
2+
3+ export default {
4+ key : "trengo-close-ticket" ,
5+ name : "Close Ticket" ,
6+ description : "Close a ticket. [See the documentation](https://developers.trengo.com/reference/close-a-ticket)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ annotations : {
10+ destructiveHint : true ,
11+ openWorldHint : true ,
12+ readOnlyHint : false ,
13+ } ,
14+ props : {
15+ app,
16+ ticketId : {
17+ propDefinition : [
18+ app ,
19+ "ticketId" ,
20+ ] ,
21+ } ,
22+ ticketResultId : {
23+ propDefinition : [
24+ app ,
25+ "ticketResultId" ,
26+ ] ,
27+ } ,
28+ } ,
29+ async run ( { $ } ) {
30+ const response = await this . app . closeTicket ( {
31+ $,
32+ ticketId : this . ticketId ,
33+ data : {
34+ ticket_result_id : this . ticketResultId ,
35+ } ,
36+ } ) ;
37+
38+ $ . export ( "$summary" , "Successfully closed ticket" ) ;
39+
40+ return response ;
41+ } ,
42+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/trengo" ,
3- "version" : " 0.5 .0" ,
3+ "version" : " 0.6 .0" ,
44 "description" : " Pipedream Trengo Components" ,
55 "main" : " trengo.app.mjs" ,
66 "keywords" : [
Original file line number Diff line number Diff line change @@ -208,6 +208,23 @@ export default {
208208 } ) ) ;
209209 } ,
210210 } ,
211+ ticketResultId : {
212+ type : "integer" ,
213+ label : "Ticket Result ID" ,
214+ description : "Select a ticket result or provide an ID" ,
215+ optional : true ,
216+ async options ( { page = 0 } ) {
217+ const response = await this . listTicketResults ( {
218+ params : {
219+ page : page + 1 ,
220+ } ,
221+ } ) ;
222+ return response . data . map ( ( ticketResult ) => ( {
223+ label : ticketResult . name ,
224+ value : ticketResult . id ,
225+ } ) ) ;
226+ } ,
227+ } ,
211228 } ,
212229 methods : {
213230 _getUrl ( path ) {
@@ -371,5 +388,20 @@ export default {
371388 ...args ,
372389 } ) ;
373390 } ,
391+ closeTicket ( {
392+ ticketId, ...args
393+ } ) {
394+ return this . _makeRequest ( {
395+ method : "POST" ,
396+ path : `/tickets/${ ticketId } /close` ,
397+ ...args ,
398+ } ) ;
399+ } ,
400+ listTicketResults ( args = { } ) {
401+ return this . _makeRequest ( {
402+ path : "/ticket_results" ,
403+ ...args ,
404+ } ) ;
405+ } ,
374406 } ,
375407} ;
You can’t perform that action at this time.
0 commit comments