UNPKG

zapier-platform-cli

Version:

The CLI for apps in the Zapier Developer Platform.

39 lines (33 loc) 800 B
// find a particular <%= LOWER_NOUN %> by name const search<%= CAMEL %> = (z, bundle) => { const responsePromise = z.request({ url: 'http://example.com/api/<%= KEY %>s.json', params: { name: bundle.inputData.name } }); return responsePromise .then(response => JSON.parse(response.content)); }; module.exports = { key: '<%= KEY %>', noun: '<%= NOUN %>', display: { label: 'Find a <%= NOUN %>', description: 'Finds a <%= LOWER_NOUN %>.' }, operation: { inputFields: [ {key: 'name', required: true, helpText: 'Find the <%= NOUN %> with this name.'} ], perform: search<%= CAMEL %>, sample: { id: 1, name: 'Test' }, outputFields: [ {key: 'id', label: 'ID'}, {key: 'name', label: 'Name'} ] } };