2024-07-03 00:59:44 -07:00
|
|
|
import type {
|
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
2020-01-17 14:48:54 -08:00
|
|
|
|
|
|
|
export class CopperApi implements ICredentialType {
|
|
|
|
name = 'copperApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-01-17 14:48:54 -08:00
|
|
|
displayName = 'Copper API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'copper';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2020-01-17 14:48:54 -08:00
|
|
|
{
|
|
|
|
displayName: 'API Key',
|
|
|
|
name: 'apiKey',
|
|
|
|
required: true,
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2020-01-17 14:48:54 -08:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Email',
|
|
|
|
name: 'email',
|
|
|
|
required: true,
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2022-06-20 07:54:01 -07:00
|
|
|
placeholder: 'name@email.com',
|
2020-01-17 14:48:54 -08:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
2024-07-03 00:59:44 -07:00
|
|
|
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
headers: {
|
|
|
|
'X-PW-AccessToken': '={{$credentials.apiKey}}',
|
|
|
|
'X-PW-Application': 'developer_api',
|
|
|
|
'X-PW-UserEmail': '={{$credentials.email}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: 'https://api.copper.com/developer_api/v1/',
|
|
|
|
url: 'users/me',
|
|
|
|
},
|
|
|
|
};
|
2020-01-17 14:48:54 -08:00
|
|
|
}
|