1 | type Gdrive = { |
2 | token: string; |
3 | }; |
4 | export async function main(gdrive_auth: Gdrive, fileId: string) { |
5 | const supportsAllDrives = true; |
6 | const COPY_FILE_URL = `https://www.googleapis.com/drive/v3/files/${fileId}/copy/?supportsAllDrives=${supportsAllDrives}`; |
7 |
|
8 | const token = gdrive_auth["token"]; |
9 |
|
10 | const response = await fetch(COPY_FILE_URL, { |
11 | method: "POST", |
12 | |
13 | headers: { |
14 | Authorization: "Bearer " + token, |
15 | "Content-Type": "application/json", |
16 | }, |
17 | }); |
18 |
|
19 | return await response.text(); |
20 | } |
21 |
|