api-br-wrapper
Version:
**API-BR-Wrapper** é uma biblioteca Node.js para facilitar o acesso a diversas **APIs públicas brasileiras**. Com ela, você pode integrar informações como dados do IBGE, consulta de CNPJs na Receita Federal, rastreio de encomendas nos Correios e muito mai
32 lines (31 loc) • 1.54 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
function main() {
return __awaiter(this, void 0, void 0, function* () {
try {
// Testando IBGE
const cityData = yield index_1.IBGE.getPopulationByCity(3550308); // Código de São Paulo
console.log("Dados do IBGE:", cityData);
// Testando Receita Federal
const cnpjData = yield index_1.ReceitaFederal.getCnpjData("19131243000197");
console.log("Dados da Receita Federal:", cnpjData);
// Testando Correios
const trackingData = yield index_1.Correios.trackPackage("AA123456789BR");
console.log("Dados dos Correios:", trackingData);
}
catch (error) {
console.error(error);
}
});
}
main();