I need to sync all the files from within a folder in Google Drive to a mobile app using the Google Drive API, and I do not see how to approach it.
- There is a files.list endpoint which could be used to retrieve the list of files at the time of the call.
- There is a changes.list which can return a paginated list of changes. To use this endpoint I must first call changes.getStartPageToken to get a starting pageToken for listing future changes, and then call changes.list with the last token to get any new changes.
So my question is, ¿how should I use those calls to sync all the files from within a folder?
Using files.list only does not work, as I can get a photo of the files and its content at a given point in time, but that does not support syncing, and with that I mean that the files.list endpoint does not detect changes since the last call, making it useless for that purpose.
The changes.list endpoint seems to be the right one for syncrhonizing, but I do not see how to start the synchronization. Any change previous to the call to changes.getStartPageToken is not picked, so how are we supposed to get the initial snapshot whith the state of all the files to start the syncrhonization.
I could use files.list for that, and then call changes.getStartPageToken to start tracking the changes, but any new file or change between those two calls would not be picked up.
¿What is the best approach?