File revisions: list, get, download a blob revision, and pin one with keep-forever. Drive may omit older revisions of busy Google Docs from the list, and only blob revisions marked keep-forever (or recent ones) can be downloaded; Google-native revisions are exported through the revision's exportLinks.

Scopes. drive.readonly to read; drive (or drive.file) to update.

Values

LIST_FIELDS

LIST_FIELDS: Str "nextPageToken,revisions(id,mimeType,modifiedTime,keepForever,published,size,md5Checksum,originalFilename,lastModifyingUser(displayName,emailAddress),exportLinks)"

REVISION_FIELDS

REVISION_FIELDS: Str "id,mimeType,modifiedTime,keepForever,published,size,md5Checksum,originalFilename,lastModifyingUser(displayName,emailAddress),exportLinks"

Functions

download-revision

fn (file-id: Str, revision-id: Str): ::google::drive/FileContent
fn (file-id: Str, revision-id: Str, opts: Map): ::google::drive/FileContent

GET /files/{id}/revisions/{revisionId}?alt=media - a blob revision's bytes as a FileContent. Options: acknowledgeAbuse, credentials.

get-revision

fn (file-id: Str, revision-id: Str): Map
fn (file-id: Str, revision-id: Str, opts: Map): Map

GET /files/{id}/revisions/{revisionId} - revision metadata ("head" is not accepted; use the file's headRevisionId).

keep-forever

fn (file-id: Str, revision-id: Str, keep: Bool): Map
fn (file-id: Str, revision-id: Str, keep: Bool, opts: Map): Map

PATCH a blob revision's keepForever flag (pinned revisions are never purged; at most 200 per file).

list-all-revisions

fn (file-id: Str): Vec
fn (file-id: Str, opts: Map): Vec

Every revision Drive returns for a file (follows nextPageToken).

list-revisions

fn (file-id: Str): Map
fn (file-id: Str, opts: Map): Map

GET /files/{id}/revisions - one page ({revisions, nextPageToken?}). Options: pageSize (max 1000), pageToken, fields, credentials.