Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f2eba1e
feat: add all types for brasil-api sdk
pietrobondioli Oct 19, 2023
d4c2154
feat(sdks): add a simple fetch wrapper helper
pietrobondioli Oct 19, 2023
5d2a5a8
docs: add cover image to project
pietrobondioli Oct 23, 2023
26d37c3
build: remove pre push hook
pietrobondioli Oct 23, 2023
b239fe1
feat(sdks): simplify viacep and cepaberto skds by using fetch wrapper
pietrobondioli Oct 23, 2023
28a8c7e
feat: add brasil-api banks wrapper and cli
pietrobondioli Oct 23, 2023
e45bf87
feat: add brasil-api cep wrapper and cli
pietrobondioli Oct 23, 2023
dca4e13
feat: add brasil-api cepv2 wrapper and cli
pietrobondioli Oct 23, 2023
fa1e7e7
feat: add brasil-api cnpj wrapper and cli
pietrobondioli Oct 23, 2023
152b0e1
feat: add brasil-api corretoras wrapper and cli
pietrobondioli Oct 23, 2023
5ad52d9
feat: fetch wrapper now accepts a query param on config object
pietrobondioli Oct 23, 2023
2a5867f
feat: add brasil-api cptec wrapper and cli
pietrobondioli Oct 23, 2023
e8b44fe
feat: add brasil-api DDD wrapper and cli
pietrobondioli Oct 23, 2023
7f0c5bc
feat: add brasil-api feriados nacionais wrapper and cli
pietrobondioli Oct 23, 2023
e012fdb
feat: add brasil-api ibge wrapper and cli
pietrobondioli Oct 23, 2023
ed673d5
feat: add brasil-api isbn wrapper and cli
pietrobondioli Oct 23, 2023
524d603
feat: add brasil-api pix wrapper and cli
pietrobondioli Oct 23, 2023
a49d9e0
feat: add brasil-api registro-br wrapper and cli
pietrobondioli Oct 25, 2023
0d03706
feat: add brasil-api fipe wrapper and cli
pietrobondioli Oct 25, 2023
5b880d9
feat: add brasil-api ncm wrapper and cli
pietrobondioli Oct 25, 2023
ac4c9f8
feat: add brasil-api taxas wrapper and cli
pietrobondioli Oct 25, 2023
3d40320
feat: using a fetch wrapper was a bad idea
pietrobondioli Apr 28, 2024
aa86a75
chore: force tsc build
pietrobondioli May 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .husky/pre-push

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Brasil Interface

![Brasil Interface Project Cover](assets/brasil-interface-cover.png)

## Sumário

- [Brasil Interface](#brasil-interface)
Expand Down
Binary file added assets/brasil-interface-cover-minified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/brasil-interface-cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/brasil-interface-logo-minified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/brasil-interface-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "yarn run clean && tsc && tsc-alias",
"build": "yarn run clean && tsc --build --force && tsc-alias",
"test": "jest --coverage --no-cache --passWithNoTests",
"dev": "ts-node -r tsconfig-paths/register src/index.ts"
},
Expand Down
62 changes: 62 additions & 0 deletions packages/cli/src/core/sdks/brasil-api/banks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Logger } from "@/helpers/logger";
import { OutputHelper } from "@/helpers/output-helper";
import { BrasilApi } from "@brasil-interface/sdks";
import { program } from "commander";

const brasilApiBanks = program
.command("brasil-api/banks")
.description("Brasil API Banks SDK");

brasilApiBanks
.command("get-all")
.description("Get information about all banks in Brazil.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const banks = new BrasilApi.Banks();

try {
const result = await banks.getAllBanks();

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(`PT-BR: Não foi possível obter informações sobre os bancos.`);
logger.info(`EN: Couldn't get information about the banks.`);
logger.error(error);
}
});

brasilApiBanks
.command("get-by-code <code>")
.description("Get information about a bank by code.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (code, options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const banks = new BrasilApi.Banks();

try {
const result = await banks.getBankByCode(code);

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre o banco ${code}.`,
);
logger.info(`EN: Couldn't get information about the bank ${code}.`);
logger.error(error);
}
});
36 changes: 36 additions & 0 deletions packages/cli/src/core/sdks/brasil-api/cep-v2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Logger } from "@/helpers/logger";
import { OutputHelper } from "@/helpers/output-helper";
import { BrasilApi } from "@brasil-interface/sdks";
import { program } from "commander";

const cepv2 = program
.command("brasil-api/cep-v2")
.description("Brasil API CEPv2 SDK");

cepv2
.command("get-by-number <cep>")
.description("Get information about an address by CEP number.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (cep, options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const cepv2 = new BrasilApi.CEPv2();

try {
const result = await cepv2.getCepByNumber(Number(cep));

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre o CEP ${cep}.`,
);
logger.info(`EN: Couldn't get information about the CEP ${cep}.`);
logger.error(error);
}
});
36 changes: 36 additions & 0 deletions packages/cli/src/core/sdks/brasil-api/cep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Logger } from "@/helpers/logger";
import { OutputHelper } from "@/helpers/output-helper";
import { BrasilApi } from "@brasil-interface/sdks";
import { program } from "commander";

const brasilApiCep = program
.command("brasil-api/cep")
.description("Brasil API CEP SDK");

brasilApiCep
.command("get-by-number <cep>")
.description("Get information about an address by CEP number.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (cep, options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const CEP = new BrasilApi.CEP();

try {
const result = await CEP.getCepByNumber(cep);

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre o CEP ${cep}.`,
);
logger.info(`EN: Couldn't get information about the CEP ${cep}.`);
logger.error(error);
}
});
36 changes: 36 additions & 0 deletions packages/cli/src/core/sdks/brasil-api/cnpj.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Logger } from "@/helpers/logger";
import { OutputHelper } from "@/helpers/output-helper";
import { BrasilApi } from "@brasil-interface/sdks";
import { program } from "commander";

const brasilApiCnpj = program
.command("brasil-api/cnpj")
.description("Brasil API CNPJ SDK");

brasilApiCnpj
.command("get-by-cnpj <cnpj>")
.description("Get information about a company by CNPJ.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (cnpj, options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const CNPJ = new BrasilApi.CNPJ();

try {
const result = await CNPJ.getCnpjInfo(cnpj);

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre o CNPJ ${cnpj}.`,
);
logger.info(`EN: Couldn't get information about the CNPJ ${cnpj}.`);
logger.error(error);
}
});
66 changes: 66 additions & 0 deletions packages/cli/src/core/sdks/brasil-api/corretoras.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Logger } from "@/helpers/logger";
import { OutputHelper } from "@/helpers/output-helper";
import { BrasilApi } from "@brasil-interface/sdks";
import { program } from "commander";

const corretoras = program
.command("brasil-api/corretoras")
.description("Brasil API Corretoras SDK");

corretoras
.command("get-all")
.description("Get information about active brokers listed in CVM.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const corretoras = new BrasilApi.Corretoras();

try {
const result = await corretoras.getCorretoras();

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre as corretoras.`,
);
logger.info(`EN: Couldn't get information about the brokers.`);
logger.error(error);
}
});

corretoras
.command("get-by-cnpj <cnpj>")
.description("Get information about an active broker listed in CVM by CNPJ.")
.option("-o, --output <filepath>", "Output file path")
.option("-c, --copy", "Copy the result to the clipboard.")
.option("-d, --debug", "Show debug information.")
.action(async (cnpj, options) => {
const { output, copy, debug } = options;
const logger = new Logger(debug);
const corretoras = new BrasilApi.Corretoras();

try {
const result = await corretoras.getCorretoraByCnpj(cnpj);

OutputHelper.handleResultOutputBasedOnOptions(result, {
isJson: true,
output,
copyToClipboard: copy,
});
} catch (error) {
logger.info(
`PT-BR: Não foi possível obter informações sobre a corretora com CNPJ ${cnpj}.`,
);
logger.info(
`EN: Couldn't get information about the broker with CNPJ ${cnpj}.`,
);
logger.error(error);
}
});
Loading