@matheustrres/brasilapi
Version:
Lightweight, easy-to-use & free of dependencies wrapper for BrasilAPI
25 lines • 879 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrasilAPICNPJ = void 0;
const source_1 = require("./source");
const http_client_1 = require("../clients/http-client");
const clear_string_1 = require("../utils/clear-string");
/**
* Represents the source from BrasilAPI CNPJ's endpoint responses
*/
class BrasilAPICNPJ extends source_1.Source {
URL = 'https://brasilapi.com.br/api/cnpj/v1';
/**
* Gets information from a CNPJ in the Minha Receita API
*
* @param {String} cnpj - The CNPJ of a legal person
* @returns {Promise<Result<CNPJ>>}
*/
async get(cnpj) {
cnpj = (0, clear_string_1.clearString)(cnpj);
const res = await (0, http_client_1.makeGET)(`${this.URL}/${cnpj}`);
return this.followUp(res);
}
}
exports.BrasilAPICNPJ = BrasilAPICNPJ;
//# sourceMappingURL=cnpj.js.map