@pipedream/google_calendar 0.3.1 → 0.3.4
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/actions/create-event/create-event.mjs +128 -0
- package/actions/delete-event/delete-event.mjs +37 -0
- package/actions/get-calendar/get-calendar.mjs +27 -0
- package/actions/get-event/get-event.mjs +37 -0
- package/actions/list-calendars/list-calendars.mjs +19 -0
- package/actions/query-free-busy-calendars/query-free-busy-calendars.mjs +34 -0
- package/actions/quick-add-event/quick-add-event.mjs +33 -0
- package/actions/update-event-attendees/update-event-attendees.mjs +74 -0
- package/common/constants.mjs +83 -0
- package/google_calendar.app.mjs +456 -0
- package/package.json +22 -20
- package/sources/common.mjs +74 -0
- package/sources/event-cancelled/event-cancelled.mjs +29 -0
- package/sources/event-ended/event-ended.mjs +35 -0
- package/sources/event-start/event-start.mjs +35 -0
- package/sources/new-calendar/new-calendar.mjs +68 -0
- package/sources/new-event/new-event.mjs +27 -0
- package/sources/new-event-search/new-event-search.mjs +38 -0
- package/sources/new-or-updated-event/new-or-updated-event.mjs +39 -0
- package/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs +289 -0
- package/google_calendar.app.js +0 -154
- package/sources/event-cancelled/event-cancelled.js +0 -65
- package/sources/event-ended/event-ended.js +0 -68
- package/sources/event-search/new-event-search.js +0 -70
- package/sources/event-start/event-start.js +0 -68
- package/sources/new-calendar/new-calendar.js +0 -50
- package/sources/new-event/new-event.js +0 -65
- package/sources/new-or-updated-event/new-or-updated-event.js +0 -64
- package/sources/new-or-updated-event-instant/new-or-updated-event-instant.js +0 -200
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-create-event",
|
|
5
|
+
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.4",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
summary: {
|
|
18
|
+
label: "Event Title",
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Enter static text (e.g., `hello world`) for the event name",
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
location: {
|
|
24
|
+
label: "Event Venue",
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Enter static text (e.g., `hello world`) for the event venue",
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
description: {
|
|
30
|
+
label: "Event Description",
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Enter detailed event description",
|
|
33
|
+
optional: true,
|
|
34
|
+
},
|
|
35
|
+
attendees: {
|
|
36
|
+
label: "Attendees",
|
|
37
|
+
type: "string[]",
|
|
38
|
+
description: "Enter the EmailId of the 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: "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
|
+
},
|
|
68
|
+
},
|
|
69
|
+
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
|
+
}
|
|
94
|
+
|
|
95
|
+
const response = await this.googleCalendar.createEvent({
|
|
96
|
+
calendarId: this.calendarId,
|
|
97
|
+
sendUpdates: this.sendUpdates,
|
|
98
|
+
resource: {
|
|
99
|
+
summary: this.summary,
|
|
100
|
+
location: this.location,
|
|
101
|
+
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,
|
|
109
|
+
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,
|
|
118
|
+
timeZone,
|
|
119
|
+
},
|
|
120
|
+
attendees,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
$.export("$summary", `Successfully created event ${response.id}`);
|
|
125
|
+
|
|
126
|
+
return response;
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-delete-event",
|
|
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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
eventId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
googleCalendar,
|
|
20
|
+
"eventId",
|
|
21
|
+
(c) => ({
|
|
22
|
+
calendarId: c.calendarId,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
async run({ $ }) {
|
|
28
|
+
const response = await this.googleCalendar.deleteEvent({
|
|
29
|
+
calendarId: this.calendarId,
|
|
30
|
+
eventId: this.eventId,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
$.export("$summary", `Successfully deleted event ${response}`);
|
|
34
|
+
|
|
35
|
+
return response;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-get-calendar",
|
|
5
|
+
name: "Retreive Calendar Details",
|
|
6
|
+
description: "Retreive 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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const response = await this.googleCalendar.getCalendar({
|
|
20
|
+
calendarId: this.calendarId,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
$.export("$summary", `Successfully retreived calendar ${response.id}`);
|
|
24
|
+
|
|
25
|
+
return response;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-get-event",
|
|
5
|
+
name: "Retreive Event Details",
|
|
6
|
+
description: "Retreive 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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
eventId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
googleCalendar,
|
|
20
|
+
"eventId",
|
|
21
|
+
(c) => ({
|
|
22
|
+
calendarId: c.calendarId,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
async run({ $ }) {
|
|
28
|
+
const response = await this.googleCalendar.getEvent({
|
|
29
|
+
calendarId: this.calendarId,
|
|
30
|
+
eventId: this.eventId,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
$.export("$summary", `Successfully retreived event ${response.id}`);
|
|
34
|
+
|
|
35
|
+
return response;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-list-calendar",
|
|
5
|
+
name: "List calendars from user account",
|
|
6
|
+
description: "Retreive 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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
},
|
|
12
|
+
async run({ $ }) {
|
|
13
|
+
const { items: calendars } = await this.googleCalendar.listCalendars();
|
|
14
|
+
|
|
15
|
+
$.export("$summary", `Successfully listed ${calendars.length} calendars`);
|
|
16
|
+
|
|
17
|
+
return calendars;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-query-free-busy-calendars",
|
|
5
|
+
name: "Retreive Free/Busy Calendar Details",
|
|
6
|
+
description: "Retreive 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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
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`)",
|
|
15
|
+
},
|
|
16
|
+
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`)",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async run({ $ }) {
|
|
23
|
+
const response = await this.googleCalendar.queryFreebusy({
|
|
24
|
+
requestBody: {
|
|
25
|
+
timeMin: this.timeMin,
|
|
26
|
+
timeMax: this.timeMax,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", "Successfully retreived free/busy calendar info");
|
|
31
|
+
|
|
32
|
+
return response;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "google_calendar-quick-add-event",
|
|
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.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
label: "Event Title",
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Enter static text (e.g., `hello world`) for the event name",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
async run({ $ }) {
|
|
24
|
+
const response = await this.googleCalendar.quickAddEvent({
|
|
25
|
+
calendarId: this.calendarId,
|
|
26
|
+
text: this.text,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
$.export("$summary", `Successfully quick added event ${response.id}`);
|
|
30
|
+
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import googleCalendar from "../../google_calendar.app.mjs";
|
|
2
|
+
|
|
3
|
+
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 docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
googleCalendar,
|
|
11
|
+
calendarId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
googleCalendar,
|
|
14
|
+
"calendarId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
eventId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
googleCalendar,
|
|
20
|
+
"eventId",
|
|
21
|
+
(c) => ({
|
|
22
|
+
calendarId: c.calendarId,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
attendees: {
|
|
27
|
+
type: "string[]",
|
|
28
|
+
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,
|
|
39
|
+
}));
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
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({
|
|
50
|
+
eventId: this.eventId,
|
|
51
|
+
calendarId: this.calendarId,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const updatedAttendees =
|
|
55
|
+
Array.isArray(this.attendees)
|
|
56
|
+
? attendees
|
|
57
|
+
: attendees.split(",");
|
|
58
|
+
|
|
59
|
+
const response = await this.googleCalendar.updateEvent({
|
|
60
|
+
calendarId: this.calendarId,
|
|
61
|
+
eventId: this.eventId,
|
|
62
|
+
requestBody: {
|
|
63
|
+
...body,
|
|
64
|
+
attendees: updatedAttendees.map((email) => ({
|
|
65
|
+
email: email.trim(),
|
|
66
|
+
})),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
$.export("$summary", `Successfully updated event attendees ${response.id}`);
|
|
71
|
+
|
|
72
|
+
return response;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const API = {
|
|
2
|
+
ACL: {
|
|
3
|
+
NAME: "acl",
|
|
4
|
+
METHOD: {
|
|
5
|
+
DELETE: "delete",
|
|
6
|
+
GET: "get",
|
|
7
|
+
INSERT: "insert",
|
|
8
|
+
LIST: "list",
|
|
9
|
+
PATCH: "patch",
|
|
10
|
+
UPDATE: "update",
|
|
11
|
+
WATCH: "watch",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
CALENDARS: {
|
|
15
|
+
NAME: "calendars",
|
|
16
|
+
METHOD: {
|
|
17
|
+
CLEAR: "clear",
|
|
18
|
+
DELETE: "delete",
|
|
19
|
+
GET: "get",
|
|
20
|
+
INSERT: "insert",
|
|
21
|
+
PATCH: "patch",
|
|
22
|
+
UPDATE: "update",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
CALENDAR_LIST: {
|
|
26
|
+
NAME: "calendarList",
|
|
27
|
+
METHOD: {
|
|
28
|
+
DELETE: "delete",
|
|
29
|
+
GET: "get",
|
|
30
|
+
INSERT: "insert",
|
|
31
|
+
LIST: "list",
|
|
32
|
+
PATCH: "patch",
|
|
33
|
+
UPDATE: "update",
|
|
34
|
+
WATCH: "watch",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
CHANNELS: {
|
|
38
|
+
NAME: "channels",
|
|
39
|
+
METHOD: {
|
|
40
|
+
STOP: "stop",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
COLORS: {
|
|
44
|
+
NAME: "colors",
|
|
45
|
+
METHOD: {
|
|
46
|
+
GET: "get",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
EVENTS: {
|
|
50
|
+
NAME: "events",
|
|
51
|
+
METHOD: {
|
|
52
|
+
DELETE: "delete",
|
|
53
|
+
GET: "get",
|
|
54
|
+
IMPORT: "import",
|
|
55
|
+
INSERT: "insert",
|
|
56
|
+
INSTANCES: "instances",
|
|
57
|
+
LIST: "list",
|
|
58
|
+
MOVE: "move",
|
|
59
|
+
PATCH: "patch",
|
|
60
|
+
QUICK_ADD: "quickAdd",
|
|
61
|
+
UPDATE: "update",
|
|
62
|
+
WATCH: "watch",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
FREEBUSY: {
|
|
66
|
+
NAME: "freebusy",
|
|
67
|
+
METHOD: {
|
|
68
|
+
QUERY: "query",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
SETTINGS: {
|
|
72
|
+
NAME: "settings",
|
|
73
|
+
METHOD: {
|
|
74
|
+
GET: "get",
|
|
75
|
+
LIST: "list",
|
|
76
|
+
WATCH: "watch",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
API,
|
|
83
|
+
};
|