Skip to content

bookingsuedtirol/mss-nodejs

Repository files navigation

mss-nodejs

npm version

MSS API v2.0 wrapper for Node.js projects.

Available services

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

Runnable example

npm run dev

Example

import { Client, Request, MSSError } from "@bookingsuedtirol/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 with a MSSError:

try {
  const res = await client.request((req) => {
    // …
  });
  // do something with res
} catch (err) {
  if (err instanceof MSSError) {
    // handle the error
    console.error(err);
    return;
  }

  // handle generic errors
  throw error;
}

About

MSS API client for Node.js projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published