feat(DeepL Node): Add support for longer texts + Credential tests (#3651)

* Updated DeepL to send data with Body instead of QS allowing larger translations

* Updated Credentials and added test
This commit is contained in:
Jonathan Bennetts
2022-07-05 08:02:25 +01:00
committed by GitHub
parent 088daf952e
commit 88d6cfc07b
3 changed files with 33 additions and 14 deletions

View File

@@ -1,4 +1,9 @@
import { ICredentialType, INodeProperties } from 'n8n-workflow';
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class DeepLApi implements ICredentialType {
name = 'deepLApi';
@@ -28,4 +33,20 @@ export class DeepLApi implements ICredentialType {
default: 'pro',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
qs: {
auth_key: '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.apiPlan === "pro" ? "https://api.deepl.com/v2" : "https://api-free.deepl.com/v2" }}',
url: '/usage',
},
};
}