Emanuele Saccomandi 9baf4988f3
Zapier generator (#15997)
* First version of Zapier Generator

* fixed zapier codegen

* added zapier templates

* added zapier sample

* added zapier doc

* added zapier generator form data management

* added samples generation

* updated docs

* fixed zapier api template

* fixed zapier samples export

* added zapier readme template

* fixed zapier readme template

* added petstore readme

* cleaned zapier generator

* updated samples

* fixed zapier enum label

* cleaned code

* updated samples

* improved zapier search actions

* updated samples

---------

Co-authored-by: Mauro Valota <maurovalota@fattureincloud.it>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-07-09 21:52:04 +08:00

56 lines
1.8 KiB
JavaScript

const utils = require('../utils/utils');
module.exports = {
fields: (prefix = '', isInput = true, isArrayChild = false) => {
const {keyPrefix, labelPrefix} = utils.buildKeyAndLabel(prefix, isInput, isArrayChild)
return [
{
key: `${keyPrefix}id`,
label: `[${labelPrefix}id]`,
type: 'number',
},
{
key: `${keyPrefix}petId`,
label: `[${labelPrefix}petId]`,
type: 'number',
},
{
key: `${keyPrefix}quantity`,
label: `[${labelPrefix}quantity]`,
type: 'integer',
},
{
key: `${keyPrefix}shipDate`,
label: `[${labelPrefix}shipDate]`,
type: 'string',
},
{
key: `${keyPrefix}status`,
label: `Order Status - [${labelPrefix}status]`,
type: 'string',
choices: [
'placed',
'approved',
'delivered',
],
},
{
key: `${keyPrefix}complete`,
label: `[${labelPrefix}complete]`,
type: 'boolean',
},
]
},
mapping: (bundle, prefix = '') => {
const {keyPrefix} = utils.buildKeyAndLabel(prefix)
return {
'id': bundle.inputData?.[`${keyPrefix}id`],
'petId': bundle.inputData?.[`${keyPrefix}petId`],
'quantity': bundle.inputData?.[`${keyPrefix}quantity`],
'shipDate': bundle.inputData?.[`${keyPrefix}shipDate`],
'status': bundle.inputData?.[`${keyPrefix}status`],
'complete': bundle.inputData?.[`${keyPrefix}complete`],
}
},
}