Sub ShowFileList(ParentFolderID As String) As ResumableSub'ignore
Log("#-GoogleDrive.Sub ShowFileList, ParentFolderID=" & ParentFolderID)
Dim h_sfl As HttpJob
h_sfl.Initialize("", Me)
If ParentFolderID="" Then
h_sfl.Download2("https://www.googleapis.com/drive/v3/files", _
Array As String("access_token", myAccessToken, _
"corpora", "user", _
"fields", "files(description,appProperties,createdTime,id,kind,lastModifyingUser,mimeType,modifiedByMe,modifiedByMeTime,name,properties,size,starred,version)" , _
"q","mimeType!='application/vnd.google-apps.folder' and trashed=false"))
Else
h_sfl.Download2("https://www.googleapis.com/drive/v3/files", _
Array As String("access_token", myAccessToken, _
"corpora", "user", _
"fields", "files(description,appProperties,createdTime,id,kind,lastModifyingUser,mimeType,modifiedByMe,modifiedByMeTime,name,properties,size,starred,version)" , _
"q","mimeType!='application/vnd.google-apps.folder' and '" & ParentFolderID & "' in parents and trashed=false"))
End If
'
' Find the parameters with API explorer:
' --> https://developers.google.com/apis-explorer/?hl=en_GB#p/drive/v3/drive.files.list?corpora=user&q=mimeType!%253D'application%252Fvnd.google-apps.folder'
' files(appProperties,createdTime,fileExtension,id,kind,size)
Wait For (h_sfl) JobDone(h_sfl As HttpJob)
' ww~~-- ww~~-- ────────────────────
Log("#- x207, h_sfl.Success=" & h_sfl.Success)
'
If h_sfl.Success Then
Log("#- x209, h_sfl.GetString=" & h_sfl.GetString)
' {
' "files": [
' {
' "kind": "drive#file",
' "id": "sdfsdf",
' "name": "A1 gesicherte Daten vom 21.8., 10:23",
' "mimeType": "application/x-zip",
' "description": "Datendatei von A1 Wissyxcyxc\nLetzte Änderung: 20.8.2018, 19:16\n\n#1534785367351",
' "starred": false,
' "version": "2",
' "createdTime": "2018-08-21T08:23:42.114Z",
' "modifiedByMeTime": "2018-08-21T08:23:42.114Z",
' "modifiedByMe": true,
' "lastModifyingUser": {
' "kind": "drive#user",
' "displayName": "sadasd sdasda sd",
' "photoLink": "https://lh3.goog.../photo.jpg",
' "me": true,
' "permissionId": "453453455345",
' "emailAddress": "sdfsfsdfs fghfhfgh"
' },
' "size": "311567"
' },
' {
' "kind": "drive#file",
' "id": "fdssdfsdf",
' "name": "A1 gesicherte Daten vom 21.8., 10:19",
' "mimeType": "application/x-zip",
' "description": "Datendatei von A1 Wissyxcyxc\nLetzte Änderung: 20.8.2018\n#1534785367351",
' "starred": false,
' "version": "2",
' "createdTime": "2018-08-21T08:19:30.441Z",
' "modifiedByMeTime": "2018-08-21T08:19:30.441Z",
' "modifiedByMe": true,
' "lastModifyingUser": {
' "kind": "drive#user",
' "displayName": "sadasd sdasda sd",
' "photoLink": "https://lh3.goog.../photo.jpg",
' "me": true,
' "permissionId": "453453455345",
' "emailAddress": "sdfsfsdfs fghfhfgh"
' },
' "size": "311567"
' }
' ]
' }
'
Dim files As List
Dim Map1 As Map
Dim J As JSONParser
J.Initialize(h_sfl.GetString)
files.Initialize
Map1 = J.NextObject
files = Map1.Get("files")
' Log("#- x255, files.Size=" & files.Size)
'
Dim lstFilesToDownload As List
lstFilesToDownload.Initialize
Dim mapFileEntry As Map
For i = 0 To files.Size - 1
mapFileEntry = files.Get(i)
'Log("#- x261, mapFileEntry=" & fcn.logm(mapFileEntry))
Dim mapFileEntryExp As Map
mapFileEntryExp.Initialize
mapFileEntryExp.Put("id", mapFileEntry.Get("id"))
mapFileEntryExp.Put("name", mapFileEntry.Get("name"))
mapFileEntryExp.Put("mimeType", mapFileEntry.Get("mimeType"))
mapFileEntryExp.Put("createdTime", mapFileEntry.Get("createdTime"))
mapFileEntryExp.Put("description", mapFileEntry.Get("description"))
lstFilesToDownload.Add(mapFileEntryExp)
Next
' Log("#- x220, lstFilesToExport=" & fcn.loglst(lstFilesToExport, " "))
'CallSub2(evModule, evName & "_FileListResult", FilelisteExport)
Else
'hhgf-Log("#- x231, h_sfl.ErrorMessage=" & h_sfl.ErrorMessage)
End If
h_sfl.Release
'hhgf-Log("#- x233, end of ShowFileList >>>")
'hhgf-Log("#-")
'hhgf-Log("#-")
Return lstFilesToDownload
End Sub