1.0.12 • Published 4 years ago

car-query v1.0.12

Weekly downloads
60
License
MIT
Repository
github
Last release
4 years ago

CarQuery API

Build Status Build Status

Wrapper for the CarQuery API in JavaScript with Promise support.

Installing

Using npm:

npm install car-query

Example

Initialize the CarQuery object.

const carQuery = new CarQuery();

Retrieve the minimum and maximum years in the CarQuery database.

carQuery.getYears()
    .then(years => {
        // Process data
    });

Retrieve all of the makes produced in a given year.

carQuery.getMakes(2018)
    .then(makes => {
        // Process data
    });

Retrieve all of the models meeting the search criteria.

const searchCriteria = {
    year: 2018,
    make: 'Ford'
}

carQuery.getModels(searchCriteria)
    .then(models => {
        // Process data
    });

Retrive detailed information on the specified model by ID number.

carQuery.getModelDetail(44859)
    .then(years => {
        // Process data
    });

Add more search criteria

const searchCriteria = {
    year: 2018,
    make: 'Ford',
    soldInUSA: true,
    body: Bodystyle.SUV
}

carQuery.getModels(searchCriteria)
    .then(models => {
        // Process data
    });

Retrieve trim data for models meeting the search criteria.

const searchCriteria = {
    year: 2018,
    make: 'Ford',
    model: 'Escape'
}

carQuery.getTrims(searchCriteria)
    .then(trims => {
        // Process data
    });

API

Instance methods

getYears();
getMakes(year[, soldInUSA]);
getModels(params);
getTrims(params);
getModelDetail(modelId);

Known Issues

The CarQuery API does not contain the Access-Control-Allow-Origin header in its responses, so this package cannot be used within a browser.

1.0.11

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago