@matheustrres/brasilapi
Version:
Lightweight, easy-to-use & free of dependencies wrapper for BrasilAPI
23 lines • 747 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrasilAPIDDD = void 0;
const source_1 = require("./source");
const http_client_1 = require("../clients/http-client");
/**
* Represents the source from BrasilAPI DDD's endpoint responses
*/
class BrasilAPIDDD extends source_1.Source {
URL = 'https://brasilapi.com.br/api/ddd/v1';
/**
* Gets state and list of cities by area code
*
* @param {String} ddd - The area code to be fetched
* @returns {Promise<Result<DDD>>}
*/
async get(ddd) {
const res = await (0, http_client_1.makeGET)(`${this.URL}/${ddd}`);
return this.followUp(res);
}
}
exports.BrasilAPIDDD = BrasilAPIDDD;
//# sourceMappingURL=ddd.js.map