diff --git a/README.md b/README.md index 63ddb92..069b38f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Você pode acessar a documentação oficial da BrasilAPI acessando esse [link](h # Instalação -``` +```shell $ npm install brasilapi-js ``` @@ -24,12 +24,20 @@ $ npm install brasilapi-js Documentação oficial da API com todas as chamadas poderão se encontradas [neste link](https://brasilapi.com.br/docs). -# Utilização +# Utilização -``` +## Node.js ou Bun + +```js import api from "brasilapi-js"; ``` +## Deno + +```js +import api from "npm:brasilapi-js"; +``` + ## Endpoints Abaixo você pode ver todos os endpoints disponíveis, por padrão, na biblioteca: @@ -38,12 +46,12 @@ Abaixo você pode ver todos os endpoints disponíveis, por padrão, na bibliotec Buscando todos os bancos disponíveis na API. ```js -const response = api.bank.getAll(); +const response = await api.bank.getAll(); ``` Buscando um banco específico pelo seu código. ```js -const response = api.bank.getBy(1); +const response = await api.bank.getBy(1); ``` ### CEP V2 @@ -51,7 +59,7 @@ const response = api.bank.getBy(1); Buscando um CEP específico. ```js -const response = api.cep.getBy('01001000'); +const response = await api.cep.getBy('01001000'); ``` ### CNPJ @@ -59,7 +67,7 @@ const response = api.cep.getBy('01001000'); Buscando um CNPJ específico. ```js -const response = api.cnpj.getBy('00000000000191'); +const response = await api.cnpj.getBy('00000000000191'); ``` ### Corretoras @@ -67,13 +75,13 @@ const response = api.cnpj.getBy('00000000000191'); Buscando uma corretora específica pelo CNPJ. ```js -const response = api.cvm.getBy('76621457000185'); +const response = await api.cvm.getBy('76621457000185'); ``` Buscando todas as corretoras listadas pela CVM. ```js -const response = api.cvm.getAll(); +const response = await api.cvm.getAll(); ``` ### CPTEC @@ -81,31 +89,31 @@ const response = api.cvm.getAll(); Buscando uma cidade pelo nome. ```js -const response = api.cptec.city.getBy('São Paulo'); +const response = await api.cptec.city.getBy('São Paulo'); ``` Buscando todas as cidades disponíveis. ```js -const response = api.cptec.city.getAll(); +const response = await api.cptec.city.getAll(); ``` Buscando as informações meteorológicas em todas as capitais dos estados brasileiros. ```js -const response = api.cptec.weather.capital.getAll(); +const response = await api.cptec.weather.capital.getAll(); ``` Buscando as informações meteorológicas em um aeroporto específico através do seu código ICAO. ```js -const response = api.cptec.weather.airport.getBy('SBGR'); +const response = await api.cptec.weather.airport.getBy('SBGR'); ``` Buscando as informações meteorológicas de uma cidade específica pelo seu código. ```js -const response = api.cptec.weather.forecast.getBy(999); +const response = await api.cptec.weather.forecast.getBy(999); ``` Buscando as informações meteorológicas de uma cidade específica no período de X dias. @@ -114,13 +122,13 @@ Buscando as informações meteorológicas de uma cidade específica no período Lembrando que só é possível buscar informações entre 1 a 6 dias. ```js -const response = api.cptec.weather.forecast.getBy(999, 6); +const response = await api.cptec.weather.forecast.getBy(999, 6); ``` Buscando a previsão oceânica em uma cidade específica. ```js -const response = api.cptec.weather.ocean.getBy(999); +const response = await api.cptec.weather.ocean.getBy(999); ``` Buscando a previsão oceânica em uma cidade específica no período de X dias. @@ -129,7 +137,7 @@ Buscando a previsão oceânica em uma cidade específica no período de X dias. Lembrando que só é possível buscar informações entre 1 a 6 dias. ```js -const response = api.cptec.weather.ocean.getBy(999, 6); +const response = await api.cptec.weather.ocean.getBy(999, 6); ``` ### DDD @@ -137,7 +145,7 @@ const response = api.cptec.weather.ocean.getBy(999, 6); Buscando o estado e cidades que possuem determinado DDD. ```js -const response = api.ddd.getBy.getBy(77); +const response = await api.ddd.getBy.getBy(77); ``` ### Feriados @@ -145,7 +153,7 @@ const response = api.ddd.getBy.getBy(77); Buscando todos os feriados nacionais em determinado ano. ```js -const response = api.holidays.getBy(2022); +const response = await api.holidays.getBy(2022); ``` ### FIPE @@ -153,19 +161,19 @@ const response = api.holidays.getBy(2022); Buscando todas as marcas de veículos referente a um tipo de veículo. ```js -const response = api.fipe.brands.getBy('caminhoes'); +const response = await api.fipe.brands.getBy('caminhoes'); ``` Buscando o preço de um veículo específico pelo seu código FIPE. ```js -const response = api.fipe.price.getBy('001004-9'); +const response = await api.fipe.price.getBy('001004-9'); ``` Buscando as tabelas de referência existentes. ```js -const response = api.fipe.tables.getAll(); +const response = await api.fipe.tables.getAll(); ``` ### IBGE @@ -173,19 +181,19 @@ const response = api.fipe.tables.getAll(); Buscando todos os municípios de um estado específico pela sua sigla. ```js -const response = api.ibge.state.getBy('BA'); +const response = await api.ibge.state.getBy('BA'); ``` Buscando informações de todos os estados brasileiros. ```js -const response = api.ibge.state.getAll(); +const response = await api.ibge.state.getAll(); ``` Buscando informações de um estado específico pela sua sigla. ```js -const response = api.ibge.country.getBy('BA'); +const response = await api.ibge.country.getBy('BA'); ``` ### ISBN @@ -193,7 +201,7 @@ const response = api.ibge.country.getBy('BA'); Buscando informações sobre um livro específico pelo seu código ISBN. ```js -const response = api.isbn.getBy('9788545702870'); +const response = await api.isbn.getBy('9788545702870'); ``` ### NCM @@ -201,19 +209,19 @@ const response = api.isbn.getBy('9788545702870'); Buscando informações sobre todos os NCMs. ```js -const response = api.ncm.getAll(); +const response = await api.ncm.getAll(); ``` Buscando informações sobre um NCM específico. ```js -const response = api.ncm.getBy('01012100'); +const response = await api.ncm.getBy('01012100'); ``` Buscando informações de um NCM a partir de um código ou descrição. ```js -const response = api.ncm.search('01012100'); +const response = await api.ncm.search('01012100'); ``` ### Pix @@ -221,7 +229,7 @@ const response = api.ncm.search('01012100'); Buscando informações de todos os participantes do PIX no dia atual ou anterior. ```js -const response = api.pix.getAll(); +const response = await api.pix.getAll(); ``` ### Registro BR @@ -229,7 +237,7 @@ const response = api.pix.getAll(); Buscando informações de um domínio específico. ```js -const response = api.registerBr.getBy('google.com'); +const response = await api.registerBr.getBy('google.com'); ``` ### Taxas @@ -237,11 +245,11 @@ const response = api.registerBr.getBy('google.com'); Buscando as taxas de juros e alguns índices oficiais do Brasil. ```js -const response = api.taxes.getAll(); +const response = await api.taxes.getAll(); ``` Buscando informações de uma taxa a partir do seu nome/sigla. ```js -const response = api.taxes.getBy('Selic'); +const response = await api.taxes.getBy('Selic'); ```