1
Delete Event
One script reply has been approved by the moderators Verified
Created by rossmccrann 852 days ago Viewed 9258 times
0
Submitted by rossmccrann Deno
Verified 852 days ago
1
type Gcal = {
2
  token: string;
3
};
4
export async function main(
5
  gcal_auth: Gcal,
6
  calendarId: string,
7
  eventId: string,
8
) {
9
  const sendUpdates = "all";
10

11
  const DELETE_EVENT_URL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events/${eventId}/?sendUpdates=${sendUpdates}`;
12

13
  const token = gcal_auth["token"];
14

15
  const response = await fetch(DELETE_EVENT_URL, {
16
    method: "DELETE",
17
    headers: {
18
      Authorization: "Bearer " + token,
19
      "Content-Type": "application/json",
20
    },
21
  });
22

23
  return response;
24
}
25