mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
d68b7a4cf4
* 🔨 fix for not all posts returning * ⚡ added credential test * ⚡ Improvements * ⚡ Improvements * ⚡ Define test the new way * ⚡ Remove not needed imports * ⚡ Fix auth test problem Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Ricardo Espinoza <ricardo@n8n.io> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import {
|
|
ICredentialDataDecryptedObject,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
IHttpRequestOptions,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class ZendeskApi implements ICredentialType {
|
|
name = 'zendeskApi';
|
|
displayName = 'Zendesk API';
|
|
documentationUrl = 'zendesk';
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Subdomain',
|
|
name: 'subdomain',
|
|
type: 'string',
|
|
description: 'The subdomain of your Zendesk work environment',
|
|
placeholder: 'company',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'Email',
|
|
name: 'email',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
{
|
|
displayName: 'API Token',
|
|
name: 'apiToken',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
];
|
|
async authenticate(credentials: ICredentialDataDecryptedObject, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions> {
|
|
requestOptions.auth = {
|
|
username: `${credentials.email}/token`,
|
|
password: credentials.apiToken as string,
|
|
};
|
|
return requestOptions;
|
|
}
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '=https://{{$credentials.subdomain}}.zendesk.com/api/v2',
|
|
url: '/ticket_fields.json',
|
|
},
|
|
};
|
|
}
|