n8n/packages/nodes-base/credentials/MailgunApi.credentials.ts

65 lines
1.1 KiB
TypeScript
Raw Normal View History

import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
2019-06-23 03:35:23 -07:00
export class MailgunApi implements ICredentialType {
name = 'mailgunApi';
2019-06-23 03:35:23 -07:00
displayName = 'Mailgun API';
documentationUrl = 'mailgun';
properties: INodeProperties[] = [
2019-06-23 03:35:23 -07:00
{
displayName: 'API Domain',
name: 'apiDomain',
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',
description: 'The configured mailgun API domain',
2019-06-23 03:35:23 -07:00
},
{
displayName: 'Email Domain',
name: 'emailDomain',
type: 'string',
2019-06-23 03:35:23 -07:00
default: '',
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
2019-06-23 03:35:23 -07:00
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
auth: {
username: 'api',
password: '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '=https://{{$credentials.apiDomain}}/v3',
url: '/domains',
},
};
2019-06-23 03:35:23 -07:00
}