2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
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';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-27 04:07:25 -07:00
|
|
|
displayName = 'Action Network API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-08-13 03:04:01 -07:00
|
|
|
documentationUrl = 'actionNetwork';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
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-12-02 12:54:28 -08:00
|
|
|
|
2022-04-08 02:28:29 -07:00
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: 'https://actionnetwork.org/api/v2',
|
|
|
|
url: '/events?per_page=1',
|
|
|
|
},
|
|
|
|
};
|
2022-12-02 12:54:28 -08:00
|
|
|
|
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
|
|
|
}
|