2022-10-07 05:23:03 -07:00
|
|
|
import {
|
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class CloudflareApi implements ICredentialType {
|
|
|
|
name = 'cloudflareApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-10-07 05:23:03 -07:00
|
|
|
displayName = 'Cloudflare API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-10-07 05:23:03 -07:00
|
|
|
documentationUrl = 'cloudflare';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-10-07 05:23:03 -07:00
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'API Token',
|
|
|
|
name: 'apiToken',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
headers: {
|
2022-11-22 03:44:35 -08:00
|
|
|
Authorization: '=Bearer {{$credentials.apiToken}}',
|
2022-10-07 05:23:03 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: 'https://api.cloudflare.com/client/v4/user/tokens/verify',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|