1

Get Calendar List

by
Published Jul 26, 2022
Script gcal Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 6 days ago
1
//native
2

3
type Gcal = {
4
  token: string;
5
};
6
export async function main(gcal_auth: Gcal) {
7
  const CALENDAR_LIST_URL = `https://www.googleapis.com/calendar/v3/users/me/calendarList`;
8

9
  const token = gcal_auth["token"];
10

11
  const response = await fetch(CALENDAR_LIST_URL, {
12
    method: "GET",
13
    headers: {
14
      Authorization: "Bearer " + token,
15
      "Content-Type": "application/json",
16
    },
17
  });
18

19
  const result = await response.json();
20

21
  return result;
22
}
23

Other submissions
  • Submitted by rossmccrann Deno
    Created 398 days ago
    1
    type Gcal = {
    2
      token: string;
    3
    };
    4
    export async function main(gcal_auth: Gcal) {
    5
      const CALENDAR_LIST_URL = `https://www.googleapis.com/calendar/v3/users/me/calendarList`;
    6
    
    
    7
      const token = gcal_auth["token"];
    8
    
    
    9
      const response = await fetch(CALENDAR_LIST_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