Skip to content

Commit 5e54249

Browse files
willywongiJoffcomRicardoE105
authored
⚡ Make event on Eventbrite Trigger Node optional (n8n-io#2829)
* Set `event` property as optional * Add some parameter descriptions To please nodelinter, mostly. * Fix UI complaining about missing parameter. * 🚨 Fixed lint isssues * ⚡ Improvements Co-authored-by: Jonathan Bennetts <[email protected]> Co-authored-by: ricardo <[email protected]>
1 parent 29fdd77 commit 5e54249

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class EventbriteTrigger implements INodeType {
2626
group: ['trigger'],
2727
version: 1,
2828
description: 'Handle Eventbrite events via webhooks',
29+
subtitle: '={{$parameter["event"]}}',
2930
defaults: {
3031
name: 'Eventbrite Trigger',
3132
},
@@ -79,7 +80,6 @@ export class EventbriteTrigger implements INodeType {
7980
},
8081
],
8182
default: 'privateKey',
82-
description: 'The resource to operate on.',
8383
},
8484
{
8585
displayName: 'Organization',
@@ -90,7 +90,7 @@ export class EventbriteTrigger implements INodeType {
9090
loadOptionsMethod: 'getOrganizations',
9191
},
9292
default: '',
93-
description: '',
93+
description: 'The Eventbrite Organization to work on',
9494
},
9595
{
9696
displayName: 'Event',
@@ -104,7 +104,7 @@ export class EventbriteTrigger implements INodeType {
104104
loadOptionsMethod: 'getEvents',
105105
},
106106
default: '',
107-
description: '',
107+
description: 'Limit the triggers to this event',
108108
},
109109
{
110110
displayName: 'Actions',
@@ -174,14 +174,14 @@ export class EventbriteTrigger implements INodeType {
174174
],
175175
required: true,
176176
default: [],
177-
description: '',
177+
description: 'One or more action to subscribe to.',
178178
},
179179
{
180180
displayName: 'Resolve Data',
181181
name: 'resolveData',
182182
type: 'boolean',
183183
default: true,
184-
description: 'By default does the webhook-data only contain the URL to receive the object data manually. If this option gets activated, it will resolve the data automatically.',
184+
description: 'By default does the webhook-data only contain the URL to receive the object data manually. If this option gets activated, it will resolve the data automatically',
185185
},
186186
],
187187
};
@@ -206,7 +206,7 @@ export class EventbriteTrigger implements INodeType {
206206
// Get all the available events to display them to user so that he can
207207
// select them easily
208208
async getEvents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
209-
const returnData: INodePropertyOptions[] = [];
209+
const returnData: INodePropertyOptions[] = [{ name: 'All', value: 'all' }];
210210
const organization = this.getCurrentNodeParameter('organization');
211211
const events = await eventbriteApiRequestAllItems.call(this, 'events', 'GET', `/organizations/${organization}/events`);
212212
for (const event of events) {
@@ -264,9 +264,10 @@ export class EventbriteTrigger implements INodeType {
264264
actions: actions.join(','),
265265
event_id: event,
266266
};
267-
267+
if (event === 'all' || event === '') {
268+
delete body.event_id;
269+
}
268270
const responseData = await eventbriteApiRequest.call(this, 'POST', endpoint, body);
269-
270271
webhookData.webhookId = responseData.id;
271272
return true;
272273
},

packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from 'n8n-core';
1212

1313
import {
14-
IDataObject, NodeApiError, NodeOperationError,
14+
IDataObject, JsonObject, NodeApiError, NodeOperationError,
1515
} from 'n8n-workflow';
1616

1717
export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
@@ -38,13 +38,12 @@ export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFuncti
3838
}
3939

4040
options.headers!['Authorization'] = `Bearer ${credentials.apiKey}`;
41-
4241
return await this.helpers.request!(options);
4342
} else {
4443
return await this.helpers.requestOAuth2!.call(this, 'eventbriteOAuth2Api', options);
4544
}
4645
} catch (error) {
47-
throw new NodeApiError(this.getNode(), error);
46+
throw new NodeApiError(this.getNode(), error as JsonObject);
4847
}
4948
}
5049

0 commit comments

Comments
 (0)