Parameters for request
Optionally override request options, such as url
, method
, and encoding
.
Optional
params: Params$Resource$Revisions$DeleteOptional
options: MethodOptionsGets a revision's metadata or content by ID.
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/drive.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const drive = google.drive('v3');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/drive.metadata',
'https://www.googleapis.com/auth/drive.metadata.readonly',
'https://www.googleapis.com/auth/drive.photos.readonly',
'https://www.googleapis.com/auth/drive.readonly',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await drive.revisions.get({
// Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
acknowledgeAbuse: 'placeholder-value',
// The ID of the file.
fileId: 'placeholder-value',
// The ID of the revision.
revisionId: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "exportLinks": {},
// "id": "my_id",
// "keepForever": false,
// "kind": "my_kind",
// "lastModifyingUser": {},
// "md5Checksum": "my_md5Checksum",
// "mimeType": "my_mimeType",
// "modifiedTime": "my_modifiedTime",
// "originalFilename": "my_originalFilename",
// "publishAuto": false,
// "published": false,
// "publishedLink": "my_publishedLink",
// "publishedOutsideDomain": false,
// "size": "my_size"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
A promise if used with async/await, or void if used with a callback.
Parameters for request
Optionally override request options, such as url
, method
, and encoding
.
Optional
params: Params$Resource$Revisions$GetOptional
options: MethodOptionsLists a file's revisions.
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/drive.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const drive = google.drive('v3');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/drive.metadata',
'https://www.googleapis.com/auth/drive.metadata.readonly',
'https://www.googleapis.com/auth/drive.photos.readonly',
'https://www.googleapis.com/auth/drive.readonly',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await drive.revisions.list({
// The ID of the file.
fileId: 'placeholder-value',
// The maximum number of revisions to return per page.
pageSize: 'placeholder-value',
// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.
pageToken: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "kind": "my_kind",
// "nextPageToken": "my_nextPageToken",
// "revisions": []
// }
}
main().catch(e => {
console.error(e);
throw e;
});
A promise if used with async/await, or void if used with a callback.
Parameters for request
Optionally override request options, such as url
, method
, and encoding
.
Optional
params: Params$Resource$Revisions$ListOptional
options: MethodOptionsUpdates a revision with patch semantics.
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/drive.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const drive = google.drive('v3');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.file',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await drive.revisions.update({
// The ID of the file.
fileId: 'placeholder-value',
// The ID of the revision.
revisionId: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "exportLinks": {},
// "id": "my_id",
// "keepForever": false,
// "kind": "my_kind",
// "lastModifyingUser": {},
// "md5Checksum": "my_md5Checksum",
// "mimeType": "my_mimeType",
// "modifiedTime": "my_modifiedTime",
// "originalFilename": "my_originalFilename",
// "publishAuto": false,
// "published": false,
// "publishedLink": "my_publishedLink",
// "publishedOutsideDomain": false,
// "size": "my_size"
// }
},
});
console.log(res.data);
// Example response
// {
// "exportLinks": {},
// "id": "my_id",
// "keepForever": false,
// "kind": "my_kind",
// "lastModifyingUser": {},
// "md5Checksum": "my_md5Checksum",
// "mimeType": "my_mimeType",
// "modifiedTime": "my_modifiedTime",
// "originalFilename": "my_originalFilename",
// "publishAuto": false,
// "published": false,
// "publishedLink": "my_publishedLink",
// "publishedOutsideDomain": false,
// "size": "my_size"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
A promise if used with async/await, or void if used with a callback.
Parameters for request
Optionally override request options, such as url
, method
, and encoding
.
Optional
params: Params$Resource$Revisions$UpdateOptional
options: MethodOptionsGenerated using TypeDoc
Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.
Example
Returns
A promise if used with async/await, or void if used with a callback.