1 | type Gcal = { |
2 | token: string; |
3 | }; |
4 | export async function main(gcal_auth: Gcal, calendarId: string) { |
5 | const LIST_EVENTS_URL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events`; |
6 |
|
7 | const token = gcal_auth["token"]; |
8 |
|
9 | const response = await fetch(LIST_EVENTS_URL, { |
10 | method: "GET", |
11 | headers: { |
12 | Authorization: "Bearer " + token, |
13 | "Content-Type": "application/json", |
14 | }, |
15 | }); |
16 |
|
17 | const result = await response.json(); |
18 |
|
19 | return result; |
20 | } |
21 |
|