UNPKG

805 BJavaScriptView Raw
1// find a particular <%= LOWER_NOUN %> by name
2const search<%= CAMEL %> = (z, bundle) => {
3 const responsePromise = z.request({
4 url: 'https://jsonplaceholder.typicode.com/posts',
5 params: {
6 name: bundle.inputData.name
7 }
8 });
9 return responsePromise
10 .then(response => z.JSON.parse(response.content));
11};
12
13module.exports = {
14 key: '<%= KEY %>',
15 noun: '<%= NOUN %>',
16
17 display: {
18 label: 'Find a <%= NOUN %>',
19 description: 'Finds a <%= LOWER_NOUN %>.'
20 },
21
22 operation: {
23 inputFields: [
24 {key: 'name', required: true, helpText: 'Find the <%= NOUN %> with this name.'}
25 ],
26 perform: search<%= CAMEL %>,
27
28 sample: {
29 id: 1,
30 name: 'Test'
31 },
32
33 outputFields: [
34 {key: 'id', label: 'ID'},
35 {key: 'name', label: 'Name'}
36 ]
37 }
38};