MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / listAutomakers

Function listAutomakers

services/fipe/automakers.js:6–24  ·  view source on GitHub ↗
({ vehicleType, referenceTable })

Source from the content-addressed store, hash-verified

4import { getLatestReferenceTable } from './referenceTable';
5
6async function listAutomakers({ vehicleType, referenceTable }) {
7 const params = new URLSearchParams();
8 params.append('codigoTabelaReferencia', referenceTable);
9 params.append('codigoTipoVeiculo', vehicleType);
10
11 const { data } = await axios.post(
12 `${FIPE_URL}/veiculos/ConsultarMarcas`,
13 params,
14 {
15 headers: {
16 'Content-Type': 'application/x-www-form-urlencoded',
17 },
18 }
19 );
20
21 return data
22 .map((item) => ({ nome: item.Label, valor: item.Value }))
23 .sort((a, b) => parseInt(a.valor, 10) - parseInt(b.valor, 10));
24}
25
26export async function listCarAutomakers(
27 { referenceTable } = { referenceTable: undefined }

Callers 4

FipeAutomakersFunction · 0.85
listCarAutomakersFunction · 0.85
listMotorcycleAutomakersFunction · 0.85
listTruckAutomakersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected