2022-08-01 13:47:55 -07:00
|
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2021-06-27 04:07:25 -07:00
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
|
import { makeSimpleField, personAdditionalFieldsOptions } from './SharedFields';
|
2021-06-27 04:07:25 -07:00
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
|
export const personOperations: INodeProperties[] = [
|
2021-06-27 04:07:25 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Operation',
|
|
|
|
|
name: 'operation',
|
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
|
noDataExpression: true,
|
2021-06-27 04:07:25 -07:00
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Create',
|
|
|
|
|
value: 'create',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Create a person',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get',
|
|
|
|
|
value: 'get',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get a person',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get All',
|
|
|
|
|
value: 'getAll',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all people',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Update',
|
|
|
|
|
value: 'update',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Update a person',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
default: 'create',
|
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
|
];
|
2021-06-27 04:07:25 -07:00
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
|
export const personFields: INodeProperties[] = [
|
2021-06-27 04:07:25 -07:00
|
|
|
|
// ----------------------------------------
|
|
|
|
|
// person: create
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
makeSimpleField('person', 'create'),
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Email Address', // on create, only _one_ must be passed in
|
|
|
|
|
name: 'email_addresses',
|
|
|
|
|
type: 'fixedCollection',
|
|
|
|
|
default: {},
|
|
|
|
|
placeholder: 'Add Email Address Field',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Person’s email addresses',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['create'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Email Addresses Fields',
|
|
|
|
|
name: 'email_addresses_fields',
|
|
|
|
|
values: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Address',
|
|
|
|
|
name: 'address',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
|
description: "Person's email address",
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Primary',
|
|
|
|
|
name: 'primary',
|
|
|
|
|
type: 'hidden',
|
|
|
|
|
default: true,
|
2022-08-01 13:47:55 -07:00
|
|
|
|
description: "Whether this is the person's primary email address",
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Status',
|
|
|
|
|
name: 'status',
|
|
|
|
|
type: 'options',
|
|
|
|
|
default: 'subscribed',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Subscription status of this email address',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Bouncing',
|
|
|
|
|
value: 'bouncing',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Previous Bounce',
|
|
|
|
|
value: 'previous bounce',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Previous Spam Complaint',
|
|
|
|
|
value: 'previous spam complaint',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Spam Complaint',
|
|
|
|
|
value: 'spam complaint',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Subscribed',
|
|
|
|
|
value: 'subscribed',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Unsubscribed',
|
|
|
|
|
value: 'unsubscribed',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
|
name: 'additionalFields',
|
|
|
|
|
type: 'collection',
|
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
|
default: {},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['create'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: personAdditionalFieldsOptions,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
// person: get
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Person ID',
|
|
|
|
|
name: 'personId',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'ID of the person to retrieve',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
default: '',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['get'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
makeSimpleField('person', 'get'),
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
// person: getAll
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Return All',
|
|
|
|
|
name: 'returnAll',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['getAll'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Limit',
|
|
|
|
|
name: 'limit',
|
|
|
|
|
type: 'number',
|
2022-04-08 02:28:29 -07:00
|
|
|
|
default: 25,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Max number of results to return',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
typeOptions: {
|
|
|
|
|
minValue: 1,
|
2022-04-08 02:28:29 -07:00
|
|
|
|
maxValue: 25,
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['getAll'],
|
|
|
|
|
returnAll: [false],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
makeSimpleField('person', 'getAll'),
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
// person: update
|
|
|
|
|
// ----------------------------------------
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Person ID',
|
|
|
|
|
name: 'personId',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'ID of the person to update',
|
2021-06-27 04:07:25 -07:00
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
default: '',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['update'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
makeSimpleField('person', 'update'),
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
|
name: 'updateFields',
|
|
|
|
|
type: 'collection',
|
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
|
default: {},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
|
resource: ['person'],
|
|
|
|
|
operation: ['update'],
|
2021-06-27 04:07:25 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: personAdditionalFieldsOptions,
|
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
|
];
|