1 | |
2 |
|
3 | type Gdrive = { |
4 | token: string; |
5 | }; |
6 | export async function main( |
7 | gdrive_auth: Gdrive, |
8 | requestId: string, |
9 | drive_name: string, |
10 | ) { |
11 | const supportsAllDrives = true; |
12 | const CREATE_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/?requestId=${requestId}`; |
13 |
|
14 | const token = gdrive_auth["token"]; |
15 | const body = { |
16 | name: drive_name, |
17 | }; |
18 | const response = await fetch(CREATE_SHARED_DRIVE_URL, { |
19 | method: "POST", |
20 | body: JSON.stringify(body), |
21 | headers: { |
22 | Authorization: "Bearer " + token, |
23 | "Content-Type": "application/json", |
24 | }, |
25 | }); |
26 |
|
27 | return await response.text(); |
28 | } |
29 |
|