@pipedream/google_calendar 0.3.11 → 0.3.13

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.
package/README.md CHANGED
@@ -18,5 +18,3 @@ include:
18
18
  to see their tasks and events in one place.
19
19
  - A reminder application that uses Google Calendar data to remind users of
20
20
  upcoming events.
21
-
22
- Pipedream's use and transfer of information received from Google APIs to any other app will adhere to the [Google API Services User Data Policy](https://developers.google.com/terms/api-services-user-data-policy#additional_requirements_for_specific_api_scopes), including the Limited Use requirements.
@@ -0,0 +1,117 @@
1
+ import googleCalendar from "../../google_calendar.app.mjs";
2
+
3
+ export default {
4
+ props: ({ isUpdate }) => (
5
+ {
6
+ summary: {
7
+ label: "Event Title",
8
+ type: "string",
9
+ description: "Enter a title for the event, (e.g., `My event`)",
10
+ optional: true,
11
+ },
12
+ location: {
13
+ label: "Event Location",
14
+ type: "string",
15
+ description: "Specify the location of the event",
16
+ optional: true,
17
+ },
18
+ description: {
19
+ label: "Event Description",
20
+ type: "string",
21
+ description: "Enter a description for the event",
22
+ optional: true,
23
+ },
24
+ attendees: {
25
+ label: "Attendees",
26
+ type: "string[]",
27
+ description: "Enter an array of email addresses for any attendees",
28
+ optional: true,
29
+ },
30
+ eventStartDate: {
31
+ label: "Event Start Date",
32
+ 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
+ timeZone: {
43
+ propDefinition: [
44
+ googleCalendar,
45
+ "timeZone",
46
+ ],
47
+ },
48
+ sendUpdates: {
49
+ propDefinition: [
50
+ googleCalendar,
51
+ "sendUpdates",
52
+ ],
53
+ },
54
+ sendNotifications: {
55
+ propDefinition: [
56
+ googleCalendar,
57
+ "sendNotifications",
58
+ ],
59
+ },
60
+ }
61
+ ),
62
+ methods: {
63
+ async getTimeZone(selectedTimeZone) {
64
+ /**
65
+ * Based on the IINA Time Zone DB
66
+ * http://www.iana.org/time-zones
67
+ */
68
+ const { value: timeZone } = selectedTimeZone ?? await this.googleCalendar.getSettings({
69
+ setting: "timezone",
70
+ });
71
+ return timeZone;
72
+ },
73
+ formatAttendees(selectedAttendees, currentAttendees) {
74
+ /**
75
+ * Format for the attendees
76
+ *
77
+ * [
78
+ * { "email": "lpage@example.com",},
79
+ * { "email": "sbrin@example.com",},
80
+ * ]
81
+ */
82
+ let attendees = [];
83
+ if (selectedAttendees && Array.isArray(selectedAttendees)) {
84
+ attendees = selectedAttendees.map((email) => ({
85
+ email,
86
+ }));
87
+ } else if (currentAttendees && Array.isArray(currentAttendees)) {
88
+ return currentAttendees.map((attendee) => ({
89
+ email: attendee.email,
90
+ }));
91
+ }
92
+ return attendees;
93
+ },
94
+ checkDateOrDateTimeInput(date, type) {
95
+ if (type === "date") {
96
+ return date && date.length <= 10
97
+ ? date
98
+ : undefined;
99
+ }
100
+ if (type === "dateTime") {
101
+ return date && date.length > 10
102
+ ? date
103
+ : undefined;
104
+ }
105
+ },
106
+ getDateParam({
107
+ date,
108
+ timeZone,
109
+ }) {
110
+ return {
111
+ date: this.checkDateOrDateTimeInput(date, "date"),
112
+ dateTime: this.checkDateOrDateTimeInput(date, "dateTime"),
113
+ timeZone,
114
+ };
115
+ },
116
+ },
117
+ };
@@ -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-create-event",
5
6
  name: "Create Event",
6
- description: "Create an event to the Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#insert)",
7
- version: "0.1.5",
7
+ description: "Create an event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#insert)",
8
+ version: "0.1.6",
8
9
  type: "action",
9
10
  props: {
10
11
  googleCalendar,
@@ -14,114 +15,38 @@ export default {
14
15
  "calendarId",
15
16
  ],
16
17
  },
17
- summary: {
18
- label: "Event Title",
19
- type: "string",
20
- description: "Enter a title for the event",
21
- optional: true,
22
- },
23
- location: {
24
- label: "Event Location",
25
- type: "string",
26
- description: "Specify the location of the event",
27
- optional: true,
28
- },
29
- description: {
30
- label: "Event Description",
31
- type: "string",
32
- description: "Enter a description for the event",
33
- optional: true,
34
- },
35
- attendees: {
36
- label: "Attendees",
37
- type: "string[]",
38
- description: "Enter an array of email addresses for any attendees",
39
- optional: true,
40
- },
41
- eventStartDate: {
42
- label: "Event Date",
43
- type: "string",
44
- 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.",
45
- },
46
- eventEndDate: {
47
- label: "Event End Date",
48
- type: "string",
49
- 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.",
50
- },
51
- sendUpdates: {
52
- label: "Send Updates",
53
- type: "string",
54
- description: "Configure whether to send notifications about the creation of the new event",
55
- optional: true,
56
- options: [
57
- "all",
58
- "externalOnly",
59
- "none",
60
- ],
61
- },
62
- timeZone: {
63
- propDefinition: [
64
- googleCalendar,
65
- "timeZone",
66
- ],
67
- },
18
+ ...createEventCommon.props({
19
+ isUpdate: false,
20
+ }),
21
+ },
22
+ methods: {
23
+ ...createEventCommon.methods,
68
24
  },
69
25
  async run({ $ }) {
70
- /**
71
- * Based on the IINA Time Zone DB
72
- * http://www.iana.org/time-zones
73
- */
74
- const { value: timeZone } = this.timeZone ?? await this.googleCalendar.getSettings({
75
- setting: "timezone",
76
- });
77
-
78
- /**
79
- * Format for the attendees
80
- *
81
- * [
82
- * { "email": "lpage@example.com",},
83
- * { "email": "sbrin@example.com",},
84
- * ]
85
- */
86
-
87
- let attendees = [];
88
-
89
- if (this.attendees && Array.isArray(this.attendees)) {
90
- attendees = this.attendees.map((email) => ({
91
- email,
92
- }));
93
- }
26
+ const timeZone = this.getTimeZone(this.timeZone);
27
+ const attendees = this.formatAttendees(this.attendees);
94
28
 
95
29
  const response = await this.googleCalendar.createEvent({
96
30
  calendarId: this.calendarId,
97
31
  sendUpdates: this.sendUpdates,
32
+ sendNotifications: this.sendNotifications,
98
33
  resource: {
99
34
  summary: this.summary,
100
35
  location: this.location,
101
36
  description: this.description,
102
- start: {
103
- date: this.eventStartDate.length <= 10
104
- ? this.eventStartDate
105
- : undefined,
106
- dateTime: this.eventStartDate.length > 10
107
- ? this.eventStartDate
108
- : undefined,
37
+ start: this.getDateParam({
38
+ date: this.eventStartDate,
109
39
  timeZone,
110
- },
111
- end: {
112
- date: this.eventEndDate.length <= 10
113
- ? this.eventEndDate
114
- : undefined,
115
- dateTime: this.eventEndDate.length > 10
116
- ? this.eventEndDate
117
- : undefined,
40
+ }),
41
+ end: this.getDateParam({
42
+ date: this.eventEndDate,
118
43
  timeZone,
119
- },
44
+ }),
120
45
  attendees,
121
46
  },
122
47
  });
123
48
 
124
- $.export("$summary", `Successfully created event ${response.id}`);
49
+ $.export("$summary", `Successfully created event: "${response.id}"`);
125
50
 
126
51
  return response;
127
52
  },
@@ -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 docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#delete)",
7
- version: "0.1.1",
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.2",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -28,9 +28,10 @@ export default {
28
28
  const response = await this.googleCalendar.deleteEvent({
29
29
  calendarId: this.calendarId,
30
30
  eventId: this.eventId,
31
+ returnOnlyData: false,
31
32
  });
32
33
 
33
- $.export("$summary", `Successfully deleted event ${response}`);
34
+ $.export("$summary", `Successfully deleted event: "${this.eventId}"`);
34
35
 
35
36
  return response;
36
37
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-get-calendar",
5
5
  name: "Retrieve Calendar Details",
6
- description: "Retrieve Calendar details of a Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendars.html#get)",
7
- version: "0.1.2",
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.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -20,7 +20,7 @@ export default {
20
20
  calendarId: this.calendarId,
21
21
  });
22
22
 
23
- $.export("$summary", `Successfully retrieved calendar ${response.id}`);
23
+ $.export("$summary", `Successfully retrieved calendar: "${response.id}"`);
24
24
 
25
25
  return response;
26
26
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-get-event",
5
5
  name: "Retrieve Event Details",
6
- description: "Retrieve event details from the Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#get)",
7
- version: "0.1.2",
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.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -30,7 +30,7 @@ export default {
30
30
  eventId: this.eventId,
31
31
  });
32
32
 
33
- $.export("$summary", `Successfully retrieved event ${response.id}`);
33
+ $.export("$summary", `Successfully retrieved event: "${response.id}"`);
34
34
 
35
35
  return response;
36
36
  },
@@ -2,9 +2,9 @@ import googleCalendar from "../../google_calendar.app.mjs";
2
2
 
3
3
  export default {
4
4
  key: "google_calendar-list-calendars",
5
- name: "List calendars from user account",
6
- description: "Retrieve calendars from the user account. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendarlist.html#list)",
7
- version: "0.1.2",
5
+ name: "List Calendars",
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.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -12,7 +12,7 @@ export default {
12
12
  async run({ $ }) {
13
13
  const { items: calendars } = await this.googleCalendar.listCalendars();
14
14
 
15
- $.export("$summary", `Successfully listed ${calendars.length} calendars`);
15
+ $.export("$summary", `Successfully retrieved ${calendars.length} calendar(s)`);
16
16
 
17
17
  return calendars;
18
18
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-list-events",
5
5
  name: "List Events",
6
- description: "Retrieve a list of event from the Google Calendar. [See the docs here](https://developers.google.com/calendar/api/v3/reference/events/list)",
7
- version: "0.0.2",
6
+ description: "Retrieve a list of event from the Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/list)",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -3,31 +3,56 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-query-free-busy-calendars",
5
5
  name: "Retrieve Free/Busy Calendar Details",
6
- description: "Retrieve Free/Busy Calendar Details from the user account. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Freebusy.html#query)",
7
- version: "0.1.2",
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.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
11
+ calendarId: {
12
+ propDefinition: [
13
+ googleCalendar,
14
+ "calendarId",
15
+ ],
16
+ optional: false,
17
+ description: "Select a calendar to retrieve free/busy details",
18
+ },
11
19
  timeMin: {
12
- type: "string",
13
- label: "Time Min",
14
- description: "The start of the interval for the query formatted as per RFC3339. (eg. `2022-02-20T19:27:40Z`)",
20
+ propDefinition: [
21
+ googleCalendar,
22
+ "timeMin",
23
+ ],
24
+ optional: false,
15
25
  },
16
26
  timeMax: {
17
- type: "string",
18
- label: "Time Max",
19
- description: "The end of the interval for the query formatted as per RFC3339. (eg. `2022-04-20T19:27:40Z`)",
27
+ propDefinition: [
28
+ googleCalendar,
29
+ "timeMax",
30
+ ],
31
+ optional: false,
32
+ },
33
+ timeZone: {
34
+ propDefinition: [
35
+ googleCalendar,
36
+ "timeZone",
37
+ ],
38
+ description: "Specify the preferred time zone to be used on the response",
20
39
  },
21
40
  },
22
41
  async run({ $ }) {
23
- const response = await this.googleCalendar.queryFreebusy({
42
+ const response = await this.googleCalendar.queryFreeBusy({
24
43
  requestBody: {
25
44
  timeMin: this.timeMin,
26
45
  timeMax: this.timeMax,
46
+ timeZone: this.timeZone,
47
+ items: [
48
+ {
49
+ id: this.calendarId,
50
+ },
51
+ ],
27
52
  },
28
53
  });
29
54
 
30
- $.export("$summary", "Successfully retrieved free/busy calendar info");
55
+ $.export("$summary", `Successfully retrieved free/busy calendar details from ${this.timeMin} to ${this.timeMax}`);
31
56
 
32
57
  return response;
33
58
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-quick-add-event",
5
5
  name: "Add Quick Event",
6
- description: "Create an event to the Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#quickAdd)",
7
- version: "0.1.1",
6
+ 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.2",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -17,7 +17,7 @@ export default {
17
17
  text: {
18
18
  label: "Event Title",
19
19
  type: "string",
20
- description: "Enter static text (e.g., `hello world`) for the event name",
20
+ description: "Enter a title for the event, (e.g., `My event`)",
21
21
  },
22
22
  },
23
23
  async run({ $ }) {
@@ -26,7 +26,7 @@ export default {
26
26
  text: this.text,
27
27
  });
28
28
 
29
- $.export("$summary", `Successfully quick added event ${response.id}`);
29
+ $.export("$summary", `Successfully added a quick event: "${response.id}"`);
30
30
 
31
31
  return response;
32
32
  },
@@ -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-update-event",
5
6
  name: "Update Event",
6
- description: "Update an event to the Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
7
- version: "0.0.2",
7
+ description: "Update an event from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
8
+ version: "0.0.3",
8
9
  type: "action",
9
10
  props: {
10
11
  googleCalendar,
@@ -23,114 +24,44 @@ export default {
23
24
  }),
24
25
  ],
25
26
  },
26
- summary: {
27
- label: "Event Title",
28
- type: "string",
29
- description: "Enter static text (e.g., `hello world`) for the event name",
30
- optional: true,
31
- },
32
- location: {
33
- label: "Event Venue",
34
- type: "string",
35
- description: "Enter static text (e.g., `hello world`) for the event venue",
36
- optional: true,
37
- },
38
- description: {
39
- label: "Event Description",
40
- type: "string",
41
- description: "Enter detailed event description",
42
- optional: true,
43
- },
44
- attendees: {
45
- label: "Attendees",
46
- type: "string[]",
47
- description: "Enter the EmailId of the attendees",
48
- optional: true,
49
- },
50
- eventStartDate: {
51
- label: "Event Date",
52
- type: "string",
53
- 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.",
54
- },
55
- eventEndDate: {
56
- label: "Event End Date",
57
- type: "string",
58
- 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.",
59
- },
60
- sendUpdates: {
61
- label: "Send Updates",
62
- type: "string",
63
- description: "Whether to send notifications about the creation of the new event.",
64
- optional: true,
65
- options: [
66
- "all",
67
- "externalOnly",
68
- "none",
69
- ],
70
- },
71
- timeZone: {
72
- propDefinition: [
73
- googleCalendar,
74
- "timeZone",
75
- ],
76
- },
27
+ ...createEventCommon.props({
28
+ isUpdate: true,
29
+ }),
30
+ },
31
+ methods: {
32
+ ...createEventCommon.methods,
77
33
  },
78
34
  async run({ $ }) {
79
- /**
80
- * Based on the IINA Time Zone DB
81
- * http://www.iana.org/time-zones
82
- */
83
- const { value: timeZone } = this.timeZone ?? await this.googleCalendar.getSettings({
84
- setting: "timezone",
35
+ const currentEvent = await this.googleCalendar.getEvent({
36
+ calendarId: this.calendarId,
37
+ eventId: this.eventId,
85
38
  });
86
39
 
87
- /**
88
- * Format for the attendees
89
- *
90
- * [
91
- * { "email": "lpage@example.com",},
92
- * { "email": "sbrin@example.com",},
93
- * ]
94
- */
95
-
96
- let attendees = [];
97
-
98
- if (this.attendees && Array.isArray(this.attendees)) {
99
- attendees = this.attendees.map((email) => ({
100
- email,
101
- }));
102
- }
40
+ const timeZone = this.getTimeZone(this.timeZone || currentEvent.start.timeZone);
41
+ const attendees = this.formatAttendees(this.attendees, currentEvent.attendees);
103
42
 
104
43
  const response = await this.googleCalendar.updateEvent({
105
44
  calendarId: this.calendarId,
106
45
  eventId: this.eventId,
46
+ sendUpdates: this.sendUpdates,
47
+ sendNotifications: this.sendNotifications,
107
48
  requestBody: {
108
- summary: this.summary,
109
- location: this.location,
110
- description: this.description,
111
- start: {
112
- date: this.eventStartDate.length <= 10
113
- ? this.eventStartDate
114
- : undefined,
115
- dateTime: this.eventStartDate.length > 10
116
- ? this.eventStartDate
117
- : undefined,
118
- timeZone,
119
- },
120
- end: {
121
- date: this.eventEndDate.length <= 10
122
- ? this.eventEndDate
123
- : undefined,
124
- dateTime: this.eventEndDate.length > 10
125
- ? this.eventEndDate
126
- : undefined,
127
- timeZone,
128
- },
49
+ summary: this.summary || currentEvent.summary,
50
+ location: this.location || currentEvent.location,
51
+ description: this.description || currentEvent.description,
52
+ start: this.getDateParam({
53
+ date: this.eventStartDate || currentEvent.start.dateTime,
54
+ timeZone: timeZone || currentEvent.start.timeZone,
55
+ }),
56
+ end: this.getDateParam({
57
+ date: this.eventEndDate || currentEvent.end.dateTime,
58
+ timeZone: timeZone || currentEvent.end.timeZone,
59
+ }),
129
60
  attendees,
130
61
  },
131
62
  });
132
63
 
133
- $.export("$summary", `Successfully updated event ${response.id}`);
64
+ $.export("$summary", `Successfully updated event: "${response.id}"`);
134
65
 
135
66
  return response;
136
67
  },
@@ -3,8 +3,8 @@ import googleCalendar from "../../google_calendar.app.mjs";
3
3
  export default {
4
4
  key: "google_calendar-update-event-attendees",
5
5
  name: "Update attendees of an event",
6
- description: "Update attendees of an existing event. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
7
- version: "0.1.1",
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.2",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -24,51 +24,52 @@ export default {
24
24
  ],
25
25
  },
26
26
  attendees: {
27
- type: "string[]",
28
27
  label: "Attendees",
29
- description: "Array of selected email addresses or a comma separated list of email addresses of attendees. (eg. `a@domain.com,b@domain.com`)",
30
- async options() {
31
- const { attendees = [] } =
32
- await this.googleCalendar.getEvent({
33
- eventId: this.eventId,
34
- calendarId: this.calendarId,
35
- });
36
- return attendees.map(({ email }) => ({
37
- label: email,
38
- value: email,
28
+ type: "string[]",
29
+ description: "Enter an array of email addresses for any attendees",
30
+ },
31
+ sendUpdates: {
32
+ propDefinition: [
33
+ googleCalendar,
34
+ "sendUpdates",
35
+ ],
36
+ },
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,
39
50
  }));
40
- },
51
+ }
52
+ return attendees;
41
53
  },
42
54
  },
43
55
  async run({ $ }) {
44
- const { attendees = [] } = this;
45
- const {
46
- // eslint-disable-next-line no-unused-vars
47
- attendees: ignored,
48
- ...body
49
- } = await this.googleCalendar.getEvent({
56
+ const updatedAttendees = this.formatAttendees(this.attendees);
57
+ const currentEvent = await this.googleCalendar.getEvent({
50
58
  eventId: this.eventId,
51
59
  calendarId: this.calendarId,
52
60
  });
53
-
54
- const updatedAttendees =
55
- Array.isArray(this.attendees)
56
- ? attendees
57
- : attendees.split(",");
58
-
59
61
  const response = await this.googleCalendar.updateEvent({
60
62
  calendarId: this.calendarId,
61
63
  eventId: this.eventId,
64
+ sendUpdates: this.sendUpdates,
65
+ sendNotifications: this.sendNotifications,
62
66
  requestBody: {
63
- ...body,
64
- attendees: updatedAttendees.map((email) => ({
65
- email: email.trim(),
66
- })),
67
+ ...currentEvent,
68
+ attendees: updatedAttendees,
67
69
  },
68
70
  });
69
71
 
70
- $.export("$summary", `Successfully updated event attendees ${response.id}`);
71
-
72
+ $.export("$summary", `Successfully updated event attendees: "${response.id}"`);
72
73
  return response;
73
74
  },
74
75
  };
@@ -7,9 +7,9 @@ export default {
7
7
  app: "google_calendar",
8
8
  propDefinitions: {
9
9
  calendarId: {
10
- label: "Calendar",
10
+ label: "Calendar ID",
11
11
  type: "string",
12
- description: "Optionally select the calendar you'd like to use (defaults to the primary calendar for the logged-in user)",
12
+ description: "Optionally select the calendar, defaults to the primary calendar for the logged-in user",
13
13
  default: "primary",
14
14
  optional: true,
15
15
  async options({ prevContext }) {
@@ -33,9 +33,9 @@ export default {
33
33
  },
34
34
  },
35
35
  eventId: {
36
- label: "Event Name",
36
+ label: "Event ID",
37
37
  type: "string",
38
- description: "Event identifier. To retreive event Ids from a calender.",
38
+ description: "Select an event from Google Calendar.",
39
39
  async options({
40
40
  calendarId, prevContext,
41
41
  }) {
@@ -143,14 +143,14 @@ export default {
143
143
  type: "string",
144
144
  },
145
145
  timeMax: {
146
- label: "Max start time",
147
- description: "Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMin is set, timeMax must be greater than timeMin.",
146
+ label: "Max time",
147
+ description: "Upper bound (exclusive) for an event's time to filter by. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. Must be greater than Min Time.",
148
148
  optional: true,
149
149
  type: "string",
150
150
  },
151
151
  timeMin: {
152
- label: "Minimum end time",
153
- description: "Lower bound (exclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMax is set, timeMin must be smaller than timeMax.",
152
+ label: "Min time",
153
+ description: "Lower bound (exclusive) for an event's time to filter by. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. Must be smaller than Max Time.",
154
154
  optional: true,
155
155
  type: "string",
156
156
  },
@@ -244,6 +244,23 @@ export default {
244
244
  description: "The email address of a user or group, or the name of a domain, depending on the scope type. Omitted for type 'default'",
245
245
  optional: true,
246
246
  },
247
+ sendUpdates: {
248
+ label: "Send Updates",
249
+ type: "string",
250
+ description: "Configure whether to send notifications about the event",
251
+ optional: true,
252
+ options: [
253
+ "all",
254
+ "externalOnly",
255
+ "none",
256
+ ],
257
+ },
258
+ sendNotifications: {
259
+ label: "Send Notifications",
260
+ type: "boolean",
261
+ description: "Whether to send notifications about the event update",
262
+ optional: true,
263
+ },
247
264
  },
248
265
  methods: {
249
266
  _tokens() {
@@ -426,7 +443,7 @@ export default {
426
443
  args,
427
444
  });
428
445
  },
429
- async queryFreebusy(args = {}) {
446
+ async queryFreeBusy(args = {}) {
430
447
  return this.requestHandler({
431
448
  api: constants.API.FREEBUSY.NAME,
432
449
  method: constants.API.FREEBUSY.METHOD.QUERY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [
@@ -1,21 +1,26 @@
1
- import googleCalendar from "../google_calendar.app.mjs";
1
+ import googleCalendar from "../../google_calendar.app.mjs";
2
2
  import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3
3
 
4
4
  export default {
5
- props: {
6
- googleCalendar,
7
- calendarId: {
8
- propDefinition: [
9
- googleCalendar,
10
- "calendarId",
11
- ],
12
- },
13
- timer: {
14
- type: "$.interface.timer",
15
- default: {
16
- intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
5
+ props: ({ useCalendarId }) => {
6
+ const props = {
7
+ googleCalendar,
8
+ timer: {
9
+ type: "$.interface.timer",
10
+ default: {
11
+ intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
12
+ },
17
13
  },
18
- },
14
+ };
15
+ if (useCalendarId) {
16
+ props.calendarId = {
17
+ propDefinition: [
18
+ googleCalendar,
19
+ "calendarId",
20
+ ],
21
+ };
22
+ }
23
+ return props;
19
24
  },
20
25
  hooks: {
21
26
  async activate() {
@@ -1,15 +1,18 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-event-cancelled",
6
- // eslint-disable-next-line pipedream/source-name
7
- name: "Event Cancelled",
8
- // eslint-disable-next-line pipedream/source-description
9
- description: "Emits when an event is cancelled or deleted",
10
- version: "0.1.3",
6
+ name: "New Cancelled Event",
7
+ description: "Emit new event when a Google Calendar event is cancelled or deleted",
8
+ version: "0.1.4",
11
9
  type: "source",
12
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
+ },
13
16
  methods: {
14
17
  ...common.methods,
15
18
  getConfig({
@@ -1,15 +1,18 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-event-ended",
6
- // eslint-disable-next-line pipedream/source-name
7
- name: "Event Ended",
8
- // eslint-disable-next-line pipedream/source-description
9
- description: "Emits when an event ends",
10
- version: "0.1.3",
6
+ name: "New Ended Event",
7
+ description: "Emit new event when a Google Calendar event ends",
8
+ version: "0.1.4",
11
9
  type: "source",
12
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
+ },
13
16
  methods: {
14
17
  ...common.methods,
15
18
  getConfig({
@@ -1,15 +1,18 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-event-start",
6
- // eslint-disable-next-line pipedream/source-name
7
- name: "Event Start",
8
- // eslint-disable-next-line pipedream/source-description
9
- description: "Emits a specified time before an event starts",
10
- version: "0.1.3",
6
+ name: "New Event Start",
7
+ description: "Emit new event when the specified time before the Google Calendar event starts",
8
+ version: "0.1.4",
11
9
  type: "source",
12
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
+ },
13
16
  methods: {
14
17
  ...common.methods,
15
18
  getConfig({
@@ -1,26 +1,19 @@
1
- import googleCalendar from "../../google_calendar.app.mjs";
2
- import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
1
+ import common from "../common/common.mjs";
3
2
 
4
3
  export default {
5
4
  key: "google_calendar-new-calendar",
6
- name: "New Calendar",
7
- // eslint-disable-next-line pipedream/source-description
8
- description: "Emit an event when a calendar is created.",
9
- version: "0.1.3",
5
+ name: "New Calendar Created",
6
+ description: "Emit new event when a calendar is created.",
7
+ version: "0.1.4",
10
8
  type: "source",
11
9
  props: {
10
+ ...common.props({
11
+ useCalendarId: false,
12
+ }),
12
13
  db: "$.service.db",
13
- googleCalendar,
14
- timer: {
15
- type: "$.interface.timer",
16
- default: {
17
- intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
18
- },
19
- },
20
14
  },
21
15
  hooks: {
22
16
  async activate() {
23
- // get list of calendars
24
17
  const { items: calendars = [] } = await this.googleCalendar.listCalendars();
25
18
  this.emitNewCalendars(calendars);
26
19
  const calendarIds = calendars.map((item) => item.id);
@@ -1,13 +1,18 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-new-event",
6
- name: "New Event",
7
- description: "Emits when an event is created",
8
- version: "0.1.3",
6
+ name: "New Event Created",
7
+ description: "Emit new event when a Google Calendar event is created",
8
+ version: "0.1.4",
9
9
  type: "source",
10
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
+ },
11
16
  methods: {
12
17
  ...common.methods,
13
18
  getConfig({ past }) {
@@ -1,20 +1,20 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-new-event-search",
6
- // eslint-disable-next-line pipedream/source-name
7
- name: "Event Search",
8
- // eslint-disable-next-line pipedream/source-description
9
- description: "Emit when an event is created that matches a search",
10
- version: "0.1.3",
6
+ name: "New Event Matching a Search",
7
+ description: "Emit new event when a Google Calendar event is created that matches a search",
8
+ version: "0.1.4",
11
9
  type: "source",
12
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
13
11
  props: {
14
- ...common.props,
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
15
  q: {
16
16
  propDefinition: [
17
- common.props.googleCalendar,
17
+ common.props({}).googleCalendar,
18
18
  "q",
19
19
  ],
20
20
  },
@@ -1,14 +1,18 @@
1
- import common from "../common.mjs";
1
+ import common from "../common/common.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
5
  key: "google_calendar-new-or-updated-event",
6
- name: "New or Updated Event",
7
- // eslint-disable-next-line pipedream/source-description
8
- description: "Emits when an event is created or updated (except when it's cancelled)",
9
- version: "0.1.3",
6
+ name: "New Created or Updated Event",
7
+ description: "Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)",
8
+ version: "0.1.4",
10
9
  type: "source",
11
- dedupe: "unique", // Dedupe events based on the Google Calendar event ID
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props({
13
+ useCalendarId: true,
14
+ }),
15
+ },
12
16
  methods: {
13
17
  ...common.methods,
14
18
  getConfig({ past }) {
@@ -5,9 +5,9 @@ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
5
5
  export default {
6
6
  key: "google_calendar-new-or-updated-event-instant",
7
7
  type: "source",
8
- name: "New or Updated Event (Instant)",
9
- description: "Emit new calendar events when an event is created or updated (does not emit cancelled events)",
10
- version: "0.1.6",
8
+ name: "New Created or Updated Event (Instant)",
9
+ description: "Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)",
10
+ version: "0.1.8",
11
11
  dedupe: "unique",
12
12
  props: {
13
13
  googleCalendar,
@@ -18,13 +18,16 @@ export default {
18
18
  "calendarId",
19
19
  ],
20
20
  type: "string[]",
21
+ default: [
22
+ "primary",
23
+ ],
21
24
  label: "Calendars",
22
- description: "Select one or more calendars to watch",
25
+ description: "Select one or more calendars to watch (defaults to the primary calendar)",
23
26
  },
24
27
  newOnly: {
25
- label: "New events only?",
28
+ label: "Emit only for new events",
26
29
  type: "boolean",
27
- description: "Emit new events only, and not updates to existing events",
30
+ description: "Emit new events only, and not updates to existing events (defaults to `false`)",
28
31
  optional: true,
29
32
  default: false,
30
33
  },
@@ -2,15 +2,13 @@ import taskScheduler from "../../../pipedream/sources/new-scheduled-tasks/new-sc
2
2
  import googleCalendar from "../../google_calendar.app.mjs";
3
3
  import { axios } from "@pipedream/platform";
4
4
 
5
- const docLink = "https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source";
6
-
7
5
  export default {
8
6
  key: "google_calendar-upcoming-event-alert",
9
- // eslint-disable-next-line pipedream/source-name
10
- name: "Upcoming Event Alert",
11
- description: `Triggers based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler.
12
- [See here](${docLink}) for more information and instructions for connecting your Pipedream account.`,
13
- version: "0.0.2",
7
+ name: "New Upcoming Event Alert",
8
+ description: `Emit new event based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler.
9
+ [See the documentation](https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source)
10
+ for more information and instructions for connecting your Pipedream account.`,
11
+ version: "0.0.3",
14
12
  type: "source",
15
13
  props: {
16
14
  pipedream: taskScheduler.props.pipedream,