import { INodeProperties } from "n8n-workflow"; export const contactOperations = [ { displayName: 'Operation', name: 'operation', type: 'options', displayOptions: { show: { resource: [ 'contact', ], }, }, options: [ { name: 'Create', value: 'create', description: 'Create a contact', }, { name: 'Delete', value: 'delete', description: 'Delete a contact', }, { name: 'Get', value: 'get', description: 'Get data of a contact', }, { name: 'Get All', value: 'getAll', description: 'Get data of all contact', }, { name: 'Update', value: 'update', description: 'Update a contact', }, ], default: 'create', description: 'The operation to perform.', }, ] as INodeProperties[]; export const contactFields = [ // ---------------------------------- // contact:create // ---------------------------------- { displayName: 'Email', name: 'email', type: 'string', default: '', required: true, displayOptions: { show: { operation: [ 'create', ], resource: [ 'contact', ], }, }, description: 'The email of the contact to create.', }, { displayName: 'Update if exists', name: 'updateIfExists', type: 'boolean', displayOptions: { show: { operation: [ 'create', ], resource: [ 'contact', ], }, }, default: false, description: 'Update user if it exists already. If not set and user exists it will error instead.', }, { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', displayOptions: { show: { operation: [ 'create', ], resource: [ 'contact', ], }, }, default: {}, options: [ { displayName: 'First Name', name: 'firstName', type: 'string', default: '', description: 'The first name of the contact to create.', }, { displayName: 'Last Name', name: 'lastName', type: 'string', default: '', description: 'The last name of the contact to create.', }, { displayName: 'Phone', name: 'phone', type: 'string', default: '', description: 'Phone number of the contact.', }, { displayName: 'Custom Properties', name: 'customProperties', placeholder: 'Add Custom Property', description: 'Adds a custom property to set also values which have not been predefined.', type: 'fixedCollection', typeOptions: { multipleValues: true, }, default: {}, options: [ { name: 'property', displayName: 'Property', values: [ { displayName: 'Property Name', name: 'name', type: 'string', default: '', description: 'Name of the property to set.', }, { displayName: 'Property Value', name: 'value', type: 'string', default: '', description: 'Value of the property to set.', }, ] }, ], }, ], }, // ---------------------------------- // contact:update // ---------------------------------- { displayName: 'Contact ID', name: 'contactId', type: 'number', displayOptions: { show: { operation: [ 'update', ], resource: [ 'contact', ], }, }, default: 0, required: true, description: 'ID of the contact to update.', }, { displayName: 'Update Fields', name: 'updateFields', type: 'collection', description: 'The fields to update.', placeholder: 'Add Field', displayOptions: { show: { operation: [ 'update', ], resource: [ 'contact', ], }, }, default: {}, options: [ { displayName: 'Email', name: 'email', type: 'string', default: '', description: 'Email of the contact.', }, { displayName: 'First Name', name: 'firstName', type: 'string', default: '', description: 'First name of the contact.', }, { displayName: 'Last Name', name: 'lastName', type: 'string', default: '', description: 'Last name of the contact.', }, { displayName: 'Phone', name: 'phone', type: 'string', default: '', description: 'Phone number of the contact.', }, { displayName: 'Custom Properties', name: 'customProperties', placeholder: 'Add Custom Property', description: 'Adds a custom property to set also values which have not been predefined.', type: 'fixedCollection', typeOptions: { multipleValues: true, }, default: {}, options: [ { name: 'property', displayName: 'Property', values: [ { displayName: 'Property Name', name: 'name', type: 'string', default: '', description: 'Name of the property to set.', }, { displayName: 'Property Value', name: 'value', type: 'string', default: '', description: 'Value of the property to set.', }, ] }, ], }, ], }, // ---------------------------------- // contact:delete // ---------------------------------- { displayName: 'Contact ID', name: 'contactId', type: 'number', displayOptions: { show: { operation: [ 'delete', ], resource: [ 'contact', ], }, }, default: 0, required: true, description: 'ID of the contact to delete.', }, // ---------------------------------- // contact:get // ---------------------------------- { displayName: 'Contact ID', name: 'contactId', type: 'number', displayOptions: { show: { operation: [ 'get', ], resource: [ 'contact', ], }, }, default: 0, required: true, description: 'ID of the contact to get.', }, // ---------------------------------- // contact:getAll // ---------------------------------- { displayName: 'Return All', name: 'returnAll', type: 'boolean', displayOptions: { show: { operation: [ 'getAll', ], resource: [ 'contact', ], }, }, default: false, description: 'If all results should be returned or only up to a given limit.', }, { displayName: 'Limit', name: 'limit', type: 'number', displayOptions: { show: { operation: [ 'getAll', ], resource: [ 'contact', ], returnAll: [ false, ], }, }, typeOptions: { minValue: 1, maxValue: 500, }, default: 100, description: 'How many results to return.', }, ] as INodeProperties[];