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
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import addToCalendarPro from "../../add_to_calendar_pro.app.mjs";

export default {
key: "add_to_calendar_pro-create-event-group",
name: "Create Event Group",
description: "Create an event group. [See the documentation](https://docs.add-to-calendar-pro.com/api/groups#add-a-group)",
version: "0.0.1",
type: "action",
props: {
addToCalendarPro,
eventGroupName: {
propDefinition: [
addToCalendarPro,
"eventGroupName",
],
},
internalNote: {
propDefinition: [
addToCalendarPro,
"internalNote",
],
},
subscriptionCalUrl: {
propDefinition: [
addToCalendarPro,
"subscriptionCalUrl",
],
},
cta: {
propDefinition: [
addToCalendarPro,
"cta",
],
},
styleId: {
propDefinition: [
addToCalendarPro,
"styleId",
],
},
landingPageTemplateId: {
propDefinition: [
addToCalendarPro,
"landingPageTemplateId",
],
optional: true,
},
ctaTemplateId: {
propDefinition: [
addToCalendarPro,
"ctaTemplateId",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.addToCalendarPro.createGroup({
$,
data: {
name: this.eventGroupName,
internal_note: this.internalNote,
subscription: this.subscriptionCalUrl
? "external"
: "no",
subscription_cal_url: this.subscriptionCalUrl,
cta: this.cta,
layout: this.styleId,
landingpage: this.landingPageTemplateId,
cta_block: this.ctaTemplateId,
},
});
$.export("$summary", "Successfully created event group.");
return response;
},
};
294 changes: 294 additions & 0 deletions components/add_to_calendar_pro/actions/create-event/create-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
import addToCalendarPro from "../../add_to_calendar_pro.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "add_to_calendar_pro-create-event",
name: "Create Event",
description: "Create an event in a group. [See the documentation](https://docs.add-to-calendar-pro.com/api/events#add-an-event)",
version: "0.0.1",
type: "action",
props: {
addToCalendarPro,
groupProKey: {
propDefinition: [
addToCalendarPro,
"groupProKey",
],
description: "The pro key of the group to add the event to. Either this or newEventGroupName is required.",
optional: true,
},
newEventGroupName: {
type: "string",
label: "New Event Group Name",
description: "Create a new group for the event with the name provided. Either this or groupProKey is required.",
optional: true,
},
titleEventSeries: {
propDefinition: [
addToCalendarPro,
"titleEventSeries",
],
},
simplifiedRecurrence: {
propDefinition: [
addToCalendarPro,
"simplifiedRecurrence",
],
},
recurrence: {
propDefinition: [
addToCalendarPro,
"recurrence",
],
},
recurrenceSimpleType: {
propDefinition: [
addToCalendarPro,
"recurrenceSimpleType",
],
},
recurrenceInterval: {
propDefinition: [
addToCalendarPro,
"recurrenceInterval",
],
},
recurrenceByDay: {
propDefinition: [
addToCalendarPro,
"recurrenceByDay",
],
},
recurrenceByMonth: {
propDefinition: [
addToCalendarPro,
"recurrenceByMonth",
],
},
recurrenceByMonthDay: {
propDefinition: [
addToCalendarPro,
"recurrenceByMonthDay",
],
},
recurrenceCount: {
propDefinition: [
addToCalendarPro,
"recurrenceCount",
],
},
recurrenceWeekStart: {
propDefinition: [
addToCalendarPro,
"recurrenceWeekStart",
],
},
iCalFileName: {
propDefinition: [
addToCalendarPro,
"iCalFileName",
],
},
rsvp: {
propDefinition: [
addToCalendarPro,
"rsvp",
],
},
distribution: {
propDefinition: [
addToCalendarPro,
"distribution",
],
},
hideButton: {
propDefinition: [
addToCalendarPro,
"hideButton",
],
},
cta: {
propDefinition: [
addToCalendarPro,
"cta",
],
},
styleId: {
propDefinition: [
addToCalendarPro,
"styleId",
],
},
landingPageTemplateId: {
propDefinition: [
addToCalendarPro,
"landingPageTemplateId",
],
optional: true,
},
rsvpTemplateId: {
propDefinition: [
addToCalendarPro,
"rsvpTemplateId",
],
optional: true,
},
ctaTemplateId: {
propDefinition: [
addToCalendarPro,
"ctaTemplateId",
],
optional: true,
},
numberOfDates: {
type: "integer",
label: "Number of Dates",
description: "The number of dates to create for the event",
reloadProps: true,
},
},
additionalProps() {
const props = {};
if (!this.numberOfDates) {
return props;
}
for (let i = 0; i < this.numberOfDates; i++) {
props[`name${i}`] = {
type: "string",
label: `Title of Date ${i + 1}`,
description: `The title of Date ${i + 1}`,
};
props[`startDate${i}`] = {
type: "string",
label: `Start Date of Date ${i + 1}`,
description: `The start date of Date ${i + 1} in format YYYY-MM-DD`,
};
props[`startTime${i}`] = {
type: "string",
label: `Start Time of Date ${i + 1}`,
description: `The start time of Date ${i + 1} in format HH:MM`,
optional: true,
};
props[`endDate${i}`] = {
type: "string",
label: `End Date of Date ${i + 1}`,
description: `The end date of Date ${i + 1} in format YYYY-MM-DD`,
optional: true,
};
props[`endTime${i}`] = {
type: "string",
label: `End Time of Date ${i + 1}`,
description: `The end time of Date ${i + 1} in format HH:MM`,
optional: true,
};
props[`timeZone${i}`] = {
type: "string",
label: `Time Zone of Date ${i + 1}`,
description: `The time zone of Date ${i + 1}. Example: "America/Los_Angeles"`,
optional: true,
};
props[`description${i}`] = {
type: "string",
label: `Description of Date ${i + 1}`,
description: `The description of Date ${i + 1}`,
optional: true,
};
props[`location${i}`] = {
type: "string",
label: `Location of Date ${i + 1}`,
description: `The location of Date ${i + 1}`,
optional: true,
};
props[`availability${i}`] = {
type: "string",
label: `Availability of Date ${i + 1}`,
description: `The availability of Date ${i + 1}`,
options: [
"free",
"busy",
],
optional: true,
};
props[`organizerName${i}`] = {
type: "string",
label: `Organizer Name of Date ${i + 1}`,
description: `The organizer name of Date ${i + 1}`,
optional: true,
};
props[`organizerEmail${i}`] = {
type: "string",
label: `Organizer Email of Date ${i + 1}`,
description: `The organizer email of Date ${i + 1}`,
optional: true,
};
props[`attendeeName${i}`] = {
type: "string",
label: `Attendee Name of Date ${i + 1}`,
description: `The attendee name of Date ${i + 1}`,
optional: true,
};
props[`attendeeEmail${i}`] = {
type: "string",
label: `Attendee Email of Date ${i + 1}`,
description: `The attendee email of Date ${i + 1}`,
optional: true,
};
}
return props;
},
async run({ $ }) {
if (!this.groupProKey && !this.newEventGroupName) {
throw new ConfigurationError("Either `groupProKey` or `newEventGroupName` is required.");
}
if (this.groupProKey && this.newEventGroupName) {
throw new ConfigurationError("Only one of `groupProKey` or `newEventGroupName` can be provided.");
}
const dates = [];
for (let i = 0; i < this.numberOfDates; i++) {
dates.push({
name: this[`name${i}`],
startDate: this[`startDate${i}`],
startTime: this[`startTime${i}`],
endDate: this[`endDate${i}`],
endTime: this[`endTime${i}`],
timeZone: this[`timeZone${i}`],
description: this[`description${i}`],
location: this[`location${i}`],
availability: this[`availability${i}`],
organizerName: this[`organizerName${i}`],
organizerEmail: this[`organizerEmail${i}`],
attendeeName: this[`attendeeName${i}`],
attendeeEmail: this[`attendeeEmail${i}`],
});
}
const event = await this.addToCalendarPro.createEvent({
$,
data: {
event_group: this.groupProKey,
new_event_group_name: this.newEventGroupName,
dates,
title_event_series: this.titleEventSeries,
simplified_recurrence: this.simplifiedRecurrence,
recurrence: this.recurrence,
recurrence_simple_type: this.recurrenceSimpleType,
recurrence_interval: this.recurrenceInterval,
recurrence_byDay: this.recurrenceByDay,
recurrence_byMonth: this.recurrenceByMonth,
recurrence_byMonthDay: this.recurrenceByMonthDay,
recurrence_count: this.recurrenceCount,
recurrence_weekstart: this.recurrenceWeekStart,
iCalFileName: this.iCalFileName,
rsvp: this.rsvp,
rsvp_block: this.rsvpTemplateId,
distribution: this.distribution,
hideButton: this.hideButton,
cta: this.cta,
cta_block: this.ctaTemplateId,
layout: this.styleId,
landingpage: this.landingPageTemplateId,
},
});
$.export("$summary", "Successfully created event.");
return event;
},
};
Loading
Loading