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
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all forms' ,
2022-07-10 13:50:51 -07:00
action : 'Get all forms' ,
2022-03-20 01:54:31 -07:00
} ,
] ,
default : 'get' ,
} ,
] ;
export const formFields : INodeProperties [ ] = [
/* -------------------------------------------------------------------------- */
/* form:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Form ID' ,
name : 'formId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'form' ] ,
operation : [ 'get' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
description : 'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg)' ,
} ,
/* -------------------------------------------------------------------------- */
/* 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
} ,
] ,
} ,
] ;