mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
Fixed deprecated API calls & Added OAuth2 support
This commit is contained in:
@@ -35,7 +35,25 @@ export class EventbriteTrigger implements INodeType {
|
||||
{
|
||||
name: 'eventbriteApi',
|
||||
required: true,
|
||||
}
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'eventbriteOAuth2Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
{
|
||||
@@ -46,6 +64,23 @@ export class EventbriteTrigger implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Access Token',
|
||||
value: 'accessToken',
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2',
|
||||
},
|
||||
],
|
||||
default: 'accessToken',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Organization',
|
||||
name: 'organization',
|
||||
@@ -192,10 +227,12 @@ export class EventbriteTrigger implements INodeType {
|
||||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const organisation = this.getNodeParameter('organization') as string;
|
||||
|
||||
if (webhookData.webhookId === undefined) {
|
||||
return false;
|
||||
}
|
||||
const endpoint = `/webhooks/${webhookData.webhookId}/`;
|
||||
const endpoint = `/organizations/${organisation}/webhooks/`;
|
||||
try {
|
||||
await eventbriteApiRequest.call(this, 'GET', endpoint);
|
||||
} catch (e) {
|
||||
@@ -206,9 +243,10 @@ export class EventbriteTrigger implements INodeType {
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const organisation = this.getNodeParameter('organization') as string;
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
const actions = this.getNodeParameter('actions') as string[];
|
||||
const endpoint = `/webhooks/`;
|
||||
const endpoint = `/organizations/${organisation}/webhooks/`;
|
||||
const body: IDataObject = {
|
||||
endpoint_url: webhookUrl,
|
||||
actions: actions.join(','),
|
||||
|
||||
Reference in New Issue
Block a user