1 | |
2 |
|
3 | type Gdrive = { |
4 | token: string; |
5 | }; |
6 | export async function main( |
7 | gdrive_auth: Gdrive, |
8 | driveId: string, |
9 | useDomainAdminAccess: boolean = true, |
10 | ) { |
11 | const UPDATE_SHARED_DRIVE_URL = `https://www.googleapis.com/drive/v3/drives/${driveId}/?useDomainAdminAccess=${useDomainAdminAccess}`; |
12 |
|
13 | const token = gdrive_auth["token"]; |
14 |
|
15 | const body = { |
16 | name: "Update Drive Test", |
17 | restrictions: { |
18 | adminManagedRestrictions: false, |
19 | copyRequiresWriterPermission: false, |
20 | domainUsersOnly: false, |
21 | driveMembersOnly: false, |
22 | }, |
23 | colorRgb: "#ff0000", |
24 | }; |
25 | const response = await fetch(UPDATE_SHARED_DRIVE_URL, { |
26 | method: "PATCH", |
27 | body: JSON.stringify(body), |
28 | headers: { |
29 | Authorization: "Bearer " + token, |
30 | "Content-Type": "application/json", |
31 | }, |
32 | }); |
33 |
|
34 | return await response.text(); |
35 | } |
36 |
|