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/domainsrdap.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 domainsrdap = google.domainsrdap('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: [],
      });
    
      // 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 domainsrdap.nameserver.get({
        nameserverId: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "description": [],
      //   "errorCode": 0,
      //   "jsonResponse": {},
      //   "lang": "my_lang",
      //   "notices": [],
      //   "rdapConformance": [],
      //   "title": "my_title"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • const {google} = require('googleapis');
    const domainsrdap = google.domainsrdap('v1');
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/domainsrdap.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 domainsrdap = google.domainsrdap('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: [],
      });
    
      // 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 domainsrdap.ip.get({
        ipId: 'placeholder-value',
    
        ipId1: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "description": [],
      //   "errorCode": 0,
      //   "jsonResponse": {},
      //   "lang": "my_lang",
      //   "notices": [],
      //   "rdapConformance": [],
      //   "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/domainsrdap.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 domainsrdap = google.domainsrdap('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: [],
      });
    
      // 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 domainsrdap.getEntities({});
      console.log(res.data);
    
      // Example response
      // {
      //   "description": [],
      //   "errorCode": 0,
      //   "jsonResponse": {},
      //   "lang": "my_lang",
      //   "notices": [],
      //   "rdapConformance": [],
      //   "title": "my_title"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • const { GoogleAuth, Impersonated } = require('google-auth-library');
    const { SecretManagerServiceClient } = require('@google-cloud/secret-manager');
    
    async function main() {
    
      // Acquire source credentials:
      const auth = new GoogleAuth();
      const client = await auth.getClient();
    
      // Impersonate new credentials:
      let targetClient = new Impersonated({
        sourceClient: client,
        targetPrincipal: 'impersonated-account@projectID.iam.gserviceaccount.com',
        lifetime: 30,
        delegates: [],
        targetScopes: ['https://www.googleapis.com/auth/cloud-platform']
      });
    
      // Get impersonated credentials:
      const authHeaders = await targetClient.getRequestHeaders();
      // Do something with `authHeaders.Authorization`.
    
      // Use impersonated credentials:
      const url = 'https://www.googleapis.com/storage/v1/b?project=anotherProjectID'
      const resp = await targetClient.request({ url });
      for (const bucket of resp.data.items) {
        console.log(bucket.name);
      }
    
      // Use impersonated credentials with google-cloud client library
      // Note: this works only with certain cloud client libraries utilizing gRPC 
      //    e.g., SecretManager, KMS, AIPlatform
      // will not currently work with libraries using REST, e.g., Storage, Compute
      const smClient = new SecretManagerServiceClient({
        projectId: anotherProjectID,
        auth: {
          getClient: () => targetClient,
        },
      });
      const secretName = 'projects/anotherProjectNumber/secrets/someProjectName/versions/1';
      const [accessResponse] = await smClient.accessSecretVersion({
        name: secretName,
      });
    
      const responsePayload = accessResponse.payload.data.toString('utf8');
      // Do something with the secret contained in `responsePayload`.
    };
    
    main();
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples