autotrader-connect-api
Version:
Production-ready TypeScript wrapper for Auto Trader UK Connect APIs
60 lines • 2.21 kB
JavaScript
;
/**
* Valuations module for AutoTrader API
* Handles vehicle valuation endpoints and operations
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHistoricalValuation = exports.getBatchValuations = exports.getQuickValuation = exports.getValuation = void 0;
const client_1 = __importDefault(require("../client"));
/**
* Get vehicle valuation
* @param request Valuation request parameters
* @returns Promise resolving to valuation data
*/
async function getValuation(request) {
const response = await client_1.default.post('/valuations', request);
return response.data;
}
exports.getValuation = getValuation;
/**
* Get quick valuation by registration
* @param registration Vehicle registration number
* @param mileage Current mileage
* @param postcode Optional postcode for location-based pricing
* @returns Promise resolving to quick valuation
*/
async function getQuickValuation(registration, mileage, postcode) {
const response = await client_1.default.get('/valuations/quick', {
params: { registration, mileage, postcode },
});
return response.data;
}
exports.getQuickValuation = getQuickValuation;
/**
* Get batch valuations for multiple vehicles
* @param requests Array of valuation requests
* @returns Promise resolving to array of valuations
*/
async function getBatchValuations(requests) {
const response = await client_1.default.post('/valuations/batch', { requests });
return response.data;
}
exports.getBatchValuations = getBatchValuations;
/**
* Get historical valuation data
* @param request Valuation request parameters
* @param period Period for historical data ('6m', '1y', '2y', '5y')
* @returns Promise resolving to historical valuation data
*/
async function getHistoricalValuation(request, period = '1y') {
const response = await client_1.default.post('/valuations/historical', {
...request,
period,
});
return response.data;
}
exports.getHistoricalValuation = getHistoricalValuation;
//# sourceMappingURL=valuations.js.map