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

33 lines
1.0 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}code`,
label: `[${labelPrefix}code]`,
type: 'integer',
},
{
key: `${keyPrefix}type`,
label: `[${labelPrefix}type]`,
type: 'string',
},
{
key: `${keyPrefix}message`,
label: `[${labelPrefix}message]`,
type: 'string',
},
]
},
mapping: (bundle, prefix = '') => {
const {keyPrefix} = utils.buildKeyAndLabel(prefix)
return {
'code': bundle.inputData?.[`${keyPrefix}code`],
'type': bundle.inputData?.[`${keyPrefix}type`],
'message': bundle.inputData?.[`${keyPrefix}message`],
}
},
}