Skip to content

Commit

Permalink
Add language parameter to getHotelDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
Achraf-El-khaier committed Jan 30, 2025
1 parent 0ec0bbc commit 692fd7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,10 @@ class LiteApi {
/**
* The hotel details API returns all the static contents details of a hotel or property if the hotel ID is provided. The static content include name, description, address, amenities, cancellation policies, images and more.
* @param {string} hotelId - Unique ID of a hotel
* @param {string} language - Language code for the response (optional)
* @returns {array} - The result of the operation.
*/
async getHotelDetails(hotelId) {
async getHotelDetails(hotelId, language) {
let errors = [];
if (hotelId == "" || hotelId === undefined) {
errors.push("The Hotel code is required");
Expand All @@ -451,7 +452,7 @@ class LiteApi {
'X-API-Key': this.apiKey
},
};
const response = await fetch(this.serviceURL + '/data/hotel?hotelId=' + hotelId, options)
const response = await fetch(this.serviceURL + '/data/hotel?hotelId=' + hotelId + (language ? '&language=' + encodeURIComponent(language) : ''), options)
const data = await response.json();
if (!response.ok) {
return {
Expand Down

0 comments on commit 692fd7a

Please sign in to comment.