This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including @tempicolabs/sdk
with all npm
packages installed. Try it out:
const tempicoLabsSDK = require('@tempicolabs/sdk')
const tmLabs = new tempicoLabsSDK.TmLabs() // new TmLabs object instance
// Event handlers
tmLabs.on('error', function (error, command) {
console.error('[ SDK ERROR ]', error)
})
// tmLabs.on('response', function (command, response) {
// console.info('Command response content', response.content)
// console.log(`balanceRemaining: ${command.balanceRemaining}`) // return Remaining Balance
// })
// API Request
const dnsAnswer = await tmLabs.fetch('dns', { // wanna get google.com ip addresses
domain: 'google.com'
});
console.log(dnsAnswer)
// const alternativeDnsAnswer = await tempicoLabsSDK.fetch('dns', {
// domain: 'google.com'
// });
// console.log(alternativeDnsAnswer)
const ipv4s = dnsAnswer.content[Object.keys(dnsAnswer.content)[0]] // array of IPv4
console.info(`[ GOOGLE IP ADDRESSES ]: ${ipv4s}`) // get info about google ip address
const ipAnswer = await tmLabs.fetch('ip', {
ip: ipv4s[0]
});
console.info(ipAnswer.content) // get info about google ip address
// Also can do multiple commands
// for example dns command
const domains = ['google.com', 'facebook.com', 'ibm.com'].map(function (domain) { // make the right structure for fetchBatch function
return {
domain: domain
}
});
const batchAnswer = await tmLabs.fetchBatch('dns', domains);
console.log(batchAnswer)
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.