// 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.apps.readonly',
'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.changes.get({
// The ID of the change.
changeId: 'placeholder-value',
// The shared drive from which the change is returned.
driveId: 'placeholder-value',
// Whether the requesting application supports both My Drives and shared drives.
supportsAllDrives: 'placeholder-value',
// Deprecated use supportsAllDrives instead.
supportsTeamDrives: 'placeholder-value',
// Deprecated use driveId instead.
teamDriveId: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "changeType": "my_changeType",
// "deleted": false,
// "drive": {},
// "driveId": "my_driveId",
// "file": {},
// "fileId": "my_fileId",
// "id": "my_id",
// "kind": "my_kind",
// "modificationDate": "my_modificationDate",
// "selfLink": "my_selfLink",
// "teamDrive": {},
// "teamDriveId": "my_teamDriveId",
// "type": "my_type"
// }
}
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.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.drives.list({
// Maximum number of shared drives to return per page.
maxResults: 'placeholder-value',
// Page token for shared drives.
pageToken: 'placeholder-value',
// Query string for searching shared drives.
q: 'placeholder-value',
// Issue the request as a domain administrator; if set to true, then all shared drives of the domain in which the requester is an administrator are returned.
useDomainAdminAccess: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "items": [],
// "kind": "my_kind",
// "nextPageToken": "my_nextPageToken"
// }
}
main().catch(e => {
console.error(e);
throw e;
});