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.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.comments.insert({
        // The ID of the file.
        fileId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "anchor": "my_anchor",
          //   "author": {},
          //   "commentId": "my_commentId",
          //   "content": "my_content",
          //   "context": {},
          //   "createdDate": "my_createdDate",
          //   "deleted": false,
          //   "fileId": "my_fileId",
          //   "fileTitle": "my_fileTitle",
          //   "htmlContent": "my_htmlContent",
          //   "kind": "my_kind",
          //   "modifiedDate": "my_modifiedDate",
          //   "replies": [],
          //   "selfLink": "my_selfLink",
          //   "status": "my_status"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "anchor": "my_anchor",
      //   "author": {},
      //   "commentId": "my_commentId",
      //   "content": "my_content",
      //   "context": {},
      //   "createdDate": "my_createdDate",
      //   "deleted": false,
      //   "fileId": "my_fileId",
      //   "fileTitle": "my_fileTitle",
      //   "htmlContent": "my_htmlContent",
      //   "kind": "my_kind",
      //   "modifiedDate": "my_modifiedDate",
      //   "replies": [],
      //   "selfLink": "my_selfLink",
      //   "status": "my_status"
      // }
    }
    
    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.comments.update({
        // The ID of the comment.
        commentId: 'placeholder-value',
        // The ID of the file.
        fileId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "anchor": "my_anchor",
          //   "author": {},
          //   "content": "my_content",
          //   "createdTime": "my_createdTime",
          //   "deleted": false,
          //   "htmlContent": "my_htmlContent",
          //   "id": "my_id",
          //   "kind": "my_kind",
          //   "modifiedTime": "my_modifiedTime",
          //   "quotedFileContent": {},
          //   "replies": [],
          //   "resolved": false
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "anchor": "my_anchor",
      //   "author": {},
      //   "content": "my_content",
      //   "createdTime": "my_createdTime",
      //   "deleted": false,
      //   "htmlContent": "my_htmlContent",
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "modifiedTime": "my_modifiedTime",
      //   "quotedFileContent": {},
      //   "replies": [],
      //   "resolved": 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('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.comments.delete({
        // The ID of the comment.
        commentId: 'placeholder-value',
        // The ID of the file.
        fileId: '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.comments.create({
        // The ID of the file.
        fileId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "anchor": "my_anchor",
          //   "author": {},
          //   "content": "my_content",
          //   "createdTime": "my_createdTime",
          //   "deleted": false,
          //   "htmlContent": "my_htmlContent",
          //   "id": "my_id",
          //   "kind": "my_kind",
          //   "modifiedTime": "my_modifiedTime",
          //   "quotedFileContent": {},
          //   "replies": [],
          //   "resolved": false
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "anchor": "my_anchor",
      //   "author": {},
      //   "content": "my_content",
      //   "createdTime": "my_createdTime",
      //   "deleted": false,
      //   "htmlContent": "my_htmlContent",
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "modifiedTime": "my_modifiedTime",
      //   "quotedFileContent": {},
      //   "replies": [],
      //   "resolved": 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('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.insert({
        // An ID, such as a random UUID, which uniquely identifies this user's request for idempotent creation of a shared drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same shared drive. If the shared drive already exists a 409 error will be returned.
        requestId: '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
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples