2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2021-06-27 04:07:25 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { makeSimpleField, petitionAdditionalFieldsOptions } from './SharedFields';
|
2021-06-27 04:07:25 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const petitionOperations: INodeProperties[] = [
|
2021-06-27 04:07:25 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2021-06-27 04:07:25 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a petition',
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a petition',
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
{
|
2022-09-07 07:51:14 -07:00
|
|
|
name: 'Get Many',
|
2021-06-27 04:07:25 -07:00
|
|
|
value: 'getAll',
|
2022-09-08 08:10:13 -07:00
|
|
|
action: 'Get many petitions',
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a petition',
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2021-06-27 04:07:25 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const petitionFields: INodeProperties[] = [
|
2021-06-27 04:07:25 -07:00
|
|
|
// ----------------------------------------
|
|
|
|
// petition: create
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Origin System',
|
|
|
|
name: 'originSystem',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Source where the petition originated',
|
2021-06-27 04:07:25 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['create'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Title',
|
|
|
|
name: 'title',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Title of the petition to create',
|
2021-06-27 04:07:25 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['create'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
makeSimpleField('petition', 'create'),
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['create'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: petitionAdditionalFieldsOptions,
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// petition: get
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Petition ID',
|
|
|
|
name: 'petitionId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the petition to retrieve',
|
2021-06-27 04:07:25 -07:00
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['get'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
makeSimpleField('petition', 'get'),
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// petition: getAll
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2021-06-27 04:07:25 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['getAll'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-06-27 04:07:25 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
makeSimpleField('petition', 'getAll'),
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// petition: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Petition ID',
|
|
|
|
name: 'petitionId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the petition to update',
|
2021-06-27 04:07:25 -07:00
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['update'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
makeSimpleField('petition', 'update'),
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['petition'],
|
|
|
|
operation: ['update'],
|
2021-06-27 04:07:25 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: petitionAdditionalFieldsOptions,
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|