Hierarchy

  • Resource$Permissions

Constructors

Properties

Methods

Constructors

  • Parameters

    • context: APIRequestContext

    Returns Resource$Permissions

Properties

context: APIRequestContext

Methods

  • Creates a permission for a file or shared drive.

    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.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.permissions.create({
    // A plain text custom message to include in the notification email.
    emailMessage: 'placeholder-value',
    // Deprecated. See moveToNewOwnersRoot for details.
    enforceSingleParent: 'placeholder-value',
    // The ID of the file or shared drive.
    fileId: 'placeholder-value',
    // This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to true, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to false, parents are not changed.
    moveToNewOwnersRoot: 'placeholder-value',
    // Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.
    sendNotificationEmail: 'placeholder-value',
    // Whether the requesting application supports both My Drives and shared drives.
    supportsAllDrives: 'placeholder-value',
    // Deprecated use supportsAllDrives instead.
    supportsTeamDrives: 'placeholder-value',
    // Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. File owners can only transfer ownership of files existing on My Drive. Files existing in a shared drive are owned by the organization that owns that shared drive. Ownership transfers are not supported for files and folders in shared drives. Organizers of a shared drive can move items from that shared drive into their My Drive which transfers the ownership to them.
    transferOwnership: 'placeholder-value',
    // Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
    useDomainAdminAccess: 'placeholder-value',

    // Request body metadata
    requestBody: {
    // request body parameters
    // {
    // "allowFileDiscovery": false,
    // "deleted": false,
    // "displayName": "my_displayName",
    // "domain": "my_domain",
    // "emailAddress": "my_emailAddress",
    // "expirationTime": "my_expirationTime",
    // "id": "my_id",
    // "kind": "my_kind",
    // "pendingOwner": false,
    // "permissionDetails": [],
    // "photoLink": "my_photoLink",
    // "role": "my_role",
    // "teamDrivePermissionDetails": [],
    // "type": "my_type",
    // "view": "my_view"
    // }
    },
    });
    console.log(res.data);

    // Example response
    // {
    // "allowFileDiscovery": false,
    // "deleted": false,
    // "displayName": "my_displayName",
    // "domain": "my_domain",
    // "emailAddress": "my_emailAddress",
    // "expirationTime": "my_expirationTime",
    // "id": "my_id",
    // "kind": "my_kind",
    // "pendingOwner": false,
    // "permissionDetails": [],
    // "photoLink": "my_photoLink",
    // "role": "my_role",
    // "teamDrivePermissionDetails": [],
    // "type": "my_type",
    // "view": "my_view"
    // }
    }

    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$Permission>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Deletes a permission.

    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.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.permissions.delete({
    // The ID of the file or shared drive.
    fileId: 'placeholder-value',
    // The ID of the permission.
    permissionId: 'placeholder-value',
    // Whether the requesting application supports both My Drives and shared drives.
    supportsAllDrives: 'placeholder-value',
    // Deprecated use supportsAllDrives instead.
    supportsTeamDrives: 'placeholder-value',
    // Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
    useDomainAdminAccess: '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 permission 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.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.permissions.get({
    // The ID of the file.
    fileId: 'placeholder-value',
    // The ID of the permission.
    permissionId: 'placeholder-value',
    // Whether the requesting application supports both My Drives and shared drives.
    supportsAllDrives: 'placeholder-value',
    // Deprecated use supportsAllDrives instead.
    supportsTeamDrives: 'placeholder-value',
    // Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
    useDomainAdminAccess: 'placeholder-value',
    });
    console.log(res.data);

    // Example response
    // {
    // "allowFileDiscovery": false,
    // "deleted": false,
    // "displayName": "my_displayName",
    // "domain": "my_domain",
    // "emailAddress": "my_emailAddress",
    // "expirationTime": "my_expirationTime",
    // "id": "my_id",
    // "kind": "my_kind",
    // "pendingOwner": false,
    // "permissionDetails": [],
    // "photoLink": "my_photoLink",
    // "role": "my_role",
    // "teamDrivePermissionDetails": [],
    // "type": "my_type",
    // "view": "my_view"
    // }
    }

    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$Permission>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Lists a file's or shared drive's permissions.

    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.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.permissions.list({
    // The ID of the file or shared drive.
    fileId: 'placeholder-value',
    // Specifies which additional view's permissions to include in the response. Only 'published' is supported.
    includePermissionsForView: 'placeholder-value',
    // The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
    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',
    // Whether the requesting application supports both My Drives and shared drives.
    supportsAllDrives: 'placeholder-value',
    // Deprecated use supportsAllDrives instead.
    supportsTeamDrives: 'placeholder-value',
    // Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
    useDomainAdminAccess: 'placeholder-value',
    });
    console.log(res.data);

    // Example response
    // {
    // "kind": "my_kind",
    // "nextPageToken": "my_nextPageToken",
    // "permissions": []
    // }
    }

    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$PermissionList>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Updates a permission 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.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.permissions.update({
    // The ID of the file or shared drive.
    fileId: 'placeholder-value',
    // The ID of the permission.
    permissionId: 'placeholder-value',
    // Whether to remove the expiration date.
    removeExpiration: 'placeholder-value',
    // Whether the requesting application supports both My Drives and shared drives.
    supportsAllDrives: 'placeholder-value',
    // Deprecated use supportsAllDrives instead.
    supportsTeamDrives: 'placeholder-value',
    // Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. File owners can only transfer ownership of files existing on My Drive. Files existing in a shared drive are owned by the organization that owns that shared drive. Ownership transfers are not supported for files and folders in shared drives. Organizers of a shared drive can move items from that shared drive into their My Drive which transfers the ownership to them.
    transferOwnership: 'placeholder-value',
    // Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
    useDomainAdminAccess: 'placeholder-value',

    // Request body metadata
    requestBody: {
    // request body parameters
    // {
    // "allowFileDiscovery": false,
    // "deleted": false,
    // "displayName": "my_displayName",
    // "domain": "my_domain",
    // "emailAddress": "my_emailAddress",
    // "expirationTime": "my_expirationTime",
    // "id": "my_id",
    // "kind": "my_kind",
    // "pendingOwner": false,
    // "permissionDetails": [],
    // "photoLink": "my_photoLink",
    // "role": "my_role",
    // "teamDrivePermissionDetails": [],
    // "type": "my_type",
    // "view": "my_view"
    // }
    },
    });
    console.log(res.data);

    // Example response
    // {
    // "allowFileDiscovery": false,
    // "deleted": false,
    // "displayName": "my_displayName",
    // "domain": "my_domain",
    // "emailAddress": "my_emailAddress",
    // "expirationTime": "my_expirationTime",
    // "id": "my_id",
    // "kind": "my_kind",
    // "pendingOwner": false,
    // "permissionDetails": [],
    // "photoLink": "my_photoLink",
    // "role": "my_role",
    // "teamDrivePermissionDetails": [],
    // "type": "my_type",
    // "view": "my_view"
    // }
    }

    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$Permission>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

Generated using TypeDoc