UNPKG

@shaggytools/nhtsa-api-wrapper

Version:

Universal javascript wrapper for the NHTSA.dot.gov VPIC 'vehicles' API, useful for VIN decoding, etc.

66 lines 3.13 kB
/** * @module api/endpoints/GetWMIsForManufacturer * @category API Endpoints */ import type { AtLeastOne, NhtsaResponse } from '../../types'; /** * ::: tip :bulb: More Information * See: [GetWMIsForManufacturer Documentation](/api/endpoints/get-wmis-for-manufacturer) * ::: * * `GetWMIsForManufacturer` provides information on the World Manufacturer Identifier (WMI) for a * specified `manufacturer`. Only WMIs registered in vPICList are displayed. Multiple results are * returned in case of multiple matches. * * Both `manufacturer` and `vehicleType` are optional but at least one must be provided. * * `manufacturer` can be a partial name, or a full name for more specificity, or WMI ID number, * e.g., "Merc", "Mercedes Benz", 987, etc. * - If `manufacturer` is a number - method will do exact match on Manufacturer's Id * - If `manufacturer` is a string - it will look for manufacturers whose name is LIKE the provided * name (it accepts a partial Manufacturer name as an input) * * `vehicleType` can be a string or number, e.g., "car", 1, etc. * - If `vehicleType` is a number - method will do exact match on VehicleType's Id * - If `vehicleType` is a string - it will look for VehicleType whose name is LIKE the provided * name (it accepts a partial VehicleType name as an input). * * _NOTE_: For this endpoint, `manufacturer` is actually part of the path string, not a query param. * We include `manufacturer` in params as it's easier to type the function args using the * 'AtLeastOne' type if they are placed in the same object (params). This can cause confusion as * it's not consistent with other endpoint methods where path string is the first arg, and the query * params are the second arg. * * @param [params] - Object of Query Search names and values to append to the URL as a query string * @param {(string|number)} [params.manufacturer] - Manufacturer Name or ID, or WMI ID * (required if !vehicleType) * @param {(string|number)} [params.vehicleType] - Optional Vehicle Type search parameter * (required if !manufacturer) * @param {boolean} [doFetch=true] - Whether to fetch the data or just return the URL * (default: `true`) * @returns {(Promise<NhtsaResponse<GetWMIsForManufacturerResults> | string>)} - Api Response * `object` -or- url `string` if `doFetch = false` */ declare function GetWMIsForManufacturer(params: AtLeastOne<{ manufacturer?: string | number; vehicleType?: string | number; }>, doFetch?: true): Promise<NhtsaResponse<GetWMIsForManufacturerResults>>; declare function GetWMIsForManufacturer(params: AtLeastOne<{ manufacturer?: string | number; vehicleType?: string | number; }>, doFetch: false): Promise<string>; export { GetWMIsForManufacturer }; /** * Objects found in the `Results` array of `GetWMIsForManufacturer` endpoint response. */ export type GetWMIsForManufacturerResults = { Country: string | null; CreatedOn: string; DateAvailableToPublic: string; Id: number; Name: string; UpdatedOn: string; VehicleType: string; WMI: string; }; //# sourceMappingURL=GetWMIsForManufacturer.d.ts.map