Parameters for request
Optionally override request options, such as url
, method
, and encoding
.
Optional
params: Params$Resource$Changes$GetstartpagetokenOptional
options: MethodOptionsLists the changes for a user or shared drive.
// 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.changes.list({
// The shared drive from which changes are returned. If specified the change IDs will be reflective of the shared drive; use the combined drive ID and change ID as an identifier.
driveId: 'placeholder-value',
// Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.
includeCorpusRemovals: 'placeholder-value',
// Whether both My Drive and shared drive items should be included in results.
includeItemsFromAllDrives: 'placeholder-value',
// Specifies which additional view's permissions to include in the response. Only 'published' is supported.
includePermissionsForView: 'placeholder-value',
// Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.
includeRemoved: 'placeholder-value',
// Deprecated use includeItemsFromAllDrives instead.
includeTeamDriveItems: 'placeholder-value',
// The maximum number of changes 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 or to the response from the getStartPageToken method.
pageToken: 'placeholder-value',
// Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.
restrictToMyDrive: 'placeholder-value',
// A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
spaces: '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
// {
// "changes": [],
// "kind": "my_kind",
// "newStartPageToken": "my_newStartPageToken",
// "nextPageToken": "my_nextPageToken"
// }
}
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$Changes$ListOptional
options: MethodOptionsSubscribes to changes for a user.
// 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.changes.watch({
// The shared drive from which changes are returned. If specified the change IDs will be reflective of the shared drive; use the combined drive ID and change ID as an identifier.
driveId: 'placeholder-value',
// Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.
includeCorpusRemovals: 'placeholder-value',
// Whether both My Drive and shared drive items should be included in results.
includeItemsFromAllDrives: 'placeholder-value',
// Specifies which additional view's permissions to include in the response. Only 'published' is supported.
includePermissionsForView: 'placeholder-value',
// Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.
includeRemoved: 'placeholder-value',
// Deprecated use includeItemsFromAllDrives instead.
includeTeamDriveItems: 'placeholder-value',
// The maximum number of changes 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 or to the response from the getStartPageToken method.
pageToken: 'placeholder-value',
// Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.
restrictToMyDrive: 'placeholder-value',
// A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
spaces: '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',
// Request body metadata
requestBody: {
// request body parameters
// {
// "address": "my_address",
// "expiration": "my_expiration",
// "id": "my_id",
// "kind": "my_kind",
// "params": {},
// "payload": false,
// "resourceId": "my_resourceId",
// "resourceUri": "my_resourceUri",
// "token": "my_token",
// "type": "my_type"
// }
},
});
console.log(res.data);
// Example response
// {
// "address": "my_address",
// "expiration": "my_expiration",
// "id": "my_id",
// "kind": "my_kind",
// "params": {},
// "payload": false,
// "resourceId": "my_resourceId",
// "resourceUri": "my_resourceUri",
// "token": "my_token",
// "type": "my_type"
// }
}
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$Changes$WatchOptional
options: MethodOptionsGenerated using TypeDoc
Gets the starting pageToken for listing future changes.
Example
Returns
A promise if used with async/await, or void if used with a callback.