2023-01-27 03:22:44 -08:00
import type { 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' ,
2022-09-13 03:36:36 -07:00
description : 'List many hooks on a form' ,
2022-10-12 12:56:49 -07:00
action : 'Get Many hooks' ,
2022-03-20 01:54:31 -07:00
} ,
{
name : 'Logs' ,
value : 'getLogs' ,
description : 'Get hook logs' ,
2022-10-12 12:56:49 -07:00
action : 'Get Logs for 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-10-12 12:56:49 -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-10-12 12:56:49 -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' ] ,
2022-12-06 02:00:53 -08:00
operation : [ 'get' , 'retryOne' , 'retryAll' , 'getLogs' , 'getAll' ] ,
2022-03-20 01:54:31 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'Form ID (e.g. aSAvYreNzVEkrWg5Gdcvg). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/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 */
/* -------------------------------------------------------------------------- */
{
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' ] ,
2022-10-12 12:56:49 -07:00
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 : [ 'hook' ] ,
2022-10-12 12:56:49 -07:00
operation : [ 'getAll' ] ,
2022-08-17 08:50:24 -07:00
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
} ,
2022-10-12 12:56:49 -07:00
/* -------------------------------------------------------------------------- */
/* hook:getLogs */
/* -------------------------------------------------------------------------- */
{
displayName : 'Log Status' ,
name : 'status' ,
type : 'options' ,
displayOptions : {
show : {
resource : [ 'hook' ] ,
operation : [ 'getLogs' ] ,
} ,
} ,
default : '' ,
description : 'Only retrieve logs with a specific status' ,
options : [
{
name : 'All' ,
value : '' ,
} ,
{
name : 'Failed' ,
value : '0' ,
} ,
{
name : 'Pending' ,
value : '1' ,
} ,
{
name : 'Success' ,
value : '2' ,
} ,
] ,
} ,
{
displayName : 'Start Date' ,
name : 'startDate' ,
type : 'dateTime' ,
displayOptions : {
show : {
resource : [ 'hook' ] ,
operation : [ 'getLogs' ] ,
} ,
} ,
default : '' ,
description : 'Minimum date for the hook log to retrieve' ,
} ,
{
displayName : 'End Date' ,
name : 'endDate' ,
type : 'dateTime' ,
displayOptions : {
show : {
resource : [ 'hook' ] ,
operation : [ 'getLogs' ] ,
} ,
} ,
default : '' ,
description : 'Maximum date for the hook log to retrieve' ,
} ,
2022-03-20 01:54:31 -07:00
] ;