Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 99 additions & 4 deletions components/eventzilla/eventzilla.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,106 @@
import { axios } from "@pipedream/platform";
const DEFAULT_LIMIT = 20;
const MAX_LIMIT = 100;

export default {
type: "app",
app: "eventzilla",
propDefinitions: {},
propDefinitions: {
eventId: {
type: "string",
label: "Event ID",
description: "The ID of the event",
async options({ page }) {
const { events } = await this.listEvents({
params: {
limit: DEFAULT_LIMIT,
offset: page * DEFAULT_LIMIT,
},
});
if (!events?.length) {
return [];
}
return events.map((event) => ({
label: event.title,
value: event.id,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://www.eventzillaapi.net/api/v2";
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: {
"x-api-key": `${this.$auth.api_key}`,
},
...opts,
});
},
listEvents(opts = {}) {
return this._makeRequest({
path: "/events",
...opts,
});
},
listAttendees({
eventId, ...opts
}) {
return this._makeRequest({
path: `/events/${eventId}/attendees`,
...opts,
});
},
listEventTransactions({
eventId, ...opts
}) {
return this._makeRequest({
path: `/events/${eventId}/transactions`,
...opts,
});
},
async *paginate({
fn, args, resourceKey, max,
}) {
args = {
...args,
params: {
...args?.params,
limit: MAX_LIMIT,
offset: 0,
},
};
let total, count = 0;
do {
const response = await fn(args);
const items = resourceKey
? response[resourceKey]
: response;
if (!items?.length) {
return;
}
for (const item of items) {
yield item;
if (max && ++count >= max) {
return;
}
}
args.params.offset += args.params.limit;
total = items?.length;
} while (total === args.params.limit);
},
async getPaginatedResources(opts = {}) {
const items = [];
const results = this.paginate(opts);
for await (const item of results) {
items.push(item);
}
return items;
},
},
};
4 changes: 2 additions & 2 deletions components/eventzilla/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/eventzilla",
"version": "0.6.0",
"version": "0.7.0",
"description": "Pipedream eventzilla Components",
"main": "eventzilla.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.0"
"@pipedream/platform": "^3.0.3"
}
}
66 changes: 66 additions & 0 deletions components/eventzilla/sources/common/base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import eventzilla from "../../eventzilla.app.mjs";
import {
ConfigurationError, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
} from "@pipedream/platform";

export default {
props: {
eventzilla,
db: "$.service.db",
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
methods: {
getArgs() {
return {};
},
getResourceKey() {
return;
},
generateMeta(item) {
return {
id: item.id,
summary: this.getSummary(item),
ts: Date.now(),
};
},
getResourceFn() {
throw new ConfigurationError("getResourceFn is not implemented");
},
getSummary() {
throw new ConfigurationError("getSummary is not implemented");
},
},
async run() {
const fn = this.getResourceFn();
const args = this.getArgs();
const resourceKey = this.getResourceKey();

try {
let items = await this.eventzilla.getPaginatedResources({
fn,
args,
resourceKey,
});

if (!items?.length) {
return;
}

for (const item of items) {
const meta = this.generateMeta(item);
this.$emit(item, meta);
}
} catch (error) {
if (error.message) {
console.log(JSON.parse(error.message).message);
} else {
throw new ConfigurationError(error);
}
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "eventzilla-new-attendee-added",
name: "New Attendee Added",
description: "Emit new event when a new attendee is added to an event in Eventzilla. [See the documentation](https://developer.eventzilla.net/docs/)",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
eventId: {
propDefinition: [
common.props.eventzilla,
"eventId",
],
},
},
methods: {
...common.methods,
getResourceFn() {
return this.eventzilla.listAttendees;
},
getArgs() {
return {
eventId: this.eventId,
};
},
getResourceKey() {
return "attendees";
},
getSummary(item) {
return `New Attendee ID: ${item.id}`;
},
},
sampleEmit,
};
19 changes: 19 additions & 0 deletions components/eventzilla/sources/new-attendee-added/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
"first_name": "Test",
"last_name": "User",
"ticket_type": "ticket type",
"bar_code": "486608160870031397",
"is_attended": "No",
"questions": [],
"refno": "20255486608-9518980",
"id": 2145905812,
"event_date": "2025-05-29T09:00:00",
"event_id": 2138658701,
"transaction_date": "2025-05-27T16:27:56",
"transaction_amount": 0,
"transaction_status": "Confirmed",
"email": "",
"buyer_first_name": "Test",
"buyer_last_name": "User",
"payment_type": "Free"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "eventzilla-new-event-created",
name: "New Event Created",
description: "Emit new event when a new event is created in Eventzilla. [See the documentation](https://developer.eventzilla.net/docs/)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getResourceFn() {
return this.eventzilla.listEvents;
},
getResourceKey() {
return "events";
},
getSummary(item) {
return `New Event ID: ${item.id}`;
},
},
sampleEmit,
};
27 changes: 27 additions & 0 deletions components/eventzilla/sources/new-event-created/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default {
"id": 2138658701,
"title": "event1",
"description": "test event",
"currency": "$",
"start_date": "2025-05-29T00:00:00",
"start_time": "09:00",
"end_date": "2025-05-29T00:00:00",
"end_time": "17:00",
"time_zone": "(GMT-0500) United States (New York) Time",
"tickets_sold": 0,
"tickets_total": 100,
"status": "Live",
"show_remaining": false,
"twitter_hashtag": "",
"utc_offset": "-04:00",
"invite_code": "",
"url": "https://events.eventzilla.net/e/event1-2138658701",
"logo_url": "",
"bgimage_url": "https://ucarecdn.com/30c1b4e6-c63b-496a-af64-e29456aaaa1f/-/crop/1200x401/0,113/-/preview/",
"venue": "virtual event",
"dateid": 2138283242,
"categories": "Virtual Event",
"language": "en",
"description_html": "<p>test event</p>",
"timezone_code": "EDT"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "eventzilla-new-event-transaction",
name: "New Event Transaction",
description: "Emit new event when a new transaction occurs for an event in Eventzilla. [See the documentation](https://developer.eventzilla.net/docs/)",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
eventId: {
propDefinition: [
common.props.eventzilla,
"eventId",
],
},
},
methods: {
...common.methods,
getResourceFn() {
return this.eventzilla.listEventTransactions;
},
getArgs() {
return {
eventId: this.eventId,
};
},
getResourceKey() {
return "transactions";
},
getSummary(item) {
return `New Event Transaction ID: ${item.checkout_id}`;
},
generateMeta(item) {
return {
id: item.checkout_id,
summary: this.getSummary(item),
ts: Date.now(),
};
},
},
sampleEmit,
};
21 changes: 21 additions & 0 deletions components/eventzilla/sources/new-event-transaction/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
"refno": "20255486608-9518980",
"checkout_id": 2146370777,
"transaction_date": "2025-05-27T16:27:56",
"transaction_amount": 0,
"tickets_in_transaction": 1,
"event_date": "2025-05-29T14:00:00",
"transaction_status": "Confirmed",
"user_id": 2135013619,
"event_id": 486608,
"title": "event1",
"email": "",
"buyer_first_name": "Test",
"buyer_last_name": "User",
"promo_code": "",
"payment_type": "Free",
"comments": "",
"transaction_tax": 0,
"transaction_discount": 0,
"eventzilla_fee": 0
}
5 changes: 2 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading