Move File to Trash ( gdrive)
One script reply has been approved by the moderators Verified

Created by rossmccrann 310 days ago Viewed 113 times 1 Point

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";

export async function main(
    gdrive_auth: wmill.Resource<"gdrive">,
    fileId: string,
) {
    const supportsAllDrives = true;
    const DELETE_FILE_URL = `https://www.googleapis.com/drive/v2/files/${fileId}/?supportsAllDrives=${supportsAllDrives}`;

    const token = gdrive_auth["token"];

    const response = await fetch(DELETE_FILE_URL, {
        method: "DELETE",
        headers: {
            Authorization: "Bearer " + token,
            "Content-Type": "application/json",
        },
    });

    return 'file moved to trash';
}

Submitted by rossmccrann 310 days ago

Edited 59 days ago

No comments yet

Login to be able to comment