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
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const dealOperations: INodeProperties[] = [
|
2020-05-05 07:03:53 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-05-05 07:03:53 -07:00
|
|
|
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',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-05-05 07:03:53 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const dealFields: INodeProperties[] = [
|
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',
|
2022-05-20 14:47:24 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2020-05-11 11:22:31 -07:00
|
|
|
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,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
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: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Closing date of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Expected Value',
|
|
|
|
name: 'expectedValue',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
maxValue: 1000000000000,
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 1,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Expected Value of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Milestone',
|
|
|
|
name: 'milestone',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Milestone of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Probability',
|
|
|
|
name: 'probability',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
maxValue: 100,
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Expected probability',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2022-05-20 14:47:24 -07:00
|
|
|
displayName: 'Additional Fields',
|
2020-05-11 11:22:31 -07:00
|
|
|
name: 'additionalFieldsJson',
|
|
|
|
type: 'json',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Object of values to set as described <a href="https://github.com/agilecrm/rest-api#1-deals---companies-api">here</a>',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'deal',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
jsonParameters: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2022-05-20 14:47:24 -07:00
|
|
|
displayName: 'Contact IDs',
|
2020-05-11 11:22:31 -07:00
|
|
|
name: 'contactIds',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
multipleValueButtonText: 'Add ID',
|
|
|
|
},
|
|
|
|
default: [],
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Unique contact identifiers',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Data',
|
|
|
|
name: 'customData',
|
|
|
|
type: 'fixedCollection',
|
2021-12-03 00:44:16 -08:00
|
|
|
default: {},
|
2020-05-11 11:22:31 -07:00
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property name',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property value',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
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: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of deal to update',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
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
|
|
|
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Object of values to set as described <a href="https://github.com/agilecrm/rest-api#1-deals---companies-api">here</a>',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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,
|
2020-10-22 06:46:03 -07:00
|
|
|
maxValue: 10000,
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Expected Value of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Probability',
|
|
|
|
name: 'probability',
|
|
|
|
type: 'number',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
2020-10-22 06:46:03 -07:00
|
|
|
maxValue: 100,
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Expected Value of deal',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
2022-05-20 14:47:24 -07:00
|
|
|
displayName: 'Contact IDs',
|
2020-05-11 11:22:31 -07:00
|
|
|
name: 'contactIds',
|
|
|
|
type: 'string',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
multipleValueButtonText: 'Add ID',
|
|
|
|
},
|
|
|
|
default: [],
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Unique contact identifiers',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Data',
|
|
|
|
name: 'customData',
|
|
|
|
type: 'fixedCollection',
|
2021-12-03 00:44:16 -08:00
|
|
|
default: {},
|
2020-05-11 11:22:31 -07:00
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Property',
|
|
|
|
name: 'customProperty',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property name',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Property value',
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2020-05-11 11:22:31 -07:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|