mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
55 lines
997 B
TypeScript
55 lines
997 B
TypeScript
|
import type {
|
||
|
IAuthenticateGeneric,
|
||
|
ICredentialTestRequest,
|
||
|
ICredentialType,
|
||
|
INodeProperties,
|
||
|
} from 'n8n-workflow';
|
||
|
|
||
|
export class MotorheadApi implements ICredentialType {
|
||
|
name = 'motorheadApi';
|
||
|
|
||
|
displayName = 'MotorheadApi';
|
||
|
|
||
|
documentationUrl = 'motorhead';
|
||
|
|
||
|
properties: INodeProperties[] = [
|
||
|
{
|
||
|
displayName: 'Host',
|
||
|
name: 'host',
|
||
|
required: true,
|
||
|
type: 'string',
|
||
|
default: 'https://api.getmetal.io/v1',
|
||
|
},
|
||
|
{
|
||
|
displayName: 'API Key',
|
||
|
name: 'apiKey',
|
||
|
type: 'string',
|
||
|
typeOptions: { password: true },
|
||
|
required: true,
|
||
|
default: '',
|
||
|
},
|
||
|
{
|
||
|
displayName: 'Client ID',
|
||
|
name: 'clientId',
|
||
|
type: 'string',
|
||
|
default: '',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
authenticate: IAuthenticateGeneric = {
|
||
|
type: 'generic',
|
||
|
properties: {
|
||
|
headers: {
|
||
|
'x-metal-client-id': '={{$credentials.clientId}}',
|
||
|
'x-metal-api-key': '={{$credentials.apiKey}}',
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
|
||
|
test: ICredentialTestRequest = {
|
||
|
request: {
|
||
|
baseURL: '={{$credentials.host}}/keys/current',
|
||
|
},
|
||
|
};
|
||
|
}
|