mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
set up functionality layout
This commit is contained in:
parent
e896c1c319
commit
683c889a14
|
@ -1120,6 +1120,71 @@ export class ActiveCampaign implements INodeType {
|
|||
addAdditionalFields(body.contact as IDataObject, updateFields);
|
||||
|
||||
}
|
||||
} else if (resource === 'deal') {
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// deal:create
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
dataKey = 'deal';
|
||||
body.deal = {
|
||||
email: this.getNodeParameter('email', i) as string,
|
||||
} as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
addAdditionalFields(body.deal as IDataObject, additionalFields);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// deal:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// deal:get
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// persons:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
dataKey = 'deals';
|
||||
endpoint = `/api/3/deals`;
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// deal:update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
dataKey = 'deal';
|
||||
body.deal = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
addAdditionalFields(body.deal as IDataObject, updateFields);
|
||||
|
||||
} else {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
@ -1140,4 +1205,4 @@ export class ActiveCampaign implements INodeType {
|
|||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue