n8n/packages/nodes-base/credentials/WordpressApi.credentials.ts
agobrech d5d4dd3845
feat: Updated multiple credentials with tests and allow to be used on HTTP Request Node (#3670)
* Notion cred updated

* Airtable new cred

* revamped twilio cred

* urlscanlo revamp cred

* Wordpress revamp cred with testing

* SendGrid cred revamped

* 🐛 Fix imports

* 🐛  Fixes imports in urlscanio

* Fix airtable cred injection

* Fixes notion request, changes way of cred injection

* Change auth type from method to generic

* Fix minor issues

* Fix lint issue

Co-authored-by: Omar Ajoue <krynble@gmail.com>
2022-07-10 13:32:19 +03:00

54 lines
990 B
TypeScript

import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class WordpressApi implements ICredentialType {
name = 'wordpressApi';
displayName = 'Wordpress API';
documentationUrl = 'wordpress';
properties: INodeProperties[] = [
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
typeOptions: {
password: true,
},
default: '',
},
{
displayName: 'Wordpress URL',
name: 'url',
type: 'string',
default: '',
placeholder: 'https://example.com',
},
];
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',
},
};
}