Remove executeSingle from Mailgun node

This commit is contained in:
dali 2021-02-22 15:07:53 +01:00
parent 81f33b4c04
commit 5cce827d6f

View file

@ -1,6 +1,6 @@
import { import {
BINARY_ENCODING, BINARY_ENCODING,
IExecuteSingleFunctions, IExecuteFunctions,
} from 'n8n-core'; } from 'n8n-core';
import { import {
IDataObject, IDataObject,
@ -105,17 +105,24 @@ export class Mailgun implements INodeType {
}; };
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const item = this.getInputData(); const items = this.getInputData();
const fromEmail = this.getNodeParameter('fromEmail') as string; const returnData: INodeExecutionData[] = [];
const toEmail = this.getNodeParameter('toEmail') as string; const length = items.length as unknown as number;
const ccEmail = this.getNodeParameter('ccEmail') as string; let item: INodeExecutionData;
const bccEmail = this.getNodeParameter('bccEmail') as string;
const subject = this.getNodeParameter('subject') as string; for (let itemIndex = 0; itemIndex < length; itemIndex++) {
const text = this.getNodeParameter('text') as string; item = items[itemIndex];
const html = this.getNodeParameter('html') as string;
const attachmentPropertyString = this.getNodeParameter('attachments') as string; const fromEmail = this.getNodeParameter('fromEmail', itemIndex) as string;
const toEmail = this.getNodeParameter('toEmail', itemIndex) as string;
const ccEmail = this.getNodeParameter('ccEmail', itemIndex) as string;
const bccEmail = this.getNodeParameter('bccEmail', itemIndex) as string;
const subject = this.getNodeParameter('subject', itemIndex) as string;
const text = this.getNodeParameter('text', itemIndex) as string;
const html = this.getNodeParameter('html', itemIndex) as string;
const attachmentPropertyString = this.getNodeParameter('attachments', itemIndex) as string;
const credentials = this.getCredentials('mailgunApi'); const credentials = this.getCredentials('mailgunApi');
@ -177,8 +184,10 @@ export class Mailgun implements INodeType {
const responseData = await this.helpers.request(options); const responseData = await this.helpers.request(options);
return { returnData.push({
json: responseData, json: responseData,
}; });
}
return this.prepareOutputData(returnData)
} }
} }