2020-02-13 07:43:59 -08:00
|
|
|
import {
|
2022-06-26 15:55:51 -07:00
|
|
|
IAuthenticateGeneric,
|
2022-05-15 11:39:54 -07:00
|
|
|
ICredentialTestRequest,
|
2020-02-13 07:43:59 -08:00
|
|
|
ICredentialType,
|
2021-06-12 09:39:55 -07:00
|
|
|
INodeProperties,
|
2020-02-13 07:43:59 -08:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class MailjetEmailApi implements ICredentialType {
|
|
|
|
name = 'mailjetEmailApi';
|
|
|
|
displayName = 'Mailjet Email API';
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'mailjet';
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2020-02-13 07:43:59 -08:00
|
|
|
{
|
|
|
|
displayName: 'API Key',
|
|
|
|
name: 'apiKey',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2020-02-13 07:43:59 -08:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Secret Key',
|
|
|
|
name: 'secretKey',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-02-13 07:43:59 -08:00
|
|
|
default: '',
|
|
|
|
},
|
2022-03-20 12:13:18 -07:00
|
|
|
{
|
|
|
|
displayName: 'Sandbox Mode',
|
|
|
|
name: 'sandboxMode',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
2022-07-24 08:36:17 -07:00
|
|
|
description:
|
|
|
|
'Whether to allow to run the API call in a Sandbox mode, where all validations of the payload will be done without delivering the message',
|
2022-03-20 12:13:18 -07:00
|
|
|
},
|
2020-02-13 07:43:59 -08:00
|
|
|
];
|
2022-06-26 15:55:51 -07:00
|
|
|
|
2022-07-24 08:36:17 -07:00
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
auth: {
|
|
|
|
username: '={{$credentials.apiKey}}',
|
|
|
|
password: '={{$credentials.secretKey}}',
|
|
|
|
},
|
2022-06-26 15:55:51 -07:00
|
|
|
},
|
2022-07-24 08:36:17 -07:00
|
|
|
};
|
2022-06-26 15:55:51 -07:00
|
|
|
|
2022-07-24 08:36:17 -07:00
|
|
|
test: ICredentialTestRequest = {
|
2022-05-15 11:39:54 -07:00
|
|
|
request: {
|
|
|
|
baseURL: `https://api.mailjet.com`,
|
|
|
|
url: '/v3/REST/template',
|
|
|
|
method: 'GET',
|
|
|
|
},
|
|
|
|
};
|
2020-02-13 07:43:59 -08:00
|
|
|
}
|