@hgv/mss-nodejs

MSS API wrapper for Node.js projects

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@hgv/mss-nodejs
0.17.06 months ago4 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

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

Example

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

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

const res = await 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;
});

const hotel = res.result.hotel[0];
console.log(hotel.name); // => "Hotel Lichtenstern"
console.log(hotel.stars); // => 3

Error handling

If MSS returns an error response or the request times out, the Promise is rejected:
try {
  const res = await client.request((req) => {
    // …
  });
  // do something with res
} catch (err) {
  console.error(err);
}