Hierarchy

  • Resource$Revisions

Constructors

Properties

Methods

Constructors

  • Parameters

    • context: APIRequestContext

    Returns Resource$Revisions

Properties

context: APIRequestContext

Methods

  • 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

    // 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;
    });

    Returns

    A promise if used with async/await, or void if used with a callback.

    Parameters

    Returns GaxiosPromise<Readable>

  • Parameters

    Returns GaxiosPromise<void>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • callback: BodyResponseCallback<void>

    Returns void

  • Gets a revision's metadata or content by ID.

    Example

    // 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;
    });

    Returns

    A promise if used with async/await, or void if used with a callback.

    Parameters

    Returns GaxiosPromise<Readable>

  • Parameters

    Returns GaxiosPromise<Schema$Revision>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Lists a file's revisions.

    Example

    // 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;
    });

    Returns

    A promise if used with async/await, or void if used with a callback.

    Parameters

    Returns GaxiosPromise<Readable>

  • Parameters

    Returns GaxiosPromise<Schema$RevisionList>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Updates a revision with patch semantics.

    Example

    // 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;
    });

    Returns

    A promise if used with async/await, or void if used with a callback.

    Parameters

    Returns GaxiosPromise<Readable>

  • Parameters

    Returns GaxiosPromise<Schema$Revision>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

Generated using TypeDoc