2022-08-01 13:47:55 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2021-04-02 10:12:19 -07:00
|
|
|
|
|
|
|
import {
|
|
|
|
addressFixedCollection,
|
|
|
|
emailFixedCollection,
|
|
|
|
phoneNumbersFixedCollection,
|
|
|
|
} from '../utils/sharedFields';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const leadOperations: INodeProperties[] = [
|
2021-04-02 10:12:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2021-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get all leads',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2021-04-02 10:12:19 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const leadFields: INodeProperties[] = [
|
2021-04-02 10:12:19 -07:00
|
|
|
// ----------------------------------------
|
|
|
|
// lead: create
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the lead to create',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['create'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['create'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
2022-08-01 13:47:55 -07:00
|
|
|
options: [addressFixedCollection, emailFixedCollection, phoneNumbersFixedCollection],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// lead: delete
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Lead ID',
|
|
|
|
name: 'leadId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the lead to delete',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['delete'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// lead: get
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Lead ID',
|
|
|
|
name: 'leadId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the lead to retrieve',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['get'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// lead: 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-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['getAll'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 5,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-04-02 10:12:19 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 1000,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filterFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['getAll'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Country',
|
|
|
|
name: 'country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the country to filter by',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the lead to filter by',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// lead: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Lead ID',
|
|
|
|
name: 'leadId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the lead to update',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['update'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['lead'],
|
|
|
|
operation: ['update'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
addressFixedCollection,
|
|
|
|
{
|
|
|
|
displayName: 'Details',
|
|
|
|
name: 'details',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Description to set for the lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
emailFixedCollection,
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name to set for the lead',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
phoneNumbersFixedCollection,
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|