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/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
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/dialogflow.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 dialogflow = google.dialogflow('v2beta1');
    
    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/cloud-platform',
          'https://www.googleapis.com/auth/dialogflow',
        ],
      });
    
      // 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 dialogflow.projects.agent.knowledgeBases.documents.reload({
        // Required. The name of the document to reload. Format: `projects//locations//knowledgeBases//documents/`
        name: 'projects/my-project/agent/knowledgeBases/my-knowledgeBase/documents/my-document',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "gcsSource": {},
          //   "importGcsCustomMetadata": false
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "done": false,
      //   "error": {},
      //   "metadata": {},
      //   "name": "my_name",
      //   "response": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/dialogflow.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 dialogflow = google.dialogflow('v2beta1');
    
    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/cloud-platform',
          'https://www.googleapis.com/auth/dialogflow',
        ],
      });
    
      // 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 dialogflow.projects.agent.knowledgeBases.documents.delete({
        // Required. The name of the document to delete. Format: `projects//locations//knowledgeBases//documents/`.
        name: 'projects/my-project/agent/knowledgeBases/my-knowledgeBase/documents/my-document',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "done": false,
      //   "error": {},
      //   "metadata": {},
      //   "name": "my_name",
      //   "response": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/firestore.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 firestore = google.firestore('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/cloud-platform',
          'https://www.googleapis.com/auth/datastore',
        ],
      });
    
      // 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 firestore.projects.databases.documents.runQuery({
        // Required. The parent resource name. In the format: `projects/{project_id\}/databases/{database_id\}/documents` or `projects/{project_id\}/databases/{database_id\}/documents/{document_path\}`. For example: `projects/my-project/databases/my-database/documents` or `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
        parent:
          'projects/my-project/databases/my-database/documents/my-document/.*',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "newTransaction": {},
          //   "readTime": "my_readTime",
          //   "structuredQuery": {},
          //   "transaction": "my_transaction"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "document": {},
      //   "readTime": "my_readTime",
      //   "skippedResults": 0,
      //   "transaction": "my_transaction"
      // }
    }
    
    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