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'],
      });
    
      // 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.update({
        // The ID of the shared drive.
        driveId: 'placeholder-value',
        // Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the shared drive belongs.
        useDomainAdminAccess: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "backgroundImageFile": {},
          //   "backgroundImageLink": "my_backgroundImageLink",
          //   "capabilities": {},
          //   "colorRgb": "my_colorRgb",
          //   "createdDate": "my_createdDate",
          //   "hidden": false,
          //   "id": "my_id",
          //   "kind": "my_kind",
          //   "name": "my_name",
          //   "restrictions": {},
          //   "themeId": "my_themeId"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "backgroundImageFile": {},
      //   "backgroundImageLink": "my_backgroundImageLink",
      //   "capabilities": {},
      //   "colorRgb": "my_colorRgb",
      //   "createdDate": "my_createdDate",
      //   "hidden": false,
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "name": "my_name",
      //   "restrictions": {},
      //   "themeId": "my_themeId"
      // }
    }
    
    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.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.changes.get({
        // The ID of the change.
        changeId: 'placeholder-value',
        // The shared drive from which the change is returned.
        driveId: '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
      // {
      //   "changeType": "my_changeType",
      //   "deleted": false,
      //   "drive": {},
      //   "driveId": "my_driveId",
      //   "file": {},
      //   "fileId": "my_fileId",
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "modificationDate": "my_modificationDate",
      //   "selfLink": "my_selfLink",
      //   "teamDrive": {},
      //   "teamDriveId": "my_teamDriveId",
      //   "type": "my_type"
      // }
    }
    
    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.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.changes.getStartPageToken({
        // The ID of the shared drive for which the starting pageToken for listing future changes from that shared drive is returned.
        driveId: '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
      // {
      //   "kind": "my_kind",
      //   "startPageToken": "my_startPageToken"
      // }
    }
    
    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.update({
        // The ID for the file or shared drive.
        fileId: 'placeholder-value',
        // The ID for 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
          // {
          //   "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.list({
        // Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency.
        corpora: 'placeholder-value',
        // The source of files to list. Deprecated: use 'corpora' instead.
        corpus: 'placeholder-value',
        // ID of the shared drive to search.
        driveId: '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',
        // Deprecated use includeItemsFromAllDrives instead.
        includeTeamDriveItems: 'placeholder-value',
        // A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
        orderBy: 'placeholder-value',
        // The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.
        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',
        // A query for filtering the file results. See the "Search for Files" guide for supported syntax.
        q: 'placeholder-value',
        // A comma-separated list of spaces to query within the corpus. Supported values are 'drive' and 'appDataFolder'.
        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
      // {
      //   "files": [],
      //   "incompleteSearch": false,
      //   "kind": "my_kind",
      //   "nextPageToken": "my_nextPageToken"
      // }
    }
    
    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