mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
86721fc496
* ⚡ Add generic auth type * ⚡ Remove queryAuth * ⚡ Remove bearer * ⚡ Remove headerAuth * ⚡ Remove basicAuth * ⚡ Adjust tests * ⚡ Small improvements * 👕 Fix lint issue
51 lines
984 B
TypeScript
51 lines
984 B
TypeScript
import {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class GithubApi implements ICredentialType {
|
|
name = 'githubApi';
|
|
displayName = 'GitHub API';
|
|
documentationUrl = 'github';
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Github Server',
|
|
name: 'server',
|
|
type: 'string',
|
|
default: 'https://api.github.com',
|
|
description: 'The server to connect to. Only has to be set if Github Enterprise is used.',
|
|
},
|
|
{
|
|
displayName: 'User',
|
|
name: 'user',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Access Token',
|
|
name: 'accessToken',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=token {{$credentials?.accessToken}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{$credentials?.server}}',
|
|
url: '/user',
|
|
method: 'GET',
|
|
},
|
|
};
|
|
}
|