1

Delete 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
  allowItemDeletion: boolean = false,
10
  useDomainAdminAccess: boolean = false,
11
) {
12
  const DELETE_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/${driveId}/?allowItemDeletion=${allowItemDeletion}&useDomainAdminAccess=${useDomainAdminAccess}`;
13

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

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

24
  return "Deleted shared drive.";
25
}
26

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
      allowItemDeletion: boolean = false,
    8
      useDomainAdminAccess: boolean = false,
    9
    ) {
    10
      const DELETE_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/${driveId}/?allowItemDeletion=${allowItemDeletion}&useDomainAdminAccess=${useDomainAdminAccess}`;
    11
    
    
    12
      const token = gdrive_auth["token"];
    13
    
    
    14
      const response = await fetch(DELETE_SHARED_DRIVE_URL, {
    15
        method: "DELETE",
    16
        headers: {
    17
          Authorization: "Bearer " + token,
    18
          "Content-Type": "application/json",
    19
        },
    20
      });
    21
    
    
    22
      return "Deleted shared drive.";
    23
    }
    24