2020-10-28 15:03:29 -07:00
import {
INodeProperties ,
2020-10-28 15:04:12 -07:00
} from 'n8n-workflow' ;
2020-10-28 15:03:29 -07:00
2021-12-03 00:44:16 -08:00
export const subscriberOperations : INodeProperties [ ] = [
2020-10-28 15:03:29 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-10-28 15:03:29 -07:00
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new subscriber' ,
2022-07-10 13:50:51 -07:00
action : 'Create a subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get an subscriber' ,
2022-07-10 13:50:51 -07:00
action : 'Get a subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all subscribers' ,
2022-07-10 13:50:51 -07:00
action : 'Get all subscribers' ,
2020-10-28 15:03:29 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update an subscriber' ,
2022-07-10 13:50:51 -07:00
action : 'Update a subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-10-28 15:03:29 -07:00
2021-12-03 00:44:16 -08:00
export const subscriberFields : INodeProperties [ ] = [
2020-10-28 15:03:29 -07:00
2020-10-28 15:04:12 -07:00
/* -------------------------------------------------------------------------- */
/* subscriber:create */
/* -------------------------------------------------------------------------- */
2020-10-28 15:03:29 -07:00
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-10-28 15:03:29 -07:00
required : true ,
2021-12-03 00:44:16 -08:00
default : '' ,
2020-10-28 15:03:29 -07:00
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
2020-10-28 15:14:09 -07:00
'create' ,
] ,
2020-10-28 15:03:29 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Email of new subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
displayName : 'Confirmation Timestamp' ,
name : 'confirmation_timestamp' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Confirmation IP' ,
name : 'confirmation_ip' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Filter by custom fields' ,
2020-10-28 15:03:29 -07:00
default : { } ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-10-28 15:03:29 -07:00
name : 'fieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'The ID of the field to add custom field to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The value to set on custom field' ,
2020-10-28 15:03:29 -07:00
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Resubscribe' ,
name : 'resubscribe' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to reactivate subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Signup IP' ,
name : 'signup_ip' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Signup Timestamp' ,
name : 'signup_timestamp' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'active' ,
} ,
{
name : 'Unsubscribed' ,
value : 'unsubscribed' ,
} ,
{
name : 'Unconfirmed' ,
value : 'unconfirmed' ,
} ,
] ,
default : '' ,
} ,
] ,
} ,
2020-10-28 15:04:12 -07:00
/* -------------------------------------------------------------------------- */
/* subscriber:update */
/* -------------------------------------------------------------------------- */
2020-10-28 15:03:29 -07:00
{
2020-10-28 15:04:12 -07:00
displayName : 'Subscriber Email' ,
2020-10-28 15:03:29 -07:00
name : 'subscriberId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Email of subscriber' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Filter by custom fields' ,
2020-10-28 15:03:29 -07:00
default : { } ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-10-28 15:03:29 -07:00
name : 'fieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'The ID of the field to add custom field to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The value to set on custom field' ,
2020-10-28 15:03:29 -07:00
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Resend Autoresponders' ,
name : 'resend_autoresponders' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether it is needed to resend autoresponders' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'active' ,
} ,
{
name : 'Unsubscribed' ,
value : 'unsubscribed' ,
} ,
{
name : 'Unconfirmed' ,
value : 'unconfirmed' ,
} ,
] ,
default : '' ,
} ,
] ,
} ,
2020-10-28 15:04:12 -07:00
/* -------------------------------------------------------------------------- */
/* subscriber:delete */
/* -------------------------------------------------------------------------- */
2020-10-28 15:03:29 -07:00
{
2020-10-28 15:04:12 -07:00
displayName : 'Subscriber Email' ,
2020-10-28 15:03:29 -07:00
name : 'subscriberId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Email of subscriber to delete' ,
2020-10-28 15:03:29 -07:00
} ,
2020-10-28 15:04:12 -07:00
/* -------------------------------------------------------------------------- */
/* subscriber:get */
/* -------------------------------------------------------------------------- */
2020-10-28 15:03:29 -07:00
{
2020-10-28 15:04:12 -07:00
displayName : 'Subscriber Email' ,
2020-10-28 15:03:29 -07:00
name : 'subscriberId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Email of subscriber to get' ,
2020-10-28 15:03:29 -07:00
} ,
2020-10-28 15:04:12 -07:00
/* -------------------------------------------------------------------------- */
/* subscriber:getAll */
/* -------------------------------------------------------------------------- */
2020-10-28 15:03:29 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'subscriber' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-10-28 15:03:29 -07:00
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
displayOptions : {
show : {
operation : [
'getAll' ,
] ,
resource : [
'subscriber' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'active' ,
} ,
{
name : 'Unsubscribed' ,
value : 'unsubscribed' ,
} ,
{
name : 'Unconfirmed' ,
value : 'unconfirmed' ,
} ,
] ,
default : '' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;