UNPKG

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