italy-fuel-api-client
v1.1.0
Published
A lightweight client to interact with the official Osservatorio Prezzi fuel API.
Readme
italy-fuel-api-client
A lightweight client to interact with the official Osservatorio Prezzi fuel API.
Usage
- Import
fuelApi:
import { fuelApi } from "italy-fuel-api-client";- Call endpoints:
// gets fuel list
const fuelList = fuelApi.registry.getFuelList();
// search in area
const operators = fuelApi.search.searchArea({
region: 9,
fuelType: "1-x",
});Available endpoints
The fuelApi objects splits available endpoints by registry and search, reflecting the acutal API endpoints.
Types overview Fuel id explanation
Registry
| Function | Description |
|----------------------------------------------|------------------------------------------------------------------------------------|
| fuelApi.registry.getRegionList() | Returns the list of regions. |
| fuelApi.registry.getProvinceList(regionId) | Returns the list of provinces by region. |
| fuelApi.registry.getTownList(provinceCode) | Returns the list of towns by province. Accepts province code as input (e.g. "MT"). |
| fuelApi.registry.getFuelList() | Returns the list of fuel types. |
| fuelApi.registry.getServiceList() | Returns the list of services. |
Search
| Function | Description |
|--------------------------------------|------------------------------------------------------------------------|
| fuelApi.search.searchArea(payload) | Returns search results for a given area. Accepts ISearchAreaPayload. |
| fuelApi.search.searchZone(payload) | Returns search results for a given zone. Accepts ISearchZonePayload. |
Development
- Install dependencies:
npm install- Run the unit tests:
npm run test- Build the library:
npm run build