Skip to content

Commit

Permalink
⚡ Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoE105 committed Apr 13, 2022
1 parent 50cde33 commit 2f201ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions packages/nodes-base/nodes/Eventbrite/EventbriteTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class EventbriteTrigger implements INodeType {
group: ['trigger'],
version: 1,
description: 'Handle Eventbrite events via webhooks',
subtitle: 'Subscribe to get notifications of Eventbrite actions',
subtitle: '={{$parameter["event"]}}',
defaults: {
name: 'Eventbrite Trigger',
},
Expand Down Expand Up @@ -181,7 +181,7 @@ export class EventbriteTrigger implements INodeType {
name: 'resolveData',
type: 'boolean',
default: true,
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.',
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',
},
],
};
Expand All @@ -206,7 +206,7 @@ export class EventbriteTrigger implements INodeType {
// Get all the available events to display them to user so that he can
// select them easily
async getEvents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [{name: 'All', value: ''}];
const returnData: INodePropertyOptions[] = [{ name: 'All', value: 'all' }];
const organization = this.getCurrentNodeParameter('organization');
const events = await eventbriteApiRequestAllItems.call(this, 'events', 'GET', `/organizations/${organization}/events`);
for (const event of events) {
Expand Down Expand Up @@ -262,12 +262,12 @@ export class EventbriteTrigger implements INodeType {
const body: IDataObject = {
endpoint_url: webhookUrl,
actions: actions.join(','),
event_id: event,
};
console.log(event);
if (event.length) {
body.event_id = event;
if (event === 'all' || event === '') {
delete body.event_id;
}

console.log(body);
const responseData = await eventbriteApiRequest.call(this, 'POST', endpoint, body);
webhookData.webhookId = responseData.id;
return true;
Expand Down
4 changes: 2 additions & 2 deletions packages/nodes-base/nodes/Eventbrite/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'n8n-core';

import {
IDataObject, NodeApiError, NodeOperationError,
IDataObject, JsonObject, NodeApiError, NodeOperationError,
} from 'n8n-workflow';

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
Expand Down Expand Up @@ -43,7 +43,7 @@ export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFuncti
return await this.helpers.requestOAuth2!.call(this, 'eventbriteOAuth2Api', options);
}
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}

Expand Down

0 comments on commit 2f201ea

Please sign in to comment.