mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
add dealnote functionality
This commit is contained in:
parent
819efc50e5
commit
66a335054f
|
@ -1,5 +1,5 @@
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions, getExecuteSingleFunctions,
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
import {
|
import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -906,6 +906,24 @@ export class ActiveCampaign implements INodeType {
|
||||||
},
|
},
|
||||||
description: 'The ID of the deal note',
|
description: 'The ID of the deal note',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Deal note ID',
|
||||||
|
name: 'dealNoteId',
|
||||||
|
type: 'number',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'updateNote',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'deal',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the deal note',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Deal Note',
|
displayName: 'Deal Note',
|
||||||
name: 'dealNote',
|
name: 'dealNote',
|
||||||
|
@ -998,7 +1016,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// persons:getAll
|
// contacts:getAll
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
requestMethod = 'GET';
|
requestMethod = 'GET';
|
||||||
|
@ -1027,7 +1045,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
addAdditionalFields(body.contact as IDataObject, updateFields);
|
addAdditionalFields(body.contact as IDataObject, updateFields);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The operation ${operation} is not known`);
|
throw new Error(`The operation "${operation}" is not known`);
|
||||||
}
|
}
|
||||||
} else if (resource === 'deal') {
|
} else if (resource === 'deal') {
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
|
@ -1091,7 +1109,7 @@ export class ActiveCampaign implements INodeType {
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// persons:getAll
|
// deals:getAll
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
requestMethod = 'GET';
|
requestMethod = 'GET';
|
||||||
|
@ -1103,8 +1121,36 @@ export class ActiveCampaign implements INodeType {
|
||||||
|
|
||||||
dataKey = 'deals';
|
dataKey = 'deals';
|
||||||
endpoint = `/api/3/deals`;
|
endpoint = `/api/3/deals`;
|
||||||
|
|
||||||
|
} else if (operation === 'createNote') {
|
||||||
|
// ----------------------------------
|
||||||
|
// deal:createNote
|
||||||
|
// ----------------------------------
|
||||||
|
requestMethod = 'POST'
|
||||||
|
|
||||||
|
body.note = {
|
||||||
|
note: this.getNodeParameter('createNote', i) as string,
|
||||||
|
}
|
||||||
|
|
||||||
|
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||||
|
endpoint = `/api/3/deals/${dealId}/notes`;
|
||||||
|
|
||||||
|
} else if (operation === 'updateNote') {
|
||||||
|
// ----------------------------------
|
||||||
|
// deal:updateNote
|
||||||
|
// ----------------------------------
|
||||||
|
requestMethod = 'POST'
|
||||||
|
|
||||||
|
body.note = {
|
||||||
|
note: this.getNodeParameter('updateNote', i) as string,
|
||||||
|
}
|
||||||
|
|
||||||
|
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||||
|
const dealNoteId = this.getNodeParameter('dealNoteId', i) as number;
|
||||||
|
endpoint = `/api/3/deals/${dealId}/notes/${dealNoteId}`;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The operation ${operation} is not known`);
|
throw new Error(`The operation "${operation}" is not known`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The resource "${resource}" is not known!`);
|
throw new Error(`The resource "${resource}" is not known!`);
|
||||||
|
|
Loading…
Reference in a new issue