2020-04-07 21:35:50 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
2019-12-03 13:48:17 -08:00
|
|
|
|
|
|
|
export const dealOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a deal',
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
{
|
2020-04-07 21:35:50 -07:00
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
2020-07-24 03:56:41 -07:00
|
|
|
description: 'Delete a deal',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2019-12-03 13:48:17 -08:00
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get a deal',
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
description: 'Get all deals',
|
|
|
|
},
|
|
|
|
{
|
2019-12-07 13:21:04 -08:00
|
|
|
name: 'Get Recently Created',
|
|
|
|
value: 'getRecentlyCreated',
|
2019-12-04 09:21:02 -08:00
|
|
|
description: 'Get recently created deals',
|
|
|
|
},
|
|
|
|
{
|
2019-12-07 13:21:04 -08:00
|
|
|
name: 'Get Recently Modified',
|
|
|
|
value: 'getRecentlyModified',
|
2019-12-04 09:21:02 -08:00
|
|
|
description: 'Get recently modified deals',
|
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a deal',
|
|
|
|
},
|
2019-12-03 13:48:17 -08:00
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
description: 'The operation to perform.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const dealFields = [
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
/* deal:create */
|
2019-12-03 13:48:17 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
2019-12-04 09:21:02 -08:00
|
|
|
displayName: 'Deal Stage',
|
2019-12-03 19:21:52 -08:00
|
|
|
name: 'stage',
|
2019-12-03 13:48:17 -08:00
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDealStages'
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
options: [],
|
|
|
|
description: 'The dealstage is required when creating a deal. See the CRM Pipelines API for details on managing pipelines and stages.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Deal Name',
|
|
|
|
name: 'dealName',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Pipeline',
|
|
|
|
name: 'pipeline',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Close Date',
|
|
|
|
name: 'closeDate',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Amount',
|
|
|
|
name: 'amount',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Deal Type',
|
|
|
|
name: 'dealType',
|
2019-12-03 19:21:52 -08:00
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDealTypes',
|
|
|
|
},
|
2020-01-04 20:19:10 -08:00
|
|
|
default: '',
|
2019-12-03 13:48:17 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Associated Company',
|
|
|
|
name: 'associatedCompany',
|
|
|
|
type: 'multiOptions',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod:'getCompanies' ,
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Associated Vids',
|
|
|
|
name: 'associatedVids',
|
|
|
|
type: 'multiOptions',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod:'getContacts' ,
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:update */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Unique identifier for a particular deal',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Update Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Deal Name',
|
|
|
|
name: 'dealName',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Deal Stage',
|
|
|
|
name: 'stage',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDealStages'
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'The dealstage is required when creating a deal. See the CRM Pipelines API for details on managing pipelines and stages.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Pipeline',
|
|
|
|
name: 'pipeline',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Close Date',
|
|
|
|
name: 'closeDate',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Amount',
|
|
|
|
name: 'amount',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Deal Type',
|
|
|
|
name: 'dealType',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDealTypes',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
]
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:get */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Unique identifier for a particular deal',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Include Property Versions ',
|
|
|
|
name: 'includePropertyVersions',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: `By default, you will only get data for the most recent version of a property in the "versions" data.<br/>
|
|
|
|
If you include this parameter, you will get data for all previous versions.`,
|
|
|
|
},
|
|
|
|
]
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:getAll */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: false,
|
|
|
|
description: 'If all results should be returned or only up to a given limit.',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 250,
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: 100,
|
|
|
|
description: 'How many results to return.',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filters',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Include Associations',
|
|
|
|
name: 'includeAssociations',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: `Include the IDs of the associated contacts and companies in the results<br/>.
|
|
|
|
This will also automatically include the num_associated_contacts property.`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Properties',
|
|
|
|
name: 'properties',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: `Used to include specific deal properties in the results.<br/>
|
|
|
|
By default, the results will only include Deal ID and will not include the values for any properties for your Deals.<br/>
|
|
|
|
Including this parameter will include the data for the specified property in the results.<br/>
|
|
|
|
You can include this parameter multiple times to request multiple properties separed by ,.`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Properties With History',
|
|
|
|
name: 'propertiesWithHistory',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: `Works similarly to properties=, but this parameter will include the history for the specified property,<br/>
|
|
|
|
instead of just including the current value. Use this parameter when you need the full history of changes to a property's value.`,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:delete */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Unique identifier for a particular deal',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
/* deal:getRecentlyCreated deal:getRecentlyModified */
|
2019-12-04 09:21:02 -08:00
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getRecentlyCreated',
|
|
|
|
'getRecentlyModified',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: false,
|
|
|
|
description: 'If all results should be returned or only up to a given limit.',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getRecentlyCreated',
|
|
|
|
'getRecentlyModified',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 250,
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
default: 100,
|
|
|
|
description: 'How many results to return.',
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filters',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getRecentlyCreated',
|
|
|
|
'getRecentlyModified',
|
|
|
|
],
|
|
|
|
},
|
2019-12-04 09:21:02 -08:00
|
|
|
},
|
2020-04-07 21:35:50 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Since',
|
|
|
|
name: 'since',
|
|
|
|
type: 'dateTime',
|
|
|
|
default: '',
|
|
|
|
description: `Only return deals created after timestamp x`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Include Property Versions',
|
|
|
|
name: 'includePropertyVersions',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: `By default, you will only get data for the most recent version of a property in the "versions" data.<br/>
|
|
|
|
If you include this parameter, you will get data for all previous versions.`,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2019-12-03 13:48:17 -08:00
|
|
|
] as INodeProperties[];
|