How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // 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.permissions.getIdForEmail({
        // The email address for which to return a permission ID
        email: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "id": "my_id",
      //   "kind": "my_kind"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // 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.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 for the file or shared drive.
        fileId: 'placeholder-value',
        // The ID for 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;
    });
    
    Docs
  • // 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;
    });
    
    Docs
  • // 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.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.insert({
        // A plain text custom message to include in notification emails.
        emailMessage: 'placeholder-value',
        // Deprecated. See moveToNewOwnersRoot for details.
        enforceSingleParent: 'placeholder-value',
        // The ID for 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 notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.
        sendNotificationEmails: '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',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "additionalRoles": [],
          //   "authKey": "my_authKey",
          //   "deleted": false,
          //   "domain": "my_domain",
          //   "emailAddress": "my_emailAddress",
          //   "etag": "my_etag",
          //   "expirationDate": "my_expirationDate",
          //   "id": "my_id",
          //   "kind": "my_kind",
          //   "name": "my_name",
          //   "permissionDetails": [],
          //   "photoLink": "my_photoLink",
          //   "role": "my_role",
          //   "selfLink": "my_selfLink",
          //   "teamDrivePermissionDetails": [],
          //   "type": "my_type",
          //   "value": "my_value",
          //   "view": "my_view",
          //   "withLink": false
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "additionalRoles": [],
      //   "authKey": "my_authKey",
      //   "deleted": false,
      //   "domain": "my_domain",
      //   "emailAddress": "my_emailAddress",
      //   "etag": "my_etag",
      //   "expirationDate": "my_expirationDate",
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "name": "my_name",
      //   "permissionDetails": [],
      //   "photoLink": "my_photoLink",
      //   "role": "my_role",
      //   "selfLink": "my_selfLink",
      //   "teamDrivePermissionDetails": [],
      //   "type": "my_type",
      //   "value": "my_value",
      //   "view": "my_view",
      //   "withLink": false
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // 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.files.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',
        // Specifies which additional view's permissions to include in the response. Only 'published' is supported.
        includePermissionsForView: 'placeholder-value',
        // Whether the requesting application supports both My Drives and shared drives.
        supportsAllDrives: 'placeholder-value',
        // Deprecated use supportsAllDrives instead.
        supportsTeamDrives: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "appProperties": {},
      //   "capabilities": {},
      //   "contentHints": {},
      //   "contentRestrictions": [],
      //   "copyRequiresWriterPermission": false,
      //   "createdTime": "my_createdTime",
      //   "description": "my_description",
      //   "driveId": "my_driveId",
      //   "explicitlyTrashed": false,
      //   "exportLinks": {},
      //   "fileExtension": "my_fileExtension",
      //   "folderColorRgb": "my_folderColorRgb",
      //   "fullFileExtension": "my_fullFileExtension",
      //   "hasAugmentedPermissions": false,
      //   "hasThumbnail": false,
      //   "headRevisionId": "my_headRevisionId",
      //   "iconLink": "my_iconLink",
      //   "id": "my_id",
      //   "imageMediaMetadata": {},
      //   "isAppAuthorized": false,
      //   "kind": "my_kind",
      //   "lastModifyingUser": {},
      //   "linkShareMetadata": {},
      //   "md5Checksum": "my_md5Checksum",
      //   "mimeType": "my_mimeType",
      //   "modifiedByMe": false,
      //   "modifiedByMeTime": "my_modifiedByMeTime",
      //   "modifiedTime": "my_modifiedTime",
      //   "name": "my_name",
      //   "originalFilename": "my_originalFilename",
      //   "ownedByMe": false,
      //   "owners": [],
      //   "parents": [],
      //   "permissionIds": [],
      //   "permissions": [],
      //   "properties": {},
      //   "quotaBytesUsed": "my_quotaBytesUsed",
      //   "resourceKey": "my_resourceKey",
      //   "shared": false,
      //   "sharedWithMeTime": "my_sharedWithMeTime",
      //   "sharingUser": {},
      //   "shortcutDetails": {},
      //   "size": "my_size",
      //   "spaces": [],
      //   "starred": false,
      //   "teamDriveId": "my_teamDriveId",
      //   "thumbnailLink": "my_thumbnailLink",
      //   "thumbnailVersion": "my_thumbnailVersion",
      //   "trashed": false,
      //   "trashedTime": "my_trashedTime",
      //   "trashingUser": {},
      //   "version": "my_version",
      //   "videoMediaMetadata": {},
      //   "viewedByMe": false,
      //   "viewedByMeTime": "my_viewedByMeTime",
      //   "viewersCanCopyContent": false,
      //   "webContentLink": "my_webContentLink",
      //   "webViewLink": "my_webViewLink",
      //   "writersCanShare": false
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples