@matheustrres/brasilapi
Version:
Lightweight, easy-to-use & free of dependencies wrapper for BrasilAPI
22 lines (21 loc) • 770 B
TypeScript
import { Source } from './source';
import { type CEP } from '../typings';
import { type Result } from '../typings/result';
interface ICEP {
get(cep: string, version: 'v1' | 'v2'): Promise<Result<CEP>>;
}
/**
* Represents the source from BrasilAPI CEP's endpoint responses
*/
export declare class BrasilAPICEP extends Source implements ICEP {
protected readonly URL = "https://brasilapi.com.br/api/cep";
/**
* Gets information from a Zip Code with multiple fallback providers
*
* @param {String} cep - The zip code to be fetched
* @param {String} [version] - The CEP endpoint version to use (defaults to `v1`)
* @returns {Promise<Result<CEP>>}
*/
get(cep: string, version?: 'v1' | 'v2'): Promise<Result<CEP>>;
}
export {};