Search... Ctrl + K

Create Folder (gdrive)
One script reply has been approved by the moderators Verified

Created by rossmccrann 127 days ago Used 32 times 1 Point

No comments yet

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.23.0/mod.ts";

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

    const token = gdrive_auth["token"];
    const body = {
        "name": title,
        "mimeType": "application/vnd.google-apps.folder"
    };
    const response = await fetch(CREATE_FOLDER_URL, {
        method: "POST",
        body: JSON.stringify(body),
        headers: {
            Authorization: "Bearer " + token,
            "Content-Type": "application/json",
        },
    });

    return await response.text();
}

Submitted by rossmccrann 127 days ago

Edited 127 days ago

No comments yet