@hgv/mss-nodejs

MSS API wrapper for Node.js projects

Stats

StarsIssuesVersionUpdatedCreatedSize
@hgv/mss-nodejs
100.9.0a month ago3 years agoMinified + gzip package size for @hgv/mss-nodejs in KB

Readme

mss-nodejs

npm version

Experimential MSS API wrapper for Node.js projects.

Warning! Do not use this in production yet! Supports only v2.0!

Available services

  • getHotelList
  • getSpecialList
  • getRoomList
  • getPriceList
  • getRoomAvailability
  • getHotelPictures
  • getHotelPictureGroups
  • prepareBooking
  • getBooking
  • createInquiry
  • getUserSources

Example

const { Client, Request } = require("@hgv/mss-nodejs");

const client = new Client({
  user: "username",
  password: "password",
  source: "source"
});

client
  .request(req => {
    req.header.method = "getHotelList";
    req.request.search.id = ["11230"];
    req.request.options = {
      hotel_details:
        Request.HotelDetails.BasicInfo |
        Request.HotelDetails.PaymentOptionsForOnlineBooking
    };
    return req;
  })
  .then(res => {
    const hotel = res.result.hotel[0];
    console.log(hotel.name); // => string(18) "Hotel Lichtenstern"
    console.log(hotel.stars); // => float(3)
  });

Exception handling

If the MSS returns an error response, an exception is thrown.

client
  .request(req => { ... })
  .then(res => { ... })
  .catch(e => {
    console.log(e); // "oh, no!"
  });

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.