2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2022-03-20 01:54:31 -07:00
export const formOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2022-03-20 01:54:31 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
options : [
{
name : 'Get' ,
value : 'get' ,
description : 'Get a form' ,
2022-07-10 13:50:51 -07:00
action : 'Get a form' ,
2022-03-20 01:54:31 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2022-03-20 01:54:31 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many forms' ,
2022-09-08 08:10:13 -07:00
action : 'Get many forms' ,
2022-03-20 01:54:31 -07:00
} ,
2022-12-06 02:00:53 -08:00
{
name : 'Redeploy' ,
value : 'redeploy' ,
description : 'Redeploy Current Form Version' ,
action : 'Redeploy Current Form Version' ,
} ,
2022-03-20 01:54:31 -07:00
] ,
default : 'get' ,
} ,
] ;
export const formFields : INodeProperties [ ] = [
/* -------------------------------------------------------------------------- */
/* form:get */
/* -------------------------------------------------------------------------- */
{
2022-12-06 02:00:53 -08:00
displayName : 'Form Name or ID' ,
2022-03-20 01:54:31 -07:00
name : 'formId' ,
2022-12-06 02:00:53 -08:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadForms' ,
} ,
2022-03-20 01:54:31 -07:00
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
2022-12-06 02:00:53 -08:00
operation : [ 'get' , 'redeploy' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
2022-12-06 02:00:53 -08:00
description :
'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-03-20 01:54:31 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* form:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
required : true ,
default : false ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
operation : [ 'getAll' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2022-03-20 01:54:31 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
typeOptions : {
maxValue : 3000 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
default : 1000 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2022-03-20 01:54:31 -07:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
placeholder : 'Add Option' ,
type : 'collection' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
operation : [ 'getAll' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
options : [
{
displayName : 'Sort' ,
name : 'sort' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : false ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-03-20 01:54:31 -07:00
placeholder : 'Add Sort' ,
options : [
{
displayName : 'Sort' ,
name : 'value' ,
values : [
{
displayName : 'Descending' ,
name : 'descending' ,
type : 'boolean' ,
default : true ,
2022-06-20 07:54:01 -07:00
description : 'Whether to sort by descending order' ,
2022-03-20 01:54:31 -07:00
} ,
{
displayName : 'Order By' ,
name : 'ordering' ,
type : 'options' ,
default : 'date_modified' ,
options : [
{
name : 'Asset Type' ,
value : 'asset_type' ,
} ,
{
name : 'Date Modified' ,
value : 'date_modified' ,
} ,
{
name : 'Name' ,
value : 'name' ,
} ,
{
name : 'Owner Username' ,
value : 'owner__username' ,
} ,
{
name : 'Subscribers Count' ,
value : 'subscribers_count' ,
} ,
] ,
description : 'Field to order by' ,
} ,
] ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
operation : [ 'getAll' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
options : [
{
displayName : 'Filter' ,
name : 'filter' ,
type : 'string' ,
default : 'asset_type:survey' ,
2022-08-17 08:50:24 -07:00
description :
'A text search query based on form data - e.g. "owner__username:meg AND name__icontains:quixotic" - see <a href="https://github.com/kobotoolbox/kpi#searching" target="_blank">docs</a> for more details' ,
2022-03-20 01:54:31 -07:00
} ,
] ,
} ,
] ;