1

Get Shared Drive

by
Published Jul 27, 2022
Script gdrive Verified

The script

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

3
type Gdrive = {
4
  token: string;
5
};
6
export async function main(
7
  gdrive_auth: Gdrive,
8
  driveId: string,
9
  useDomainAdminAccess: boolean = false,
10
) {
11
  const GET_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/${driveId}/?useDomainAdminAccess=${useDomainAdminAccess}`;
12

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

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

23
  return await response.text();
24
}
25

Other submissions
  • Submitted by rossmccrann Deno
    Created 398 days ago
    1
    type Gdrive = {
    2
      token: string;
    3
    };
    4
    export async function main(
    5
      gdrive_auth: Gdrive,
    6
      driveId: string,
    7
      useDomainAdminAccess: boolean = false,
    8
    ) {
    9
      const GET_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/${driveId}/?useDomainAdminAccess=${useDomainAdminAccess}`;
    10
    
    
    11
      const token = gdrive_auth["token"];
    12
    
    
    13
      const response = await fetch(GET_SHARED_DRIVE_URL, {
    14
        method: "GET",
    15
        headers: {
    16
          Authorization: "Bearer " + token,
    17
          "Content-Type": "application/json",
    18
        },
    19
      });
    20
    
    
    21
      return await response.text();
    22
    }
    23