2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2022-03-20 01:54:31 -07:00
export const hookOperations : 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 : [ 'hook' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
options : [
{
name : 'Get' ,
value : 'get' ,
description : 'Get a single hook definition' ,
2022-07-10 13:50:51 -07:00
action : 'Get a hook' ,
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' ,
description : 'List all hooks on a form' ,
2022-07-10 13:50:51 -07:00
action : 'Get all hooks' ,
2022-03-20 01:54:31 -07:00
} ,
{
name : 'Logs' ,
value : 'getLogs' ,
description : 'Get hook logs' ,
2022-07-10 13:50:51 -07:00
action : 'Logs a hook' ,
2022-03-20 01:54:31 -07:00
} ,
{
name : 'Retry All' ,
value : 'retryAll' ,
description : 'Retry all failed attempts for a given hook' ,
2022-07-10 13:50:51 -07:00
action : 'Retry all hooks' ,
2022-03-20 01:54:31 -07:00
} ,
{
name : 'Retry One' ,
value : 'retryOne' ,
description : 'Retry a specific hook' ,
2022-07-10 13:50:51 -07:00
action : 'Retry one hook' ,
2022-03-20 01:54:31 -07:00
} ,
] ,
default : 'getAll' ,
} ,
] ;
export const hookFields : INodeProperties [ ] = [
/* -------------------------------------------------------------------------- */
/* hook:get */
/* -------------------------------------------------------------------------- */
{
2022-06-03 10:23:49 -07:00
displayName : 'Form Name or ID' ,
2022-03-20 01:54:31 -07:00
name : 'formId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadForms' ,
} ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'hook' ] ,
operation : [ 'get' , 'retryOne' , 'retryAll' , 'getLogs' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
2022-08-17 08:50:24 -07: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
} ,
{
displayName : 'Hook ID' ,
name : 'hookId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'hook' ] ,
operation : [ 'get' , 'retryOne' , 'retryAll' , 'getLogs' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
default : '' ,
description : 'Hook ID (starts with h, e.g. hVehywQ2oXPYGHJHKtqth4)' ,
} ,
/* -------------------------------------------------------------------------- */
/* hook:getAll */
/* -------------------------------------------------------------------------- */
{
2022-06-03 10:23:49 -07:00
displayName : 'Form Name or ID' ,
2022-03-20 01:54:31 -07:00
name : 'formId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadForms' ,
} ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'hook' ] ,
operation : [ 'getAll' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
2022-08-17 08:50:24 -07: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
} ,
{
displayName : 'Hook Log ID' ,
name : 'logId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'hook' ] ,
operation : [ 'retryOne' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
default : '' ,
description : 'Hook log ID (starts with hl, e.g. hlSbGKaUKzTVNoWEVMYbLHe)' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
required : true ,
default : false ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'hook' ] ,
operation : [ 'getAll' , 'getLogs' ] ,
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 : [ 'hook' ] ,
operation : [ 'getAll' , 'getLogs' ] ,
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
} ,
] ;