2020-05-05 07:03:53 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
2020-05-11 11:22:31 -07:00
|
|
|
} from 'n8n-workflow';
|
2020-05-05 07:03:53 -07:00
|
|
|
|
|
|
|
export const dealOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
2020-05-11 11:22:31 -07:00
|
|
|
{
|
2020-05-06 04:01:52 -07:00
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a new deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
2020-05-06 04:01:52 -07:00
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a deal',
|
|
|
|
},
|
2020-05-05 07:03:53 -07:00
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get a deal',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
description: 'Get all deals',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update deal properties',
|
|
|
|
},
|
2020-05-06 04:01:52 -07:00
|
|
|
|
2020-05-05 07:03:53 -07:00
|
|
|
],
|
|
|
|
default: 'get',
|
|
|
|
description: 'The operation to perform.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const dealFields = [
|
2020-05-11 11:22:31 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:get */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-05-05 07:03:53 -07:00
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Unique identifier for a particular deal',
|
|
|
|
},
|
|
|
|
|
2020-05-11 11:22:31 -07:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:get all */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 20,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
|
|
|
description: 'If all results should be returned or only up to a given limit.',
|
|
|
|
},
|
2020-05-05 07:03:53 -07:00
|
|
|
|
2020-05-06 04:01:52 -07:00
|
|
|
|
2020-05-11 11:22:31 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:create */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Close Date',
|
|
|
|
name: 'closeDate',
|
|
|
|
type: 'dateTime',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Closing date of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Expected Value',
|
|
|
|
name: 'expectedValue',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
maxValue: 1000000000000
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 1,
|
|
|
|
description: 'Expected Value of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Milestone',
|
|
|
|
name: 'milestone',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Milestone of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Name of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Probability',
|
|
|
|
name: 'probability',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
maxValue: 100
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 50,
|
|
|
|
description: 'Expected probability.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: ' Additional Fields',
|
|
|
|
name: 'additionalFieldsJson',
|
|
|
|
type: 'json',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
description: `Object of values to set as described <a href="https://github.com/agilecrm/rest-api#1-deals---companies-api" target="_blank">here</a>.`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Contact Ids',
|
|
|
|
name: 'contactIds',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
multipleValueButtonText: 'Add ID',
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
description: 'Unique contact identifiers.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Data',
|
|
|
|
name: 'customData',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
description: 'Custom Data',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
description: 'Property name.'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Property value.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-05-05 07:03:53 -07:00
|
|
|
|
2020-05-11 11:22:31 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:delete */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'ID of deal to delete',
|
|
|
|
},
|
2020-05-05 08:44:02 -07:00
|
|
|
|
2020-05-11 11:22:31 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* deal:update */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Deal ID',
|
|
|
|
name: 'dealId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Id of deal to update',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFieldsJson',
|
|
|
|
type: 'json',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-05-05 07:03:53 -07:00
|
|
|
|
2020-05-11 11:22:31 -07:00
|
|
|
description: `Object of values to set as described <a href="https://github.com/agilecrm/rest-api#1-deals---companies-api" target="_blank">here</a>.`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Expected Value',
|
|
|
|
name: 'expectedValue',
|
|
|
|
type: 'number',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
maxValue: 10000
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Expected Value of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Name of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Probability',
|
|
|
|
name: 'probability',
|
|
|
|
type: 'number',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
maxValue: 100
|
|
|
|
},
|
|
|
|
default: 50,
|
|
|
|
description: 'Expected Value of deal.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Contact Ids',
|
|
|
|
name: 'contactIds',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
multipleValueButtonText: 'Add ID',
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
description: 'Unique contact identifiers.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Data',
|
|
|
|
name: 'customData',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
description: 'Custom Data',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
description: 'Property name.'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Property value.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2020-05-05 07:03:53 -07:00
|
|
|
] as INodeProperties[];
|