mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Add Contact List resource and deal:search operation (#1217)
* ⚡ Add Contact List resource and deal:search operation * ⚡ Minior improvements to Hubspot-Node Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
00249c85ee
commit
bea7469c61
160
packages/nodes-base/nodes/Hubspot/ContactListDescription.ts
Normal file
160
packages/nodes-base/nodes/Hubspot/ContactListDescription.ts
Normal file
|
@ -0,0 +1,160 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const contactListOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add',
|
||||
value: 'add',
|
||||
description: 'Add contact to a list',
|
||||
},
|
||||
{
|
||||
name: 'Remove',
|
||||
value: 'remove',
|
||||
description: 'Remove a contact from a list',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const contactListFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contactList:add */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'By',
|
||||
name: 'by',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Contact ID',
|
||||
value: 'id',
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 'email',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
by: [
|
||||
'email',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
by: [
|
||||
'id',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'List ID',
|
||||
name: 'listId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contactList:remove */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'remove',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'List ID',
|
||||
name: 'listId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contactList',
|
||||
],
|
||||
operation: [
|
||||
'remove',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
] as INodeProperties[];
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const dealOperations = [
|
||||
{
|
||||
|
@ -45,6 +45,11 @@ export const dealOperations = [
|
|||
value: 'getRecentlyModified',
|
||||
description: 'Get recently modified deals',
|
||||
},
|
||||
{
|
||||
name: 'Search',
|
||||
value: 'search',
|
||||
description: 'Search deals',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
|
@ -58,9 +63,9 @@ export const dealOperations = [
|
|||
|
||||
export const dealFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Deal Stage',
|
||||
name: 'stage',
|
||||
|
@ -111,7 +116,7 @@ export const dealFields = [
|
|||
name: 'associatedCompany',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod:'getCompanies' ,
|
||||
loadOptionsMethod: 'getCompanies',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
|
@ -120,7 +125,7 @@ export const dealFields = [
|
|||
name: 'associatedVids',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod:'getContacts' ,
|
||||
loadOptionsMethod: 'getContacts',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
|
@ -188,9 +193,10 @@ export const dealFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
|
@ -307,9 +313,10 @@ export const dealFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
|
@ -355,9 +362,10 @@ export const dealFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -444,9 +452,10 @@ export const dealFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
|
@ -465,9 +474,10 @@ export const dealFields = [
|
|||
default: '',
|
||||
description: 'Unique identifier for a particular deal',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:getRecentlyCreated deal:getRecentlyModified */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* deal:getRecentlyCreated deal:getRecentlyModified */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -546,4 +556,238 @@ export const dealFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
|
||||
/*--------------------------------------------------------------------------- */
|
||||
/* deal:search */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 250,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
{
|
||||
displayName: 'Filter Groups',
|
||||
name: 'filterGroupsUi',
|
||||
type: 'fixedCollection',
|
||||
default: '',
|
||||
placeholder: 'Add Filter Group',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
required: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'filterGroupsValues',
|
||||
displayName: 'Filter Group',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filtersUi',
|
||||
type: 'fixedCollection',
|
||||
default: '',
|
||||
placeholder: 'Add Filter',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
required: false,
|
||||
options: [
|
||||
{
|
||||
name: 'filterValues',
|
||||
displayName: 'Filter',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'propertyName',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealProperties',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Operator',
|
||||
name: 'operator',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Equal',
|
||||
value: 'EQ',
|
||||
},
|
||||
{
|
||||
name: 'Not Equal',
|
||||
value: 'NEQ',
|
||||
},
|
||||
{
|
||||
name: 'Less Than',
|
||||
value: 'LT',
|
||||
},
|
||||
{
|
||||
name: 'Less Than Or Equal',
|
||||
value: 'LTE',
|
||||
},
|
||||
{
|
||||
name: 'Greater Than',
|
||||
value: 'GT',
|
||||
},
|
||||
{
|
||||
name: 'Greater Than Or Equal',
|
||||
value: 'GTE',
|
||||
},
|
||||
{
|
||||
name: 'Is Known',
|
||||
value: 'HAS_PROPERTY',
|
||||
},
|
||||
{
|
||||
name: 'Is Unknown',
|
||||
value: 'NOT_HAS_PROPERTY',
|
||||
},
|
||||
{
|
||||
name: 'Contains Exactly',
|
||||
value: 'CONSTAIN_TOKEN',
|
||||
},
|
||||
{
|
||||
name: `Doesn't Contain Exactly`,
|
||||
value: 'NOT_CONSTAIN_TOKEN',
|
||||
},
|
||||
],
|
||||
default: 'EQ',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
operator: [
|
||||
'HAS_PROPERTY',
|
||||
'NOT_HAS_PROPERTY',
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description: 'Use filters to limit the results to only CRM objects with matching property values. More info <a href="https://developers.hubspot.com/docs/api/crm/search">here</a>',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description: `When multiple filters are provided within a filterGroup, they will be combined using a logical AND operator.<br>
|
||||
When multiple filterGroups are provided, they will be combined using a logical OR operator.<br>
|
||||
The system supports a maximum of three filterGroups with up to three filters each.<br>
|
||||
More info <a href="https://developers.hubspot.com/docs/api/crm/search">here</a>`,
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Direction',
|
||||
name: 'direction',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'ASC',
|
||||
value: 'ASCENDING',
|
||||
},
|
||||
{
|
||||
name: 'DESC',
|
||||
value: 'DESCENDING',
|
||||
},
|
||||
],
|
||||
default: 'DESCENDING',
|
||||
description: 'Defines the direction in which search results are ordered. Default value is DESC.',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
name: 'properties',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealProperties',
|
||||
},
|
||||
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 companys.<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: 'Query',
|
||||
name: 'query',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Perform a text search against all property values for an object type',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort By',
|
||||
name: 'sortBy',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealProperties',
|
||||
},
|
||||
default: 'createdate',
|
||||
},
|
||||
],
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue