diff --git a/nodes/FriendGrid/FriendGrid.node.ts b/nodes/FriendGrid/FriendGrid.node.ts index e074d51..d769732 100644 --- a/nodes/FriendGrid/FriendGrid.node.ts +++ b/nodes/FriendGrid/FriendGrid.node.ts @@ -1,11 +1,8 @@ -import { - IExecuteFunctions, -} from 'n8n-core'; - import { ICredentialsDecrypted, ICredentialTestFunctions, IDataObject, + IExecuteFunctions, INodeCredentialTestResult, INodeExecutionData, INodeType, @@ -93,7 +90,8 @@ export class FriendGrid implements INodeType { message: `${response.error}`, }; } - } catch (err) { + // tslint:disable-next-line:no-any + } catch (err: any) { return { status: 'Error', message: `${err.message}`, @@ -115,7 +113,7 @@ export class FriendGrid implements INodeType { const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; let body: IDataObject = {}; - const qs: IDataObject = {}; + const qs: IDataObject = {}; // query string for (let i = 0; i < items.length; i++) { try { @@ -124,12 +122,9 @@ export class FriendGrid implements INodeType { // https://docs.sendgrid.com/api-reference/contacts/add-or-update-a-contact const email = this.getNodeParameter('email', i) as string; - const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - const data: IDataObject = { - email, - }; + const data: IDataObject = { email }; Object.assign(data, additionalFields); body = { @@ -147,7 +142,8 @@ export class FriendGrid implements INodeType { } else if (responseData !== undefined) { returnData.push(responseData as IDataObject); } - } catch (error) { + // tslint:disable-next-line:no-any + } catch (error: any) { if (this.continueOnFail()) { returnData.push({ error: error.message }); continue; diff --git a/nodes/FriendGrid/GenericFunctions.ts b/nodes/FriendGrid/GenericFunctions.ts index 29cc623..f16d4ce 100644 --- a/nodes/FriendGrid/GenericFunctions.ts +++ b/nodes/FriendGrid/GenericFunctions.ts @@ -3,14 +3,11 @@ import { } from 'request'; import { + IDataObject, IExecuteFunctions, IExecuteSingleFunctions, IHookFunctions, ILoadOptionsFunctions, -} from 'n8n-core'; - -import { - IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow'; @@ -29,7 +26,7 @@ export async function friendGridApiRequest(this: IHookFunctions | IExecuteFuncti const options: OptionsWithUri = { method, headers: { - 'Accept': ' application/json', + 'Accept': 'application/json', 'Authorization': `Bearer ${credentials.apiKey}`, }, qs, @@ -47,7 +44,8 @@ export async function friendGridApiRequest(this: IHookFunctions | IExecuteFuncti try { return this.helpers.request!(options); - } catch (error) { + // tslint:disable-next-line:no-any + } catch (error: any) { throw new NodeApiError(this.getNode(), error); } -} \ No newline at end of file +}