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