2022-07-24 08:36:17 -07:00
|
|
|
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
2020-03-08 19:39:20 -07:00
|
|
|
|
2021-09-18 13:18:35 -07:00
|
|
|
const scopes = [
|
2021-12-10 11:28:59 -08:00
|
|
|
'crm.objects.contacts.read',
|
|
|
|
'crm.schemas.contacts.read',
|
|
|
|
'crm.objects.companies.read',
|
|
|
|
'crm.schemas.companies.read',
|
|
|
|
'crm.objects.deals.read',
|
|
|
|
'crm.schemas.deals.read',
|
2021-09-18 13:18:35 -07:00
|
|
|
];
|
|
|
|
|
2022-07-04 02:12:08 -07:00
|
|
|
// eslint-disable-next-line n8n-nodes-base/cred-class-name-missing-oauth2-suffix
|
2020-03-08 19:39:20 -07:00
|
|
|
export class HubspotDeveloperApi implements ICredentialType {
|
2022-07-04 02:12:08 -07:00
|
|
|
// eslint-disable-next-line n8n-nodes-base/cred-class-field-name-missing-oauth2
|
2020-03-08 19:39:20 -07:00
|
|
|
name = 'hubspotDeveloperApi';
|
2022-07-04 02:12:08 -07:00
|
|
|
// eslint-disable-next-line n8n-nodes-base/cred-class-field-display-name-missing-oauth2
|
2022-05-24 02:36:19 -07:00
|
|
|
displayName = 'HubSpot Developer API';
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'hubspot';
|
2022-07-24 08:36:17 -07:00
|
|
|
extends = ['oAuth2Api'];
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2022-06-13 22:27:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Grant Type',
|
|
|
|
name: 'grantType',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'authorizationCode',
|
|
|
|
},
|
2020-03-08 19:39:20 -07:00
|
|
|
{
|
2021-09-18 13:18:35 -07:00
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'https://app.hubspot.com/oauth/authorize',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'https://api.hubapi.com/oauth/v1/token',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'grant_type=authorization_code',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'body',
|
2020-03-08 19:39:20 -07:00
|
|
|
},
|
|
|
|
{
|
2021-09-18 13:18:35 -07:00
|
|
|
displayName: 'Developer API Key',
|
|
|
|
name: 'apiKey',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2020-03-08 19:39:20 -07:00
|
|
|
default: '',
|
|
|
|
},
|
2021-01-31 23:31:40 -08:00
|
|
|
{
|
2021-09-18 13:18:35 -07:00
|
|
|
displayName: 'APP ID',
|
2021-01-31 23:31:40 -08:00
|
|
|
name: 'appId',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2021-01-31 23:31:40 -08:00
|
|
|
required: true,
|
|
|
|
default: '',
|
2021-09-18 13:18:35 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
|
|
|
type: 'hidden',
|
|
|
|
default: scopes.join(' '),
|
2021-01-31 23:31:40 -08:00
|
|
|
},
|
2020-03-08 19:39:20 -07:00
|
|
|
];
|
|
|
|
}
|