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 driveactivity = google.driveactivity('v2');
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/driveactivity.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 driveactivity = google.driveactivity('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.activity',
          'https://www.googleapis.com/auth/drive.activity.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 driveactivity.activity.query({
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "ancestorName": "my_ancestorName",
          //   "consolidationStrategy": {},
          //   "filter": "my_filter",
          //   "itemName": "my_itemName",
          //   "pageSize": 0,
          //   "pageToken": "my_pageToken"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "activities": [],
      //   "nextPageToken": "my_nextPageToken"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • const {ExternalAccountClient} = require('google-auth-library');
    const jsonConfig = require('/path/to/config.json');
    
    async function main() {
      const client = ExternalAccountClient.fromJSON(jsonConfig);
      client.scopes = ['https://www.googleapis.com/auth/cloud-platform'];
      // List all buckets in a project.
      const url = `https://storage.googleapis.com/storage/v1/b?project=${projectId}`;
      const res = await client.request({url});
      console.log(res.data);
    }
    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.volumes.list({
        // Restrict to volumes by download availability.
        download: 'placeholder-value',
        // Filter search results.
        filter: 'placeholder-value',
        // Restrict results to books with this language code.
        langRestrict: 'placeholder-value',
        // Restrict search to this user's library.
        libraryRestrict: 'placeholder-value',
        // The maximum allowed maturity rating of returned recommendations. Books with a higher maturity rating are filtered out.
        maxAllowedMaturityRating: 'placeholder-value',
        // Maximum number of results to return.
        maxResults: 'placeholder-value',
        // Sort search results.
        orderBy: 'placeholder-value',
        // Restrict and brand results for partner ID.
        partner: 'placeholder-value',
        // Restrict to books or magazines.
        printType: 'placeholder-value',
        // Restrict information returned to a set of selected fields.
        projection: 'placeholder-value',
        // Full-text search query string.
        q: 'placeholder-value',
        // Set to true to show books available for preorder. Defaults to false.
        showPreorders: 'placeholder-value',
        // String to identify the originator of this request.
        source: 'placeholder-value',
        // Index of the first result to return (starts at 0)
        startIndex: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "items": [],
      //   "kind": "my_kind",
      //   "totalItems": 0
      // }
    }
    
    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