UNPKG

2.05 kBJavaScriptView Raw
1module.exports = {
2
3 name: "<%=name%>",
4
5 label: "<%=title%>",
6
7 version: "<%=version%>",
8
9 input: {
10 type: "object",
11 title: "<%=title%>",
12 description: "Short description",
13 properties: {
14 event: {
15 type: "string",
16 enum: ["<%=name%>"],
17 isExecute: true
18 },
19 polling: {
20 type: "boolean",
21 default: true,
22 options: {
23 hidden: true
24 }
25 }
26 }
27 },
28
29 output: {
30 "<%=name%>": {
31 type: "object",
32 properties: {
33
34 }
35 }
36 },
37
38 mock_data: {}, // output of trigger data
39
40 mock_input: {},
41
42 getUserData: function (input, options, output) {
43 // will be called when testing trigger before it is created
44 // return the actual data from your service which will be used for
45 // creating output schema and it should be flat output json
46 return output(null, []);
47 },
48
49 execute: function (input, options, output) {
50 // will be called every 5 minutes
51 // to access auth info use input.auth , eg: input.auth.username
52 // and to return output use output callback like this output(null, [{ mykey : "key", value : "My Val"}])
53 // output should be an array of objects or an empty array.
54
55 // your code here
56
57 output(null, []);
58
59 },
60
61 activate: function (input, options, output) {
62 // this function will be called whenever user activate or reactivates flow
63 // to access auth info use input.auth , eg: input.auth.username
64 // you can use this function to reset your cursor or timestamp
65
66 // your code goes here
67
68 output(null, true);
69 },
70
71 validate: function (input, options, output) {
72 // will be called when trigger is created 1st time
73 // to access auth info use input.auth , eg: input.auth.username
74 // to successfully validate auth info and other parameter provided by user call output(null, true)
75 // in case auth or other info is invalid, prevent creating trigger by sending error output("Username or password is invalid")
76
77 // your code goes here
78
79 output(null, true);
80 }
81}