// 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.about.get({
// Whether to count changes outside the My Drive hierarchy. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the maxChangeIdCount.
includeSubscribed: 'placeholder-value',
// Maximum number of remaining change IDs to count
maxChangeIdCount: 'placeholder-value',
// Change ID to start counting from when calculating number of remaining change IDs
startChangeId: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "additionalRoleInfo": [],
// "canCreateDrives": false,
// "canCreateTeamDrives": false,
// "domainSharingPolicy": "my_domainSharingPolicy",
// "driveThemes": [],
// "etag": "my_etag",
// "exportFormats": [],
// "features": [],
// "folderColorPalette": [],
// "importFormats": [],
// "isCurrentAppInstalled": false,
// "kind": "my_kind",
// "languageCode": "my_languageCode",
// "largestChangeId": "my_largestChangeId",
// "maxUploadSizes": [],
// "name": "my_name",
// "permissionId": "my_permissionId",
// "quotaBytesByService": [],
// "quotaBytesTotal": "my_quotaBytesTotal",
// "quotaBytesUsed": "my_quotaBytesUsed",
// "quotaBytesUsedAggregate": "my_quotaBytesUsedAggregate",
// "quotaBytesUsedInTrash": "my_quotaBytesUsedInTrash",
// "quotaType": "my_quotaType",
// "remainingChangeIds": "my_remainingChangeIds",
// "rootFolderId": "my_rootFolderId",
// "selfLink": "my_selfLink",
// "teamDriveThemes": [],
// "user": {}
// }
}
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.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.
pageSize: '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
// {
// "drives": [],
// "kind": "my_kind",
// "nextPageToken": "my_nextPageToken"
// }
}
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;
});
// 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.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.teamdrives.list({
// Maximum number of Team Drives to return.
pageSize: 'placeholder-value',
// Page token for Team Drives.
pageToken: 'placeholder-value',
// Query string for searching Team Drives.
q: 'placeholder-value',
// Issue the request as a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.
useDomainAdminAccess: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "kind": "my_kind",
// "nextPageToken": "my_nextPageToken",
// "teamDrives": []
// }
}
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.teamdrives.list({
// Maximum number of Team Drives to return.
maxResults: 'placeholder-value',
// Page token for Team Drives.
pageToken: 'placeholder-value',
// Query string for searching Team Drives.
q: 'placeholder-value',
// Issue the request as a domain administrator; if set to true, then all Team 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;
});