1
Delete Shared Drive
One script reply has been approved by the moderators Verified
Created by rossmccrann 634 days ago Viewed 4594 times
0
Submitted by rossmccrann Deno
Verified 634 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