I'm trying to figure out how to programmatically revert to a pinned revision of a file using the Advanced Drive Service.
I've looked at the documentation here
https://developers.google.com/apps-script/advanced/drive#listing_revisions and here
https://developers.google.com/drive/v3/reference/#Revisions
I've tried
var revs = Drive.Revisions.list(fileId);
var revArr = revs.items;
var len = revArr.length;
var rev = revArr[len - 2];
var rev2 = revArr[len - 1];
var revId = rev.id;
var revId2 = rev2.id;
// These will throw an id mismatch error.
Drive.Revisions.update(rev, fileId, revId2);
Drive.Revisions.patch(rev, fileId, revId2);
// These don't seem to revert the file.
Drive.Revisions.update(rev2, fileId, revId2);
Drive.Revisions.patch(rev2, fileId, revId2);
I just want to take the file and revert it back a revision.
I don't want to download the old file, but take the current file and put it back to how it was before.
Eg.
FileA rev0 -> {Edited: Change Text to gibberish} -> FileA rev1
(Using ADS) Drive.Revisions.revertTo(rev0.id); //Or something like that.
I've tried a bunch of different things, but can't seem to get it to work.