@pipedream/google_calendar 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +7 -16
  2. package/actions/{update-event-attendees/update-event-attendees.mjs → add-attendees-to-event/add-attendees-to-event.mjs} +11 -25
  3. package/actions/common/create-event-common.mjs +76 -33
  4. package/actions/create-event/create-event.mjs +110 -12
  5. package/actions/delete-event/delete-event.mjs +2 -2
  6. package/actions/get-calendar/get-calendar.mjs +1 -1
  7. package/actions/get-event/get-event.mjs +1 -1
  8. package/actions/list-calendars/list-calendars.mjs +4 -2
  9. package/actions/list-events/list-events.mjs +22 -19
  10. package/actions/query-free-busy-calendars/query-free-busy-calendars.mjs +1 -1
  11. package/actions/quick-add-event/quick-add-event.mjs +22 -3
  12. package/actions/update-event/update-event.mjs +33 -5
  13. package/common/constants.mjs +8 -0
  14. package/google_calendar.app.mjs +33 -64
  15. package/package.json +3 -2
  16. package/sources/common/common.mjs +2 -2
  17. package/sources/event-cancelled/event-cancelled.mjs +3 -1
  18. package/sources/event-cancelled/test-event.mjs +31 -0
  19. package/sources/event-ended/event-ended.mjs +3 -1
  20. package/sources/event-ended/test-event.mjs +31 -0
  21. package/sources/new-calendar/new-calendar.mjs +4 -1
  22. package/sources/new-calendar/test-event.mjs +18 -0
  23. package/sources/new-event-search/new-event-search.mjs +2 -2
  24. package/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs +1 -1
  25. package/sources/upcoming-event-alert/test-event.mjs +32 -0
  26. package/sources/upcoming-event-alert/upcoming-event-alert.mjs +17 -26
  27. package/actions/list-events-by-type/list-events-by-type.mjs +0 -56
  28. package/sources/event-start/event-start.mjs +0 -60
  29. package/sources/event-start/test-event.mjs +0 -32
  30. package/sources/new-event/new-event.mjs +0 -36
  31. package/sources/new-or-updated-event/new-or-updated-event.mjs +0 -48
  32. package/sources/upcoming-event-type-alert/upcoming-event-type-alert.mjs +0 -149
package/README.md CHANGED
@@ -1,20 +1,11 @@
1
1
  # Overview
2
2
 
3
- The Google Calendar API gives developers access to Google Calendar data,
4
- allowing them to create their own applications that can read, write, and update
5
- calendar data. With the API, users can integrate their own calendar
6
- applications with Google Calendar, giving them the ability to manage their
7
- calendars in one place. The API also provides the ability to search for events
8
- and create new events.
3
+ The Google Calendar API lets you dip into the powerhouse of scheduling, allowing for the reading, creation, and manipulation of events and calendars directly from your applications. Through Pipedream, you can seamlessly integrate Google Calendar into a myriad of workflows, automating event management, syncing with other services, setting up custom reminders, or even collating data for reporting. The key here is to streamline your calendar-related processes, ensuring that your time management is as efficient and automated as possible.
9
4
 
10
- Possible applications that could be built using the Google Calendar API
11
- include:
5
+ # Example Use Cases
12
6
 
13
- - A calendar application that integrates with Google Calendar, allowing users
14
- to manage their calendars in one place.
15
- - A calendar application that allows users to search for events and create new
16
- events.
17
- - A to-do list application that integrates with Google Calendar, allowing users
18
- to see their tasks and events in one place.
19
- - A reminder application that uses Google Calendar data to remind users of
20
- upcoming events.
7
+ - **Event Synchronization Across Platforms**: Create a workflow that listens for new events on Google Calendar and replicates them on other platforms like Outlook or Apple Calendar. This ensures your schedule remains in sync across different services.
8
+
9
+ - **Automated Meeting Prep**: Set up a Pipedream workflow that triggers a sequence of events whenever a new meeting is scheduled on Google Calendar. This could send out reminder emails with attached agendas to participants, book conference rooms through your office management system, or check the attendees' LinkedIn profiles to provide you with recent updates about them before the meeting.
10
+
11
+ - **Dynamic Event Response**: Implement a workflow that reacts to updated or canceled events on Google Calendar. On event cancellation, it could trigger a message on Slack to inform team members and update project management tools to reschedule associated tasks. When an event is updated, it can automatically adjust reminders or send out new invites if the attendee list changes.
@@ -1,10 +1,11 @@
1
1
  import googleCalendar from "../../google_calendar.app.mjs";
2
+ import createEventCommon from "../common/create-event-common.mjs";
2
3
 
3
4
  export default {
4
- key: "google_calendar-update-event-attendees",
5
- name: "Update attendees of an event",
6
- description: "Update attendees of an existing event. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
7
- version: "0.1.4",
5
+ key: "google_calendar-add-attendees-to-event",
6
+ name: "Add Attendees To Event",
7
+ description: "Add attendees to an existing event. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
8
+ version: "0.0.1",
8
9
  type: "action",
9
10
  props: {
10
11
  googleCalendar,
@@ -25,8 +26,8 @@ export default {
25
26
  },
26
27
  attendees: {
27
28
  label: "Attendees",
28
- type: "string[]",
29
- description: "Enter an array of email addresses for any attendees",
29
+ type: "string",
30
+ description: "Enter either an array or a comma separated list of email addresses of attendees",
30
31
  },
31
32
  sendUpdates: {
32
33
  propDefinition: [
@@ -34,35 +35,20 @@ export default {
34
35
  "sendUpdates",
35
36
  ],
36
37
  },
37
- sendNotifications: {
38
- propDefinition: [
39
- googleCalendar,
40
- "sendNotifications",
41
- ],
42
- },
43
- },
44
- methods: {
45
- formatAttendees(selectedAttendees) {
46
- let attendees = [];
47
- if (selectedAttendees && Array.isArray(selectedAttendees)) {
48
- attendees = selectedAttendees.map((email) => ({
49
- email,
50
- }));
51
- }
52
- return attendees;
53
- },
54
38
  },
55
39
  async run({ $ }) {
56
- const updatedAttendees = this.formatAttendees(this.attendees);
40
+ const updatedAttendees = createEventCommon.methods.formatAttendees(this.attendees);
57
41
  const currentEvent = await this.googleCalendar.getEvent({
58
42
  eventId: this.eventId,
59
43
  calendarId: this.calendarId,
60
44
  });
45
+ if (currentEvent?.attendees && currentEvent.attendees.length) {
46
+ updatedAttendees.push(...currentEvent.attendees);
47
+ }
61
48
  const response = await this.googleCalendar.updateEvent({
62
49
  calendarId: this.calendarId,
63
50
  eventId: this.eventId,
64
51
  sendUpdates: this.sendUpdates,
65
- sendNotifications: this.sendNotifications,
66
52
  requestBody: {
67
53
  ...currentEvent,
68
54
  attendees: updatedAttendees,
@@ -1,4 +1,5 @@
1
- import googleCalendar from "../../google_calendar.app.mjs";
1
+ import { ConfigurationError } from "@pipedream/platform";
2
+ import constants from "../../common/constants.mjs";
2
3
 
3
4
  export default {
4
5
  props: ({ isUpdate }) => (
@@ -9,6 +10,18 @@ export default {
9
10
  description: "Enter a title for the event, (e.g., `My event`)",
10
11
  optional: true,
11
12
  },
13
+ eventStartDate: {
14
+ label: "Event Start Date",
15
+ type: "string",
16
+ description: "For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): `yyyy-mm-ddThh:mm:ss+01:00`. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
17
+ optional: isUpdate,
18
+ },
19
+ eventEndDate: {
20
+ label: "Event End Date",
21
+ type: "string",
22
+ description: "For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): `yyyy-mm-ddThh:mm:ss+01:00`. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
23
+ optional: isUpdate,
24
+ },
12
25
  location: {
13
26
  label: "Event Location",
14
27
  type: "string",
@@ -23,45 +36,38 @@ export default {
23
36
  },
24
37
  attendees: {
25
38
  label: "Attendees",
26
- type: "string[]",
27
- description: "Enter an array of email addresses for any attendees",
39
+ type: "string",
40
+ description: "Enter either an array or a comma separated list of email addresses of attendees",
28
41
  optional: true,
29
42
  },
30
- eventStartDate: {
31
- label: "Event Start Date",
43
+ repeatFrequency: {
32
44
  type: "string",
33
- description: "For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): `yyyy-mm-ddThh:mm:ss+01:00`. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
34
- optional: isUpdate,
35
- },
36
- eventEndDate: {
37
- label: "Event End Date",
38
- type: "string",
39
- description: "For all-day events, enter the Event day in the format `yyyy-mm-dd`. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): `yyyy-mm-ddThh:mm:ss+01:00`. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
40
- optional: isUpdate,
41
- },
42
- recurrence: {
43
- label: "Recurrence",
44
- type: "string[]",
45
- description: "Recurrence rule(s) for the event. For example, `RRULE:FREQ=DAILY;INTERVAL=2` means once every two days, `RRULE:FREQ=YEARLY` means annually.\nYou can combine multiple recurrence rules. [See the documentation](https://developers.google.com/calendar/api/concepts/events-calendars#recurrence_rule)",
45
+ label: "Repeat Frequency",
46
+ description: "Select a frequency to make this event repeating",
46
47
  optional: true,
48
+ options: Object.keys(constants.REPEAT_FREQUENCIES),
49
+ reloadProps: true,
47
50
  },
48
- timeZone: {
49
- propDefinition: [
50
- googleCalendar,
51
- "timeZone",
52
- ],
51
+ repeatInterval: {
52
+ type: "integer",
53
+ label: "Repeat Interval",
54
+ description: "Enter 1 to \"repeat every day\", enter 2 to \"repeat every other day\", etc. Defaults to 1.",
55
+ optional: true,
56
+ hidden: true,
53
57
  },
54
- sendUpdates: {
55
- propDefinition: [
56
- googleCalendar,
57
- "sendUpdates",
58
- ],
58
+ repeatUntil: {
59
+ type: "string",
60
+ label: "Repeat Until",
61
+ description: "The event will repeat only until this date, if set",
62
+ optional: true,
63
+ hidden: true,
59
64
  },
60
- sendNotifications: {
61
- propDefinition: [
62
- googleCalendar,
63
- "sendNotifications",
64
- ],
65
+ repeatTimes: {
66
+ type: "integer",
67
+ label: "Repeat How Many Times?",
68
+ description: "Limit the number of times this event will occur",
69
+ optional: true,
70
+ hidden: true,
65
71
  },
66
72
  }
67
73
  ),
@@ -86,6 +92,11 @@ export default {
86
92
  * ]
87
93
  */
88
94
  let attendees = [];
95
+ if (typeof selectedAttendees === "string") {
96
+ selectedAttendees = selectedAttendees.includes("[") && selectedAttendees.includes("]")
97
+ ? JSON.parse(selectedAttendees)
98
+ : selectedAttendees.replaceAll(" ", "").split(",");
99
+ }
89
100
  if (selectedAttendees && Array.isArray(selectedAttendees)) {
90
101
  attendees = selectedAttendees.map((email) => ({
91
102
  email,
@@ -119,5 +130,37 @@ export default {
119
130
  timeZone,
120
131
  };
121
132
  },
133
+ /**
134
+ * Format recurrence prop
135
+ * https://developers.google.com/calendar/api/concepts/events-calendars#recurrence_rule
136
+ */
137
+ formatRecurrence({
138
+ repeatFrequency,
139
+ repeatInterval,
140
+ repeatTimes,
141
+ repeatUntil,
142
+ }) {
143
+ if (!repeatFrequency) {
144
+ return;
145
+ }
146
+ if (repeatTimes && repeatUntil) {
147
+ throw new ConfigurationError("Only one of `Repeat Until` or Repeat `How Many Times` may be entered");
148
+ }
149
+
150
+ let recurrence = `RRULE:FREQ=${repeatFrequency}`;
151
+ if (repeatInterval) {
152
+ recurrence = `${recurrence};INTERVAL=${repeatInterval}`;
153
+ }
154
+ if (repeatTimes) {
155
+ recurrence = `${recurrence};COUNT=${repeatTimes}`;
156
+ }
157
+ if (repeatUntil) {
158
+ const date = repeatUntil.slice(0, 10).replaceAll("-", "");
159
+ recurrence = `${recurrence};UNTIL=${date}`;
160
+ }
161
+ return [
162
+ recurrence,
163
+ ];
164
+ },
122
165
  },
123
166
  };
@@ -1,48 +1,145 @@
1
1
  import googleCalendar from "../../google_calendar.app.mjs";
2
2
  import createEventCommon from "../common/create-event-common.mjs";
3
3
  import { v4 as uuidv4 } from "uuid";
4
+ import constants from "../../common/constants.mjs";
4
5
 
5
6
  export default {
6
7
  key: "google_calendar-create-event",
7
8
  name: "Create Event",
8
- description: "Create an event to the Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/insert)",
9
- version: "0.2.2",
9
+ description: "Create an event in a Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/insert)",
10
+ version: "0.2.3",
10
11
  type: "action",
11
12
  props: {
12
13
  googleCalendar,
14
+ addType: {
15
+ type: "string",
16
+ label: "Type of Add",
17
+ description: "Whether to perform a quick add or a detailed event",
18
+ options: [
19
+ {
20
+ label: "Add Detailed Event",
21
+ value: "detailed",
22
+ },
23
+ {
24
+ label: "Add Quick Event using Natural Language",
25
+ value: "quick",
26
+ },
27
+ ],
28
+ reloadProps: true,
29
+ },
13
30
  calendarId: {
14
31
  propDefinition: [
15
32
  googleCalendar,
16
33
  "calendarId",
17
34
  ],
18
35
  },
19
- createMeetRoom: {
20
- label: "Create Meet Room",
21
- description: "Create a Google Meet room for this event.",
22
- type: "boolean",
36
+ text: {
37
+ type: "string",
38
+ label: "Describe Event",
39
+ description: "Write a plain text description of event, and Google will parse this string to create the event. eg. 'Meet with Michael 10am 7/22/2024' or 'Call Sarah at 1:30PM on Friday'",
40
+ hidden: true,
41
+ },
42
+ summary: {
43
+ label: "Event Title",
44
+ type: "string",
45
+ description: "Enter a title for the event, (e.g., `My event`)",
23
46
  optional: true,
47
+ hidden: true,
24
48
  },
25
- ...createEventCommon.props({
26
- isUpdate: false,
27
- }),
28
49
  colorId: {
29
50
  propDefinition: [
30
51
  googleCalendar,
31
52
  "colorId",
32
53
  ],
54
+ hidden: true,
55
+ },
56
+ timeZone: {
57
+ propDefinition: [
58
+ googleCalendar,
59
+ "timeZone",
60
+ ],
61
+ hidden: true,
62
+ },
63
+ sendUpdates: {
64
+ propDefinition: [
65
+ googleCalendar,
66
+ "sendUpdates",
67
+ ],
68
+ hidden: true,
69
+ },
70
+ createMeetRoom: {
71
+ type: "boolean",
72
+ label: "Create Meet Room",
73
+ description: "Whether to create a Google Meet room for this event.",
74
+ optional: true,
75
+ hidden: true,
76
+ },
77
+ visibility: {
78
+ type: "string",
79
+ label: "Visibility",
80
+ description: "Visibility of the event",
81
+ options: [
82
+ "default",
83
+ "public",
84
+ "private",
85
+ "confidential",
86
+ ],
87
+ optional: true,
88
+ hidden: true,
33
89
  },
34
90
  },
91
+ async additionalProps(props) {
92
+ const isDetailed = this.addType === "detailed";
93
+
94
+ props.text.hidden = isDetailed;
95
+
96
+ props.summary.hidden = !isDetailed;
97
+ props.colorId.hidden = !isDetailed;
98
+ props.timeZone.hidden = !isDetailed;
99
+ props.sendUpdates.hidden = !isDetailed;
100
+ props.createMeetRoom.hidden = !isDetailed;
101
+ props.visibility.hidden = !isDetailed;
102
+
103
+ if (isDetailed) {
104
+ const commonProps = createEventCommon.props({
105
+ isUpdate: false,
106
+ });
107
+ if (this.repeatFrequency) {
108
+ const frequency = constants.REPEAT_FREQUENCIES[this.repeatFrequency];
109
+ commonProps.repeatInterval.description = `Enter 1 to "repeat every ${frequency}", enter 2 to "repeat every other ${frequency}", etc. Defaults to 1.`;
110
+ commonProps.repeatInterval.hidden = !this.repeatFrequency;
111
+ commonProps.repeatUntil.hidden = !this.repeatFrequency;
112
+ commonProps.repeatTimes.hidden = !this.repeatFrequency;
113
+ }
114
+ return commonProps;
115
+ }
116
+ return {};
117
+ },
35
118
  methods: {
36
119
  ...createEventCommon.methods,
37
120
  },
38
121
  async run({ $ }) {
122
+ if (this.addType === "quick") {
123
+ const quickResponse = await this.googleCalendar.quickAddEvent({
124
+ calendarId: this.calendarId,
125
+ text: this.text,
126
+ });
127
+ $.export("$summary", `Successfully added a quick event: "${quickResponse.id}"`);
128
+ return quickResponse;
129
+ }
130
+
39
131
  const timeZone = await this.getTimeZone(this.timeZone);
40
132
  const attendees = this.formatAttendees(this.attendees);
133
+ const recurrence = this.formatRecurrence({
134
+ repeatFrequency: this.repeatFrequency,
135
+ repeatInterval: this.repeatInterval,
136
+ repeatTimes: this.repeatTimes,
137
+ repeatUntil: this.repeatUntil,
138
+ });
41
139
 
42
140
  const data = {
43
141
  calendarId: this.calendarId,
44
142
  sendUpdates: this.sendUpdates,
45
- sendNotifications: this.sendNotifications,
46
143
  resource: {
47
144
  summary: this.summary,
48
145
  location: this.location,
@@ -55,9 +152,10 @@ export default {
55
152
  date: this.eventEndDate,
56
153
  timeZone,
57
154
  }),
58
- recurrence: this.recurrence,
155
+ recurrence,
59
156
  attendees,
60
157
  colorId: this.colorId,
158
+ visibility: this.visibility,
61
159
  },
62
160
  };
63
161
 
@@ -75,7 +173,7 @@ export default {
75
173
 
76
174
  const response = await this.googleCalendar.createEvent(data);
77
175
 
78
- $.export("$summary", `Successfully created event: "${response.id}"`);
176
+ $.export("$summary", `Successfully created event with ID: "${response.id}"`);
79
177
 
80
178
  return response;
81
179
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-delete-event",
5
5
  name: "Delete an Event",
6
- description: "Delete an event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#delete)",
7
- version: "0.1.4",
6
+ description: "Delete an event from a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#delete)",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-get-calendar",
5
5
  name: "Retrieve Calendar Details",
6
6
  description: "Retrieve calendar details of a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendars.html#get)",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-get-event",
5
5
  name: "Retrieve Event Details",
6
6
  description: "Retrieve event details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#get)",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-list-calendars",
5
5
  name: "List Calendars",
6
6
  description: "Retrieve a list of calendars from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendarlist.html#list)",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -12,7 +12,9 @@ export default {
12
12
  async run({ $ }) {
13
13
  const { items: calendars } = await this.googleCalendar.listCalendars();
14
14
 
15
- $.export("$summary", `Successfully retrieved ${calendars.length} calendar(s)`);
15
+ $.export("$summary", `Successfully retrieved ${calendars.length} calendar${calendars.length === 1
16
+ ? ""
17
+ : "s"}`);
16
18
 
17
19
  return calendars;
18
20
  },
@@ -1,11 +1,12 @@
1
1
  import googleCalendar from "../../google_calendar.app.mjs";
2
2
  import utils from "../../common/utils.mjs";
3
+ import { ConfigurationError } from "@pipedream/platform";
3
4
 
4
5
  export default {
5
6
  key: "google_calendar-list-events",
6
7
  name: "List Events",
7
8
  description: "Retrieve a list of event from the Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/list)",
8
- version: "0.0.5",
9
+ version: "0.0.6",
9
10
  type: "action",
10
11
  props: {
11
12
  googleCalendar,
@@ -40,12 +41,6 @@ export default {
40
41
  ],
41
42
  default: "",
42
43
  },
43
- pageToken: {
44
- propDefinition: [
45
- googleCalendar,
46
- "pageToken",
47
- ],
48
- },
49
44
  privateExtendedProperty: {
50
45
  propDefinition: [
51
46
  googleCalendar,
@@ -82,12 +77,6 @@ export default {
82
77
  "singleEvents",
83
78
  ],
84
79
  },
85
- syncToken: {
86
- propDefinition: [
87
- googleCalendar,
88
- "syncToken",
89
- ],
90
- },
91
80
  timeMax: {
92
81
  propDefinition: [
93
82
  googleCalendar,
@@ -120,30 +109,44 @@ export default {
120
109
  },
121
110
  },
122
111
  async run({ $ }) {
112
+ if (this.orderBy === "startTime" && !this.singleEvents) {
113
+ throw new ConfigurationError("Single Events must be `true` to order by `startTime`");
114
+ }
115
+
123
116
  const args = utils.filterEmptyValues({
124
117
  calendarId: this.calendarId,
125
118
  iCalUID: this.iCalUID,
126
119
  maxAttendees: this.maxAttendees,
127
- maxResults: this.maxResults,
128
120
  orderBy: this.orderBy || undefined,
129
- pageToken: this.pageToken,
130
121
  privateExtendedProperty: this.privateExtendedProperty,
131
122
  q: this.q,
132
123
  sharedExtendedProperty: this.sharedExtendedProperty,
133
124
  showDeleted: this.showDeleted,
134
125
  showHiddenInvitations: this.showHiddenInvitations,
135
126
  singleEvents: this.singleEvents,
136
- syncToken: this.syncToken,
137
127
  timeMax: this.timeMax,
138
128
  timeMin: this.timeMin,
139
129
  timeZone: this.timeZone,
140
130
  updatedMin: this.updatedMin,
141
131
  eventTypes: this.eventTypes,
142
132
  });
143
- const response = await this.googleCalendar.listEvents(args);
144
133
 
145
- $.export("$summary", `Successfully retrieved ${response.items.length} event(s)`);
134
+ const events = [];
135
+ do {
136
+ const {
137
+ items, nextPageToken,
138
+ } = await this.googleCalendar.listEvents(args);
139
+ events.push(...items);
140
+ args.pageToken = nextPageToken;
141
+ } while (args.pageToken && (!this.maxResults || events.length < this.maxResults));
142
+ if (events.length > this.maxResults) {
143
+ events.length = this.maxResults;
144
+ }
145
+
146
+ $.export("$summary", `Successfully retrieved ${events.length} event${events.length === 1
147
+ ? ""
148
+ : "s"}`);
146
149
 
147
- return response;
150
+ return events;
148
151
  },
149
152
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-query-free-busy-calendars",
5
5
  name: "Retrieve Free/Busy Calendar Details",
6
6
  description: "Retrieve free/busy calendar details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Freebusy.html#query)",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -1,10 +1,11 @@
1
1
  import googleCalendar from "../../google_calendar.app.mjs";
2
+ import createEventCommon from "../common/create-event-common.mjs";
2
3
 
3
4
  export default {
4
5
  key: "google_calendar-quick-add-event",
5
6
  name: "Add Quick Event",
6
7
  description: "Create a quick event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#quickAdd)",
7
- version: "0.1.4",
8
+ version: "0.1.5",
8
9
  type: "action",
9
10
  props: {
10
11
  googleCalendar,
@@ -15,9 +16,15 @@ export default {
15
16
  ],
16
17
  },
17
18
  text: {
18
- label: "Event Title",
19
19
  type: "string",
20
- description: "Enter a title for the event, (e.g., `My event`)",
20
+ label: "Describe Event",
21
+ description: "Write a plain text description of event, and Google will parse this string to create the event. eg. 'Meet with Michael 10am 7/22/2024' or 'Call Sarah at 1:30PM on Friday'",
22
+ },
23
+ attendees: {
24
+ label: "Attendees",
25
+ type: "string",
26
+ description: "Enter either an array or a comma separated list of email addresses of attendees",
27
+ optional: true,
21
28
  },
22
29
  },
23
30
  async run({ $ }) {
@@ -26,6 +33,18 @@ export default {
26
33
  text: this.text,
27
34
  });
28
35
 
36
+ if (this.attendees) {
37
+ const update = await this.googleCalendar.updateEvent({
38
+ calendarId: this.calendarId,
39
+ eventId: response.id,
40
+ requestBody: {
41
+ ...response,
42
+ attendees: createEventCommon.methods.formatAttendees(this.attendees),
43
+ },
44
+ });
45
+ response.attendees = update.attendees;
46
+ }
47
+
29
48
  $.export("$summary", `Successfully added a quick event: "${response.id}"`);
30
49
 
31
50
  return response;