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 {GoogleAuth} = require('google-auth-library');
    
    /**
    * Instead of specifying the type of client you'd like to use (JWT, OAuth2, etc)
    * this library will automatically choose the right client based on the environment.
    */
    async function main() {
      const auth = new GoogleAuth({
        scopes: 'https://www.googleapis.com/auth/cloud-platform'
      });
      const client = await auth.getClient();
      const projectId = await auth.getProjectId();
      const url = `https://dns.googleapis.com/dns/v1/projects/${projectId}`;
      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/dns.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 dns = google.dns('v1beta2');
    
    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/cloud-platform.read-only',
          'https://www.googleapis.com/auth/ndev.clouddns.readonly',
          'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
        ],
      });
    
      // 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 dns.projects.get({
        // For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
        clientOperationId: 'placeholder-value',
        // Identifies the project addressed by this request.
        project: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "number": "my_number",
      //   "quota": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/datafusion.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 datafusion = google.datafusion('v1beta1');
    
    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'],
      });
    
      // 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 datafusion.projects.locations.instances.dnsPeerings.add({
        // The resource on which DNS peering will be created.
        parent: 'projects/my-project/locations/my-location/instances/my-instance',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "dnsPeering": {}
          // }
        },
      });
      console.log(res.data);
    
      // Example 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/dns.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 dns = google.dns('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/cloud-platform.read-only',
          'https://www.googleapis.com/auth/ndev.clouddns.readonly',
          'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
        ],
      });
    
      // 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 dns.projects.get({
        // For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
        clientOperationId: 'placeholder-value',
        // Identifies the project addressed by this request.
        project: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "id": "my_id",
      //   "kind": "my_kind",
      //   "number": "my_number",
      //   "quota": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/domains.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 domains = google.domains('v1beta1');
    
    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'],
      });
    
      // 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 domains.projects.locations.registrations.configureDnsSettings({
          // Required. The name of the `Registration` whose DNS settings are being updated, in the format `projects/x/locations/x/registrations/x`.
          registration:
            'projects/my-project/locations/my-location/registrations/my-registration',
    
          // Request body metadata
          requestBody: {
            // request body parameters
            // {
            //   "dnsSettings": {},
            //   "updateMask": "my_updateMask",
            //   "validateOnly": false
            // }
          },
        });
      console.log(res.data);
    
      // Example response
      // {
      //   "done": false,
      //   "error": {},
      //   "metadata": {},
      //   "name": "my_name",
      //   "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