JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q59163F
  • License MIT

Michelin direction for JavaScript is a library to fetch routes from the Michelin routing API

Package Exports

  • @mappingfactory/directions
  • @mappingfactory/directions/dist/michelin-directions.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mappingfactory/directions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Michelin Directions Javascript API Client

Michelin directions for JavaScript is a library to fetch routes from the Michelin routing API

💡 Getting Started

First, install Michelin Directions JavaScript API Client via the npm package manager:

npm install @mappingfactory/directions

Then, initialise your client and use it.

  • Purpose: The main purpose of the direction SDK is to gather the necessary parameters to create a Json body or a request by adding these params to the URL .
  • Functionality: The 'MichelinDirectionsClient' class consists of three main components: -

Supported ENUMS:

  • TYPE_ENUM
  • VALUES
  • Shortest
  • Recommended
  • Fastest
  • Eco

  • MODE ENUM

  • VALUES

  • Motorcycle

  • Car

  • Truck

  • Bicycle

  • Pedestrian

  • GEOMETRIES ENUM

  • VALUES

  • Polyline

  • Polyline6

  • geojson

  • LANGUAGE_ENUM : Comprises of all the languages supported.

  • The setter method for the language ENUM.

  • MENTIONS ENUM : type of mentions namely main or all.

  • AVOID ENUM : Consists of the paths

  • VALUES

  • Tollroads

  • Motorways

  • ferries

  • Unpaved

  • roads

  • border

  • Crossings

  • MOTORIZATION** ENUM ****:** Represents the type of motorizations

  • VALUES

  • Fuel

  • Electric

  • fuel

  • cell

  • hybrid

  • FUEL_TYPE_ENUM :

  • VALUES

  • Gasoline

  • Diesel

  • E85

  • LPG

  • ngv

  • h2

  • CAR TYPE ENUM :

  • VALUES:

  • Hatchback

  • Compact

  • Family

  • Sedan

  • luxury

  • VEHICLE LOAD TYPE ENUM Contain vehicle load types like (Explosives Compressed Gas Flammable Liquids Flammable Solids Oxidizers Poison Radioactive Corrosives Miscellaneous Explosives Miscellaneous Harmful to Water)

  • VEHICLE ADR TUNNEL RESTRICTION CODE ENUM Represent the tunnel restrictions.

  • VEHICLE_LOAD_TYPE_ENUM

  • VALUES

  • (Explosives)

  • (Compressed Gas)

  • (Flammable Liquids)

  • (Flammable Solids)

  • (Oxidizers)

  • (Poison)

  • (Radioactive)

  • (Corrosives)

  • (Miscellaneous)

  • (Explosives)

  • (Miscellaneous)

  • (Harmful to Water)

  • VEHICLE_TYPE_ENUM

    1. (Motorcycles/ Sidecars/ Trikes)
  • 2)(Light vehicles - All cars with/without one/two axle trailers)

    1. (Intermediate vehicles - Pick-ups and Vans with/without one/two axle trailers)
  • ANNOTATION_ENUM :

  • VALUES:

  • Contain Maxspeed

  • congestion

  • duration

  • CONGESTION_ENUM :

  • VALUES

  • Severe

  • Heavy

  • moderate

  • low

  • unknown

  • CURRENCY_ENUM :

  • VALUES

  • EUR

  • CAD

  • HKD

  • ISK

  • PHP

  • DKK

  • HUF

  • CZK

  • AUD

  • RON

  • SEK

  • IDR

  • INR

  • BRL

  • RUB

  • HRK

  • JPY

  • THB

  • CHF

  • SGD

  • PLN

  • BGN

  • TRY

  • CNY

  • NOK

  • NZD

  • ZAR

  • USD

  • MXN

  • ILS

  • GBP

  • KRW

  • Setter method that coincides with the currency

  • UNIT ENUM : Represents metric orimperial units.
  • VALUES
  • metric
  • imperial
  • Setter method to set the unit

How Methods are working:

  • Direction SDK is currently taking static API END-POINT URL and API KEY. To make it dynamic, call below method from Cite tool michelinDirections({api_key: dynaApi.api_key, api_url: dynaApi.api_url})
  • And in Direction SDK passing the parameter in constructor to collect the dynamic API KEY and API URL. And the details were present in {this.opts}
  • The' MichelinDirectionsClient' consists of all the Client functionality for the Direction SDK.

Method: getRequestUrl

  • By adding the necessary parameters to the request URL , the request is then constructed with the help of the '** getRequestUrl ****' method by passing the formdata as an argument.**

Method :** getRequestOptions**

  • The above method is then used to make the API call to gain the required response.

Method : search

This method internally calls the ' getRequestOptions'

Client-side mapping of the search method would look like:

Example Usage of the form data

  • This Method helps us select a particular MODE :

  • This Method helps us set a particular MODE :

Some Important Scripts and Commands:

Test Scrip Command
JEST test:jest jest --config jest.config.js
JEST ENUMs test:jest:enums jest --config jest.config.js enums.test.js
Test test npm run test:lint
To Build the Webpack build:webpack webpack
Husky dev:init husky install
Webpack dev:watch webpack --watch
To Run the build pre-commit npm run test && npm run build
To build Webpack build npm run build:webpack
To Run the Pre Publish build prepublish npm run build
Semantic Release semantic-release semantic-release --dry-run

Possible Enhancements:

1)The direction SDK still does not support the granularized POIs that currently include (Accommodation, Service Station, Rest Stop, Restaurant, Partner) the scope should expand to include (Leisure, transport, tourism, Government based services, Movies, Shops, food, health and lodging)

2) Bookmarking or tagging some POIs or some favorite or frequently travelled Routes.

3) Providing a feature to save Geo Media.

4)We need to explore Query optimization.

Web Cite UI** :** Cite (webmichelin.com)