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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.3 KiB
TypeScript
Raw Normal View History

import type {
IAuthenticateGeneric,
ICredentialTestRequest,
2019-12-30 13:08:22 -08:00
ICredentialType,
INodeProperties,
2019-12-30 13:08:22 -08:00
} from 'n8n-workflow';
export class WordpressApi implements ICredentialType {
name = 'wordpressApi';
2019-12-30 13:08:22 -08:00
displayName = 'Wordpress API';
documentationUrl = 'wordpress';
properties: INodeProperties[] = [
2019-12-30 13:08:22 -08:00
{
displayName: 'Username',
name: 'username',
type: 'string',
2019-12-30 13:08:22 -08:00
default: '',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
typeOptions: {
password: true,
},
2019-12-30 13:08:22 -08:00
default: '',
},
{
displayName: 'Wordpress URL',
name: 'url',
type: 'string',
2019-12-30 13:08:22 -08:00
default: '',
placeholder: 'https://example.com',
2019-12-30 13:08:22 -08:00
},
{
displayName: 'Ignore SSL Issues',
name: 'allowUnauthorizedCerts',
type: 'boolean',
description: 'Whether to connect even if SSL certificate validation is not possible',
default: false,
},
2019-12-30 13:08:22 -08:00
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
auth: {
username: '={{$credentials.username}}',
password: '={{$credentials.password}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.url}}/wp-json/wp/v2',
url: '/users',
method: 'GET',
skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
},
};
2019-12-30 13:08:22 -08:00
}