2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2022-08-24 01:26:48 -07:00
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
export class MailgunApi implements ICredentialType {
|
|
|
|
name = 'mailgunApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
displayName = 'Mailgun API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'mailgun';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2019-06-23 03:35:23 -07:00
|
|
|
{
|
|
|
|
displayName: 'API Domain',
|
|
|
|
name: 'apiDomain',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'options',
|
2019-06-23 03:35:23 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'api.eu.mailgun.net',
|
|
|
|
value: 'api.eu.mailgun.net',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'api.mailgun.net',
|
|
|
|
value: 'api.mailgun.net',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'api.mailgun.net',
|
2022-04-13 23:32:27 -07:00
|
|
|
description: 'The configured mailgun API domain',
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Email Domain',
|
|
|
|
name: 'emailDomain',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2019-06-23 03:35:23 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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 },
|
2019-06-23 03:35:23 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-08-24 01:26:48 -07:00
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
auth: {
|
|
|
|
username: 'api',
|
|
|
|
password: '={{$credentials.apiKey}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-08-24 01:26:48 -07:00
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: '=https://{{$credentials.apiDomain}}/v3',
|
|
|
|
url: '/domains',
|
|
|
|
},
|
|
|
|
};
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|