2021-06-27 04:07:25 -07:00
|
|
|
import {
|
2022-04-08 02:28:29 -07:00
|
|
|
ICredentialDataDecryptedObject,
|
|
|
|
ICredentialTestRequest,
|
2021-06-27 04:07:25 -07:00
|
|
|
ICredentialType,
|
2022-04-08 02:28:29 -07:00
|
|
|
IHttpRequestOptions,
|
2021-10-07 14:07:56 -07:00
|
|
|
INodeProperties,
|
2021-06-27 04:07:25 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class ActionNetworkApi implements ICredentialType {
|
|
|
|
name = 'actionNetworkApi';
|
|
|
|
displayName = 'Action Network API';
|
2021-08-13 03:04:01 -07:00
|
|
|
documentationUrl = 'actionNetwork';
|
2021-10-07 14:07:56 -07:00
|
|
|
properties: INodeProperties[] = [
|
2021-06-27 04:07:25 -07:00
|
|
|
{
|
|
|
|
displayName: 'API Key',
|
|
|
|
name: 'apiKey',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2021-06-27 04:07:25 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
2022-04-08 02:28:29 -07:00
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: 'https://actionnetwork.org/api/v2',
|
|
|
|
url: '/events?per_page=1',
|
|
|
|
},
|
|
|
|
};
|
2022-07-24 08:36:17 -07:00
|
|
|
async authenticate(
|
|
|
|
credentials: ICredentialDataDecryptedObject,
|
|
|
|
requestOptions: IHttpRequestOptions,
|
|
|
|
): Promise<IHttpRequestOptions> {
|
2022-04-08 02:28:29 -07:00
|
|
|
requestOptions.headers = { 'OSDI-API-Token': credentials.apiKey };
|
|
|
|
return requestOptions;
|
2022-07-24 08:36:17 -07:00
|
|
|
}
|
2021-06-27 04:07:25 -07:00
|
|
|
}
|