1 | |
2 |
|
3 | type Gcal = { |
4 | token: string; |
5 | }; |
6 | export async function main( |
7 | gcal_auth: Gcal, |
8 | calendarId: string, |
9 | eventText: string, |
10 | ) { |
11 | const sendUpdates = "all"; |
12 |
|
13 | const QUICK_EVENT_URL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events/quickAdd/?text=${eventText}&sendUpdates=${sendUpdates}`; |
14 |
|
15 | const token = gcal_auth["token"]; |
16 |
|
17 | const response = await fetch(QUICK_EVENT_URL, { |
18 | method: "POST", |
19 | headers: { |
20 | Authorization: "Bearer " + token, |
21 | "Content-Type": "application/json", |
22 | }, |
23 | }); |
24 |
|
25 | const result = await response.json(); |
26 |
|
27 | return result; |
28 | } |
29 |
|