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

  • const {google} = require('googleapis');
    const docs = google.docs('v1');
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/docs.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 docs = google.docs('v1');
    
    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/documents',
          '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 docs.documents.batchUpdate({
        // The ID of the document to update.
        documentId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "requests": [],
          //   "writeControl": {}
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "documentId": "my_documentId",
      //   "replies": [],
      //   "writeControl": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/docs.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 docs = google.docs('v1');
    
    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/documents',
          '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 docs.documents.create({
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "body": {},
          //   "documentId": "my_documentId",
          //   "documentStyle": {},
          //   "footers": {},
          //   "footnotes": {},
          //   "headers": {},
          //   "inlineObjects": {},
          //   "lists": {},
          //   "namedRanges": {},
          //   "namedStyles": {},
          //   "positionedObjects": {},
          //   "revisionId": "my_revisionId",
          //   "suggestedDocumentStyleChanges": {},
          //   "suggestedNamedStylesChanges": {},
          //   "suggestionsViewMode": "my_suggestionsViewMode",
          //   "title": "my_title"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "body": {},
      //   "documentId": "my_documentId",
      //   "documentStyle": {},
      //   "footers": {},
      //   "footnotes": {},
      //   "headers": {},
      //   "inlineObjects": {},
      //   "lists": {},
      //   "namedRanges": {},
      //   "namedStyles": {},
      //   "positionedObjects": {},
      //   "revisionId": "my_revisionId",
      //   "suggestedDocumentStyleChanges": {},
      //   "suggestedNamedStylesChanges": {},
      //   "suggestionsViewMode": "my_suggestionsViewMode",
      //   "title": "my_title"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • const {JWT} = require('google-auth-library');
    const keys = require('./jwt.keys.json');
    
    async function main() {
      const client = new JWT({
        email: keys.client_email,
        key: keys.private_key,
        scopes: ['https://www.googleapis.com/auth/cloud-platform'],
      });
      const url = `https://dns.googleapis.com/dns/v1/projects/${keys.project_id}`;
      const res = await client.request({url});
      console.log(res.data);
    }
    
    main().catch(console.error);
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/books.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 books = google.books('v1');
    
    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/books'],
      });
    
      // 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 books.mylibrary.bookshelves.addVolume({
        // The reason for which the book is added to the library.
        reason: 'placeholder-value',
        // ID of bookshelf to which to add a volume.
        shelf: 'placeholder-value',
        // String to identify the originator of this request.
        source: 'placeholder-value',
        // ID of volume to add.
        volumeId: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {}
    }
    
    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