2020-01-15 18:53:43 -08:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2020-01-15 05:55:46 -08:00
|
|
|
|
|
|
|
export const contactOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a new contact',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a contact',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get data of a contact',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
description: 'Get data of all contacts',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a contact',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
description: 'The operation to perform.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const contactFields = [
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:create */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'First Name',
|
|
|
|
name: 'firstName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'First Name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Name',
|
|
|
|
name: 'lastName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2020-01-15 18:53:43 -08:00
|
|
|
description: 'Last Name',
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Primary Company',
|
|
|
|
name: 'company',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCompanies',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Primary company',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Position',
|
|
|
|
name: 'position',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Position',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Title',
|
|
|
|
name: 'title',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Title',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Body',
|
|
|
|
name: 'bodyJson',
|
|
|
|
type: 'json',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Contact parameters',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'IP Address',
|
|
|
|
name: 'ipAddress',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'IP address to associate with the contact',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Active',
|
|
|
|
name: 'lastActive',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
description: 'Date/time in UTC;',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Owner ID',
|
|
|
|
name: 'ownerId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'ID of a Mautic user to assign this contact to',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:update */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Contact ID',
|
|
|
|
name: 'contactId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Contact ID',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Body',
|
|
|
|
name: 'bodyJson',
|
|
|
|
type: 'json',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Contact parameters',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'First Name',
|
|
|
|
name: 'firstName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'First Name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Name',
|
|
|
|
name: 'lastName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'LastName',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Primary Company',
|
|
|
|
name: 'company',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCompanies',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Primary company',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Position',
|
|
|
|
name: 'position',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Position',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Title',
|
|
|
|
name: 'title',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/jsonParameters': [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Title',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'IP Address',
|
|
|
|
name: 'ipAddress',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'IP address to associate with the contact',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Active',
|
|
|
|
name: 'lastActive',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
description: 'Date/time in UTC;',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Owner ID',
|
|
|
|
name: 'ownerId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'ID of a Mautic user to assign this contact to',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
|
2020-01-15 05:55:46 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:get */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Contact ID',
|
|
|
|
name: 'contactId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Contact ID',
|
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
|
2020-01-15 05:55:46 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:getAll */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
|
|
|
description: 'If all results should be returned or only up to a given limit.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 30,
|
|
|
|
},
|
|
|
|
default: 30,
|
|
|
|
description: 'How many results to return.',
|
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:delete */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-01-15 05:55:46 -08:00
|
|
|
{
|
2020-01-15 18:53:43 -08:00
|
|
|
displayName: 'Contact ID',
|
|
|
|
name: 'contactId',
|
|
|
|
type: 'string',
|
2020-01-15 05:55:46 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2020-01-15 18:53:43 -08:00
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
],
|
2020-01-15 05:55:46 -08:00
|
|
|
resource: [
|
|
|
|
'contact',
|
|
|
|
],
|
2020-01-15 18:53:43 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Contact ID',
|
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* contact:all */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Options',
|
|
|
|
name: 'options',
|
|
|
|
type: 'collection',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'resource': [
|
|
|
|
'contact',
|
2020-01-15 05:55:46 -08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
placeholder: 'Add Option',
|
|
|
|
default: {},
|
2020-01-15 05:55:46 -08:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Search',
|
|
|
|
name: 'search',
|
|
|
|
type: 'string',
|
2020-01-15 18:53:43 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/resource': [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
'/operation': [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 05:55:46 -08:00
|
|
|
default: '',
|
|
|
|
description: 'String or search command to filter entities by.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Order By',
|
|
|
|
name: 'orderBy',
|
|
|
|
type: 'string',
|
2020-01-15 18:53:43 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/resource': [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
'/operation': [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 05:55:46 -08:00
|
|
|
default: '',
|
2020-01-15 18:53:43 -08:00
|
|
|
description: 'Column to sort by. Can use any column listed in the response.',
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Order By Dir',
|
|
|
|
name: 'orderByDir',
|
|
|
|
type: 'options',
|
2020-01-15 18:53:43 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/resource': [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
'/operation': [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 05:55:46 -08:00
|
|
|
default: '',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'ASC',
|
2020-01-15 18:53:43 -08:00
|
|
|
value: 'asc',
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
|
|
|
{
|
2020-01-15 18:53:43 -08:00
|
|
|
name: 'DESC',
|
|
|
|
value: 'desc',
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
|
|
|
],
|
2020-01-15 18:53:43 -08:00
|
|
|
description: 'Sort direction: ASC or DESC.',
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Published Only',
|
|
|
|
name: 'publishedOnly',
|
|
|
|
type: 'boolean',
|
2020-01-15 18:53:43 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/resource': [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
'/operation': [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 05:55:46 -08:00
|
|
|
default: false,
|
|
|
|
description: 'Only return currently published entities.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Minimal',
|
|
|
|
name: 'minimal',
|
|
|
|
type: 'boolean',
|
2020-01-15 18:53:43 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
'/resource': [
|
|
|
|
'contact',
|
|
|
|
],
|
|
|
|
'/operation': [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-01-15 05:55:46 -08:00
|
|
|
default: false,
|
|
|
|
description: 'Return only array of entities without additional lists in it.',
|
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
{
|
|
|
|
displayName: 'RAW Data',
|
|
|
|
name: 'rawData',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: `By default only the data of the fields get returned. If this<br />
|
|
|
|
options gets set the RAW response with all data gets returned.`,
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
]
|
2020-01-15 05:55:46 -08:00
|
|
|
},
|
2020-01-15 18:53:43 -08:00
|
|
|
|
2020-01-15 05:55:46 -08:00
|
|
|
] as INodeProperties[];
|