// 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('v2');
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',
// Maximum number of revisions to return.
maxResults: 'placeholder-value',
// Page token for revisions. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
pageToken: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "etag": "my_etag",
// "items": [],
// "kind": "my_kind",
// "nextPageToken": "my_nextPageToken",
// "selfLink": "my_selfLink"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// 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.delete({
// The ID of the file.
fileId: 'placeholder-value',
// The ID of the revision.
revisionId: 'placeholder-value',
});
console.log(res.data);
}
main().catch(e => {
console.error(e);
throw e;
});
// 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('v2');
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({
// The ID of the file.
fileId: 'placeholder-value',
// The ID of the revision.
revisionId: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "downloadUrl": "my_downloadUrl",
// "etag": "my_etag",
// "exportLinks": {},
// "fileSize": "my_fileSize",
// "id": "my_id",
// "kind": "my_kind",
// "lastModifyingUser": {},
// "lastModifyingUserName": "my_lastModifyingUserName",
// "md5Checksum": "my_md5Checksum",
// "mimeType": "my_mimeType",
// "modifiedDate": "my_modifiedDate",
// "originalFilename": "my_originalFilename",
// "pinned": false,
// "publishAuto": false,
// "published": false,
// "publishedLink": "my_publishedLink",
// "publishedOutsideDomain": false,
// "selfLink": "my_selfLink"
// }
}
main().catch(e => {
console.error(e);
throw e;
});