-
Notifications
You must be signed in to change notification settings - Fork 1
/
listfiles.js
38 lines (33 loc) · 1.01 KB
/
listfiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
for any request
gapi.client.request(path , method=get , params{key:value} ,headers ,body{for post,put})
*/
//XXXXXXXXXXXXXXXXXXXXXX listfiles is the entry function that i can access gapi throught it XXXXXXXXXXXXXXXXXXXXXX
async function listFiles() {
listchindrens("1yxrZOSGLu6kagK0OlgFrjnYpYmRjK3_f");
}
function listchindrens(folderID) {
let q = transformFolderID(folderID);
gapi.client.drive.files
.list({q}).then((e, f) => {
console.log("holy shit", e);
renderFiles(e.result.files);
});
}
// to make it "1DQNrFndwdH1_D_026miRfwM7nA1duKVF" in parents
function transformFolderID(folderID) {
let parent = "in parents";
let s1 = "";
let s2 = s1.concat('"' + folderID + '" ' + parent);
return s2;
}
const container = document.getElementById("container");
function renderFiles(f) {
const files = document.createElement("ul");
container.appendChild(files);
f.map(e => {
let file = document.createElement('li');
file.innerText= e.name;
files.appendChild(file)
});
}