1 | |
2 |
|
3 | type Gcal = { |
4 | token: string; |
5 | }; |
6 | export async function main( |
7 | gcal_auth: Gcal, |
8 | calendarId: string, |
9 | eventId: string, |
10 | attendees: Array<object>, |
11 | ) { |
12 | const alwaysIncludeEmail = true; |
13 | const sendUpdates = "all"; |
14 | const supportsAttachments = true; |
15 | const UPDATE_EVENT_ATTENDEES_URL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events/${eventId}/?alwaysIncludeEmail=${alwaysIncludeEmail}&sendUpdates=${sendUpdates}&supportsAttachments=${supportsAttachments}`; |
16 |
|
17 | const token = gcal_auth["token"]; |
18 |
|
19 | const body = { |
20 | attendees: attendees, |
21 | }; |
22 |
|
23 | const response = await fetch(UPDATE_EVENT_ATTENDEES_URL, { |
24 | method: "PUT", |
25 | body: JSON.stringify(body), |
26 | headers: { |
27 | Authorization: "Bearer " + token, |
28 | "Content-Type": "application/json", |
29 | }, |
30 | }); |
31 |
|
32 | const result = await response.json(); |
33 |
|
34 | return result; |
35 | } |
36 |
|